🐛 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

@ -35,124 +35,8 @@ const top = [{
}, },
parentId: 3 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 }) => { export default ({ mock }) => {
if (!mock) return; 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', () => { Mock.mock('/user/getTopMenu', 'get', () => {
return { return {
data: top data: top

View File

@ -13,30 +13,6 @@ export default ({ mock }) => {
Mock.mock('/user/refesh', 'post', { Mock.mock('/user/refesh', 'post', {
data: new Date().getTime() + '' 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', () => { Mock.mock('/user/getTable', 'get', () => {

View File

@ -32,14 +32,10 @@ router.beforeEach((to, from, next) => {
next({ path: '/' }) next({ path: '/' })
} else { } else {
//如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页 //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页
if (store.getters.roles.length === 0) { if (store.getters.token.length === 0) {
store.dispatch('GetUserInfo').then(() => {
next({ ...to, replace: true })
}).catch(() => {
store.dispatch('FedLogOut').then(() => { store.dispatch('FedLogOut').then(() => {
next({ path: '/login' }) next({ path: '/login' })
}) })
})
} else { } else {
const value = to.query.src || to.fullPath; const value = to.query.src || to.fullPath;
const label = to.query.name || to.name; const label = to.query.name || to.name;

View File

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