| | |
| | | }, |
| | | |
| | | //上传成功后对返回数据进行处理 |
| | | async afterReadImg(event,key="images") { |
| | | async afterReadImg(event, key = "images") { |
| | | // console.log(key) |
| | | // console.log(this.form[key]); |
| | | this.showLoading() |
| | | var that = this; |
| | | // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
| | | let lists = [].concat(event.file) |
| | | |
| | | |
| | | let fileListLen = this.form[key].length |
| | | lists.map((item) => { |
| | | this.form[key].push({ |
| | |
| | | const result = await this.uploadFilePromise(lists[i].url) |
| | | that.form[key].splice(fileListLen, 1, Object.assign({}, { |
| | | url: result.data.link, |
| | | name:result.data.name |
| | | name: result.data.name |
| | | })) |
| | | fileListLen++ |
| | | } |
| | | |
| | | |
| | | // let fileListLen = this.form.images.length |
| | | // lists.map((item) => { |
| | | // this.form.images.push({ |
| | |
| | | // })) |
| | | // fileListLen++ |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | this.loadingClose() |
| | | }, |
| | | |
| | | |
| | | |
| | | //删除图片 |
| | | deletePic(event,key="images") { |
| | | deletePic(event, key = "images") { |
| | | |
| | | console.log(111) |
| | | |
| | | this.form[key].splice(event.index, 1) |
| | | }, |
| | | |
| | | deletePics(event,key) { |
| | | console.log(event,key); |
| | | |
| | | deletePics(event, key) { |
| | | console.log(event, key); |
| | | this[key].splice(event.index, 1) |
| | | }, |
| | | |
| | | |
| | | showLoading() { |
| | | uni.showLoading({ |
| | | mask: true, |