guide.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // module/chats/components/guide/guide.ts
  2. import { getPatients } from "../../../../pages/home/request";
  3. import { toCertificationPage } from "../../../../pages/home/router";
  4. Component({
  5. lifetimes: {},
  6. properties: {
  7. id: { type: String, value: "" },
  8. active: { type: Boolean, value: false },
  9. analysisCount: { type: Number, value: 0 },
  10. },
  11. data: {
  12. result: [] as string[],
  13. result2: false,
  14. patient: {} as any,
  15. },
  16. methods: {
  17. async handleA() {
  18. const { patient } = await getPatients(/*this.data.patientId*/);
  19. console.log("patient", patient);
  20. if (!patient) await toCertificationPage();
  21. else {
  22. if (this.data.active) {
  23. this.triggerEvent("next", { component: "questionnaire", scroll: true });
  24. this.triggerEvent("nextType", { MessageType: 2 });
  25. }
  26. }
  27. },
  28. async handleB() {
  29. const { patient } = await getPatients(/*this.data.patientId*/);
  30. if (!patient) await toCertificationPage();
  31. else {
  32. if (this.data.active)
  33. wx.navigateTo({
  34. url: "/module/health/pages/status/status",
  35. events: { update: this._update.bind(this) },
  36. });
  37. }
  38. },
  39. async handleC() {
  40. const { patient } = await getPatients(/*this.data.patientId*/);
  41. if (!patient) await toCertificationPage();
  42. else {
  43. if (this.data.active)
  44. wx.navigateTo({
  45. url: "/module/user/pages/user-edit/user-edit",
  46. events: {
  47. update2: () => {
  48. this.setData({ result2: true });
  49. this.triggerEvent("next", { component: "guide", scroll: true });
  50. },
  51. },
  52. });
  53. }
  54. },
  55. handleD() {
  56. // if (this.data.active) wx.navigateBack();
  57. if (this.data.active) {
  58. console.log("tiaohzuan1");
  59. wx.redirectTo({ url: "/pages/home/home" });
  60. }
  61. },
  62. _update(result: string[]) {
  63. if (result.length) {
  64. this.setData({ result });
  65. this.triggerEvent("next", { component: "guide", scroll: true });
  66. } else {
  67. setTimeout(
  68. () => wx.showToast({ title: `没有更改项`, icon: "none" }),
  69. 300
  70. );
  71. }
  72. },
  73. },
  74. });