路泰科技体检小程序UI设计新版本
1
wwl
5 天以前 a6cdbcfe28fcc40ebb4919f57d60fb20122e8e57
pages/mine/index.vue
@@ -263,21 +263,38 @@
        }
      });
    },
    subScriptionMessage() {
      wx.requestSubscribeMessage({
        tmplIds: [
          'M4K_BNVG7g4hOAcrIDO18ux8KOTneHeNide5GdPW3kc',
          'X467Xtd8HnFDNk-IoT0ChcdoBnClLZJQQwP7DMztYQ8',
          'Gzc2BgzSsEY9uki6FThNQRLD1_An6uqpSve3PaU58PQ',
        ],
        success(res) {
          console.log(res);
        },
        fail(res) {
          console.log(res);
subScriptionMessage() {
  wx.requestSubscribeMessage({
    tmplIds: [
      'M4K_BNVG7g4hOAcrIDO18ux8KOTneHeNide5GdPW3kc',
      'X467Xtd8HnFDNk-IoT0ChcdoBnClLZJQQwP7DMztYQ8',
      'Gzc2BgzSsEY9uki6FThNQRLD1_An6uqpSve3PaU58PQ',
    ],
    success: (res) => {
      console.log('订阅消息结果:', res);
      const tmplIds = [
        'M4K_BNVG7g4hOAcrIDO18ux8KOTneHeNide5GdPW3kc',
        'X467Xtd8HnFDNk-IoT0ChcdoBnClLZJQQwP7DMztYQ8',
        'Gzc2BgzSsEY9uki6FThNQRLD1_An6uqpSve3PaU58PQ',
      ];
      let acceptedCount = 0;
      tmplIds.forEach(id => {
        if (res[id] === 'accept') {
          acceptedCount++;
        }
      });
      if (acceptedCount > 0) {
        this.$u.toast(`成功订阅`);
      } else {
        this.$u.toast('已取消');
      }
    },
    fail: (res) => {
      console.error('订阅消息失败:', res);
      this.$u.toast('订阅消息失败,请稍后重试');
    }
  });
},
    questionnaire() {
      const msg = uni.getStorageSync('msg');
      if (msg) {
@@ -354,42 +371,44 @@
      this.$tab.navigateTo('/pagesB/mine/myReservation/myReservation');
    },
    handleBuilding() {
      const msg = uni.getStorageSync('msg');
      if (msg) {
        let phone = msg;
        getIdCardByPhone(phone).then(response => {
          if (response.data) {
            uni.setStorageSync('data', response.data);
            const cusIdCard = uni.getStorageSync('data');
            uni.navigateTo({
              url: `/pages/tjrecord/tjrecord?cusIdCard=${cusIdCard}`
            });
          } else {
            uni.navigateTo({
              url: `/pagesA/Examiner/Examiner?id=2`
            });
          }
        });
      } else if (this.phone) {
        let phone = this.phone;
        getIdCardByPhone(phone).then(response => {
          if (response.data) {
            uni.setStorageSync('data', response.data);
            const cusIdCard = uni.getStorageSync('data');
            uni.navigateTo({
              url: `/pages/tjrecord/tjrecord?cusIdCard=${cusIdCard}`
            });
          } else {
            uni.navigateTo({
              url: `/pagesA/Examiner/Examiner?id=2`
            });
          }
        });
      } else {
      // 优先从 uni.getStorageSync 获取 phone,若无则使用 this.phone
      const phone = uni.getStorageSync('msg') || this.phone;
      // 如果 phone 不存在,直接跳转到 Examiner 页面
      if (!phone) {
        uni.navigateTo({
          url: `/pagesA/Examiner/Examiner?id=2`
          url: '/pagesA/Examiner/Examiner?id=2'
        });
        return;
      }
      // 调用 API 获取身份证号
      getIdCardByPhone(phone)
        .then(response => {
          if (response.data) {
            // 存储身份证号并跳转到 tjrecord 页面
            uni.setStorageSync('data', response.data);
            uni.navigateTo({
              url: `/pages/tjrecord/tjrecord?cusIdCard=${response.data}`
            });
          } else {
            // 无数据时跳转到 Examiner 页面
            uni.navigateTo({
              url: '/pagesA/Examiner/Examiner?id=2'
            });
          }
        })
        .catch(err => {
          console.error('getIdCardByPhone 错误:', err);
          uni.showToast({
            title: err.message || '网络错误,请稍后重试',
            icon: 'none'
          });
          // 可选:根据需求决定是否跳转
          uni.navigateTo({
            url: '/pagesA/Examiner/Examiner?id=2'
          });
        });
    },
    personnel(canshu) {
      if (this.token) {