From c91d33e4ab58bdee9d4328adc2248495cc656c25 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 18 八月 2021 19:15:03 +0800 Subject: [PATCH] update 优化 OSS 模块与上传组件 异常处理 --- ruoyi-ui/src/components/FileUpload/index.vue | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 244ac28..d5c3bc7 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -146,9 +146,14 @@ }, // 涓婁紶鎴愬姛鍥炶皟 handleUploadSuccess(res, file) { - this.$message.success("涓婁紶鎴愬姛"); - this.fileList.push({ name: res.data.fileName, url: res.data.fileName }); - this.$emit("input", this.listToString(this.fileList)); + if (res.code === 200) { + this.$message.success("涓婁紶鎴愬姛"); + this.fileList.push({ name: res.data.fileName, url: res.data.fileName }); + this.$emit("input", this.listToString(this.fileList)); + } else { + this.$message.error(res.msg); + this.loading.close(); + } }, // 鍒犻櫎鏂囦欢 handleDelete(index) { @@ -170,9 +175,9 @@ for (let i in list) { strs += list[i].url + separator; } - return strs != '' ? strs.substr(0, strs.length - 1) : ''; - } - } + return strs != "" ? strs.substr(0, strs.length - 1) : ""; + }, + }, }; </script> -- Gitblit v1.9.3