Sfoglia il codice sorgente

个人画像-通过账号id控制隐藏和显示

吴朋磊 2 mesi fa
parent
commit
e2b8e9be47
1 ha cambiato i file con 49 aggiunte e 7 eliminazioni
  1. 49 7
      src/views/analysisReport/studentPage/mainPage.vue

+ 49 - 7
src/views/analysisReport/studentPage/mainPage.vue

@@ -38,9 +38,9 @@
 
                                 <button v-if="isShowKnowledgeButtons" class="mm_btn mb_10"
                                     :class="{ active: activeBtn === pathTwo }" @click="toPage(pathTwo)">举一反三</button>
-                                <!-- <button v-if="!isTotalScore" class="mm_btn mb_10"
+                                <button v-if="!isTotalScore && schoolId == '520929546006958081'" class="mm_btn mb_10"
                                     :class="{ active: activeBtn === pathThree }"
-                                    @click="toPage(pathThree)">个人画像</button> -->
+                                    @click="toPage(pathThree)">个人画像</button>
                             </div>
 
                             <div class="right">
@@ -90,10 +90,28 @@ export default {
         isTotalScore() {
             return this.$store.state.report.isTotalScore;
         },
-        // 筛选数据,不再在个人画像页面隐藏总分选项
+        // 动态过滤筛选数据,在个人画像页面隐藏总分选项
         filteredFilterData() {
-            // 返回原始数据,不在个人画像页面隐藏总分选项
-            return this.filterData;
+            // 检查当前是否在个人画像页面
+            const isPersonalProfilePage = this.$route.path === '/studentAnalysisReport/reportDetails/personalProfile';
+            
+            if (!isPersonalProfilePage) {
+                // 非个人画像页面,返回原始数据
+                return this.filterData;
+            }
+            
+            // 深拷贝原始数据,避免直接修改
+            const updatedFilterData = JSON.parse(JSON.stringify(this.filterData));
+            
+            // 遍历筛选数据,找到科目名称筛选项
+            updatedFilterData.forEach(filterItem => {
+                if (filterItem.type === 'subjectName') {
+                    // 过滤掉总分选项(isTotal为1或subjectGroupType为1的选项)
+                    filterItem.list = filterItem.list.filter(item => item.isTotal !== 1 && item.subjectGroupType !== 1);
+                }
+            });
+            
+            return updatedFilterData;
         },
         canBtnClick() {
             return this.$store.state.question.canDownloanBtnClick;
@@ -120,6 +138,7 @@ export default {
             pathThree: '/studentAnalysisReport/reportDetails/personalProfile',//个人画像
             isLianXiao: false,//是否联校
             stuPdfLoading: false,
+            schoolId: this.$store.state.user.userInfo.id,
         };
     },
 
@@ -264,9 +283,32 @@ export default {
             this.stuPdfLoading = false;
         },
 
-        // 处理筛选数据更新
+        // 处理筛选数据更新,在个人画像页面隐藏总分选项
         handleFilterDataUpdate() {
-            // 不再在个人画像页面隐藏总分选项
+            // 检查当前是否在个人画像页面
+            const isPersonalProfilePage = this.$route.path === '/studentAnalysisReport/reportDetails/personalProfile';
+            
+            if (isPersonalProfilePage) {
+                // 深拷贝原始数据,避免直接修改props
+                const updatedFilterData = JSON.parse(JSON.stringify(this.filterData));
+                
+                // 遍历筛选数据,找到科目名称筛选项
+                updatedFilterData.forEach((filterItem, index) => {
+                    if (filterItem.type === 'subjectName') {
+                        // 过滤掉总分选项(isTotal为1的选项)
+                        const nonTotalItems = filterItem.list.filter(item => item.isTotal !== 1 && item.subjectGroupType !== 1);
+                        
+                        // 检查当前选中的是否是总分选项
+                        const currentSelected = filterItem.list.find(item => item.value === filterItem.value);
+                        const isCurrentTotal = currentSelected && (currentSelected.isTotal === 1 || currentSelected.subjectGroupType === 1);
+                        
+                        // 如果当前选中的是总分选项且有其他选项,切换到第一个非总分选项
+                        if (isCurrentTotal && nonTotalItems.length > 0) {
+                            this.ChangeFilters({ index, value: nonTotalItems[0].value });
+                        }
+                    }
+                });
+            }
         },
     },
     watch: {