按钮权限修改

This commit is contained in:
aoli.qu 2021-09-06 12:39:58 +08:00
parent 2e71de1cec
commit d9b743f4df
3 changed files with 9 additions and 3 deletions

View File

@ -120,4 +120,10 @@ export default {
<style lang="less">
@import "./BasicLayout.less";
/*隐藏原本的图标*/
.ant-pro-global-header-trigger{
display: none;
}
</style>

View File

@ -5,7 +5,7 @@ const getters = {
color: state => state.app.color,
token: state => state.user.token,
avatar: state => state.user.avatar,
nickname: state => state.user.name,
name: state => state.user.name,
welcome: state => state.user.welcome,
roles: state => state.user.roles,
buttons: state => state.user.buttons,

View File

@ -14,8 +14,8 @@ export function actionToObject (json) {
*/
export function hasBtnPermission (permission) {
const myBtns = store.getters.buttons
const nickname = store.getters.nickname
if (nickname == '超级管理员') {
const name = store.getters.name
if (name == 'admin') {
return true
}
return myBtns.indexOf(permission) > -1