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

fix(wisdom): 拆分 v-if 条件提高可读性

Xiaogang Liao 2 месяцев назад
Родитель
Сommit
d71f7c73c3
2 измененных файлов с 38 добавлено и 4 удалено
  1. 36 2
      cfc-frontend/pages/wisdom/index.vue
  2. 2 2
      cfc-web/src/views/admin/ArticleManage.vue

+ 36 - 2
cfc-frontend/pages/wisdom/index.vue

@@ -27,12 +27,13 @@
       :dualDimension="dualDimension" />
       :dualDimension="dualDimension" />
 
 
     <!-- 4. 认知雷达图(登录后) -->
     <!-- 4. 认知雷达图(登录后) -->
-    <view class="section" v-if="isLoggedIn && cognitiveReport">
+    <view class="section" v-if="isLoggedIn">
       <view class="section-header">
       <view class="section-header">
         <text class="section-title">认知雷达</text>
         <text class="section-title">认知雷达</text>
         <text class="section-more" @click="goCognitiveReport">查看详情 ›</text>
         <text class="section-more" @click="goCognitiveReport">查看详情 ›</text>
       </view>
       </view>
       <RadarChart
       <RadarChart
+        v-if="cognitiveReport"
         :dimensions="cognitiveDimensions"
         :dimensions="cognitiveDimensions"
         :scores="cognitiveScores"
         :scores="cognitiveScores"
         :avg-scores="cognitiveAvgScores"
         :avg-scores="cognitiveAvgScores"
@@ -40,6 +41,11 @@
         fillColor="#6366F1"
         fillColor="#6366F1"
         gridColor="#E0E7FF"
         gridColor="#E0E7FF"
         labelColor="#3730A3" />
         labelColor="#3730A3" />
+      <view v-else class="no-report-hint" @click="goAssessment">
+        <text class="no-report-icon">📊</text>
+        <text class="no-report-text">完成认知测评后查看六维能力雷达图</text>
+        <text class="no-report-action">点击预约测评 ›</text>
+      </view>
     </view>
     </view>
 
 
     <!-- 5. 家庭成员关系图谱(登录后) -->
     <!-- 5. 家庭成员关系图谱(登录后) -->
@@ -330,7 +336,7 @@ export default {
     },
     },
     loadCognitiveReport: function() {
     loadCognitiveReport: function() {
       var self = this
       var self = this
-      var childId = this.activeChildId
+      var childId = self.activeChildId
       if (!childId) return
       if (!childId) return
       getAssessmentLatestResult(childId).then(function(res) {
       getAssessmentLatestResult(childId).then(function(res) {
         if (res.code === 200 && res.data) {
         if (res.code === 200 && res.data) {
@@ -633,6 +639,34 @@ export default {
   color: #999;
   color: #999;
 }
 }
 
 
+/* ===== 认知雷达无数据提示 ===== */
+.no-report-hint {
+  background: #fff;
+  border-radius: 20rpx;
+  padding: 48rpx 30rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06);
+}
+
+.no-report-icon {
+  font-size: 64rpx;
+  margin-bottom: 16rpx;
+}
+
+.no-report-text {
+  font-size: 26rpx;
+  color: #666;
+  margin-bottom: 20rpx;
+}
+
+.no-report-action {
+  font-size: 24rpx;
+  color: #6366F1;
+  font-weight: 500;
+}
+
 /* ===== 智慧小贴士 ===== */
 /* ===== 智慧小贴士 ===== */
 .tips-list {
 .tips-list {
   display: flex;
   display: flex;

+ 2 - 2
cfc-web/src/views/admin/ArticleManage.vue

@@ -201,8 +201,8 @@
               </el-dropdown>
               </el-dropdown>
             </template>
             </template>
           </template>
           </template>
-        </el-table-column>
-        </el-table></div>
+        </el-table>
+        </div>
       </div>
       </div>
 
 
       <div class="pagination-wrap">
       <div class="pagination-wrap">