陈鹏飞 4 years ago
parent
commit
3498f020b5
  1. 2
      proxy.config.json
  2. 2
      src/app/ui/basicinfo/basicinfo.component.html
  3. 21
      src/app/ui/basicinfo/basicinfo.component.ts

2
proxy.config.json

@ -1,6 +1,6 @@
{
"/api": {
"target": "http://39.106.78.171:8008",
"target": "http://121.37.20.190:8008/",
"secure": false,
"changeOrigin": true
}

2
src/app/ui/basicinfo/basicinfo.component.html

@ -112,7 +112,7 @@
<mat-spinner *ngIf="isspinner" diameter= 50></mat-spinner>
</div>
<div class="image" (click)="closeorganizationbox()">
<input id="selectedfile" type="file" ng2FileSelect [uploader]="uploader" (change)="filechange($event)" name="imgFile" accept=".jpg,.png,.jpeg,.gif,.webp">
<input id="selectedfile" type="file" ng2FileSelect [uploader]="uploader" (change)="filechange($event)" name="imgFile" accept="image/jpg,image/png,image/jpeg">
</div>
<div class="addbtn">
<button type="submit" color="primary" class="submit1" mat-button mat-raised-button>保存</button>

21
src/app/ui/basicinfo/basicinfo.component.ts

@ -655,11 +655,30 @@ export class BasicinfoComponent implements OnInit {
image.src = reader.result
}
setTimeout(() => {
if(image.width>=4096 || image.height>=5000 ){
if(this.file.type.indexOf('image') == -1){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请上传图片','确定',config);
if((<HTMLInputElement>document.getElementById('selectedfile'))){
(<HTMLInputElement>document.getElementById('selectedfile')).value = null //清空input框缓存
}
}else if(this.file.name.toLowerCase().indexOf('png') == -1 && this.file.name.toLowerCase().indexOf('jpg') == -1 && this.file.name.toLowerCase().indexOf('jpeg') == -1){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请上传图片后缀为png,jpg,jpeg的文件','确定',config);
if((<HTMLInputElement>document.getElementById('selectedfile'))){
(<HTMLInputElement>document.getElementById('selectedfile')).value = null //清空input框缓存
}
}else if(image.width>=4096 || image.height>=5000 ){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config);
if((<HTMLInputElement>document.getElementById('selectedfile'))){
(<HTMLInputElement>document.getElementById('selectedfile')).value = null //清空input框缓存
}
}else{
if(this.file){
this.startUploading()

Loading…
Cancel
Save