|
|
|
const app = getApp<IAppOption>();
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
show1: false,
|
|
|
|
show2: false,
|
|
|
|
|
|
|
|
deptList: [] as any,
|
|
|
|
labelList: [] as any,
|
|
|
|
|
|
|
|
images: [] as any,
|
|
|
|
description: "",
|
|
|
|
audios: [] as any,
|
|
|
|
files: [] as any,
|
|
|
|
deptId: "",
|
|
|
|
labelIds: [] as any,
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
app.waitLogin().then(() => {
|
|
|
|
this.getDoctorDict();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getDoctorDict() {
|
|
|
|
wx.ajax({
|
|
|
|
method: "GET",
|
|
|
|
url: "?r=takeda/reg/doctor-dict",
|
|
|
|
data: {},
|
|
|
|
}).then((res) => {
|
|
|
|
this.setData({
|
|
|
|
deptList: res.DoctorSpecialtyLabel,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
formatParams() {
|
|
|
|
const { images, description, audios, files, deptId, labelIds } = this.data;
|
|
|
|
return {
|
|
|
|
images: JSON.stringify(images),
|
|
|
|
description,
|
|
|
|
audios: JSON.stringify(audios),
|
|
|
|
files: JSON.stringify(files),
|
|
|
|
deptId,
|
|
|
|
labelIds: JSON.stringify(labelIds),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
handleCache() {
|
|
|
|
const params = this.formatParams();
|
|
|
|
},
|
|
|
|
handleSave() {
|
|
|
|
this.setData({
|
|
|
|
show1: true,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleSubmit() {
|
|
|
|
const params = this.formatParams();
|
|
|
|
// wx.navigateTo({
|
|
|
|
// url: "/module1/pages/entryCasesResult/index",
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
handleInvite() {},
|
|
|
|
handlePhoto(e) {
|
|
|
|
const detail = e.detail;
|
|
|
|
const images = this.data.images;
|
|
|
|
this.setData({
|
|
|
|
images: [
|
|
|
|
...images,
|
|
|
|
{
|
|
|
|
name: detail.name,
|
|
|
|
url: detail.fileUrl,
|
|
|
|
isRepeat: 2,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleDelPhoto(e) {
|
|
|
|
const { index } = e.currentTarget.dataset;
|
|
|
|
this.setData({
|
|
|
|
images: this.data.images.filter((_, i) => i !== Number(index)),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleAudio(e) {
|
|
|
|
this.setData({
|
|
|
|
audios: [
|
|
|
|
...this.data.audios,
|
|
|
|
{
|
|
|
|
name: e.detail.name,
|
|
|
|
url: e.detail.fileUrl,
|
|
|
|
duration: e.detail.duration,
|
|
|
|
isRepeat: 2,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleDelAudio(e) {
|
|
|
|
const { index } = e.currentTarget.dataset;
|
|
|
|
this.setData({
|
|
|
|
audios: this.data.audios.filter((_, i) => i !== Number(index)),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleFile(e) {
|
|
|
|
this.setData({
|
|
|
|
files: [
|
|
|
|
...this.data.files,
|
|
|
|
{
|
|
|
|
fileType: e.detail.fileType,
|
|
|
|
name: e.detail.name,
|
|
|
|
url: e.detail.fileUrl,
|
|
|
|
size: e.detail.size,
|
|
|
|
isRepeat: 2,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleDept(e) {
|
|
|
|
const { params } = e.currentTarget.dataset;
|
|
|
|
this.setData({
|
|
|
|
deptId: params.value,
|
|
|
|
labelList: params.options,
|
|
|
|
labelIds: [],
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleLabel(e) {
|
|
|
|
const { params } = e.currentTarget.dataset;
|
|
|
|
const labelIds = this.data.labelIds;
|
|
|
|
const newLabelId = labelIds.includes(params.value)
|
|
|
|
? labelIds.filter((item: any) => item !== params.value)
|
|
|
|
: [...labelIds, ...params.value];
|
|
|
|
this.setData({
|
|
|
|
labelIds: newLabelId,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export {};
|