Explorar el Código

修复扫码进健康分析报告页用户注册的问题

张田田 hace 6 meses
padre
commit
7b06a32988
Se han modificado 1 ficheros con 17 adiciones y 5 borrados
  1. 17 5
      miniprogram/pages/home/home.ts

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

@@ -70,6 +70,8 @@ Page({
 
     statusList: [] as AnyArray,
 
+    switchType: "",
+
     carouselLoading: {} as Record<string | number, boolean>, // 用于跟踪每个轮播图的加载状态
 
     // 轮播媒体列表
@@ -190,19 +192,29 @@ Page({
     const query = useRouteQuery(options.scene!);
     if (query.ys) wx.setStorageSync("doctorId", query.ys);
     this.initFabAnimated();
+    if (options.switchType) {
+      this.setData({
+        switchType: options.switchType,
+      });
+    }
+  },
+  async onShow() {
+    wx.showShareMenu({ withShareTicket: true, menus }).then();
+    await this.load();
+    console.log(
+      this.data.switchType,
+      "home.ts中的switchType",
+      this.data.patient
+    );
     // 如果是从一体机扫码进来的  有switchType值就直接跳转到注册页面
     if (
-      options.switchType &&
+      this.data.switchType &&
       ((this.data.patient as any)?.isPerfectInfo ?? true)
     ) {
       wx.navigateTo({
         url: "/module/user/pages/user-certification/user-certification?type=home",
       });
     }
-  },
-  async onShow() {
-    wx.showShareMenu({ withShareTicket: true, menus }).then();
-    await this.load();
     // 如果用户没有手机号每次进入页面都提示  点击跳到注册页补充
     // todo 要先判断用户有没有手机号 isPerfectInfo是true 就出来弹窗提示用户
     // if ((this.data.patient as any)?.isPerfectInfo ?? true) {