From 4c99cea3e49a9712a7f8ebf4bbfaa6ede1f824af Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 21 十二月 2021 11:18:03 +0800
Subject: [PATCH] update 更新批处理演示案例注释说明
---
ruoyi-ui/src/components/ImageUpload/index.vue | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue
index f2a7402..fcf010d 100644
--- a/ruoyi-ui/src/components/ImageUpload/index.vue
+++ b/ruoyi-ui/src/components/ImageUpload/index.vue
@@ -18,7 +18,7 @@
>
<i class="el-icon-plus"></i>
</el-upload>
-
+
<!-- 涓婁紶鎻愮ず -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
璇蜂笂浼�
@@ -74,7 +74,7 @@
dialogVisible: false,
hideUpload: false,
baseUrl: process.env.VUE_APP_BASE_API,
- uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃
+ uploadImgUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃
headers: {
Authorization: "Bearer " + getToken(),
},
@@ -90,11 +90,7 @@
// 鐒跺悗灏嗘暟缁勮浆涓哄璞℃暟缁�
this.fileList = list.map(item => {
if (typeof item === "string") {
- if (item.indexOf(this.baseUrl) === -1) {
- item = { name: this.baseUrl + item, url: this.baseUrl + item };
- } else {
- item = { name: item, url: item };
- }
+ item = { name: item, url: item };
}
return item;
});
@@ -116,15 +112,22 @@
methods: {
// 鍒犻櫎鍥剧墖
handleRemove(file, fileList) {
- const findex = this.fileList.indexOf(file.name);
- this.fileList.splice(findex, 1);
- this.$emit("input", this.listToString(this.fileList));
+ const findex = this.fileList.map(f => f.name).indexOf(file.name);
+ if(findex > -1) {
+ this.fileList.splice(findex, 1);
+ this.$emit("input", this.listToString(this.fileList));
+ }
},
// 涓婁紶鎴愬姛鍥炶皟
handleUploadSuccess(res) {
- this.fileList.push({ name: res.data.fileName, url: res.data.fileName });
- this.$emit("input", this.listToString(this.fileList));
- this.loading.close();
+ if (res.code == 200) {
+ this.fileList.push({ name: res.data.fileName, url: res.data.url });
+ this.$emit("input", this.listToString(this.fileList));
+ this.loading.close();
+ } else {
+ this.$message.error(res.msg);
+ this.loading.close();
+ }
},
// 涓婁紶鍓峫oading鍔犺浇
handleBeforeUpload(file) {
@@ -134,7 +137,7 @@
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
- isImg = this.fileType.some(type => {
+ isImg = this.fileType.some((type) => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
@@ -167,7 +170,7 @@
this.$message.error(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${this.limit} 涓�!`);
},
// 涓婁紶澶辫触
- handleUploadError() {
+ handleUploadError(res) {
this.$message({
type: "error",
message: "涓婁紶澶辫触",
@@ -203,8 +206,8 @@
}
::v-deep .el-list-enter, .el-list-leave-active {
- opacity: 0;
- transform: translateY(0);
+ opacity: 0;
+ transform: translateY(0);
}
</style>
--
Gitblit v1.9.3