// module/chats/components/guide/guide.ts import { getPatients } from "../../../../pages/home/request"; import { toCertificationPage } from "../../../../pages/home/router"; Component({ lifetimes: {}, properties: { id: { type: String, value: "" }, active: { type: Boolean, value: false }, analysisCount: { type: Number, value: 0 }, }, data: { result: [] as string[], result2: false, patient: {} as any, }, methods: { async handleA() { const { patient } = await getPatients(/*this.data.patientId*/); console.log("patient", patient); if (!patient) await toCertificationPage(); else { if (this.data.active) { this.triggerEvent("next", { component: "questionnaire", scroll: true }); this.triggerEvent("nextType", { MessageType: 2 }); } } }, async handleB() { const { patient } = await getPatients(/*this.data.patientId*/); if (!patient) await toCertificationPage(); else { if (this.data.active) wx.navigateTo({ url: "/module/health/pages/status/status", events: { update: this._update.bind(this) }, }); } }, async handleC() { const { patient } = await getPatients(/*this.data.patientId*/); if (!patient) await toCertificationPage(); else { if (this.data.active) wx.navigateTo({ url: "/module/user/pages/user-edit/user-edit", events: { update2: () => { this.setData({ result2: true }); this.triggerEvent("next", { component: "guide", scroll: true }); }, }, }); } }, handleD() { // if (this.data.active) wx.navigateBack(); if (this.data.active) { console.log("tiaohzuan1"); wx.redirectTo({ url: "/pages/home/home" }); } }, _update(result: string[]) { if (result.length) { this.setData({ result }); this.triggerEvent("next", { component: "guide", scroll: true }); } else { setTimeout( () => wx.showToast({ title: `没有更改项`, icon: "none" }), 300 ); } }, }, });