feat: loginOut

This commit is contained in:
2025-09-10 17:13:35 +08:00
parent 55cd1f349d
commit 2bb11b49fe
7 changed files with 124 additions and 64 deletions

View File

@@ -71,21 +71,13 @@ export async function getTenantByWebsite(
...(options || {}),
});
}
// 登出
// export const loginOut = () => {
// return request.post({ url: "/system/auth/logout" });
// };
export async function loginOut(
body: API.UserLoginVO,
options?: { [key: string]: any }
) {
export async function loginOut() {
return request("/system/auth/logout", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
});
}
// 获取用户权限信息
@@ -93,7 +85,7 @@ export async function loginOut(
// return request.get({ url: "/system/auth/get-permission-info" });
// };
export async function getInfo(options?: { [key: string]: any }) {
return request<IResponse<{ user: API.UserVO }>>(
return request<IResponse<API.UserInfoVO>>(
"/system/auth/get-permission-info",
{
method: "GET",

View File

@@ -1,38 +1,49 @@
import { MenuVO } from "../system/menu";
export type UserLoginVO = {
username: string
password: string
captchaVerification: string
socialType?: string
socialCode?: string
socialState?: string
}
username: string;
password: string;
captchaVerification: string;
socialType?: string;
socialCode?: string;
socialState?: string;
};
export type TokenType = {
id: number // 编号
accessToken: string // 访问令牌
refreshToken: string // 刷新令牌
userId: number // 用户编号
userType: number //用户类型
clientId: string //客户端编号
expiresTime: number //过期时间
}
id: number; // 编号
accessToken: string; // 访问令牌
refreshToken: string; // 刷新令牌
userId: number; // 用户编号
userType: number; //用户类型
clientId: string; //客户端编号
expiresTime: number; //过期时间
};
export type UserVO = {
id: number
username: string
nickname: string
deptId: number
email: string
mobile: string
sex: number
avatar: string
loginIp: string
loginDate: string
}
id: number;
username: string;
nickname: string;
deptId: number;
email: string;
mobile: string;
sex: number;
avatar: string;
loginIp: string;
loginDate: string;
};
export type RegisterVO = {
tenantName: string
username: string
password: string
captchaVerification: string
tenantName: string;
username: string;
password: string;
captchaVerification: string;
};
export interface UserInfoVO {
// USER 缓存
permissions: Set<string>;
roles: string[];
isSetUser: boolean;
user: UserVO;
menus: MenuVO[];
}

View File

@@ -0,0 +1,49 @@
import { request } from "@umijs/max";
export interface MenuVO {
id: number;
name: string;
permission: string;
type: number;
sort: number;
parentId: number;
path: string;
icon: string;
component: string;
componentName?: string;
status: number;
visible: boolean;
keepAlive: boolean;
alwaysShow?: boolean;
createTime: Date;
}
// 查询菜单(精简)列表
// export const getSimpleMenusList = () => {
// return request.get({ url: '/system/menu/simple-list' })
// }
// // 查询菜单列表
// export const getMenuList = (params) => {
// return request.get({ url: '/system/menu/list', params })
// }
// // 获取菜单详情
// export const getMenu = (id: number) => {
// return request.get({ url: '/system/menu/get?id=' + id })
// }
// // 新增菜单
// export const createMenu = (data: MenuVO) => {
// return request.post({ url: '/system/menu/create', data })
// }
// // 修改菜单
// export const updateMenu = (data: MenuVO) => {
// return request.put({ url: '/system/menu/update', data })
// }
// // 删除菜单
// export const deleteMenu = (id: number) => {
// return request.delete({ url: '/system/menu/delete?id=' + id })
// }