Browse Source

成绩查询左侧菜单刷新定位选中样式

liurongli 1 month ago
parent
commit
7ffba71dd2
3 changed files with 17 additions and 2 deletions
  1. 10 1
      src/store/analysis.ts
  2. 1 0
      src/views/analysis/score.vue
  3. 6 1
      src/views/exam/components/stepItem.vue

+ 10 - 1
src/store/analysis.ts

@@ -54,12 +54,21 @@ export const useAnalysisStore = defineStore("analysis", () => {
      // 同步存储到 localStorage,确保持久化
     localStorage.setItem("analysisExamInfo", JSON.stringify(info));
   }
+  const childMenuPath = ref<string>(localStorage.getItem("childMenuPath") || '')//子级菜单路径
+  // 设置子级菜单路径
+  const setChildMenuPath = (info: string) => {
+    childMenuPath.value = info;
+    // 同步存储到 localStorage,确保持久化
+    localStorage.setItem("childMenuPath", info);
+  }
   return {
     filtersData,
     filterObject,
     analysisExamInfo,
+    childMenuPath,
     setFiltersData,
     setFilterObject,
-    setAnalysisExamInfo
+    setAnalysisExamInfo,
+    setChildMenuPath
   };
 });

+ 1 - 0
src/views/analysis/score.vue

@@ -4,6 +4,7 @@
     ref="reportModuleRef"
     :showTitle="false"
     :showDescribe="false"
+    :showPrintBtn="false"
     tableOrChart="table"
     :currentPage="state.pageInfo.pageNum"
     :pageSize="state.pageInfo.pageSize"

+ 6 - 1
src/views/exam/components/stepItem.vue

@@ -25,14 +25,18 @@
 import { ref, computed, onMounted, watch } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
 import { useExamStore } from '@/store/exam'
+import { useAnalysisStore } from '@/store/analysis'
 
 const examStore = useExamStore()
+const analysisStore = useAnalysisStore()
+const getChildMenuPath = computed(() => analysisStore?.childMenuPath || '');
+console.log(getChildMenuPath.value,2333)
 // --- 响应式数据 ---
 const route = useRoute()//读取当前路由对象
 const router = useRouter()//访问全局路由方法
 
 const stepOnIndex = ref<number>(0)//步骤索引
-const childMenuPath = ref<string>('')//子级菜单路径
+const childMenuPath = ref<string>(getChildMenuPath.value)//子级菜单路径
 const menuListRaw = ref<any[]>([]) // 用于存储计算后的菜单列表,以便 watch 能检测到变化(如果需要)
 
 // --- 计算属性 ---
@@ -184,6 +188,7 @@ const MenuSelect = (menu: any) => {
   console.log('选择的子菜单', menu)
   stepOnIndex.value = 2;
   childMenuPath.value = menu.path;
+  analysisStore.setChildMenuPath(menu.path);
   // 执行路由跳转
   router.push(`/exam/analysis/${menu.path}`)
 }