Commit b41cec38 authored by 杨硕's avatar 杨硕

清除没用的菜单

parent 1ff8d59b
...@@ -24,7 +24,7 @@ router.beforeEach((to, from, next) => { ...@@ -24,7 +24,7 @@ router.beforeEach((to, from, next) => {
store.dispatch('GetInfo').then(res => { store.dispatch('GetInfo').then(res => {
// 判断用户是否有权限 有角色 // 判断用户是否有权限 有角色
if (res.data.roles && res.data.roles.length > 0 && res.data.permissions && res.data.permissions.length > 0) { if (res.data.permissions && res.data.permissions.length > 0) {
// 拉取user_info // 拉取user_info
const roles = res.data.roles const roles = res.data.roles
store.dispatch('GenerateRoutes', { roles }).then((routers) => { store.dispatch('GenerateRoutes', { roles }).then((routers) => {
......
...@@ -61,10 +61,10 @@ const user = { ...@@ -61,10 +61,10 @@ const user = {
const avatar = user.avatar === null ? require('@/assets/image/profile.jpg') : user.avatar const avatar = user.avatar === null ? require('@/assets/image/profile.jpg') : user.avatar
if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.data.roles) commit('SET_ROLES', res.data.roles)
commit('SET_PERMISSIONS', res.data.permissions)
} else { } else {
commit('SET_ROLES', ['ROLE_DEFAULT']) commit('SET_ROLES', ['ROLE_DEFAULT'])
} }
commit('SET_PERMISSIONS', res.data.permissions)
commit('SET_NAME', user.username) commit('SET_NAME', user.username)
commit('SET_SPECIALTAG', user.specialTag) commit('SET_SPECIALTAG', user.specialTag)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment