Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
imac-vue
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
jinhui.wang
2022-03-24 13:59:00 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a5b9aff53e7b25f599486511cb0192edec8c8fe1
a5b9aff5
1 parent
6032ac51
路由更新
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
19 deletions
src/permission.js
src/permission.js
View file @
a5b9aff
import
router
from
'./router'
import
store
from
'./store'
import
{
Message
}
from
'element-ui'
import
{
getToken
,
setToken
}
from
'@/utils/auth'
import
{
getToken
}
from
'@/utils/auth'
const
whiteList
=
[
'/login'
,
'/auth-redirect'
,
'/bind'
,
'/register'
]
// window.location.href = "https://test.secure.fedex.com/logout";//wsso系统跳转
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
if
(
getToken
())
{
/* has token*/
...
...
@@ -21,32 +21,23 @@ router.beforeEach((to, from, next) => {
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成
})
}).
catch
(
err
=>
{
store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
Message
.
error
(
err
)
store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
// next({ path: '/' })
window
.
location
.
href
=
"https://testsso.ute.apac.fedex.com/logout"
;
//wsso系统跳转
})
next
({
path
:
'/'
})
})
})
}
else
{
next
()
}
}
}
else
{
// 没有token
//wsso登录时对后端重定向带来的token进行记录
let
token
=
location
.
search
.
split
(
"token="
)[
1
]
if
(
token
!=
undefined
&&
token
!=
''
&&
token
!=
null
){
setToken
(
token
)
next
({
path
:
'/'
})
}
else
{
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
// 在免登录白名单,直接进入
next
()
}
else
{
window
.
location
.
href
=
"https://testsso.ute.apac.fedex.com/logout"
;
//wsso系统跳转
}
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
// 在免登录白名单,直接进入
next
()
}
else
{
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
// 否则全部重定向到登录页
}
}
})
...
...
Please
register
or
login
to post a comment