Browse Source

代码修复

李宇 3 tháng trước cách đây
mục cha
commit
7767f33638

+ 7 - 7
cfc-backend/src/test/java/com/etotem/cfc/config/FamilyAccessInterceptorTest.java

@@ -36,7 +36,7 @@ public class FamilyAccessInterceptorTest {
     }
 
     @Test
-    public void testChildAccessValid() {
+    public void testChildAccessValid() throws Exception {
         Long userId = 1L;
         Long familyId = 1L;
         User user = createMockUser(userId, familyId, "child");
@@ -54,7 +54,7 @@ public class FamilyAccessInterceptorTest {
     }
 
     @Test
-    public void testChildAccessInvalid() {
+    public void testChildAccessInvalid() throws Exception {
         Long userId = 1L;
         Long userFamilyId = 1L;
         Long requestedFamilyId = 2L;
@@ -74,7 +74,7 @@ public class FamilyAccessInterceptorTest {
     }
 
     @Test
-    public void testTeacherAccessValid() {
+    public void testTeacherAccessValid() throws Exception {
         Long userId = 2L;
         Long teacherFamilyId = 5L;
         Long assignedFamilyId = 5L;
@@ -92,7 +92,7 @@ public class FamilyAccessInterceptorTest {
     }
 
     @Test
-    public void testMissingFamilyId() {
+    public void testMissingFamilyId() throws Exception {
         Long userId = 1L;
         Long familyId = 1L;
         User user = createMockUser(userId, familyId, "child");
@@ -109,7 +109,7 @@ public class FamilyAccessInterceptorTest {
     }
 
     @Test
-    public void testAdminPath() {
+    public void testAdminPath() throws Exception {
         Long userId = 1L;
         User user = createMockUser(userId, 1L, "admin");
         when(userService.getEffectiveFamilyIds(userId)).thenReturn(Collections.singleton(1L));
@@ -126,7 +126,7 @@ public class FamilyAccessInterceptorTest {
     }
 
     @Test
-    public void testNoUserId() {
+    public void testNoUserId() throws Exception {
         MockHttpServletRequest request = new MockHttpServletRequest();
         request.setMethod("POST");
         request.setRequestURI("/api/dan-assessment/materials");
@@ -138,7 +138,7 @@ public class FamilyAccessInterceptorTest {
     }
 
     @Test
-    public void testEmptyEffectiveFamilyIds() {
+    public void testEmptyEffectiveFamilyIds() throws Exception {
         Long userId = 1L;
         User user = createMockUser(userId, null, "parent");
         when(userService.getEffectiveFamilyIds(userId)).thenReturn(Collections.emptySet());

+ 24 - 6
cfc-frontend/components/WealthSubScores.vue

@@ -8,17 +8,17 @@
     <view class="sub-grid" v-if="isParent">
       <view class="sub-item">
         <view class="sub-label">金钱收入</view>
-        <view class="sub-value" :class="getScoreClass(income)">{{ income }}</view>
+        <view class="sub-value" :class="incomeClass">{{ income }}</view>
         <view class="sub-weight">权重 50%</view>
       </view>
       <view class="sub-item">
         <view class="sub-label">社会成就</view>
-        <view class="sub-value" :class="getScoreClass(achievement)">{{ achievement }}</view>
+        <view class="sub-value" :class="achievementClass">{{ achievement }}</view>
         <view class="sub-weight">权重 30%</view>
       </view>
       <view class="sub-item">
         <view class="sub-label">资源网络</view>
-        <view class="sub-value" :class="getScoreClass(network)">{{ network }}</view>
+        <view class="sub-value" :class="networkClass">{{ network }}</view>
         <view class="sub-weight">权重 20%</view>
       </view>
     </view>
@@ -27,17 +27,17 @@
     <view class="sub-grid" v-else>
       <view class="sub-item">
         <view class="sub-label">学业成绩</view>
-        <view class="sub-value" :class="getScoreClass(education)">{{ education }}</view>
+        <view class="sub-value" :class="educationClass">{{ education }}</view>
         <view class="sub-weight">权重 30%</view>
       </view>
       <view class="sub-item">
         <view class="sub-label">社交筹码</view>
-        <view class="sub-value" :class="getScoreClass(social)">{{ social }}</view>
+        <view class="sub-value" :class="socialClass">{{ social }}</view>
         <view class="sub-weight">权重 20%</view>
       </view>
       <view class="sub-item">
         <view class="sub-label">规则博弈</view>
-        <view class="sub-value" :class="getScoreClass(points)">{{ points }}</view>
+        <view class="sub-value" :class="pointsClass">{{ points }}</view>
         <view class="sub-weight">权重 50%</view>
       </view>
     </view>
@@ -80,6 +80,24 @@ export default {
   computed: {
     isParent() {
       return this.role === 'parent'
+    },
+    incomeClass() {
+      return this.getScoreClass(this.income)
+    },
+    achievementClass() {
+      return this.getScoreClass(this.achievement)
+    },
+    networkClass() {
+      return this.getScoreClass(this.network)
+    },
+    educationClass() {
+      return this.getScoreClass(this.education)
+    },
+    socialClass() {
+      return this.getScoreClass(this.social)
+    },
+    pointsClass() {
+      return this.getScoreClass(this.points)
     }
   },
   methods: {