Browse Source

fix(ui): 健康首页登录浮层升至顶层并打开时隐藏演示雷达

Agnes Agent 3 weeks ago
parent
commit
af58f1a742
2 changed files with 20 additions and 8 deletions
  1. 5 1
      cfc-frontend/components/login-sheet.vue
  2. 15 7
      cfc-frontend/pages/health-main/index.vue

+ 5 - 1
cfc-frontend/components/login-sheet.vue

@@ -123,6 +123,8 @@ export default {
         this.redirectUrl = decodeURIComponent(options.redirect)
       }
       this.visible = true
+      // 通知宿主页面(页面可借此隐藏可能盖住浮层的原生 canvas 等)
+      this.$emit('open')
       this.$nextTick(() => {
         setTimeout(() => {
           this.panelShow = true
@@ -133,6 +135,8 @@ export default {
       this.panelShow = false
       setTimeout(() => {
         this.visible = false
+        // 浮层完全淡出后再通知,避免宿主提前恢复被隐藏的原生 canvas 造成闪烁
+        this.$emit('close')
       }, 250)
     },
     handleOverlayClick() {
@@ -240,7 +244,7 @@ export default {
   right: 0;
   bottom: 0;
   background: rgba(0, 0, 0, 0.5);
-  z-index: 9999;
+  z-index: 99999;
   opacity: 0;
   visibility: hidden;
   transition: opacity 0.25s ease;

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

@@ -1,7 +1,7 @@
 <template>
   <view class="container" :style="{ '--font-scale': fontScale }">
     <!-- 通用登录浮层 -->
-    <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" />
+    <login-sheet ref="loginSheet" @success="onSheetLoginSuccess" @open="onLoginSheetOpen" @close="onLoginSheetClose" />
     <block v-if="!isLoggedIn">
       <!-- 品牌定位语 -->
       <view class="brand-strap"><text class="brand-strap-text">科学管理全家健康数据</text></view>
@@ -33,12 +33,15 @@
         </view>
       </view>
       
-        <RadarChart :dimensions="demoBodyDims" :scores="demoBodyScores" :fillColor="bodyColor" childName="示例" width="560" height="460" />
-        <view class="demo-chart-title-row">
-          <text class="demo-chart-name">🧠 认知雷达</text>
-          <text class="demo-chart-tag">示例</text>
+        <!-- 演示雷达(登录浮层打开时隐藏:原生 canvas 会盖在浮层之上) -->
+        <view v-if="!loginSheetVisible">
+          <RadarChart :dimensions="demoBodyDims" :scores="demoBodyScores" :fillColor="bodyColor" childName="示例" width="560" height="460" />
+          <view class="demo-chart-title-row">
+            <text class="demo-chart-name">🧠 认知雷达</text>
+            <text class="demo-chart-tag">示例</text>
+          </view>
+          <RadarChart :dimensions="demoCogDims" :scores="demoCogScores" :fillColor="wisdomColor" childName="示例" width="560" height="460" />
         </view>
-        <RadarChart :dimensions="demoCogDims" :scores="demoCogScores" :fillColor="wisdomColor" childName="示例" width="560" height="460" />
       <!-- 五维健康体系 -->
       <view class="wuxing-section">
         <view class="wuxing-title">身·心·智·行·富 · 看得见的健康闭环</view>
@@ -302,7 +305,9 @@ export default {
       energySandbox: null,
       wealthDetail: null,
       childrenList: [],
-      relationshipEmpty: false
+      relationshipEmpty: false,
+      // 登录浮层打开标志(打开期间隐藏演示雷达,避免原生 canvas 盖在浮层之上)
+      loginSheetVisible: false
     }
   },
   computed: {
@@ -479,6 +484,9 @@ export default {
     },
     switchTab: function(code) { this.currentTab = code },
     goPage: function(url) { uni.navigateTo({ url: url }) },
+    // 登录浮层打开/关闭(隐藏演示雷达,规避原生 canvas 层级高于浮层的问题)
+    onLoginSheetOpen: function() { this.loginSheetVisible = true },
+    onLoginSheetClose: function() { this.loginSheetVisible = false },
     // 登录成功:刷新登录态数据(镜像 onShow 已登录分支)
     onLoginSuccess: function() {
       // 未登录点击「15题五维健康自检」→ 登录成功后续接跳转调研问卷