mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-14 13:06:51 +00:00
fix(web): 修复代码格式和文件清理问题
清理无用文件和资源,调整代码格式统一双引号,修复部分组件路径引用问题 删除大量无用图片资源和组件文件,统一代码风格使用双引号,修复国际化文件路径引用,调整部分组件逻辑,优化项目结构
This commit is contained in:
@@ -1,214 +1,136 @@
|
||||
import request from '@/utils/http';
|
||||
import { MenuTable, MenuForm } from '@/api/module_system/menu';
|
||||
import request from "@/utils/request";
|
||||
import { MenuTable, MenuForm } from "@/api/module_system/menu";
|
||||
|
||||
const API_PATH = '/system/user';
|
||||
const API_PATH = "/system/user";
|
||||
|
||||
export const UserAPI = {
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
* @returns 当前用户信息
|
||||
*/
|
||||
getCurrentUserInfo() {
|
||||
return request<ApiResponse<UserInfo>>({
|
||||
url: `${API_PATH}/current/info`,
|
||||
method: 'get',
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 上传当前用户头像
|
||||
* @param body 头像文件
|
||||
* @returns 上传后的文件路径
|
||||
*/
|
||||
uploadCurrentUserAvatar(body: any) {
|
||||
return request<ApiResponse<UploadFilePath>>({
|
||||
url: `${API_PATH}/current/avatar/upload`,
|
||||
method: 'post',
|
||||
method: "post",
|
||||
data: body,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新当前用户信息
|
||||
* @param body 用户信息
|
||||
* @returns 更新后的用户信息
|
||||
*/
|
||||
updateCurrentUserInfo(body: InfoFormState) {
|
||||
return request<ApiResponse<UserInfo>>({
|
||||
url: `${API_PATH}/current/info/update`,
|
||||
method: 'put',
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新当前用户密码
|
||||
* @param body 密码信息
|
||||
* @returns 更新后的用户信息
|
||||
*/
|
||||
changeCurrentUserPassword(body: PasswordFormState) {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/current/password/change`,
|
||||
method: 'put',
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
* @param body 重置密码信息
|
||||
* @returns 重置密码后的用户信息
|
||||
*/
|
||||
resetUserPassword(body: ResetPasswordForm) {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/reset/password`,
|
||||
method: 'put',
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 注册用户
|
||||
* @param body 注册信息
|
||||
* @returns 注册后的用户信息
|
||||
*/
|
||||
registerUser(body: RegisterForm) {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/register`,
|
||||
method: 'post',
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
* @param body 忘记密码信息
|
||||
* @returns 忘记密码后的用户信息
|
||||
*/
|
||||
forgetPassword(body: ForgetPasswordForm) {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/forget/password`,
|
||||
method: 'post',
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
* @param query 查询参数
|
||||
* @returns 用户列表
|
||||
*/
|
||||
listUser(query: UserPageQuery) {
|
||||
return request<PageResult<UserInfo[]>>({
|
||||
return request<ApiResponse<PageResult<UserInfo[]>>>({
|
||||
url: `${API_PATH}/list`,
|
||||
method: 'get',
|
||||
method: "get",
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取用户详情
|
||||
* @param id 用户ID
|
||||
* @returns 用户详情
|
||||
*/
|
||||
detailUser(query: number) {
|
||||
return request<ApiResponse<UserInfo>>({
|
||||
url: `${API_PATH}/detail/${query}`,
|
||||
method: 'get',
|
||||
method: "get",
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
* @param body 用户信息
|
||||
* @returns 创建后的用户信息
|
||||
*/
|
||||
createUser(body: UserForm) {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/create`,
|
||||
method: 'post',
|
||||
method: "post",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
* @param id 用户ID
|
||||
* @param body 用户信息
|
||||
* @returns 更新后的用户信息
|
||||
*/
|
||||
updateUser(id: number, body: UserForm) {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/update/${id}`,
|
||||
method: 'put',
|
||||
method: "put",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
* @param body 用户ID列表
|
||||
*/
|
||||
deleteUser(body: number[]) {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: 'delete',
|
||||
method: "delete",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量设置用户状态
|
||||
* @param body 批量设置用户状态信息
|
||||
* @returns 批量设置用户状态后的用户列表
|
||||
*/
|
||||
batchUser(body: BatchType) {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/available/setting`,
|
||||
method: 'patch',
|
||||
method: "patch",
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 导出用户
|
||||
* @param body 查询参数
|
||||
* @returns 导出的用户文件
|
||||
*/
|
||||
exportUser(body: UserPageQuery) {
|
||||
return request<ApiResponse<Blob>>({
|
||||
return request<Blob>({
|
||||
url: `${API_PATH}/export`,
|
||||
method: 'post',
|
||||
method: "post",
|
||||
data: body,
|
||||
responseType: 'blob',
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 下载用户导入模板
|
||||
* @returns 导入模板文件
|
||||
*/
|
||||
downloadTemplateUser() {
|
||||
return request({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/import/template`,
|
||||
method: 'post',
|
||||
responseType: 'blob',
|
||||
method: "post",
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 导入用户数据
|
||||
* @param body 导入数据文件
|
||||
* @returns 导入后的用户列表
|
||||
*/
|
||||
importUser(body: any) {
|
||||
return request<ApiResponse<UserInfo[]>>({
|
||||
return request<ApiResponse>({
|
||||
url: `${API_PATH}/import/data`,
|
||||
method: 'post',
|
||||
method: "post",
|
||||
data: body,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
},
|
||||
@@ -256,14 +178,14 @@ export interface UserInfo extends BaseType {
|
||||
password?: string;
|
||||
menus?: MenuTable[];
|
||||
dept?: deptTreeType;
|
||||
dept_id?: deptTreeType['id'];
|
||||
dept_name?: deptTreeType['name'];
|
||||
dept_id?: deptTreeType["id"];
|
||||
dept_name?: deptTreeType["name"];
|
||||
roles?: roleSelectorType[];
|
||||
role_names?: roleSelectorType['name'][];
|
||||
role_ids?: roleSelectorType['id'][];
|
||||
role_names?: roleSelectorType["name"][];
|
||||
role_ids?: roleSelectorType["id"][];
|
||||
positions?: positionSelectorType[];
|
||||
position_names?: positionSelectorType['name'][];
|
||||
position_ids?: positionSelectorType['id'][];
|
||||
position_names?: positionSelectorType["name"][];
|
||||
position_ids?: positionSelectorType["id"][];
|
||||
is_superuser?: boolean;
|
||||
last_login?: string;
|
||||
created_by?: CommonType;
|
||||
|
||||
Reference in New Issue
Block a user