Quellcode durchsuchen

sso登录状态下联锁新增后跳转问题

yuhan vor 7 Monaten
Ursprung
Commit
c90ec2c04f
1 geänderte Dateien mit 19 neuen und 3 gelöschten Zeilen
  1. 19 3
      src/permission.js

+ 19 - 3
src/permission.js

@@ -35,7 +35,7 @@ router.beforeEach((to, from, next) => {
   // param.username = cookie.get('WISEUser')
   var loginType = cookie.get('EIName')
   console.log(loginType)
-  if(loginType === 'sso'){
+  if(loginType === 'sso' || !loginType){
     store.dispatch('TzLogin').then(response => {
       // 有EIToken
       // console.log('pppppppppresult', response)
@@ -77,7 +77,23 @@ router.beforeEach((to, from, next) => {
             })
           })
         } else {
-          next()
+          // next()
+          console.log(from, to)
+          // 从添加页面跳转其他页面后需要删除联锁添加页面
+          if(from.path === '/interLock/summary/set' && !from.meta.replace){
+            // 为了解决循环设置了replace
+            from.meta.replace = true
+            next({ ...to, replace: true })
+            from.meta.replace = false
+          } else {
+            next()
+          }
+          // 联锁添加页面刷新--返回联锁总表页面
+          if(from.path === '/' && to.path === '/interLock/summary/set'){
+            next({ path: '/interLock/summary'})
+          } else {
+            next()
+          }
         }
       }
     })
@@ -100,7 +116,7 @@ router.beforeEach((to, from, next) => {
       }
     })
   }
-  if(loginType === 'system' || !loginType){
+  if(loginType === 'system'){
     if (Vue.ls.get(ACCESS_TOKEN)) {
       /* has token */
       if (to.path === '/user/login' || to.path === OAUTH2_LOGIN_PAGE_PATH) {