🐛 Fixing a bug.

This commit is contained in:
smallchill 2019-02-21 22:19:04 +08:00
parent 7691724aea
commit d5e4c0f3cf
5 changed files with 10 additions and 154 deletions

View File

@ -3,10 +3,10 @@ import menu from './menu';
/**
* 模拟数据mock
*
*
* mock是否开启模拟数据拦截
*/
user({ mock: true });
user({ mock: true});
menu({ mock: true });
menu({ mock: true });

View File

@ -35,124 +35,8 @@ const top = [{
},
parentId: 3
}]
const first = [{
label: "标签",
path: '/tags',
component: 'views/util/tags',
icon: 'icon-caidan',
meta: {
i18n: 'tags',
},
children: []
}, {
label: "存储",
path: '/store',
component: 'views/util/store',
icon: 'icon-caidan',
meta: {
i18n: 'store',
},
children: []
}, {
label: "全局函数",
path: 'https://avuex.avue.top/$/doc/api',
icon: 'icon-caidan',
meta: {
i18n: 'api',
},
children: []
}, {
label: "日志监控",
path: '/logs',
component: 'views/util/logs',
icon: 'icon-caidan',
meta: {
i18n: 'logs',
},
children: []
}, {
label: "表格",
path: '/table',
component: 'views/util/table',
icon: 'icon-caidan',
meta: {
i18n: 'table',
},
children: []
}, {
label: "表单",
path: '/form',
component: 'views/util/form',
icon: 'icon-caidan',
meta: {
i18n: 'form',
},
children: []
}, {
label: "权限",
path: '/permission',
component: 'views/util/permission',
icon: 'icon-caidan',
meta: {
i18n: 'permission',
},
children: []
}, {
label: "数据展示",
path: '/data',
component: 'views/util/data',
icon: 'icon-caidan',
meta: {
i18n: 'data',
},
children: []
}, {
label: "异常页",
path: '/error',
meta: {
i18n: 'error',
},
icon: 'icon-caidan',
children: [{
label: "403",
path: 'error',
component: 'components/error-page/403',
icon: 'icon-caidan',
children: []
}, {
label: "404",
path: '404',
component: 'components/error-page/404',
icon: 'icon-caidan',
children: []
}, {
label: "500",
path: '500',
component: 'components/error-page/500',
icon: 'icon-caidan',
children: []
}]
}]
const second = []
const third = [{
label: "测试页面",
path: '/test',
component: 'views/test',
icon: 'icon-caidan',
meta: {
i18n: 'test',
},
children: []
}]
export default ({ mock }) => {
if (!mock) return;
let menu = [first, second, third];
Mock.mock('/user/getMenu', 'get', (res) => {
let body = JSON.parse(res.body);
return {
data: menu[body.type] || []
}
})
Mock.mock('/user/getTopMenu', 'get', () => {
return {
data: top

View File

@ -13,30 +13,6 @@ export default ({ mock }) => {
Mock.mock('/user/refesh', 'post', {
data: new Date().getTime() + ''
});
//获取用户信息
Mock.mock('/user/getUserInfo', 'get', {
data: {
userInfo: {
username: 'admin',
name: 'avue',
avatar: 'https://gitee.com/uploads/61/632261_smallweigit.jpg',
},
roles: 'admin',
permission: [
'sys_crud_btn_add',
'sys_crud_btn_export',
'sys_menu_btn_add',
'sys_menu_btn_edit',
'sys_menu_btn_del',
'sys_role_btn1',
'sys_role_btn2',
'sys_role_btn3',
'sys_role_btn4',
'sys_role_btn5',
'sys_role_btn6',
], //权限级别
}
});
//获取表格数据
Mock.mock('/user/getTable', 'get', () => {
@ -65,4 +41,4 @@ export default ({ mock }) => {
}
}
})
}
}

View File

@ -1,6 +1,6 @@
/**
* 全站权限配置
*
*
*/
import router from './router/router'
import store from './store'
@ -32,13 +32,9 @@ router.beforeEach((to, from, next) => {
next({ path: '/' })
} else {
//如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页
if (store.getters.roles.length === 0) {
store.dispatch('GetUserInfo').then(() => {
next({ ...to, replace: true })
}).catch(() => {
store.dispatch('FedLogOut').then(() => {
next({ path: '/login' })
})
if (store.getters.token.length === 0) {
store.dispatch('FedLogOut').then(() => {
next({ path: '/login' })
})
} else {
const value = to.query.src || to.fullPath;
@ -82,4 +78,4 @@ router.afterEach(() => {
title = router.$avueRouter.generateTitle(title, i18n)
//根据当前的标签也获取label的值动态设置浏览器标题
router.$avueRouter.setTitle(title);
});
});

View File

@ -1,6 +1,6 @@
// 基础路径 注意发布之前要先修改这里
let baseUrl = './'
let url = 'http://localhost:88'
let url = 'http://localhost:8800'
module.exports = {
baseUrl: baseUrl, // 根据你的实际情况更改这里
lintOnSave: true,