Переглянути джерело

修改刷新页面不切换路由

liurongli 5 місяців тому
батько
коміт
6de844becb
2 змінених файлів з 4 додано та 0 видалено
  1. 1 0
      src/views/layout/components/Header.vue
  2. 3 0
      src/views/login/login.vue

+ 1 - 0
src/views/layout/components/Header.vue

@@ -259,6 +259,7 @@ export default {
     },
     activeMenu() {
       const path = this.$route.path;
+      sessionStorage.setItem('student_currentPath', path);//当前页面路由
       // 按优先级匹配
       if (path === '/studentAnalysisReport/list') {
         sessionStorage.setItem('schoolType', 1);//单校

+ 3 - 0
src/views/login/login.vue

@@ -68,6 +68,9 @@ export default {
           return
         }
         if(getToken() && schoolType){
+          const currentPath = sessionStorage.getItem('student_currentPath');//获取当前进入的路由
+          const directUrl = currentPath?currentPath:'/studentAnalysisReport/list';
+          this.$router.push({ path: directUrl })
           return
         }
         if (event.data.type === 'STU_TOKEN') {