武田小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
2.8 KiB

6 months ago
const app = getApp<IAppOption>();
Page({
data: {
show1: false,
show2: false,
6 months ago
deptList: [] as any,
labelList: [] as any,
6 months ago
images: [] as any,
description: "",
audios: [] as any,
6 months ago
files: [] as any,
6 months ago
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,
6 months ago
});
},
handleSubmit() {
const params = this.formatParams();
// wx.navigateTo({
// url: "/module1/pages/entryCasesResult/index",
// });
},
handleInvite() {},
6 months ago
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,
},
],
});
6 months ago
},
6 months ago
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,
{
6 months ago
fileType: e.detail.fileType,
6 months ago
name: e.detail.name,
url: e.detail.fileUrl,
size: e.detail.size,
isRepeat: 2,
},
],
});
},
6 months ago
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,
});
},
6 months ago
});
6 months ago
export {};