Răsfoiți Sursa

fix: TabTransition 默认 true 确保首次渲染即出现,消除页面框架闪现

User 2 luni în urmă
părinte
comite
f5f0c0eee5

+ 2 - 0
cfc-backend/src/main/java/com/etotem/cfc/entity/FamilyMember.java

@@ -1,6 +1,7 @@
 package com.etotem.cfc.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -50,6 +51,7 @@ public class FamilyMember implements Serializable {
     private Integer totalPoints;
 
     /** 年龄(冗余字段,用于匹配时自动计算设置,getAge()通过birthday计算) */
+    @TableField(exist = false)
     private Integer age;
 
     /** 信任度 0-100 */

+ 7 - 12
cfc-frontend/pages/body/index.vue

@@ -27,18 +27,6 @@
       :sandboxData="sandboxData"
       :dualDimension="dualDimension" />
 
-    <!-- ===== 重要关系维护 ===== -->
-    <FamilyRelationshipSection
-      :contactList="contactList"
-      :healthAlerts="healthAlerts"
-      :milestones="milestones"
-      :isLoggedIn="isLoggedIn"
-      @contactClick="onContactClick"
-      @refresh="loadContacts"
-      @import="onShowImport"
-      @interactionLog="goInteractionLog"
-      @questionnaire="goRelationshipQuestionnaire" />
-
     <!-- 关系图谱(登录后可见) -->
     <FamilyRelationGraph
       v-if="isLoggedIn && familyMembersVisible.length > 0"
@@ -169,6 +157,13 @@
       @activityClick="goActivityDetail"
       @moreActivities="goMoreActivities" />
 
+    <!-- 维度商品 -->
+    <DimensionProducts
+      dimensionCode="body"
+      :products="dimensionProducts"
+      @productClick="goProductDetail"
+      @moreProducts="goMoreProducts" />
+
     <!-- 推荐阅读 -->
     <DimensionArticles
       dimensionCode="body"

+ 24 - 30
cfc-frontend/pages/index/index.vue

@@ -228,12 +228,15 @@ export default {
     if (_token) {
       _currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || ''
     }
+    // 首次启动标记(由 splash.vue 设置,表示需要展示 splash overlay)
+    var _isFirstLaunch = (uni.getStorageSync('_showSplashOverlay') === '1')
     return {
       currentRole: _currentRole,
-      showTabTransition: false,
+      // TabTransition 始终默认 true,确保首次渲染即出现;首次启动时被 splash overlay 覆盖不可见
+      showTabTransition: true,
 
-      // splash loading ovarlay(首次进入时展示,数据加载完关闭)
-      splashOverlay: false,
+      // splash loading overlay(首次进入时展示,数据加载完关闭)
+      splashOverlay: _isFirstLaunch,
       splashOverlayFading: false,
       _splashReady: false,
 
@@ -257,44 +260,33 @@ export default {
     this._doInit(options)
   },
   onShow() {
-    // 从 splash 首次进入:展示 splash overlay,数据加载完后自动关闭
-    var showOverlay = uni.getStorageSync('_showSplashOverlay')
-    var isFirstLaunch = (showOverlay === '1')
-    if (isFirstLaunch) {
+    // splash overlay 已在 data() 中根据 storage 标记初始化,此处只需配置关闭条件
+    if (this.splashOverlay) {
       uni.removeStorageSync('_showSplashOverlay')
-      this._showSplashOverlayMask()
-    }
-
-    // 首次启动由 flash 覆盖加载过程,跳过 TabTransition;后续 tab 切换才显示
-    if (!isFirstLaunch) {
-      this.showTabTransition = true
-      this._watchPageReady()
-    }
-
-    // 始终执行初始化,确保登录态变更后及时切换视图
-    this._doInit()
-  },
-  methods: {
-    // ===== Splash overlay (首次进入蒙板) =====
-    _showSplashOverlayMask() {
-      this.splashOverlay = true
       this._splashLoadCount = 0
       this._splashMinPassed = false
 
-      // 最小展示 800ms,让 overlay 有足够时间呈现
       var self = this
+      // 最低展示 800ms
       setTimeout(function() {
         self._splashMinPassed = true
         self._tryHideSplash()
       }, 800)
-
-      // 最长 5 秒强制关闭,防止 API 卡死导致蒙板不消失
+      // 最多展示 5s
       setTimeout(function() {
-        if (self.splashOverlay) {
-          self._hideSplashOverlay()
-        }
+        if (self.splashOverlay) self._hideSplashOverlay()
       }, 5000)
-    },
+    } else {
+      // 非首次:TabTransition 已在 data() 中为 true,确保首次渲染即出现
+      // 但组件缓存后再次切回时可能已被 _watchPageReady 置为 false,需要重置
+      this.showTabTransition = true
+      this._watchPageReady()
+    }
+
+    // 始终执行初始化,确保登录态变更后及时切换视图
+    this._doInit()
+  },
+  methods: {
     _checkSplashReady() {
       this._splashLoadCount++
       this._tryHideSplash()
@@ -313,6 +305,8 @@ export default {
     _hideSplashOverlay() {
       if (this.splashOverlayFading) return
       this.splashOverlayFading = true
+      // splash 关闭时同时隐藏 TabTransition(防止 splash 结束后闪现过渡页)
+      this.showTabTransition = false
       var self = this
       setTimeout(function() {
         self.splashOverlay = false

+ 0 - 7
cfc-frontend/pages/mind/index.vue

@@ -42,13 +42,6 @@
       :compatibilityMap="compatibilityMapForGraph"
       @memberTap="goMemberDetail" />
 
-    <!-- ===== 重要关系维护 + 关系健康概览 ===== -->
-    <FamilyRelationshipSection
-      :contactList="contactList"
-      :healthAlerts="healthAlerts"
-      :milestones="milestones"
-      :isLoggedIn="isLoggedIn" />
-
     <!-- 登录后:用户快捷入口 -->
     <UserQuickEntry
       v-if="isLoggedIn"

+ 1 - 1
cfc-frontend/pages/profile/profile.vue

@@ -77,7 +77,7 @@ export default {
   data() {
     return {
       shareData: null,
-      showTabTransition: false,
+      showTabTransition: true,
       selectedMascot: '',
       currentMascotName: '小助手'
     }

+ 1 - 13
cfc-frontend/pages/wisdom/index.vue

@@ -26,18 +26,6 @@
       :sandboxData="sandboxData"
       :dualDimension="dualDimension" />
 
-    <!-- ===== 重要关系维护 ===== -->
-    <FamilyRelationshipSection
-      :contactList="contactList"
-      :healthAlerts="healthAlerts"
-      :milestones="milestones"
-      :isLoggedIn="isLoggedIn"
-      @contactClick="onContactClick"
-      @refresh="loadContacts"
-      @import="onShowImport"
-      @interactionLog="goInteractionLog"
-      @questionnaire="goRelationshipQuestionnaire" />
-
     <!-- 4. 认知雷达图(登录后) -->
     <view class="section" v-if="isLoggedIn && cognitiveReport">
       <view class="section-header">
@@ -280,7 +268,7 @@ export default {
   },
   methods: {
     loadSectionConfig: function() {
-      var baseSections = ['func_entries', 'wisdom_tips']
+      var baseSections = ['func_entries', 'wisdom_tips', 'recommended_reading']
       if (!uni.getStorageSync('token')) {
         this.visibleSections = baseSections
         return