|
|
|
@ -14,12 +14,15 @@ Page({
@@ -14,12 +14,15 @@ Page({
|
|
|
|
|
DoctorLevel: 1, |
|
|
|
|
|
|
|
|
|
auth: {} as any, |
|
|
|
|
|
|
|
|
|
DeleteAttachmentIds: [] as any, |
|
|
|
|
}, |
|
|
|
|
onLoad(options) { |
|
|
|
|
this.setData({ |
|
|
|
|
caseId: options.id, |
|
|
|
|
}); |
|
|
|
|
app.waitLogin().then(() => { |
|
|
|
|
this.getCache(); |
|
|
|
|
app.getUserInfo(this, (res) => { |
|
|
|
|
this.setData({ |
|
|
|
|
DoctorLevel: res.DoctorLevel, |
|
|
|
@ -53,11 +56,53 @@ Page({
@@ -53,11 +56,53 @@ Page({
|
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}); |
|
|
|
|
this.imageVerify(detail.fileUrl); |
|
|
|
|
this.handleCache(); |
|
|
|
|
}, |
|
|
|
|
handleDelPhoto(e) { |
|
|
|
|
const { index } = e.currentTarget.dataset; |
|
|
|
|
const { images, DeleteAttachmentIds } = this.data; |
|
|
|
|
if (images[index].attachmentId) { |
|
|
|
|
DeleteAttachmentIds.push(images[index].attachmentId); |
|
|
|
|
} |
|
|
|
|
this.setData({ |
|
|
|
|
images: this.data.images.filter((_, i) => i !== Number(index)), |
|
|
|
|
DeleteAttachmentIds, |
|
|
|
|
}); |
|
|
|
|
this.handleCache(); |
|
|
|
|
}, |
|
|
|
|
imageVerify(url: string) { |
|
|
|
|
const { images, DeleteAttachmentIds } = this.data; |
|
|
|
|
const LastImagesHash: any = []; |
|
|
|
|
images.forEach((item) => { |
|
|
|
|
if (item.hash) { |
|
|
|
|
LastImagesHash.push(item.hash); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: "POST", |
|
|
|
|
url: "?r=takeda/common/image-verify", |
|
|
|
|
data: { |
|
|
|
|
ImageUrl: url, |
|
|
|
|
LastImagesHash, |
|
|
|
|
DeleteAttachmentIds, |
|
|
|
|
}, |
|
|
|
|
}).then((res) => { |
|
|
|
|
const index = images.findIndex((item) => item.url === url); |
|
|
|
|
const imageItem = images[index]; |
|
|
|
|
if (res.Hash) { |
|
|
|
|
imageItem.hash = res.Hash; |
|
|
|
|
} |
|
|
|
|
if (res.code === 1001) { |
|
|
|
|
wx.showToast({ |
|
|
|
|
title: res.msg, |
|
|
|
|
icon: "none", |
|
|
|
|
}); |
|
|
|
|
imageItem.repeat = true; |
|
|
|
|
} |
|
|
|
|
this.setData({ |
|
|
|
|
images, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleAudio(e) { |
|
|
|
@ -72,6 +117,7 @@ Page({
@@ -72,6 +117,7 @@ Page({
|
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}); |
|
|
|
|
this.handleCache(); |
|
|
|
|
}, |
|
|
|
|
handleDelAudio(e) { |
|
|
|
|
wx.showModal({ |
|
|
|
@ -84,6 +130,7 @@ Page({
@@ -84,6 +130,7 @@ Page({
|
|
|
|
|
this.setData({ |
|
|
|
|
audios: this.data.audios.filter((_, i) => i !== Number(index)), |
|
|
|
|
}); |
|
|
|
|
this.handleCache(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
@ -103,6 +150,7 @@ Page({
@@ -103,6 +150,7 @@ Page({
|
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}); |
|
|
|
|
this.handleCache(); |
|
|
|
|
}, |
|
|
|
|
handleDelFile(e) { |
|
|
|
|
wx.showModal({ |
|
|
|
@ -115,6 +163,7 @@ Page({
@@ -115,6 +163,7 @@ Page({
|
|
|
|
|
this.setData({ |
|
|
|
|
files: this.data.files.filter((_, i) => i !== Number(index)), |
|
|
|
|
}); |
|
|
|
|
this.handleCache(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
@ -214,7 +263,6 @@ Page({
@@ -214,7 +263,6 @@ Page({
|
|
|
|
|
handleBack() { |
|
|
|
|
wx.navigateBack(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleSubmit() { |
|
|
|
|
const { caseId, isOpen } = this.data; |
|
|
|
|
const params = this.formatParams(); |
|
|
|
@ -249,6 +297,39 @@ Page({
@@ -249,6 +297,39 @@ Page({
|
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
getCache() { |
|
|
|
|
const { caseId } = this.data; |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: "GET", |
|
|
|
|
url: "?r=takeda/case/get-feedback-cache", |
|
|
|
|
data: { |
|
|
|
|
caseId, |
|
|
|
|
}, |
|
|
|
|
}).then((res) => { |
|
|
|
|
this.setData({ |
|
|
|
|
images: res.images, |
|
|
|
|
info: res.info, |
|
|
|
|
audios: res.audios, |
|
|
|
|
files: res.files, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleCache() { |
|
|
|
|
const { caseId, images, info, audios, files } = this.data; |
|
|
|
|
const cacheParams = { |
|
|
|
|
caseId, |
|
|
|
|
images: JSON.stringify(images), |
|
|
|
|
info: `${info}`, |
|
|
|
|
audios: JSON.stringify(audios), |
|
|
|
|
files: JSON.stringify(files), |
|
|
|
|
}; |
|
|
|
|
wx.ajax({ |
|
|
|
|
method: "POST", |
|
|
|
|
url: "?r=takeda/case/save-feedback-cache", |
|
|
|
|
data: cacheParams, |
|
|
|
|
showMsg: false, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
export {}; |
|
|
|
|