Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
NFT
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hanfeng zhang
NFT
Commits
f4a8e732
Commit
f4a8e732
authored
Jul 05, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:添加路由权限控制
parent
2e27d560
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
index.ts
src/router/index.ts
+28
-16
No files found.
src/router/index.ts
View file @
f4a8e732
import
{
token
}
from
'@/util/userInfoUtils'
import
Vue
from
'vue'
import
VueRouter
,
{
RouteConfig
}
from
'vue-router'
import
App
from
'../App.vue'
...
...
@@ -36,24 +37,27 @@ const routes: Array<RouteConfig> = [
name
:
'Login'
,
component
:
()
=>
import
(
"@/view/Auth/Login/index.vue"
)
},
{
path
:
'/auth/PwdSetting'
,
name
:
'PwdSetting'
,
component
:
()
=>
import
(
"@/view/Auth/PwdSetting/index.vue"
)
},
{
path
:
'/auth/PwdFind'
,
name
:
'PwdFind'
,
component
:
()
=>
import
(
"@/view/Auth/PwdFind/index.vue"
)
},
{
path
:
'/auth/PwdModify'
,
name
:
'PwdModify'
,
component
:
()
=>
import
(
"@/view/Auth/PwdModify/index.vue"
)
},
//
{
//
path: '/auth/PwdSetting',
//
name: 'PwdSetting',
//
component: () => import("@/view/Auth/PwdSetting/index.vue")
//
},
//
{
//
path: '/auth/PwdFind',
//
name: 'PwdFind',
//
component: () => import("@/view/Auth/PwdFind/index.vue")
//
},
//
{
//
path: '/auth/PwdModify',
//
name: 'PwdModify',
//
component: () => import("@/view/Auth/PwdModify/index.vue")
//
},
]
},
{
path
:
'*'
,
redirect
:
{
name
:
'Home'
}
}
]
...
...
@@ -64,4 +68,12 @@ const router = new VueRouter({
routes
})
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
if
(
to
.
name
!==
'Login'
&&
token
.
getToken
()
===
null
)
{
next
({
name
:
'Login'
})
}
else
{
next
()
}
})
export
default
router
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