添加用户菜单权限接口

This commit is contained in:
xianyi
2025-12-17 09:34:53 +08:00
parent c78b2bf8ed
commit c376f9344b
2 changed files with 111 additions and 0 deletions

View File

@@ -38,6 +38,8 @@ import type {
LoginByPasswordResponse,
InputVerificationCodePhone,
VerificationCodePhoneResponse,
InputUserOwnedMenus,
UserOwnedMenusResponse,
} from './types';
/**
@@ -305,3 +307,15 @@ export const getVerificationCodePhone = (
).then(res => res.data);
};
/**
* 获取用户菜单权限
*/
export const getUserOwnedMenus = (
data: InputUserOwnedMenus
): Promise<UserOwnedMenusResponse> => {
return request.post<UserOwnedMenusResponse>(
`/api/auth/user/owned/menus`,
data
).then(res => res.data);
};

View File

@@ -611,3 +611,100 @@ export interface OutputVerificationCodePhone {
*/
export type VerificationCodePhoneResponse = CommonActionResult<OutputVerificationCodePhone>;
/**
* 菜单元数据
*/
export interface MenuMeta {
/** 激活图标 */
activeIcon?: string | null;
/** 激活路径 */
activePath?: string | null;
/** 是否固定标签页 */
affixTab: boolean;
/** 固定标签页顺序 */
affixTabOrder: number;
/** 图标 */
icon?: string | null;
/** 排序 */
order: number;
/** 标题 */
title: string;
/** 是否保持活跃 */
keepAlive: boolean;
/** 是否在菜单中隐藏子项 */
hideChildrenInMenu: boolean;
/** 是否在菜单中隐藏 */
hideInMenu: boolean;
/** 是否在面包屑中隐藏 */
hideInBreadcrumb: boolean;
/** 是否在标签页中隐藏 */
hideInTab: boolean;
/** 徽章 */
badge?: string | null;
/** 徽章类型 */
badgeType?: string | null;
/** 徽章变体 */
badgeVariants?: string | null;
/** iframe 源 */
iframeSrc?: string | null;
/** 链接 */
link?: string | null;
/** 最大打开标签页数 */
maxNumOfOpenTab: number;
/** 是否不使用基础布局 */
noBasicLayout: boolean;
/** 是否在新窗口打开 */
openInNewWindow: boolean;
/** 查询参数 */
query?: string | null;
}
/**
* 菜单项
*/
export interface MenuItem {
/** 菜单ID */
id: string;
/** 父菜单ID */
pid?: string | null;
/** 权限代码 */
authCode?: string | null;
/** 元数据 */
meta: MenuMeta;
/** 状态 */
status: number;
/** 类型 */
type: string;
/** 名称 */
name: string;
/** 路径 */
path: string;
/** 重定向路径 */
redirect?: string | null;
/** 组件 */
component?: string | null;
/** 子菜单 */
children?: MenuItem[] | string[];
}
/**
* 获取用户菜单权限入参
*/
export interface InputUserOwnedMenus {
/** 应用ID */
app_id: string;
}
/**
* 获取用户菜单权限出参
*/
export interface OutputUserOwnedMenus {
/** 菜单列表 */
menus: MenuItem[];
}
/**
* 获取用户菜单权限响应
*/
export type UserOwnedMenusResponse = CommonActionResult<OutputUserOwnedMenus>;