fix(权限设置): 个人信息无权限禁用入口

--bug=1011779 --user=刘瑞斌 【通用功能】github#12050 非管理员用户,在主页点:个人信息,弹出空白页 https://www.tapd.cn/55049933/s/1129433

Closes #12050
This commit is contained in:
CaptainB 2022-04-02 14:28:07 +08:00 committed by 刘瑞斌
parent 23f01dfc91
commit 8d0d7bc2df
1 changed files with 19 additions and 11 deletions

View File

@ -5,7 +5,9 @@
</span>
<template v-slot:dropdown>
<el-dropdown-menu>
<el-dropdown-item command="personal">{{ $t('commons.personal_information') }}</el-dropdown-item>
<el-dropdown-item command="personal" :disabled="checkPermissions()">
{{ $t('commons.personal_information') }}
</el-dropdown-item>
<el-dropdown-item command="about">{{ $t('commons.about_us') }} <i class="el-icon-info"/></el-dropdown-item>
<el-dropdown-item command="help">{{ $t('commons.help_documentation') }}</el-dropdown-item>
<el-dropdown-item command="ApiHelp">{{ $t('commons.api_help_documentation') }}</el-dropdown-item>
@ -16,28 +18,28 @@
<about-us ref="aboutUs"/>
<el-dialog :close-on-click-modal="false" width="80%"
:visible.sync="resVisible" class="api-import" destroy-on-close @close="closeDialog">
<ms-person-router @closeDialog = "closeDialog"/>
<ms-person-router @closeDialog="closeDialog"/>
</el-dialog>
</el-dropdown>
</template>
<script>
import {getCurrentUser} from "@/common/js/utils";
import {getCurrentUser, hasPermissions} from "@/common/js/utils";
import AboutUs from "./AboutUs";
import {logout} from "@/network/user";
import MsPersonRouter from "@/business/components/settings/components/PersonRouter"
import MsPersonRouter from "@/business/components/settings/components/PersonRouter";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const auth = requireComponent.keys().length > 0 ? requireComponent("./auth/Auth.vue") : {};
export default {
name: "MsUser",
components: {AboutUs,MsPersonRouter},
components: {AboutUs, MsPersonRouter},
data() {
return {
resVisible:false,
}
resVisible: false,
};
},
computed: {
currentUser: () => {
@ -52,7 +54,7 @@ export default {
switch (command) {
case "personal":
// TODO
// this.$router.push('/setting/personsetting').catch(error => error);
// this.$router.push('/setting/personsetting').catch(error => error);
this.resVisible = true;
break;
case "logout":
@ -79,12 +81,18 @@ export default {
window.location.href = "/#/api/home";
}
},
closeDialog(){
closeDialog() {
this.resVisible = false;
},
checkPermissions() {
return !hasPermissions('PERSONAL_INFORMATION:READ+EDIT',
'PERSONAL_INFORMATION:READ+API_KEYS',
'PERSONAL_INFORMATION:READ+EDIT_PASSWORD',
'PERSONAL_INFORMATION:READ+THIRD_ACCOUNT'
);
}
}
}
};
</script>
<style scoped>