修复获取用户角色code

This commit is contained in:
weibl
2026-02-03 22:10:14 +08:00
parent a86f28828a
commit 8b611ecaa0
2 changed files with 7 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import { getDisciplineByRole } from '@/utils/roleDiscipline';
import { getUserRoleCodes } from '@/utils/user';
export const getDemandHideKeys = (key: string) => {
const allKeys = [
@@ -45,7 +46,7 @@ export const getDemandHideKeys = (key: string) => {
export const getUserSimulationType = () => {
// const disciplines = await getDisciplineByRole('ROLE_ADMIN, GENERAL_USER');
// console.log('disciplines', disciplines);
const roleSimulationInfo: any = getDisciplineByRole('ROLE_ADMIN, GENERAL_USER');
const roleSimulationInfo: any = getDisciplineByRole(getUserRoleCodes());
return roleSimulationInfo.simulationType[0];
// return '动画';
// return '工业';
@@ -53,7 +54,7 @@ export const getUserSimulationType = () => {
/** 获取当前用户能看到的学科 */
export const getSeeDisciplines = () => {
const roleSimulationInfo: any = getDisciplineByRole('ROLE_ADMIN, GENERAL_USER');
const roleSimulationInfo: any = getDisciplineByRole(getUserRoleCodes());
console.log('roleSimulationInfo', roleSimulationInfo);
return roleSimulationInfo.discipline;
// return ['结构'];

View File

@@ -12,3 +12,7 @@ export const getUserId = () => {
export const getUserTenantId = () => {
return getUserData().tenantId;
};
export const getUserRoleCodes = () => {
return getUserData().roleCodes;
};