You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crmeb/app/store/getters.js

29 lines
1.0 KiB

11 months ago
export default {
token: state => state.app.token,
isLogin: state => !!state.app.token,
backgroundColor: state => state.app.backgroundColor,
userInfo: state => state.app.userInfo || {},
uid: state => state.app.uid,
homeActive: state => state.app.homeActive,
home: state => state.app.home,
chatUrl: state => state.app.chatUrl,
systemPlatform: state => state.app.systemPlatform,
productType: state => state.app.productType,
// 管理员账号信息
adminInfo: state => state.app.adminInfo || null,
// 管理员权限列表
permissions: state => state.app.adminInfo?.permissionsList || [],
// 管理员角色列表
roles: state => state.app.adminInfo?.roles ? [state.app.adminInfo.roles] : [],
// 是否超级管理员
isSuperAdmin: state => {
const permissions = state.app.adminInfo?.permissionsList || [];
return permissions.includes('*:*:*');
},
// 字典相关getter
dict: state => state.dict.dict,
dictData: state => state.dict.dictData,
// 根据字典类型获取字典数据
dictByType: state => type => state.dict.dictData[type] || []
11 months ago
};