From 22abdf7b6bdeb749c648b62e9662a9a6e5779761 Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Sat, 14 Sep 2024 17:35:18 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E6=94=B9UAT=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9A=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E9=99=90=E5=88=B6=E6=9C=80=E5=A4=9A?= =?UTF-8?q?30=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/lang/zh-cn.js | 3 ++- src/components/UploadFile.vue | 6 ++++++ src/components/jero/JUpload.vue | 11 +++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/common/lang/zh-cn.js b/src/common/lang/zh-cn.js index 948d1102..a0743b8f 100644 --- a/src/common/lang/zh-cn.js +++ b/src/common/lang/zh-cn.js @@ -646,7 +646,8 @@ module.exports = { fileFormatIncorrect: '文件格式不正确', uploadSuccessful: '上传成功', uploadMaximumATime: '一次最多上传二十张图片', - deletedSuccessfully: '删除成功' + deletedSuccessfully: '删除成功', + fileNameOverlong: '文件名长度不可超过30,请修改后重试' }, importWithTemplate: { chooseFile: '选择文件', diff --git a/src/components/UploadFile.vue b/src/components/UploadFile.vue index 113c2689..a2c08352 100644 --- a/src/components/UploadFile.vue +++ b/src/components/UploadFile.vue @@ -345,6 +345,12 @@ export default { doBeforeUpload (file) { this.uploadGoOn = true file.uploadGoOn = true + if (file.name.split('.')[0].length > 30) { + this.$message.warning(this.$t('uploadFile.fileNameOverlong')) + this.uploadGoOn = false + file.uploadGoOn = false + return false + } const fileSize = file.size // 上传的文件大小 if (fileSize === 0) { this.$message.warning(this.$t('uploadFile.cannotUploadEmpty')) diff --git a/src/components/jero/JUpload.vue b/src/components/jero/JUpload.vue index 5a0e29ff..9a6b9caf 100644 --- a/src/components/jero/JUpload.vue +++ b/src/components/jero/JUpload.vue @@ -310,8 +310,15 @@ export default { this.$emit('change', path) }, doBeforeUpload (file) { + console.log('--------file', file) this.uploadGoOn = true file.uploadGoOn = true + if (file.name.split('.')[0].length > 30) { + this.$message.warning(this.$t('uploadFile.fileNameOverlong')) + this.uploadGoOn = false + file.uploadGoOn = false + return false + } const fileSize = file.size // 上传的文件大小 if (fileSize === 0) { this.$message.warning(this.$t('uploadFile.cannotUploadEmpty')) @@ -395,6 +402,10 @@ export default { } else if (info.file.status === 'removed') { this.handleDelete(info.file) } + fileList = fileList.filter(tt => !!tt) + console.log(fileList) + // 二次过滤不符合要求的(uploadGoOn为false的),否则只上传多个不符合要求的只会有一个不出现在列表中 + fileList = fileList.filter(tt => tt.uploadGoOn === undefined || tt.uploadGoOn === null || tt.uploadGoOn === true) this.fileList = fileList if (info.file.status === 'done' || info.file.status === 'removed') { // returnUrl为true时仅返回文件路径