import { requestClient } from '@/api/request' /** * 性别枚举 * * 对应 OpenAPI: Sex (x-enums) * 1 = 男,2 = 女 */ export const Sex = { /** 男 */ MALE: 1, /** 女 */ FEMALE: 2 } as const /** 性别类型 */ export type SexType = (typeof Sex)[keyof typeof Sex] /** * 用户信息响应 * * 对应 OpenAPI: UserInfoResponse * 所有字段均为可选,部分字段可能为 null */ export interface UserInfoResponse { /** 用户昵称,最长 16 位 */ nickName?: string /** 头像图片 URL 地址,可能为 null */ avatar?: string | null /** 个性签名,最长 64 位,可能为 null */ signature?: string | null /** 年龄,可能为 null */ age?: number | null /** 性别:1=男,2=女,可能为 null */ sex?: SexType | null /** 生日(ISO 8601 日期格式),可能为 null */ birthday?: string | null } /** * 获取当前登录用户信息 * * 根据请求头中的 saToken 获取当前登录用户的详细信息, * 包括昵称、头像、个性签名、年龄、性别、生日。 * 需登录认证。 * * @returns 当前登录用户的详细信息 */ export function getUserInfo() { return requestClient.get('/user/info') }