Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qr-consistency-vue3
Project
Project
Details
Activity
Releases
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
刘怀志
qr-consistency-vue3
Commits
ad87f58c
Commit
ad87f58c
authored
Apr 15, 2025
by
ZhangRunSong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.91isoft.com:90/liuhuaizhi/qr-consistency-vue3
into dev
parents
b27a172c
a07d52ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
39 deletions
+6
-39
Navbar.vue
src/layout/components/Navbar.vue
+4
-3
permission.js
src/permission.js
+2
-36
No files found.
src/layout/components/Navbar.vue
View file @
ad87f58c
...
...
@@ -169,9 +169,10 @@ function logout() {
})
.
then
(()
=>
{
userStore
.
logOut
().
then
(()
=>
{
// 重定向到奇瑞统一身份认证平台的地址
const
finalRedirectUrl
=
'https://iamuat.mychery.com:5443/idp/oauth2/authorize?client_id=FACTS&redirect_uri=http://106.3.99.64:20073/login&response_type=code'
;
window
.
location
.
href
=
finalRedirectUrl
;
// // 重定向到奇瑞统一身份认证平台的地址
// const finalRedirectUrl = 'https://iamuat.mychery.com:5443/idp/oauth2/authorize?client_id=FACTS&redirect_uri=http://106.3.99.64:20073/login&response_type=code';
// window.location.href = finalRedirectUrl;
location
.
href
=
'/index'
})
})
.
catch
(()
=>
{})
...
...
src/permission.js
View file @
ad87f58c
...
...
@@ -8,7 +8,6 @@ import { isRelogin } from '@/utils/request'
import
useUserStore
from
'@/store/modules/user'
import
useSettingsStore
from
'@/store/modules/settings'
import
usePermissionStore
from
'@/store/modules/permission'
import
axios
from
'axios'
;
NProgress
.
configure
({
showSpinner
:
false
})
...
...
@@ -18,11 +17,6 @@ const isWhiteList = (path) => {
return
whiteList
.
some
((
pattern
)
=>
isPathMatch
(
pattern
,
path
))
}
// 统一登录页面路由
const
unifiedLoginRoute
=
'/login'
;
// 后端登录接口
const
loginBySSOApi
=
'/auth/loginBySSO'
;
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
NProgress
.
start
()
if
(
getToken
())
{
...
...
@@ -69,37 +63,9 @@ router.beforeEach((to, from, next) => {
// 没有token
if
(
isWhiteList
(
to
.
path
))
{
// 在免登录白名单,直接进入
if
(
to
.
path
===
unifiedLoginRoute
)
{
// 从URL中截取code参数
const
urlParams
=
new
URLSearchParams
(
window
.
location
.
search
);
const
code
=
urlParams
.
get
(
'code'
);
if
(
code
)
{
// 请求后端/auth/loginBySSO接口
axios
.
post
(
loginBySSOApi
,
{
ticket
:
code
})
.
then
(
response
=>
{
if
(
response
.
data
.
success
)
{
// 登录成功,跳转到首页
next
({
path
:
'/'
});
}
else
{
ElMessage
.
error
(
'登录失败,请重试'
);
next
();
}
})
.
catch
(
error
=>
{
ElMessage
.
error
(
'登录请求出错,请重试'
);
next
();
});
}
else
{
next
();
}
}
else
{
next
()
}
}
else
{
// 跳转到IAM登录页面
const
redirectUri
=
`http://106.3.99.64:20073
${
unifiedLoginRoute
}
`
;
const
iamLoginUrl
=
`https://iamuat.mychery.com:5443/idp/oauth2/authorize?client_id=FACTS&redirect_uri=
${
encodeURIComponent
(
redirectUri
)}
&response_type=code`
;
window
.
location
.
href
=
iamLoginUrl
;
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
// 否则全部重定向到登录页
NProgress
.
done
()
}
}
...
...
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