|
@@ -5,8 +5,8 @@
|
|
|
</el-button>
|
|
|
<el-dialog append-to-body :visible.sync="dialogVisible">
|
|
|
<el-upload class="editor-slide-upload"
|
|
|
- action="http://macro-oss.oss-cn-shenzhen.aliyuncs.com"
|
|
|
- :data="dataObj"
|
|
|
+ :action="minioUploadUrl"
|
|
|
+ :data="senddata"
|
|
|
:multiple="true"
|
|
|
:file-list="fileList"
|
|
|
:show-file-list="true"
|
|
@@ -45,7 +45,9 @@
|
|
|
ossaccessKeyId: '',
|
|
|
dir: '',
|
|
|
host: ''
|
|
|
- }
|
|
|
+ },
|
|
|
+ senddata:{type:3},
|
|
|
+ minioUploadUrl:`${process.env.BASE_API}/upload/fileImg`,
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -58,19 +60,24 @@
|
|
|
this.$message('请等待所有图片上传成功 或 出现了网络问题,请刷新页面重新上传!')
|
|
|
return
|
|
|
}
|
|
|
+ console.log('Object.keys(this.listObj)',this.listObj);
|
|
|
console.log(arr);
|
|
|
this.$emit('successCBK', arr);
|
|
|
this.listObj = {};
|
|
|
this.fileList = [];
|
|
|
this.dialogVisible = false;
|
|
|
},
|
|
|
- handleSuccess(response, file) {
|
|
|
+ handleSuccess(response, file) {
|
|
|
const uid = file.uid;
|
|
|
const objKeyArr = Object.keys(this.listObj)
|
|
|
+ console.log('objKeyArr',objKeyArr,'uid',uid);
|
|
|
for (let i = 0, len = objKeyArr.length; i < len; i++) {
|
|
|
- if (this.listObj[objKeyArr[i]].uid === uid) {
|
|
|
- this.listObj[objKeyArr[i]].url = this.dataObj.host + '/' + this.dataObj.dir + '/' + file.name;
|
|
|
+ console.log('this.listObj[objKeyArr[i]].uid',this.listObj[objKeyArr[i]].uid,'uid',uid)
|
|
|
+ if (this.listObj[objKeyArr[i]].uid == uid) {
|
|
|
+ // this.listObj[objKeyArr[i]].url = this.dataObj.host + '/' + this.dataObj.dir + '/' + file.name;
|
|
|
+ this.listObj[objKeyArr[i]].url = response.data;
|
|
|
this.listObj[objKeyArr[i]].hasSuccess = true;
|
|
|
+ console.log(this.listObj);
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -89,21 +96,22 @@
|
|
|
const _self = this
|
|
|
const fileName = file.uid;
|
|
|
this.listObj[fileName] = {};
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- policy().then(response => {
|
|
|
- _self.dataObj.policy = response.data.policy;
|
|
|
- _self.dataObj.signature = response.data.signature;
|
|
|
- _self.dataObj.ossaccessKeyId = response.data.accessKeyId;
|
|
|
- _self.dataObj.key = response.data.dir + '/${filename}';
|
|
|
- _self.dataObj.dir = response.data.dir;
|
|
|
- _self.dataObj.host = response.data.host;
|
|
|
- _self.listObj[fileName] = {hasSuccess: false, uid: file.uid, width: this.width, height: this.height};
|
|
|
- resolve(true)
|
|
|
- }).catch(err => {
|
|
|
- console.log(err)
|
|
|
- reject(false)
|
|
|
- })
|
|
|
- })
|
|
|
+ _self.listObj[fileName] = {hasSuccess: false, uid: file.uid};
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // policy().then(response => {
|
|
|
+ // _self.dataObj.policy = response.data.policy;
|
|
|
+ // _self.dataObj.signature = response.data.signature;
|
|
|
+ // _self.dataObj.ossaccessKeyId = response.data.accessKeyId;
|
|
|
+ // _self.dataObj.key = response.data.dir + '/${filename}';
|
|
|
+ // _self.dataObj.dir = response.data.dir;
|
|
|
+ // _self.dataObj.host = response.data.host;
|
|
|
+ // _self.listObj[fileName] = {hasSuccess: false, uid: file.uid, width: this.width, height: this.height};
|
|
|
+ // resolve(true)
|
|
|
+ // }).catch(err => {
|
|
|
+ // console.log(err)
|
|
|
+ // reject(false)
|
|
|
+ // })
|
|
|
+ // })
|
|
|
}
|
|
|
}
|
|
|
}
|