From bc72868fc5186986769b36d346b33e7689dce5d2 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: Mon, 28 Feb 2022 13:15:04 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=E5=A4=9A=E6=96=87?= =?UTF-8?q?=E4=BB=B6=20=E5=A4=9A=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/FileUpload/index.vue | 17 +++++++++++------ ruoyi-ui/src/components/ImageUpload/index.vue | 17 +++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 226cd14c..5560cbbf 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -151,12 +151,17 @@ export default { }, // 上传成功回调 handleUploadSuccess(res) { - this.uploadList.push({ name: res.data.fileName, url: res.data.url }); - if (this.uploadList.length === this.number) { - this.fileList = this.fileList.concat(this.uploadList); - this.uploadList = []; - this.number = 0; - this.$emit("input", this.listToString(this.fileList)); + if (res.code === 200) { + this.uploadList.push({ name: res.data.fileName, url: res.data.url }); + if (this.uploadList.length === this.number) { + this.fileList = this.fileList.concat(this.uploadList); + this.uploadList = []; + this.number = 0; + this.$emit("input", this.listToString(this.fileList)); + this.$modal.closeLoading(); + } + } else { + this.$modal.msgError(res.msg); this.$modal.closeLoading(); } }, diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index f00215a9..0af10bef 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -122,12 +122,17 @@ export default { }, // 上传成功回调 handleUploadSuccess(res) { - this.uploadList.push({ name: res.data.fileName, url: res.data.url }); - if (this.uploadList.length === this.number) { - this.fileList = this.fileList.concat(this.uploadList); - this.uploadList = []; - this.number = 0; - this.$emit("input", this.listToString(this.fileList)); + if (res.code == 200) { + this.uploadList.push({ name: res.data.fileName, url: res.data.url }); + if (this.uploadList.length === this.number) { + this.fileList = this.fileList.concat(this.uploadList); + this.uploadList = []; + this.number = 0; + this.$emit("input", this.listToString(this.fileList)); + this.$modal.closeLoading(); + } + } else { + this.$modal.msgError(res.msg); this.$modal.closeLoading(); } },