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
76f40174
Commit
76f40174
authored
Oct 25, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix getUserInfo by cookie bug
parent
87a44ae7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
login.js
src/mock/login.js
+1
-1
permission.js
src/permission.js
+2
-0
user.js
src/store/modules/user.js
+3
-0
No files found.
src/mock/login.js
View file @
76f40174
...
...
@@ -34,7 +34,7 @@ export default {
if
(
userMap
[
token
])
{
return
userMap
[
token
]
}
else
{
return
Promise
.
reject
(
'error'
)
return
false
}
},
logout
:
()
=>
'success'
...
...
src/permission.js
View file @
76f40174
...
...
@@ -3,6 +3,7 @@ import store from './store'
import
NProgress
from
'nprogress'
// Progress 进度条
import
'nprogress/nprogress.css'
// Progress 进度条样式
import
{
getToken
}
from
'@/utils/auth'
// 验权
import
{
Message
}
from
'element-ui'
// permissiom judge
function
hasPermission
(
roles
,
permissionRoles
)
{
...
...
@@ -29,6 +30,7 @@ router.beforeEach((to, from, next) => {
})
}).
catch
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
Message
.
error
(
'验证失败,请重新登录'
)
next
({
path
:
'/login'
})
})
})
...
...
src/store/modules/user.js
View file @
76f40174
...
...
@@ -63,6 +63,9 @@ const user = {
GetUserInfo
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getUserInfo
(
state
.
token
).
then
(
response
=>
{
if
(
!
response
.
data
)
{
// 由于mockjs 不支持自定义状态码只能这样hack
reject
(
'error'
)
}
const
data
=
response
.
data
commit
(
'SET_ROLES'
,
data
.
role
)
commit
(
'SET_NAME'
,
data
.
name
)
...
...
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