Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
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
JIRA
JIRA
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
黄瑜
VueElementTemplate
Commits
b8068a48
Commit
b8068a48
authored
May 11, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix permission bug
parent
cab7d447
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
main.js
src/main.js
+1
-1
login.js
src/mock/login.js
+6
-3
user.js
src/store/modules/user.js
+1
-0
No files found.
src/main.js
View file @
b8068a48
...
...
@@ -48,7 +48,7 @@ router.beforeEach((to, from, next) => {
if
(
to
.
path
===
'/login'
)
{
next
({
path
:
'/'
});
}
else
{
if
(
to
.
meta
&&
to
.
meta
.
role
)
{
if
(
to
.
meta
&&
to
.
meta
.
role
&&
store
.
getters
.
uid
)
{
if
(
hasPermission
(
store
.
getters
.
roles
,
to
.
meta
.
role
))
{
next
();
}
else
{
...
...
src/mock/login.js
View file @
b8068a48
...
...
@@ -4,14 +4,16 @@ const userMap = {
token
:
'admin'
,
introduction
:
'我是超级管理员'
,
avatar
:
'https://wdl.wallstreetcn.com/48a3e1e0-ea2c-4a4e-9928-247645e3428b'
,
name
:
'超级管理员小潘'
name
:
'超级管理员小潘'
,
uid
:
'001'
},
editor
:
{
role
:
[
'editor'
],
token
:
'editor'
,
introduction
:
'我是编辑'
,
avatar
:
'https://wdl.wallstreetcn.com/48a3e1e0-ea2c-4a4e-9928-247645e3428b'
,
name
:
'普通编辑小张'
name
:
'普通编辑小张'
,
uid
:
'002'
},
developer
:
{
...
...
@@ -19,7 +21,8 @@ const userMap = {
token
:
'develop'
,
introduction
:
'我是开发'
,
avatar
:
'https://wdl.wallstreetcn.com/48a3e1e0-ea2c-4a4e-9928-247645e3428b'
,
name
:
'工程师小王'
name
:
'工程师小王'
,
uid
:
'003'
}
}
...
...
src/store/modules/user.js
View file @
b8068a48
...
...
@@ -87,6 +87,7 @@ const user = {
commit
(
'SET_ROLES'
,
data
.
role
);
commit
(
'SET_NAME'
,
data
.
name
);
commit
(
'SET_AVATAR'
,
data
.
avatar
);
commit
(
'SET_UID'
,
data
.
uid
);
commit
(
'SET_INTRODUCTION'
,
data
.
introduction
);
resolve
(
response
);
}).
catch
(
error
=>
{
...
...
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