Pārlūkot izejas kodu

1. 健康管家跳转到完善信息页回退后执行下一步
2. 健康分析默认剩余次数3次

cc12458 6 mēneši atpakaļ
vecāks
revīzija
88c944ae5e

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

@@ -2,6 +2,9 @@
 import { getPatients } from "../../../../pages/home/request";
 import { toCertificationPage } from "../../../../pages/home/router";
 import { Post } from "../../../../lib/request/method";
+
+let next: 'handleA' | 'handleB' | 'handleC';
+
 Component({
   lifetimes: {
     attached(this: any) {
@@ -18,7 +21,14 @@ Component({
   pageLifetimes: {
     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: {
@@ -41,6 +51,7 @@ Component({
           {},
           {
             transform({ data }: any) {
+              if (data?.usedCou === 0 && data.residuedCou === 0) data.residuedCou = 3;
               return data?.residuedCou;
             },
           }
@@ -52,7 +63,10 @@ Component({
     },
     async handleA() {
       const { patient } = await getPatients(/*this.data.patientId*/);
-      if (!patient) await toCertificationPage();
+      if (!patient) {
+        await toCertificationPage();
+        next = 'handleA';
+      }
       else {
         if (this.data.active) {
           this.triggerEvent("next", {
@@ -65,7 +79,10 @@ Component({
     },
     async handleB() {
       const { patient } = await getPatients(/*this.data.patientId*/);
-      if (!patient) await toCertificationPage();
+      if (!patient) {
+        await toCertificationPage();
+        next = 'handleB';
+      }
       else {
         if (this.data.active)
           wx.navigateTo({
@@ -76,7 +93,10 @@ Component({
     },
     async handleC() {
       const { patient } = await getPatients(/*this.data.patientId*/);
-      if (!patient) await toCertificationPage();
+      if (!patient){
+        await toCertificationPage();
+        next = 'handleC';
+      }
       else {
         if (this.data.active)
           wx.navigateTo({

+ 2 - 2
miniprogram/module/chats/pages/index/index.wxml

@@ -8,7 +8,7 @@
 </wxs>
 <!--module/chats/pages/index/index.wxml-->
 <view class="chats-container">
-  <t-navbar title="对话管家" />
+  <t-navbar title="健康管家" />
   <scroll-view 
     id="scrollview" 
     class="page-scroll__container" 
@@ -22,7 +22,7 @@
   >
     <view class="system-wrapper">
       <view class="date">{{date}}</view>
-      <view class="title">对话管家 已进入聊天</view>
+      <view class="title">健康管家 已进入聊天</view>
     </view>
     
     <block wx:for="{{messages}}" wx:key="id">

+ 6 - 1
miniprogram/pages/home/request.ts

@@ -39,7 +39,12 @@ export function getPatients(id?: string) {
 
     return { patient, patients: data };
   };
-  return Post("/mobileAccountManage/getPatsByAid", {}, { transform });
+  return Post("/mobileAccountManage/getPatsByAid", {}, { transform }).then(res => {
+    const patientId = res.patient?.patientId;
+    if (patientId) wx.setStorageSync("patientId", patientId);
+    else wx.removeStorageSync("patientId");
+    return res;
+  });
 }
 
 export async function getPatientDescription(patient: {