diff --git a/src/api/his.ts b/src/api/his.ts index bc4371c..3ef0f49 100644 --- a/src/api/his.ts +++ b/src/api/his.ts @@ -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 => { + return request.post( + `/api/auth/user/owned/menus`, + data + ).then(res => res.data); +}; + diff --git a/src/api/types.ts b/src/api/types.ts index 2e9a512..a5776c4 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -611,3 +611,100 @@ export interface OutputVerificationCodePhone { */ export type VerificationCodePhoneResponse = CommonActionResult; +/** + * 菜单元数据 + */ +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; +