| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- // module/chats/components/guide/guide.ts
- import { getPatients } from "../../../../pages/home/request";
- import { toCertificationPage } from "../../../../pages/home/router";
- Component({
- lifetimes: {
- attached() {
- const showGuideActive = wx.getStorageSync("showGuideActive");
- // 从主页点击健康评估进来的
- if(showGuideActive){
- this.handleA();
- wx.removeStorageSync("showGuideActive");
- }
- },
-
- },
- observers: {
- active(newVal,oldVal) {
- console.log("active=>>>",newVal,oldVal);
- },
- },
- 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*/);
- if (!patient) await toCertificationPage();
- else {
- console.log("patient",this.data.active);
- 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
- );
- }
- },
- },
- });
|