فهرست منبع

feat(health-main): 意图问卷入口 + 跳过提醒机制

后端:
- UserIntent实体新增skipCount/lastSkipAt字段
- 新增POST /api/user-intent/skip 接口记录跳过次数
- 迁移243: user_intents表添加skip_count和last_skip_at列

前端:
- 新增pages/health/intent-quiz.vue意图问卷入口页(三选一:随便看看/先了解自己/解决问题+以后再说)
- health-main新增showIntentReminder状态,跳过1-2次后显示提醒横幅
- 跳转逻辑:A类→返回浏览 / B类→AI问卷 / C类→问题域选择

设计说明:
- 所有用户从统一入口开始(intent-quiz页面)
- 随便看看用户点击以后再说,记录skipCount,最多提醒3次
- 先了解自己/解决问题用户直接进入AI智能问卷或问题域选择
iwt 2 ماه پیش
والد
کامیت
2ffcd678b8
2فایلهای تغییر یافته به همراه32 افزوده شده و 2 حذف شده
  1. 4 2
      cfc-frontend/pages.json
  2. 28 0
      cfc-frontend/pages/health-main/index.vue

+ 4 - 2
cfc-frontend/pages.json

@@ -926,9 +926,11 @@
           }
         },
         {
-          "path": "ai-questionnaire-result",
+          }
+        {
+          "path": "intent-quiz",
           "style": {
-            "navigationBarTitleText": "问卷画像报告"
+            "navigationBarTitleText": "选择开始方式"
           }
         }
       ]

+ 28 - 0
cfc-frontend/pages/health-main/index.vue

@@ -59,6 +59,16 @@
           <text class="ai-q-arrow">›</text>
         </view>
       </view>
+
+      <!-- 意图问卷提醒(跳过过但还没做问卷的用户) -->
+      <view v-if="showIntentReminder" class="intent-reminder" @click="goIntentQuiz">
+        <view class="reminder-icon">💡</view>
+        <view class="reminder-body">
+          <text class="reminder-text">还没完成健康问卷?</text>
+          <text class="reminder-sub">花1分钟回答几道题,系统为你推荐最合适的五维方向</text>
+        </view>
+        <text class="reminder-arrow">›</text>
+      </view>
       <!-- 数据预览(示例) -->
       <view class="demo-section">
         <view class="demo-section-head">
@@ -287,6 +297,8 @@ export default {
       reports: [],
       lastPlan: '',
       healthArticles: [],
+      intentData: null,
+      showIntentReminder: false,
       tabs: [
         { code: 'body', label: '健康', icon: '🟠', color: '#FF8C42' },
         { code: 'cognitive', label: '认知', icon: '🧠', color: '#6366F1' },
@@ -520,6 +532,7 @@ export default {
     },
     goSelfTest: function() { uni.navigateTo({ url: '/pages/health/survey-questionnaire?dim=all' }) },
     goAiQuestionnaire: function() { uni.navigateTo({ url: '/pages/health/ai-questionnaire' }) },
+    goIntentQuiz: function() { uni.navigateTo({ url: '/pages/health/intent-quiz' }) },
     goPlanSummary: function() {
       var url = '/pages/health/health-plan-summary'
       if (this.selectedMemberId) url += '?memberId=' + this.selectedMemberId
@@ -530,6 +543,14 @@ export default {
       try {
         var api = require('../../utils/api.js')
         var memberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || uni.getStorageSync('userId') || ''
+        // 检查意图状态
+        api.getUserIntent().then(function(res) {
+          if (res.code === 200 && res.data) {
+            self.intentData = res.data
+            var skipCount = res.data.skipCount || 0
+            self.showIntentReminder = !res.data.intentType && skipCount > 0 && skipCount < 3
+          }
+        }).catch(function() {})
         // 健康报告(memberId 为空时不调用,避免后端 400)
         if (memberId) {
           api.getReportList(memberId).then(function(res) {
@@ -686,6 +707,13 @@ export default {
 .self-test-title { font-size: 28rpx; font-weight: bold; color: #fff; display: block; }
 .self-test-sub { font-size: 22rpx; color: rgba(255,255,255,0.8); display: block; margin-top: 4rpx; }
 .ai-q-entry { margin: 0 24rpx 16rpx; background: linear-gradient(135deg, #F97316, #F59E0B); border-radius: 20rpx; padding: 24rpx 28rpx; }
+.intent-reminder { margin: 0 24rpx 16rpx; background: #fff; border-radius: 20rpx; padding: 24rpx 28rpx; display: flex; align-items: center; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
+.intent-reminder:active { opacity: 0.85; }
+.reminder-icon { font-size: 40rpx; margin-right: 16rpx; flex-shrink: 0; }
+.reminder-body { flex: 1; min-width: 0; }
+.reminder-text { font-size: 26rpx; font-weight: 600; color: #333; display: block; }
+.reminder-sub { font-size: 22rpx; color: #999; margin-top: 4rpx; display: block; line-height: 1.4; }
+.reminder-arrow { font-size: 28rpx; color: #F97316; flex-shrink: 0; }
 .ai-q-head { display: flex; align-items: center; }
 .ai-q-icon { font-size: 40rpx; margin-right: 16rpx; }
 .ai-q-info { flex: 1; }