Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
hrs_app_h5
/
bill
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
10ceb282
authored
May 09, 2020
by
展昭
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://gitlab.corp.qinqinxiaobao.com:9880/hrs_app_h5/bill
parents
af812148
2087a7e9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
src/router/index.js
src/router/index.js
View file @
10ceb282
...
...
@@ -67,8 +67,9 @@ router.beforeEach((to, from, next) => {
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
const
authcode
=
to
.
query
.
authCode
||
to
.
query
.
authcode
;
const
appid
=
to
.
query
.
appId
||
to
.
query
.
appid
;
const
userId
=
to
.
query
.
userid
||
to
.
query
.
userId
||
0
;
if
(
!!
authcode
&&
!!
appid
)
{
localStorage
.
setItem
(
'appid'
,
appid
);
var
toPath
=
to
.
path
||
"/"
;
for
(
let
key
in
to
.
query
)
{
if
(
key
==
'authcode'
)
{
...
...
@@ -77,16 +78,22 @@ router.beforeEach((to, from, next) => {
toPath
+=
toPath
.
indexOf
(
"?"
)
>
-
1
?
"&"
:
"?"
;
toPath
+=
`
${
key
}
=
${
to
.
query
[
key
]}
`
;
}
const
storeAppId
=
localStorage
.
getItem
(
'appid'
);
store
.
dispatch
(
"getOidcUser"
).
then
(
oidcUser
=>
{
if
(
oidcUser
)
{
if
(
storeAppId
!=
appid
){
localStorage
.
setItem
(
'appid'
,
appid
);
setAutoLogin
({
autoCode
:
authcode
,
redirectPath
:
toPath
})
store
.
dispatch
(
"signOutOidc"
)
}
else
{
//如果登录用户与当前登录用户不匹配,则保存登录参数,退出
if
(
oidcUser
.
profile
.
sub
!=
userId
)
{
if
(
userId
>
0
&&
oidcUser
.
profile
.
sub
!=
userId
)
{
setAutoLogin
({
autoCode
:
authcode
,
redirectPath
:
toPath
})
store
.
dispatch
(
"signOutOidc"
)
}
else
{
next
()
}
}
}
else
{
autoLogin
({
autoCode
:
authcode
,
redirectPath
:
toPath
})
}
...
...
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