Browse Source

单点登录修改

sunlupeng 1 year ago
parent
commit
53da40293c
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/permission.js

+ 7 - 1
src/permission.js

@@ -3,7 +3,7 @@ import store from './store'
 import { Message } from 'element-ui'
 import NProgress from 'nprogress' // progress bar
 import 'nprogress/nprogress.css'// progress bar style
-import { getToken } from '@/utils/auth' // getToken from cookie
+import { getToken,setToken } from '@/utils/auth' // getToken from cookie
 
 NProgress.configure({ showSpinner: false })// NProgress Configuration
 
@@ -60,7 +60,13 @@ const myRoles = [
 ]
 
 router.beforeEach((to, from, next) => {
+  debugger
   NProgress.start() // start progress bar
+  const path = to.path;
+  const token = to.query.Authorization
+  if (path.indexOf('auth') != -1 && token) { 
+    setToken(token);
+  }
   if (getToken()) { // determine if there has token
     /* has token*/
     if (to.path === '/login') {