From 08520b369655e21466fe5155b9e68d6b75035e27 Mon Sep 17 00:00:00 2001 From: yufei_wang <2267742828@qq.com> Date: Fri, 11 Oct 2024 15:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BA=BF=E4=B8=8A=E7=B4=A7?= =?UTF-8?q?=E6=80=A5=E5=8F=91=E7=89=88=E9=97=AE=E9=A2=98--=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E4=BC=A0=E5=BC=82=E5=B8=B8=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UploadFile/src/UploadFile.vue | 26 +++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/components/UploadFile/src/UploadFile.vue b/src/components/UploadFile/src/UploadFile.vue index d6fe4e53f..bb3677817 100644 --- a/src/components/UploadFile/src/UploadFile.vue +++ b/src/components/UploadFile/src/UploadFile.vue @@ -109,17 +109,21 @@ const beforeUpload: UploadProps['beforeUpload'] = (file: UploadRawFile) => { // } // 文件上传成功 const handleFileSuccess: UploadProps['onSuccess'] = (res: any,uploadFile: any): void => { - message.success(t('ts.上传成功')) - const fileListNew = fileList.value - fileListNew.pop() - fileList.value = fileListNew - uploadList.value.push({ name: uploadFile.name, url: res.data }) - // if (uploadList.value.length == uploadNumber.value) { - if(fileList.value.every(it => it.status == 'success')) { - fileList.value = fileList.value.concat(uploadList.value) - uploadList.value = [] - uploadNumber.value = 0 - emit('update:modelValue', listToString(fileList.value),res,uploadFile) + if(res&&res.code==0){ + message.success(t('ts.上传成功')) + const fileListNew = fileList.value + fileListNew.pop() + fileList.value = fileListNew + uploadList.value.push({ name: uploadFile.name, url: res.data }) + // if (uploadList.value.length == uploadNumber.value) { + if(fileList.value.every(it => it.status == 'success')) { + fileList.value = fileList.value.concat(uploadList.value) + uploadList.value = [] + uploadNumber.value = 0 + emit('update:modelValue', listToString(fileList.value),res,uploadFile) + } + }else{ + message.error(res.msg) } } // 文件数超出提示