Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
罗鑫霖
/
vion-tools
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 526d1e8c
authored
Sep 10, 2024
by
李乾广
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改bug
1 parent
7b864f34
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletions
src/router/index.js
src/router/index.js
View file @
526d1e8
...
@@ -123,10 +123,22 @@ const router = createRouter(
...
@@ -123,10 +123,22 @@ const router = createRouter(
)
)
// 全局路由守卫
// 全局路由守卫
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
if
((
Cookies
.
get
(
'userrole_type'
)
&&
Cookies
.
get
(
'userrole_type'
)
==-
1
)
||
to
.
path
==
'/404'
)
{
// 加密获取userType
let
tokenArr
=
Cookies
.
get
(
"atoken"
).
split
(
''
)
let
tokenArr1
=
Cookies
.
get
(
"atoken"
).
split
(
'-'
)
let
usertypeArr
=
Cookies
.
get
(
"userrole_type"
).
split
(
'-'
)
if
(
tokenArr1
[
0
]
==
usertypeArr
[
0
]
&&
tokenArr1
[
1
]
==
usertypeArr
[
1
]
&&
tokenArr1
[
2
]
==
usertypeArr
[
2
]){
let
usertype
=
usertypeArr
[
3
]
for
(
let
yy
=
1
;
yy
<
tokenArr
.
length
;
yy
++
){
usertype
=
usertype
-
(
tokenArr
[
yy
].
charCodeAt
(
0
)
*
1
)
}
if
(
usertype
==-
1
||
to
.
path
==
'/404'
)
{
next
();
next
();
}
else
{
}
else
{
router
.
push
(
'/404'
);
router
.
push
(
'/404'
);
}
}
}
else
{
router
.
push
(
'/404'
);
}
});
});
export
default
router
export
default
router
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