From b19c2805e100c0a7bbb5abb6b30f6f97f13fd98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Tue, 5 Nov 2024 16:47:51 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E6=A0=A1?= =?UTF-8?q?=E6=A3=80=E6=96=87=E4=BB=B6=E5=90=8D=E6=98=AF=E5=90=A6=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FileUpload/index.vue | 5 +++++ src/components/ImageUpload/index.vue | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index aaaa45c..b22d09a 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -121,6 +121,11 @@ const handleBeforeUpload = (file: any) => { return false; } } + // 校检文件名是否包含特殊字符 + if (file.name.includes(',')) { + proxy?.$modal.msgError('文件名不正确,不能包含英文逗号!'); + return false; + } // 校检文件大小 if (props.fileSize) { const isLt = file.size / 1024 / 1024 < props.fileSize; diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index 1c6dcd1..0778121 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -139,6 +139,10 @@ const handleBeforeUpload = (file: any) => { proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}图片格式文件!`); return false; } + if (file.name.includes(',')) { + proxy?.$modal.msgError('文件名不正确,不能包含英文逗号!'); + return false; + } if (props.fileSize) { const isLt = file.size / 1024 / 1024 < props.fileSize; if (!isLt) {