pref: 优化插件store

This commit is contained in:
xiaojunnuo
2025-04-12 23:59:03 +08:00
parent 965dc2cb47
commit cc0657aaa8
71 changed files with 764 additions and 767 deletions
@@ -0,0 +1,68 @@
import { request } from "/src/api/service";
export interface RegisterReq {
username: string;
password: string;
confirmPassword: string;
}
/**
* @description: Login interface parameters
*/
export interface LoginReq {
username: string;
password: string;
}
export interface SmsLoginReq {
mobile: string;
phoneCode: string;
smsCode: string;
randomStr: string;
}
export interface UserInfoRes {
id: string | number;
username: string;
nickName: string;
avatar?: string;
roleIds: number[];
isWeak?: boolean;
}
export interface LoginRes {
token: string;
expire: number;
}
export async function register(user: RegisterReq): Promise<UserInfoRes> {
return await request({
url: "/register",
method: "post",
data: user,
});
}
export async function login(data: LoginReq): Promise<LoginRes> {
//如果开启了登录与权限模块,则真实登录
return await request({
url: "/login",
method: "post",
data,
});
}
export async function loginBySms(data: SmsLoginReq): Promise<LoginRes> {
//如果开启了登录与权限模块,则真实登录
return await request({
url: "/loginBySms",
method: "post",
data,
});
}
export async function mine(): Promise<UserInfoRes> {
return await request({
url: "/mine/info",
method: "post",
});
}