fix: 个人中心刷新右侧菜单列表问题

This commit is contained in:
@changcode
2021-08-19 13:35:32 +08:00
parent e21cc9e10e
commit 9167bb2107
2 changed files with 27 additions and 28 deletions

View File

@@ -69,9 +69,9 @@ export default {
disabled: false
}, {
id: 12,
name: this.$t('config.operationlog.username'),
name: this.$t('config.operationlog.userId'),
type: 'input',
label: 'username',
label: 'userId',
disabled: false
}, {
id: 13,
@@ -133,6 +133,7 @@ export default {
color: #666666;
letter-spacing: 0;
font-weight: 400;
cursor: pointer;
opacity: .6;
transform: translateX(20%);
}

View File

@@ -26,36 +26,34 @@ router.beforeEach((to, from, next) => {
})
})
} else if (sessionStorage.getItem('nz-token')) {
if (permissionWhiteList.indexOf(to.path) !== -1) {
next()
} else {
new Promise(resolve => {
if (store.getters.menuList.length === 0) {
const configUrl = 'static/config.json?Timestamp=' + new Date().getTime()
Vue.http.get(configUrl).then(config => {
post(config.body.baseUrl + 'sys/user/permissions', { token: sessionStorage.getItem('nz-token') }).then(res => {
store.commit('setMenuList', sortByOrderNum(res.data.menus))
store.commit('setButtonList', res.data.buttons)
store.commit('setRoleList', res.data.roles)
resolve()
})
new Promise(resolve => {
if (store.getters.menuList.length === 0) {
const configUrl = 'static/config.json?Timestamp=' + new Date().getTime()
Vue.http.get(configUrl).then(config => {
post(config.body.baseUrl + 'sys/user/permissions', { token: sessionStorage.getItem('nz-token') }).then(res => {
store.commit('setMenuList', sortByOrderNum(res.data.menus))
store.commit('setButtonList', res.data.buttons)
store.commit('setRoleList', res.data.roles)
resolve()
})
})
} else {
resolve()
}
}).then(res => {
if (to.path) {
if (permissionWhiteList.indexOf(to.path) !== -1) {
next()
} else if (hasMenu(store.getters.menuList, to.path)) {
next()
} else {
resolve()
}
}).then(res => {
if (to.path) {
if (hasMenu(store.getters.menuList, to.path)) {
next()
} else {
if (to.path === '/monitor/monitor/project' || to.path === '/monitor/monitor/module' || to.path === '/monitor/monitor/endpoint') {
return
}
ElementUI.Message.error(i18n.t('tip.noAccess'))
if (to.path === '/monitor/monitor/project' || to.path === '/monitor/monitor/module' || to.path === '/monitor/monitor/endpoint') {
return
}
ElementUI.Message.error(i18n.t('tip.noAccess'))
}
})
}
}
})
} else {
if (loginWhiteList.indexOf(to.path) !== -1) {
next()