Эх сурвалжийг харах

修复对话管家进行完善信息后直接进行下一步

cc12458 5 сар өмнө
parent
commit
c190b0bac0

+ 24 - 4
miniprogram/module/chats/components/guide/guide.ts

@@ -2,6 +2,9 @@
 import { getPatients } from "../../../../pages/home/request";
 import { getPatients } from "../../../../pages/home/request";
 import { toCertificationPage } from "../../../../pages/home/router";
 import { toCertificationPage } from "../../../../pages/home/router";
 import { Post } from "../../../../lib/request/method";
 import { Post } from "../../../../lib/request/method";
+
+let next: 'handleA' | 'handleB' | 'handleC';
+
 Component({
 Component({
   lifetimes: {
   lifetimes: {
     attached(this: any) {
     attached(this: any) {
@@ -18,7 +21,14 @@ Component({
   pageLifetimes: {
   pageLifetimes: {
     show(this: any) {
     show(this: any) {
       // 获取评估剩余次数
       // 获取评估剩余次数
-      this.setAnalysisCount();
+      this.setAnalysisCount().then(() => {
+        if (next) {
+          const patientId = wx.getStorageSync('patientId');
+          if (patientId) this[next]();
+          else wx.showToast({ title: '请先完善信息!', icon: 'none' });
+          next = undefined;
+        }
+      });
     },
     },
   },
   },
   properties: {
   properties: {
@@ -41,6 +51,7 @@ Component({
           {},
           {},
           {
           {
             transform({ data }: any) {
             transform({ data }: any) {
+              if (data?.usedCou === 0 && data.residuedCou === 0) data.residuedCou = 3;
               return data?.residuedCou;
               return data?.residuedCou;
             },
             },
           }
           }
@@ -52,7 +63,10 @@ Component({
     },
     },
     async handleA() {
     async handleA() {
       const { patient } = await getPatients(/*this.data.patientId*/);
       const { patient } = await getPatients(/*this.data.patientId*/);
-      if (!patient) await toCertificationPage();
+      if (!patient) {
+        await toCertificationPage();
+        next = 'handleA';
+      }
       else {
       else {
         if (this.data.active) {
         if (this.data.active) {
           this.triggerEvent("next", {
           this.triggerEvent("next", {
@@ -65,7 +79,10 @@ Component({
     },
     },
     async handleB() {
     async handleB() {
       const { patient } = await getPatients(/*this.data.patientId*/);
       const { patient } = await getPatients(/*this.data.patientId*/);
-      if (!patient) await toCertificationPage();
+      if (!patient) {
+        await toCertificationPage();
+        next = 'handleB';
+      }
       else {
       else {
         if (this.data.active)
         if (this.data.active)
           wx.navigateTo({
           wx.navigateTo({
@@ -76,7 +93,10 @@ Component({
     },
     },
     async handleC() {
     async handleC() {
       const { patient } = await getPatients(/*this.data.patientId*/);
       const { patient } = await getPatients(/*this.data.patientId*/);
-      if (!patient) await toCertificationPage();
+      if (!patient){
+        await toCertificationPage();
+        next = 'handleC';
+      }
       else {
       else {
         if (this.data.active)
         if (this.data.active)
           wx.navigateTo({
           wx.navigateTo({