Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
dsk-cr20g
Commits
d519fa32
Commit
d519fa32
authored
Aug 22, 2024
by
Star970321
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
077f62f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
permission.js
dsk-operate-ui/src/permission.js
+15
-3
No files found.
dsk-operate-ui/src/permission.js
View file @
d519fa32
...
...
@@ -3,18 +3,27 @@ import store from './store';
import
{
Message
}
from
'element-ui'
;
import
NProgress
from
'nprogress'
;
import
'nprogress/nprogress.css'
;
import
{
getToken
,
getThirdPlatform
}
from
'@/utils/auth'
;
import
{
getToken
,
getThirdPlatform
,
checkThirdPlatformChange
,
removeThirdPlatform
,
setThirdPlatform
}
from
'@/utils/auth'
;
import
{
isRelogin
}
from
'@/utils/request'
;
NProgress
.
configure
({
showSpinner
:
false
});
const
whiteList
=
[
'/login'
,
"/404"
,
"/401"
];
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
// 存在platFormkey但是 已经更换 或本地session不存在 已经存在其它token 重写拉取所有信息
const
onlyUrlKey
=
getThirdPlatform
(
true
);
if
(
onlyUrlKey
&&
checkThirdPlatformChange
(
onlyUrlKey
))
{
// 前端退出登录
await
store
.
dispatch
(
"FedLogOut"
);
removeThirdPlatform
();
setThirdPlatform
(
onlyUrlKey
);
}
// 默认跳转路径 本系统跳转首页,第三方跳转宏观市场
const
platFormKey
=
getThirdPlatform
();
let
defaultRedirectPath
=
platFormKey
?
"/macro/nationalEconomies"
:
"/"
;
NProgress
.
start
();
// 正常登录 不带第三方
if
(
getToken
())
{
// tab页签title
const
{
tabTitle
,
url
}
=
to
.
query
;
...
...
@@ -29,7 +38,10 @@ router.beforeEach((to, from, next) => {
if
(
!
store
.
state
?.
user
?.
userId
&&
!
store
.
state
?.
user
?.
roles
?.
length
)
{
isRelogin
.
show
=
true
;
// 判断当前用户是否已拉取完user_info信息
store
.
dispatch
(
'GetInfo'
).
then
(()
=>
{
store
.
dispatch
(
'GetInfo'
).
then
(
async
(
res
)
=>
{
if
(
res
?.
data
?.
isThirdPlatformLogin
&&
!
platFormKey
)
{
throw
new
Error
(
"第三方登录重置,请重新使用platFormKey进入"
);
}
isRelogin
.
show
=
false
;
store
.
dispatch
(
'GenerateRoutes'
).
then
(
accessRoutes
=>
{
// 根据roles权限生成可访问的路由表
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment