From 695cb6d76b838b1e4cb161bae335faa948dca12a Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 27 十月 2021 13:16:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into satoken --- ruoyi-ui/src/components/FileUpload/index.vue | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index d47fb98..a5971f2 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -27,7 +27,7 @@ <!-- 鏂囦欢鍒楄〃 --> <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul"> <li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList"> - <el-link :href="`${baseUrl}${file.url}`" :underline="false" target="_blank"> + <el-link :href="`${file.url}`" :underline="false" target="_blank"> <span class="el-icon-document"> {{ getFileName(file.name) }} </span> </el-link> <div class="ele-upload-list__item-content-action"> @@ -70,7 +70,7 @@ data() { return { baseUrl: process.env.VUE_APP_BASE_API, - uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 + uploadFileUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 headers: { Authorization: "Bearer " + getToken(), }, @@ -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.url }); + 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