|
|
|
@ -272,12 +272,10 @@ Page({
@@ -272,12 +272,10 @@ Page({
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
setFile(e: any) { |
|
|
|
|
console.log('DEBUGPRINT[63]: index.ts:189: e=', e) |
|
|
|
|
const { type, key } = e.currentTarget.dataset |
|
|
|
|
const { examId, period } = this.data |
|
|
|
|
const detail = e.detail || [] |
|
|
|
|
let apiArr: any[] = [] |
|
|
|
|
const fileList = this.data[key] || [] |
|
|
|
|
detail.forEach((item: any) => { |
|
|
|
|
const params: any = { |
|
|
|
|
examId, |
|
|
|
@ -288,22 +286,26 @@ Page({
@@ -288,22 +286,26 @@ Page({
|
|
|
|
|
url: item.url, |
|
|
|
|
videoUrl: item.videoUrl, |
|
|
|
|
duration: item.duration, |
|
|
|
|
key, |
|
|
|
|
} |
|
|
|
|
fileList.push(params) |
|
|
|
|
apiArr.push(this.saveAttachment(params)) |
|
|
|
|
}) |
|
|
|
|
this.setData({ |
|
|
|
|
[key]: fileList, |
|
|
|
|
}) |
|
|
|
|
Promise.all(apiArr).then((res) => { |
|
|
|
|
console.log(res) |
|
|
|
|
const fileList = this.data[key] || [] |
|
|
|
|
this.setData({ |
|
|
|
|
[key]: fileList.concat(res), |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
saveAttachment(params: any) { |
|
|
|
|
return wx.ajax({ |
|
|
|
|
method: 'POST', |
|
|
|
|
url: '?r=wtx/treatment/save-attachment', |
|
|
|
|
data: params, |
|
|
|
|
return new Promise((resolve) => { |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: 'POST', |
|
|
|
|
url: '?r=wtx/treatment/save-attachment', |
|
|
|
|
data: params, |
|
|
|
|
}).then((res) => { |
|
|
|
|
resolve({ ...params, attachmentId: res }) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
delFile(e: any) { |
|
|
|
|