Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 296d31f0
authored
Mar 27, 2026
by
yancanhua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 页面路由优化
1 parent
7113ab52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
6 deletions
aus-front/admin/src/App.vue
aus-front/admin/src/common/CustomTokenInterceptor.ts
aus-front/admin/src/App.vue
View file @
296d31f
...
@@ -156,6 +156,51 @@ export default class App extends Vue {
...
@@ -156,6 +156,51 @@ export default class App extends Vue {
this
.
loginUserName
=
this
.
$auth
.
getAuthentication
().
fullName
;
this
.
loginUserName
=
this
.
$auth
.
getAuthentication
().
fullName
;
// 底部菜单权限
// 底部菜单权限
this
.
privileges
=
this
.
getPrivileges
;
this
.
privileges
=
this
.
getPrivileges
;
// 初始化菜单选中状态
this
.
initMenuSelected
();
}
mounted
():
void
{
// 监听路由变化
this
.
$router
.
afterEach
(()
=>
{
this
.
initMenuSelected
();
});
}
/**
* 初始化菜单选中状态
*/
initMenuSelected
():
void
{
const
currentPath
=
this
.
$route
.
path
;
const
menuKey
=
this
.
findMenuKeyByPath
(
this
.
privileges
,
currentPath
);
if
(
menuKey
)
{
this
.
selectedKeys
=
[
menuKey
];
}
else
if
(
currentPath
===
'/dashboard'
)
{
this
.
selectedKeys
=
[
'dashboard'
];
}
else
if
(
currentPath
===
'/security/profile'
)
{
this
.
selectedKeys
=
[
'profile'
];
}
}
/**
* 根据路由路径查找对应的菜单键
* @param privileges 权限菜单列表
* @param path 当前路由路径
* @returns 对应的菜单键
*/
findMenuKeyByPath
(
privileges
:
any
[],
path
:
string
):
string
|
null
{
for
(
const
item
of
privileges
)
{
if
(
item
.
value
===
path
)
{
return
item
.
code
;
}
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
const
foundKey
=
this
.
findMenuKeyByPath
(
item
.
children
,
path
);
if
(
foundKey
)
{
return
foundKey
;
}
}
}
return
null
;
}
}
logout
()
{
logout
()
{
...
...
aus-front/admin/src/common/CustomTokenInterceptor.ts
View file @
296d31f
...
@@ -67,16 +67,16 @@ export class CustomTokenInterceptor {
...
@@ -67,16 +67,16 @@ export class CustomTokenInterceptor {
if
(
error
)
{
if
(
error
)
{
// 请求已发出,但是不在2xx的范围
// 请求已发出,但是不在2xx的范围
this
.
handleError
(
error
);
this
.
handleError
(
error
);
if
(
error
?.
config
?.
url
==
'security/getUserAuthentication'
)
{
if
(
error
?.
config
?.
url
==
'security/getUserAuthentication'
)
{
console
.
log
(
'token过期了重新登录'
,
error
);
console
.
log
(
'token过期了重新登录'
,
error
);
//获取报错端口
//获取报错端口
const
windowOrigin
=
window
.
location
.
origin
;
const
windowOrigin
=
window
.
location
.
origin
;
if
(
windowOrigin
==
"https://aus.test.glsx.com.cn"
)
{
if
(
windowOrigin
==
"https://aus.test.glsx.com.cn"
)
{
window
.
location
.
href
=
"https://aus.test.glsx.com.cn/admin/login"
;
window
.
location
.
href
=
"https://aus.test.glsx.com.cn/admin/login"
;
}
else
if
(
windowOrigin
==
"https://aus.glsx.com.cn"
)
{
}
else
if
(
windowOrigin
==
"https://aus.glsx.com.cn"
)
{
window
.
location
.
href
=
"https://aus.glsx.com.cn/admin/login"
;
window
.
location
.
href
=
"https://aus.glsx.com.cn/admin/login"
;
}
else
{
}
else
{
console
.
log
(
'windowOrigin'
,
windowOrigin
);
console
.
log
(
'windowOrigin'
,
windowOrigin
);
}
}
}
}
return
Promise
.
reject
(
error
.
response
);
return
Promise
.
reject
(
error
.
response
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment