Explorar el Código

注册逻辑修改 刚进页面不直接进注册页面

张田田 hace 10 meses
padre
commit
dec5033ba4

+ 5 - 1
miniprogram/components/button/button.ts

@@ -27,12 +27,16 @@ Component({
       },
       {
         name: '提交',
-        value: 'cancel',
+        value: 'submit',
       },
       {
         name: '确定',
         value: 'confirm',
       },
+      {
+        name: '取消',
+        value: 'cancel',
+      },
     ],
     src: '',
     isDisabled: false,

+ 48 - 27
miniprogram/module/chats/components/guide/guide.ts

@@ -1,54 +1,75 @@
 // 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: '' },
+    id: { type: String, value: "" },
     active: { type: Boolean, value: false },
     analysisCount: { type: Number, value: 0 },
   },
   data: {
     result: [] as string[],
     result2: false,
+    patient: {} as any,
   },
   methods: {
-    handleA() {
-      if (this.data.active){
-         this.triggerEvent('next', { component: 'questionnaire', scroll: true});
-         this.triggerEvent('nextType', { MessageType:2 });
+    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 });
+        }
       }
     },
-    handleB() {
-      if (this.data.active) wx.navigateTo({
-        url: '/module/health/pages/status/status',
-        events: { update: this._update.bind(this) }
-      });
+    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) },
+          });
+      }
     },
-    handleC() {
-      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 });
-          }
-        }
-      });
+    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"})
+        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 });
+        this.triggerEvent("next", { component: "guide", scroll: true });
       } else {
-        setTimeout(() => wx.showToast({ title: `没有更改项`, icon: 'none' }), 300)
+        setTimeout(
+          () => wx.showToast({ title: `没有更改项`, icon: "none" }),
+          300
+        );
       }
-    }
-  }
-})
+    },
+  },
+});

+ 8 - 5
miniprogram/module/user/pages/user-certification/user-certification.ts

@@ -47,6 +47,9 @@ Component({
    * 组件的方法列表
    */
   methods: {
+    cancel() {
+      wx.navigateBack();
+    },
     getPhoneNumber(event: WechatMiniprogram.ButtonGetPhoneNumber) {
       if (wx.getSystemInfoSync().platform === "devtools") {
         wx.showToast({ title: "请在真机上测试", icon: "none" });
@@ -55,9 +58,7 @@ Component({
       const { getPhoneNumber, updateValue } = usePhoneNumber();
       getPhoneNumber(event);
       updateValue((value) => this.setData({ "model.phone": value }));
-      console.log("手机号", this.data.model.phone);
     },
-    // getPhoneNumber() { /** usePhoneNumber 中实现 */ },
     openPrivacyContract: openPrivacyContract,
     onPrivacySetting({
       detail,
@@ -145,9 +146,11 @@ Component({
         // wx.redirectTo({
         //   url: `/module/chats/pages/index/index?component=questionnaire`,
         // });
-        wx.redirectTo({
-          url: `/pages/home/home`,
-        });
+        // wx.redirectTo({
+        //   url: `/pages/home/home`,
+        // });
+        // 回到相应的页面
+        wx.navigateBack();
       } catch (error) {
         // 请求失败时恢复按钮状态
         if (submitBtn) {

+ 2 - 1
miniprogram/module/user/pages/user-certification/user-certification.wxml

@@ -1,6 +1,6 @@
 <wxs src="../../../../core/wxs/dictionary.wxs" module="dictionary" />
 <!--module/user/pages/user-certification/user-certification.wxml-->
-<t-navbar title="完善信息" left-arrow="{{hide !== true}}" />
+<t-navbar title="完善信息" left-arrow />
 <scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
   <form bindsubmit="onSubmit">
     <view class="open-button">
@@ -32,6 +32,7 @@
     </view>
 
     <form-button block index="1" id="submitBtn"></form-button>
+  <button bindtap="cancel" style="margin: auto;width: 95%;">取消</button>
   </form>
 </scroll-view>
 

+ 17 - 11
miniprogram/pages/home/home.ts

@@ -232,8 +232,10 @@ Page({
       await login(forceLogin);
       wx.showLoading({ title: "加载中" });
       const { patient } = await getPatients(/*this.data.patientId*/);
-      if (!patient) await toCertificationPage();
-      else {
+      // if (!patient) await toCertificationPage();
+      if (!patient) {
+        console.log("没有患者");
+      }else {
         this.setData({ patient });
         this.observerPatient(patient);
       }
@@ -279,11 +281,11 @@ Page({
       });
       let arr2 = [
         [
-          { title: "健康状态", value: `${data?.willillStateName}` },
-          { title: "程度", value: `${data?.willillDegreeName}` },
+          { title: "健康状态", value: data?.willillStateName?`${data?.willillStateName}`:"" },
+          { title: "程度", value: data?.willillDegreeName?`${data?.willillDegreeName}`:"" },
         ],
-        [{ title: "中医证素", value: `${data?.factorItemSummary}` }],
-        [{ title: "体质", value: `${data?.constitutionGroupName}` }],
+        [{ title: "中医证素", value: data?.factorItemSummary?`${data?.factorItemSummary}`:"" }],
+        [{ title: "体质", value: data?.constitutionGroupName?`${data?.constitutionGroupName}`:"" }],
       ];
       this.setData({
         statusList: arr2,
@@ -482,11 +484,15 @@ Page({
       wx.navigateTo({ url: `/module/health/pages/scheme/scheme?id=${id}` });
     else wx.showToast({ title: "暂无调理方案", icon: "none" });
   },
-  toReportPage() {
-    const id = this.data.healthId;
-    if (id)
-      wx.navigateTo({ url: `/module/health/pages/report/report?id=${id}` });
-    else wx.showToast({ title: "暂无分析报告", icon: "none" });
+  async toReportPage() {
+    // const { patient } = await getPatients(/*this.data.patientId*/);
+    if (!this.data.patient) await toCertificationPage();
+    else {
+      const id = this.data.healthId;
+      if (id)
+        wx.navigateTo({ url: `/module/health/pages/report/report?id=${id}` });
+      else wx.showToast({ title: "暂无分析报告", icon: "none" });
+    }
   },
   onDraggableSizeUpdate(e) {
     "worklet";

+ 5 - 4
miniprogram/pages/mine/mine.ts

@@ -1,5 +1,5 @@
-import { getPatients ,getPatientPhone} from "../home/request";
-
+import { getPatients, getPatientPhone } from "../home/request";
+import { toCertificationPage } from "../home/router";
 Page({
   data: {
     patients: [] as (App.Patient.Model & { isDefault: "Y" | "N" })[],
@@ -52,9 +52,10 @@ Page({
         title: '请先登录',
         icon: 'none'
       });
-      return;
+      toCertificationPage();
+    }else {
+      wx.navigateTo({ url: `/module/health/pages/home/home` });
     }
-    wx.navigateTo({ url: `/module/health/pages/home/home` });
   },
 
   // 药膳