build: trident-sync prepare

This commit is contained in:
xiaojunnuo
2023-01-29 13:44:19 +08:00
parent dcd1023a39
commit 07a45b4530
589 changed files with 36886 additions and 2 deletions
@@ -0,0 +1,31 @@
export default [
{
path: "/login",
method: "post",
handle() {
return {
code: 0,
msg: "success",
data: {
token: "faker token",
expire: 10000
}
};
}
},
{
path: "/sys/authority/user/mine",
method: "get",
handle() {
return {
code: 0,
msg: "success",
data: {
id: 1,
username: "username",
nickName: "admin"
}
};
}
}
];
@@ -0,0 +1,51 @@
import { request, requestForMock } from "../service";
import { env } from "/@/utils/util.env";
/**
* @description: Login interface parameters
*/
export interface LoginReq {
username: string;
password: string;
}
export interface UserInfoRes {
id: string | number;
username: string;
nickName: string;
}
export interface LoginRes {
token: string;
expire: number;
}
export async function login(data: LoginReq): Promise<LoginRes> {
if (env.PM_ENABLED === "false") {
//没有开启权限模块,模拟登录
return await requestForMock({
url: "/login",
method: "post",
data
});
}
//如果开启了登录与权限模块,则真实登录
return await request({
url: "/login",
method: "post",
data
});
}
export async function mine(): Promise<UserInfoRes> {
if (env.PM_ENABLED === "false") {
//没有开启权限模块,模拟登录
return await requestForMock({
url: "/sys/authority/user/mine",
method: "post"
});
}
return await request({
url: "/sys/authority/user/mine",
method: "post"
});
}