refactor: 修改角色权限标识

This commit is contained in:
xlsea 2024-05-10 17:15:06 +08:00
parent 52de73f6fc
commit 1541c39dbd
2 changed files with 7 additions and 1 deletions

View File

@ -40,6 +40,11 @@ export const menuIconTypeRecord: Record<Api.SystemManage.IconType, App.I18n.I18n
export const menuIconTypeOptions = transformRecordToOption(menuIconTypeRecord);
export const roleTypeRecord: Record<string, string> = {
'1': 'R_ADMIN',
'2': 'R_SUPER'
};
export const podsType: Record<Api.Dashboard.DashboardPodsType, App.I18n.I18nKey> = {
1: 'page.pods.type.client',
2: 'page.pods.type.server'

View File

@ -7,6 +7,7 @@ import { useRouterPush } from '@/hooks/common/router';
import { fetchGetUserInfo, fetchLogin } from '@/service/api';
import { localStg } from '@/utils/storage';
import { $t } from '@/locales';
import { roleTypeRecord } from '@/constants/business';
import { useRouteStore } from '../route';
import { clearAuthStorage, getToken, getUserInfo } from './shared';
@ -93,7 +94,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
if (!error) {
info!.userName = info?.username;
info!.roles = [info.role];
info!.roles = [roleTypeRecord[info.role]];
// 2. store user info
localStg.set('userInfo', info);