Просмотр исходного кода

fix(action): DimensionArticles & FamilyRelationGraph show empty state

- DimensionArticles: always render section, show 暂无阅读推荐 when empty
- FamilyRelationGraph: add 暂无其他家庭成员 for 1-member case
- action/index.vue: remove outer v-if on FamilyRelationGraph so its
  own empty state renders when no members
User 4 месяцев назад
Родитель
Сommit
e1171e1910

+ 14 - 2
cfc-frontend/components/DimensionArticles.vue

@@ -1,8 +1,11 @@
 <template>
-  <view class="section" v-if="displayArticles && displayArticles.length > 0">
+  <view class="section">
     <view class="section-header">
       <text class="section-title">推荐阅读</text>
-      <text class="section-more" v-if="displayArticles.length > 0" @click="$emit('moreArticles')">更多 ›</text>
+      <text class="section-more" v-if="displayArticles && displayArticles.length > 0" @click="$emit('moreArticles')">更多 ›</text>
+    </view>
+    <view v-if="!displayArticles || displayArticles.length === 0" class="empty-state">
+      <text class="empty-tip">{{ isLoggedIn ? '暂无阅读推荐' : '登录后查看更多文章' }}</text>
     </view>
     <view class="article-list">
       <view class="article-card" v-for="article in displayArticles" :key="article.id" @click="$emit('articleClick', article)">
@@ -136,4 +139,13 @@ export default {
   color: #bbb;
   margin-left: auto;
 }
+.empty-state {
+  display: flex;
+  justify-content: center;
+  padding: 40rpx 0;
+}
+.empty-tip {
+  font-size: 24rpx;
+  color: #999;
+}
 </style>

+ 4 - 0
cfc-frontend/components/FamilyRelationGraph.vue

@@ -91,6 +91,10 @@
       </template>
     </view>
   </view>
+  <!-- 1人空状态(仅自己) -->
+  <view class="family-relation-graph graph-empty" v-else-if="members && members.length === 1">
+    <text class="empty-text">暂无其他家庭成员</text>
+  </view>
   <!-- 0人空状态 -->
   <view class="family-relation-graph graph-empty" v-else-if="members && members.length === 0">
     <text class="empty-text">暂无家庭成员</text>

+ 1 - 1
cfc-frontend/pages/action/index.vue

@@ -28,7 +28,7 @@
 
     <!-- 关系图谱(登录后可见) — 家庭关系网络 -->
     <FamilyRelationGraph
-      v-if="isLoggedIn && familyMembersVisible.length > 0"
+      v-if="isLoggedIn"
       dimensionCode="action"
       :selfId="currentChildId"
       :members="familyMembersVisible"