Explorar o código

feat(health): 15题五维健康自检入口加登录门禁,登录后自动跳转调研问卷

Agnes Agent hai 1 semana
pai
achega
28889a281d
Modificáronse 1 ficheiros con 15 adicións e 1 borrados
  1. 15 1
      cfc-frontend/pages/health-main/index.vue

+ 15 - 1
cfc-frontend/pages/health-main/index.vue

@@ -481,6 +481,13 @@ export default {
     goPage: function(url) { uni.navigateTo({ url: url }) },
     // 登录成功:刷新登录态数据(镜像 onShow 已登录分支)
     onLoginSuccess: function() {
+      // 未登录点击「15题五维健康自检」→ 登录成功后续接跳转调研问卷
+      if (this._pendingSurveyUrl) {
+        var pendingUrl = this._pendingSurveyUrl
+        this._pendingSurveyUrl = ''
+        uni.navigateTo({ url: pendingUrl })
+        return
+      }
       this.isLoggedIn = true
       var stored = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || ''
       if (stored) {
@@ -522,7 +529,14 @@ export default {
       return status === 'resolved' ? 'resolved' : 'pending'
     },
     goSelfTest: function() {
-      uni.navigateTo({ url: '/pages/health/health-survey?modules=basic,status,diet,disease,bowel,sleep,med,allergy' })
+      // 15题五维健康自检对应健康调研问卷,需登录后才能填写:未登录先弹出登录浮层
+      var url = '/pages/health/health-survey?modules=basic,status,diet,disease,bowel,sleep,med,allergy'
+      if (!uni.getStorageSync('token')) {
+        this._pendingSurveyUrl = url
+        this.openLoginSheet({ redirect: url })
+        return
+      }
+      uni.navigateTo({ url: url })
     },
     // 拉取本期待填调研(服务端按 cycle_type 计算当前周期)
     loadPendingSurveys: function() {