Showing
1 changed file
with
5 additions
and
14 deletions
| 1 | import router from './router' | 1 | import router from './router' |
| 2 | import store from './store' | 2 | import store from './store' |
| 3 | import { Message } from 'element-ui' | 3 | import { Message } from 'element-ui' |
| 4 | -import { getToken,setToken } from '@/utils/auth' | 4 | +import { getToken } from '@/utils/auth' |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] | 7 | const whiteList = ['/login', '/auth-redirect', '/bind', '/register'] |
| 8 | - | 8 | +// window.location.href = "https://test.secure.fedex.com/logout";//wsso系统跳转 |
| 9 | router.beforeEach((to, from, next) => { | 9 | router.beforeEach((to, from, next) => { |
| 10 | if (getToken()) { | 10 | if (getToken()) { |
| 11 | /* has token*/ | 11 | /* has token*/ |
| ... | @@ -21,10 +21,9 @@ router.beforeEach((to, from, next) => { | ... | @@ -21,10 +21,9 @@ router.beforeEach((to, from, next) => { |
| 21 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 | 21 | next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 |
| 22 | }) | 22 | }) |
| 23 | }).catch(err => { | 23 | }).catch(err => { |
| 24 | - Message.error(err) | ||
| 25 | store.dispatch('LogOut').then(() => { | 24 | store.dispatch('LogOut').then(() => { |
| 26 | - // next({ path: '/' }) | 25 | + Message.error(err) |
| 27 | - window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转 | 26 | + next({ path: '/' }) |
| 28 | }) | 27 | }) |
| 29 | }) | 28 | }) |
| 30 | } else { | 29 | } else { |
| ... | @@ -33,20 +32,12 @@ router.beforeEach((to, from, next) => { | ... | @@ -33,20 +32,12 @@ router.beforeEach((to, from, next) => { |
| 33 | } | 32 | } |
| 34 | } else { | 33 | } else { |
| 35 | // 没有token | 34 | // 没有token |
| 36 | - //wsso登录时对后端重定向带来的token进行记录 | ||
| 37 | - let token = location.search.split("token=")[1] | ||
| 38 | - if(token != undefined && token != '' && token != null){ | ||
| 39 | - setToken(token) | ||
| 40 | - next({ path: '/' }) | ||
| 41 | - }else{ | ||
| 42 | if (whiteList.indexOf(to.path) !== -1) { | 35 | if (whiteList.indexOf(to.path) !== -1) { |
| 43 | // 在免登录白名单,直接进入 | 36 | // 在免登录白名单,直接进入 |
| 44 | next() | 37 | next() |
| 45 | } else { | 38 | } else { |
| 46 | - window.location.href = "https://testsso.ute.apac.fedex.com/logout";//wsso系统跳转 | 39 | + next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 |
| 47 | - } | ||
| 48 | } | 40 | } |
| 49 | - | ||
| 50 | } | 41 | } |
| 51 | }) | 42 | }) |
| 52 | 43 | ... | ... |
-
Please register or login to post a comment