Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sgaqgl-vue
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
李苏
sgaqgl-vue
Commits
e4d60eca
Commit
e4d60eca
authored
Jan 10, 2023
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路由进度条
parent
a7654d57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
permission.js
src/permission.js
+5
-5
No files found.
src/permission.js
View file @
e4d60eca
...
@@ -11,14 +11,14 @@ NProgress.configure({ showSpinner: false })
...
@@ -11,14 +11,14 @@ NProgress.configure({ showSpinner: false })
const
whiteList
=
[
'/login'
,
'/auth-redirect'
,
'/bind'
,
'/register'
]
const
whiteList
=
[
'/login'
,
'/auth-redirect'
,
'/bind'
,
'/register'
]
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
console
.
log
(
store
.
state
.
user
.
token
)
//
console.log(store.state.user.token)
NProgress
.
start
()
//
NProgress.start()
if
(
getToken
())
{
if
(
getToken
())
{
to
.
meta
.
title
&&
store
.
dispatch
(
'settings/setTitle'
,
to
.
meta
.
title
)
to
.
meta
.
title
&&
store
.
dispatch
(
'settings/setTitle'
,
to
.
meta
.
title
)
/* has token*/
/* has token*/
if
(
to
.
path
===
'/login'
)
{
if
(
to
.
path
===
'/login'
)
{
next
({
path
:
'/'
})
next
({
path
:
'/'
})
NProgress
.
done
()
//
NProgress.done()
}
else
{
}
else
{
if
(
store
.
state
.
app
.
isInit
==
false
)
{
if
(
store
.
state
.
app
.
isInit
==
false
)
{
store
.
commit
(
'app/changeInit'
)
store
.
commit
(
'app/changeInit'
)
...
@@ -40,11 +40,11 @@ router.beforeEach((to, from, next) => {
...
@@ -40,11 +40,11 @@ router.beforeEach((to, from, next) => {
next
()
next
()
}
else
{
}
else
{
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
// 否则全部重定向到登录页
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
// 否则全部重定向到登录页
NProgress
.
done
()
//
NProgress.done()
}
}
}
}
})
})
router
.
afterEach
(()
=>
{
router
.
afterEach
(()
=>
{
NProgress
.
done
()
//
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