import { ImageType } from "./Model"; import type { Model } from "./Model"; import type { Attachment } from "./Attachment"; import type { Setting } from "./Setting"; import type { Role } from "./Role"; export type Gender = "MALE" | "FEMALE"; export type User = { name: string; nick?: string; password?: string; email?: string; emailVerifyAt?: number; phoneNo?: string; phoneNoVerifyAt?: number; wrapperType?: ImageType; avatarType?: ImageType; exp?: number; gender?: Gender; birthdate?: number; qq?: string; description?: string; lastLoginIP?: string; lastLoginAt?: number; unmuteAt?: number; unbanAt?: number; roleList?: string[]; roleEntityList?: Role[]; permissionList?: string[]; attachmentList?: Attachment[]; settingList?: Setting[]; tempFileIdList?: string[]; muting?: boolean; banning?: boolean; emailVerified?: boolean; phoneNoVerified?: boolean; } & Model; /** 用户资料组件使用的用户视图。 */ export type UserView = { id?: string; name: string; profile: { wrapperType?: ImageType; avatarType?: ImageType; exp?: number; sex?: number; description?: string; attachmentList?: Attachment[]; }; }; export type UserAttachType = "AVATAR" | "WRAPPER"; export type RegisterRequest = { name: string; password: string; email?: string; }; export type LoginRequest = { user: string; password: string; }; export type SmsLoginRequest = { detailId: string; captcha: string; }; export type UpdatePasswordRequest = { oldValue: string; newValue: string; }; // 登录返回 export type LoginResponse = { id: string; token: string; expireAt: number; user?: User; }; export type LoginUser = { id?: string; token?: string; expireAt?: number; user?: User; }; export type UserLevelType = { exp: number; // 经验数值,和 UserData.exp 一样 value: number; // 经验对应等级,[0, 8] percent: number; // 该经验在该等级的百分比 [0, 1] nextLevelUp: number; // 下一级经验值 }