Merge branch 'master' into refacor/style
This commit is contained in:
commit
d476e32032
5 changed files with 9 additions and 2 deletions
|
@ -26,6 +26,8 @@
|
|||
|
||||
**注意:该项目目前使用element-ui@1.4.2版本,所以最低兼容 Vue 2.3.0**
|
||||
|
||||
楼主这里有一份调查[问卷](https://www.wjx.cn/m/16866569.aspx) 有空请填写一下,以表对本项目的支持~ps:不是给这个调查问卷网站做广告,所以填完问卷不用点上面抽奖有的没的那些东西
|
||||
|
||||
## 前言
|
||||
> 这半年来一直在用vue写管理后台,目前后台已经有百来个页面,十几种权限,但维护成本依然很低,所以准备开源分享一下后台开发的经验和成果。目前的技术栈主要的采用vue+element+axios由webpack2打包。由于是个人项目,所以数据请求都是用了mockjs模拟。注意:在此项目基础上改造开发时请移除mock文件。
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "juicy",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"description": "A Vue.js admin",
|
||||
"author": "Pan <panfree23@gmail.com>",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -27,7 +27,7 @@ export default {
|
|||
if (userMap[token]) {
|
||||
return userMap[token]
|
||||
} else {
|
||||
return Promise.reject('error')
|
||||
return false
|
||||
}
|
||||
},
|
||||
logout: () => 'success'
|
||||
|
|
|
@ -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' })
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue