Tang 4 жил өмнө
parent
commit
55cafb82c5

+ 2 - 2
src/layout/permission.js

@@ -65,8 +65,8 @@ router.beforeEach((to, from, next) => {
             // 加载进度条end
         } else {
             let TenantId = 0
-            if(router.history.pending){
-                TenantId = router.history.pending.query.TenantId
+            if(router.history.current){
+                TenantId = router.history.current.query.TenantId
             }
             localStorage.clear()
             store.state.tabberLists = []

+ 7 - 2
src/utils/request.js

@@ -33,7 +33,12 @@ service.interceptors.request.use(
         } else if (router.history.current !== null && router.history.current.query.TenantId) {
             config.headers.TenantId = router.history.current.query.TenantId
             sessionStorage.TenantId = router.history.current.query.TenantId;
-        }else{
+        } else {
+            if (router.history._startLocation.indexOf("?TenantId=") !== -1) {
+                var a = router.history._startLocation.slice(router.history._startLocation.indexOf("=") +1, router.history._startLocation.indexOf("?TenantId=").length)
+                config.headers.TenantId = a
+                sessionStorage.TenantId = a
+            }
             console.log('router.history:',router.history)
             console.log('sessionStorage.TenantId:',sessionStorage.TenantId)
         }
@@ -63,7 +68,7 @@ service.interceptors.response.use(
                     Message.error(response.data.msg)
                     store.dispatch('outLogin').then(() => {
                         delCookie('token')
-                        if(router.history.current.name == "login"){
+                        if (router.history.current.name == "login") {
                             return
                         }
                         setTimeout(() => {

BIN
zz-admin.zip