import type { IUser, LoginType } from "~/types"; import { http } from "~/utils/http"; import type { IResponse } from "."; export interface LoginParams { account: string; password: string; loginType: LoginType; } export type LoginResponse = IResponse & { loginType: LoginType; token: string; }; export type UserProfileResponse = IResponse & { user: IUser; }; /** * 用户登录 * @param params 登录参数 * * @see {@link LoginParams} */ export const userLogin = async (params: LoginParams) => { return await http("/login", { method: "POST", body: params, }); }; export const userProfile = async () => { return await http("/getInfo", { method: "GET", }); }; export const userSearch = async (pararms: { searchType: "student" | "teacher"; keyword: string; }) => { return await http< IResponse & { data: IUser[]; } >(`/system/user/search`, { method: "GET", query: pararms, }); };