From 4ec85b5c3179f32895f770dcc9d488e6778506e8 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: Tue, 23 Aug 2022 10:33:21 +0000 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E5=AF=BC=E8=87=B4=E5=90=8E=E7=BB=AD=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=95=B0=E9=87=8F=E4=B8=8D=E6=AD=A3=E5=B8=B8=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=85=B3=E9=97=ADloading=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 疯狂的狮子Li <15040126243@163.com> --- ruoyi-ui/src/components/FileUpload/index.vue | 18 ++++++++++++------ ruoyi-ui/src/components/ImageUpload/index.vue | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index a58f99cc..88a636e6 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -151,13 +151,19 @@ export default { }, // 上传成功回调 handleUploadSuccess(res) { - this.uploadList.push({ name: res.data.url, 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.url, 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(); + this.number--; } }, // 删除文件 diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index 24cc75cc..04357c18 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -122,13 +122,19 @@ export default { }, // 上传成功回调 handleUploadSuccess(res) { - this.uploadList.push({ name: res.data.url, 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.url, 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(); + this.number--; } }, // 上传前loading加载