From 05e65ed9b710a09eba1fe00f621c94be35046204 Mon Sep 17 00:00:00 2001 From: cpf <1105965053@qq.com> Date: Fri, 4 Jun 2021 15:09:27 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=20=E9=99=90=E5=88=B6?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collection-tools.component.ts | 7 +++++++ .../ui/collection-tools-plan/collection-tools.component.ts | 7 +++++++ src/app/ui/collection-tools-plan/leftFunctionalDomain.ts | 7 +++++++ src/app/ui/collection-tools/collection-tools.component.ts | 7 +++++++ src/app/ui/collection-tools/leftFunctionalDomain.ts | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/src/app/ui/collection-tools-building/collection-tools.component.ts b/src/app/ui/collection-tools-building/collection-tools.component.ts index 1ce5d4a..134dff5 100644 --- a/src/app/ui/collection-tools-building/collection-tools.component.ts +++ b/src/app/ui/collection-tools-building/collection-tools.component.ts @@ -2087,6 +2087,13 @@ export class CollectionToolsBuildingComponent implements OnInit { let fileSize = file.size || null //上传文件的总大小 let maxSize = 5 * 1024 * 1024 //5MB一个分片 let tenSize = 10 * 1024 * 1024 //10MB限制 + if (file && file.name.toLowerCase().indexOf('png') == -1 && file.name.toLowerCase().indexOf('jpg') == -1 && file.name.toLowerCase().indexOf('jpeg') == -1) { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请上传图片后缀为png,jpg,jpeg的文件', '确定', config); + return + } if (file && fileSize <= maxSize) { //上传文件<=5MB时 let formData = new FormData() diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.ts b/src/app/ui/collection-tools-plan/collection-tools.component.ts index 7e0ec8b..9c95c63 100644 --- a/src/app/ui/collection-tools-plan/collection-tools.component.ts +++ b/src/app/ui/collection-tools-plan/collection-tools.component.ts @@ -2019,6 +2019,13 @@ export class CollectionToolsPlanComponent implements OnInit { let fileSize = file.size || null //上传文件的总大小 let maxSize = 5 * 1024 * 1024 //5MB一个分片 let tenSize = 10 * 1024 * 1024 //10MB限制 +    if (file && file.name.toLowerCase().indexOf('png') == -1 && file.name.toLowerCase().indexOf('jpg') == -1 && file.name.toLowerCase().indexOf('jpeg') == -1) { +      const config = new MatSnackBarConfig(); +      config.verticalPosition = 'top'; +      config.duration = 3000 +      this.snackBar.open('请上传图片后缀为png,jpg,jpeg的文件', '确定', config); +      return +    } if (file && fileSize <= maxSize) { //上传文件<=5MB时 let formData = new FormData() diff --git a/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts b/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts index 4fc836d..0a0a338 100644 --- a/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts +++ b/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts @@ -60,6 +60,13 @@ export class leftFunctionalDomainComponentPlan implements OnInit { //提交表单创建平面图 onSubmit (e) { if (this.file && this.selectedType == 'image') { +     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); +       return +   } this.maskLayerService.sendMessage(true) if (this.file.size<=5*1024*1024) { //小于5MB let formData = new FormData() diff --git a/src/app/ui/collection-tools/collection-tools.component.ts b/src/app/ui/collection-tools/collection-tools.component.ts index 52129a7..7281f41 100644 --- a/src/app/ui/collection-tools/collection-tools.component.ts +++ b/src/app/ui/collection-tools/collection-tools.component.ts @@ -2156,6 +2156,13 @@ export class CollectionToolsComponent implements OnInit { let fileSize = file.size || null //上传文件的总大小 let maxSize = 5 * 1024 * 1024 //5MB一个分片 let tenSize = 10 * 1024 * 1024 //10MB限制 + if (file && file.name.toLowerCase().indexOf('png') == -1 && file.name.toLowerCase().indexOf('jpg') == -1 && file.name.toLowerCase().indexOf('jpeg') == -1) { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请上传图片后缀为png,jpg,jpeg的文件', '确定', config); + return + } if (file && fileSize <= maxSize) { //上传文件<=5MB时 let formData = new FormData() diff --git a/src/app/ui/collection-tools/leftFunctionalDomain.ts b/src/app/ui/collection-tools/leftFunctionalDomain.ts index b13a965..3570e0a 100644 --- a/src/app/ui/collection-tools/leftFunctionalDomain.ts +++ b/src/app/ui/collection-tools/leftFunctionalDomain.ts @@ -230,6 +230,13 @@ export class addBGCDisposalNodeComponent implements OnInit { //提交表单 onSubmit (e) { if (e.name && this.file) { +     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); +       return +     } e.file = this.file this.dialogRef.close(e); } else {