From 1e1e494d5bc0506884b9acee7067cd277a443dc8 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: Sun, 12 Dec 2021 16:37:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8A=E4=BC=A0=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E6=96=B9=E6=B3=95=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Vue/src/components/FileUpload/index.vue | 6 ++++-- ZR.Vue/src/components/UploadImage/index.vue | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ZR.Vue/src/components/FileUpload/index.vue b/ZR.Vue/src/components/FileUpload/index.vue index ad5d6e5..9617600 100644 --- a/ZR.Vue/src/components/FileUpload/index.vue +++ b/ZR.Vue/src/components/FileUpload/index.vue @@ -144,10 +144,12 @@ export default { }, // 上传成功回调 handleUploadSuccess(res, file) { + if (res.code != 200) { + this.msgError(`上传失败,原因:${res.msg}!`); + return; + } this.msgSuccess("上传成功"); - console.log(res.data.fileName, res.data.url); this.fileList.push({ name: res.data.fileName, url: res.data.url }); - this.$emit("input", this.column, this.listToString(this.fileList)); }, // 删除文件 diff --git a/ZR.Vue/src/components/UploadImage/index.vue b/ZR.Vue/src/components/UploadImage/index.vue index 72aafdb..d2fc509 100644 --- a/ZR.Vue/src/components/UploadImage/index.vue +++ b/ZR.Vue/src/components/UploadImage/index.vue @@ -111,9 +111,14 @@ export default { }, //上传成功回调 handleUploadSuccess(res) { + console.log(res); + this.loading.close(); + if (res.code != 200) { + this.msgError(`上传失败,原因:${res.msg}!`); + return; + } this.fileList.push({ name: res.data.fileName, url: res.data.url }); this.$emit(`input`, this.column, this.listToString(this.fileList)); - this.loading.close(); }, // 上传前loading加载 handleBeforeUpload(file) { @@ -167,7 +172,7 @@ export default { for (let i in list) { strs += list[i].url.replace(this.baseUrl, "") + separator; } - return strs != '' ? strs.substr(0, strs.length - 1) : ''; + return strs != "" ? strs.substr(0, strs.length - 1) : ""; }, handleUploadError() { this.$message({