From d072b407643cd4fef0f7f29ef97f8de5443d67c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Mon, 16 May 2022 18:09:34 +0800 Subject: [PATCH] =?UTF-8?q?fix=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ImageUpload/index.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index 2f17b7f..293ac9f 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -16,8 +16,7 @@ :headers="headers" :file-list="fileList" :on-preview="handlePictureCardPreview" - :class="{ hide: fileList.length >= limit }" - > + :class="{ hide: fileList.length >= limit }"> @@ -113,14 +112,20 @@ function handleRemove(file, files) { // 上传成功回调 function handleUploadSuccess(res) { + if (res.code != 200) { + proxy.$modal.msgError(`上传失败,原因:${res.msg}!`) + proxy.$modal.closeLoading() + fileList.value = [] + return + } uploadList.value.push({ name: res.data.fileName, url: res.data.url }) if (uploadList.value.length === number.value) { fileList.value = fileList.value.filter((f) => f.url !== undefined).concat(uploadList.value) uploadList.value = [] number.value = 0 emit('update:modelValue', listToString(fileList.value)) - proxy.$modal.closeLoading() } + proxy.$modal.closeLoading() } // 上传前loading加载