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
d476e320
Commit
d476e320
authored
Nov 29, 2017
by
Pan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into refacor/style
parents
4feb89c9
8f2b0c94
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
2 deletions
+9
-2
README.md
README.md
+2
-0
package.json
package.json
+1
-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.
README.md
View file @
d476e320
...
@@ -26,6 +26,8 @@
...
@@ -26,6 +26,8 @@
**注意:该项目目前使用element-ui@1.4.2版本,所以最低兼容 Vue 2.3.0**
**注意:该项目目前使用element-ui@1.4.2版本,所以最低兼容 Vue 2.3.0**
楼主这里有一份调查
[
问卷
](
https://www.wjx.cn/m/16866569.aspx
)
有空请填写一下,以表对本项目的支持~ps:不是给这个调查问卷网站做广告,所以填完问卷不用点上面抽奖有的没的那些东西
## 前言
## 前言
> 这半年来一直在用vue写管理后台,目前后台已经有百来个页面,十几种权限,但维护成本依然很低,所以准备开源分享一下后台开发的经验和成果。目前的技术栈主要的采用vue+element+axios由webpack2打包。由于是个人项目,所以数据请求都是用了mockjs模拟。注意:在此项目基础上改造开发时请移除mock文件。
> 这半年来一直在用vue写管理后台,目前后台已经有百来个页面,十几种权限,但维护成本依然很低,所以准备开源分享一下后台开发的经验和成果。目前的技术栈主要的采用vue+element+axios由webpack2打包。由于是个人项目,所以数据请求都是用了mockjs模拟。注意:在此项目基础上改造开发时请移除mock文件。
...
...
package.json
View file @
d476e320
{
{
"name"
:
"juicy"
,
"name"
:
"juicy"
,
"version"
:
"2.2.
0
"
,
"version"
:
"2.2.
1
"
,
"description"
:
"A Vue.js admin"
,
"description"
:
"A Vue.js admin"
,
"author"
:
"Pan <panfree23@gmail.com>"
,
"author"
:
"Pan <panfree23@gmail.com>"
,
"license"
:
"
MIT
"
,
"license"
:
"
MIT
"
,
...
...
src/mock/login.js
View file @
d476e320
...
@@ -27,7 +27,7 @@ export default {
...
@@ -27,7 +27,7 @@ export default {
if
(
userMap
[
token
])
{
if
(
userMap
[
token
])
{
return
userMap
[
token
]
return
userMap
[
token
]
}
else
{
}
else
{
return
Promise
.
reject
(
'error'
)
return
false
}
}
},
},
logout
:
()
=>
'success'
logout
:
()
=>
'success'
...
...
src/permission.js
View file @
d476e320
...
@@ -3,6 +3,7 @@ import store from './store'
...
@@ -3,6 +3,7 @@ import store from './store'
import
NProgress
from
'nprogress'
// Progress 进度条
import
NProgress
from
'nprogress'
// Progress 进度条
import
'nprogress/nprogress.css'
// Progress 进度条样式
import
'nprogress/nprogress.css'
// Progress 进度条样式
import
{
getToken
}
from
'@/utils/auth'
// 验权
import
{
getToken
}
from
'@/utils/auth'
// 验权
import
{
Message
}
from
'element-ui'
// permissiom judge
// permissiom judge
function
hasPermission
(
roles
,
permissionRoles
)
{
function
hasPermission
(
roles
,
permissionRoles
)
{
...
@@ -29,6 +30,7 @@ router.beforeEach((to, from, next) => {
...
@@ -29,6 +30,7 @@ router.beforeEach((to, from, next) => {
})
})
}).
catch
(()
=>
{
}).
catch
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
store
.
dispatch
(
'FedLogOut'
).
then
(()
=>
{
Message
.
error
(
'验证失败,请重新登录'
)
next
({
path
:
'/login'
})
next
({
path
:
'/login'
})
})
})
})
})
...
...
src/store/modules/user.js
View file @
d476e320
...
@@ -63,6 +63,9 @@ const user = {
...
@@ -63,6 +63,9 @@ const user = {
GetUserInfo
({
commit
,
state
})
{
GetUserInfo
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getUserInfo
(
state
.
token
).
then
(
response
=>
{
getUserInfo
(
state
.
token
).
then
(
response
=>
{
if
(
!
response
.
data
)
{
// 由于mockjs 不支持自定义状态码只能这样hack
reject
(
'error'
)
}
const
data
=
response
.
data
const
data
=
response
.
data
commit
(
'SET_ROLES'
,
data
.
role
)
commit
(
'SET_ROLES'
,
data
.
role
)
commit
(
'SET_NAME'
,
data
.
name
)
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