浏览代码

刷新进入登录页bug修复

ming 3 年之前
父节点
当前提交
46a07f1a1f
共有 3 个文件被更改,包括 12 次插入14 次删除
  1. 1 0
      src/store/index.js
  2. 1 0
      src/store/modules/user.js
  3. 10 14
      src/vab/plugins/permissions.js

+ 1 - 0
src/store/index.js

@@ -37,6 +37,7 @@ export default createStore({
         largeScreenUrl: '',
         middleStatus: 1,
         homePageUrl: '',
+        firstMiddleState: false,
 
         Time_Data: [], //公共api请求参数->Time_Data
         timearr: [], //公共处理开始时间和结束时间中的时间段天数 值存储

+ 1 - 0
src/store/modules/user.js

@@ -93,6 +93,7 @@ const actions = {
                     message: `登录成功`,
                     description: `${thisTime}!`,
                 })
+                store.state.firstMiddleState = true
 
             }
 

+ 10 - 14
src/vab/plugins/permissions.js

@@ -47,10 +47,8 @@ router.beforeEach(async(to, from, next) => {
                 next()
             } else {
 
-
                 store.commit('getMiddleConfig')
 
-
                 try {
                     if (loginInterception) {
                         await store.dispatch('user/getUserInfo')
@@ -74,23 +72,21 @@ router.beforeEach(async(to, from, next) => {
                     console.log(accessRoutes)
 
                     // alert('判断是否显示中间页的middleStatus值' + store.state.middleStatus)
-                    var flag = false
 
-                    // alert(flag)
-
-                    if (store.state.middleStatus == 1 && flag == false) {
+                    // alert(store.state.firstMiddleState)
+                    if (store.state.middleStatus == 1 && store.state.firstMiddleState == true) {
                         next('/middle')
-                        flag = true
                     } else {
+                        // alert(store.state.homePageUrl)
+                        next(accessRoutes[0].children[0].path)
+                            // if (store.state.homePageUrl) {
+                            //     var pathUrl = (store.state.homePageUrl).slice(8);
+                            //     next(pathUrl)
 
-                        if (store.state.homePageUrl) {
-                            var pathUrl = (store.state.homePageUrl).slice(8);
-                            next(pathUrl)
-
-                        } else {
-                            next(accessRoutes[0].children[0].path)
+                        // } else {
+                        //     next(accessRoutes[0].children[0].path)
 
-                        }
+                        // }
 
                     }