Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
portalhtml
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
rex
portalhtml
Commits
52434ba7
Commit
52434ba7
authored
Oct 12, 2021
by
xuezezhan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限
parent
cffd6bda
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
permission.js
src/permission.js
+10
-2
No files found.
src/permission.js
View file @
52434ba7
/*
* @Descripttion:
* @Author: 薛泽展
* @Date: 2021-10-12 12:29:05
* @Since: JDK1.8
*/
import
router
from
'./router'
import
router
from
'./router'
import
store
from
'./store'
import
store
from
'./store'
import
{
Message
}
from
'element-ui'
import
{
Message
}
from
'element-ui'
...
@@ -8,7 +14,7 @@ import getPageTitle from '@/utils/get-page-title'
...
@@ -8,7 +14,7 @@ import getPageTitle from '@/utils/get-page-title'
NProgress
.
configure
({
showSpinner
:
false
})
// NProgress Configuration
NProgress
.
configure
({
showSpinner
:
false
})
// NProgress Configuration
const
whiteList
=
[
'/login'
,
'/auth-redirect'
]
// no redirect whitelist
const
whiteList
=
[
'/
prov-register'
,
'/city-register'
,
'/
login'
,
'/auth-redirect'
]
// no redirect whitelist
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
// start progress bar
// start progress bar
...
@@ -63,11 +69,13 @@ router.beforeEach(async(to, from, next) => {
...
@@ -63,11 +69,13 @@ router.beforeEach(async(to, from, next) => {
}
}
}
else
{
}
else
{
/* has no token*/
/* has no token*/
console
.
info
(
'=========================111'
+
to
.
path
)
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
if
(
whiteList
.
indexOf
(
to
.
path
)
!==
-
1
)
{
// in the free login whitelist, go directly
// in the free login whitelist, go directly
console
.
info
(
'=========================2222'
)
next
()
next
()
}
else
{
}
else
{
console
.
info
(
'=========================3333'
)
// other pages that do not have permission to access are redirected to the login page.
// other pages that do not have permission to access are redirected to the login page.
next
(
`/login?redirect=
${
to
.
path
}
`
)
next
(
`/login?redirect=
${
to
.
path
}
`
)
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