Commit 1e91559b by 蒋勇

d

parent 82a85904
<template>
<div>
<div class="demo-upload-list" :key="item.name" v-for="item in ups">
<div class="demo-upload-list" :key="'d'+index" v-for="(item,index) in ups">
<template v-if="item.status === 'finished'">
<img :src="item.url">
<div class="demo-upload-list-cover">
......@@ -96,22 +96,31 @@ export default {
},
handleRemove(file) {
//to do --添加修改时已经有逻辑,fileList中没有
const fileList = this.$refs.upload.fileList;
this.$refs.upload.fileList.splice(fileList.indexOf(file), 1);
const fileList = this.uploadList;
this.uploadList.splice(fileList.indexOf(file), 1);
let cresults= this.result.split(",")
let cs =cresults.filter(r=>{
return r!=file.url
})
this.result=cs.join(",")
this.$emit('change',this.result)
},
handleSuccess(res, file, fileList) {
// var xml= this.loadXML(res);
// this.result=xml.documentElement.getElementsByTagName("Location")[0].textContent;
//解析filelist,构造逗号分隔的文件列表
console.log(fileList);
console.log("/////////////////////////////////////////",fileList);
let mps = fileList.map(item => {
if (item.status == "finished") {
let xml = this.loadXML(item.response);
let tmp = xml.documentElement.getElementsByTagName("Location")[0]
.textContent;
return tmp;
if (item.response) {
let xml = this.loadXML(item.response);
let tmp = xml.documentElement.getElementsByTagName("Location")[0]
.textContent;
return tmp;
}
}
});
mps.push(this.result);
this.result = mps.join(",");
this.$emit("change", this.result);
},
......@@ -137,7 +146,7 @@ export default {
title: "Up to five pictures can be uploaded."
});
}
this.result = "";
// this.result = "";
var myDate = new Date();
var key =
"zc_" +
......@@ -158,6 +167,7 @@ export default {
created() {},
computed: {
ups() {
let tmpary = [];
let ti = this.uploadList.map(item => {
console.log(item);
if (item.status == "finished" && item.response) {
......@@ -169,15 +179,8 @@ export default {
return item;
}
});
// if(this.result){
// let tmpats=[]
// let i=1
// this.result.split(",").forEach(item=>{
// tmpats.push( {name:i++,url:item,status:'finished'})
// })
// return tmpats
// }
return ti;
let t = tmpary.concat(ti);
return t;
}
},
mounted() {
......@@ -197,18 +200,31 @@ export default {
console.log("cofig fetch failuer");
}
});
this.$refs.upload.fileList = [];
this.uploadList = this.$refs.upload.fileList;
},
watch: {
value: function(v) {
this.result = v;
if (this.result) {
//打开窗口,给vaue属性赋予值
this.$refs.upload.fileList = [];
if (this.result && this.result!="") {
console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.");
let i = 10;
this.result.split(",").forEach(item => {
this.uploadList.push({ name: i++, url: item, status: "finished" });
let sb = this.uploadList.some(s => {
if (s.url) {
return s.url == item;
}
});
if (!sb) {
this.uploadList.push({ name: i++, url: item, status: "finished" });
}
});
}else{
this.uploadList=[]
}
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment