Files
FastapiAdmin/frontend/web/src/api/module_system/params.ts
T
zhangtao 8725be6d7d refactor: 重构工具模块导入与项目代码结构
1.  统一所有API文件的request导入路径,从@utils/http改为@utils
2.  合并工具类导出,将分散的工具模块整合到@utils统一出口
3.  重构状态管理导入路径,统一从@utils导入相关工具与store
4.  整理组件导入与样式引用,优化项目内组件与样式的引用路径
5.  新增部分基础组件与工具方法,完善项目基础能力
6.  修复部分样式类名的书写规范,统一类名格式
2026-05-17 06:56:31 +08:00

98 lines
2.1 KiB
TypeScript

import { request, NO_AUTH_FLAG } from "@utils";
const API_PATH = "/system/param";
const ParamsAPI = {
uploadFile(body: any) {
return request<ApiResponse<UploadFilePath>>({
url: `${API_PATH}/upload`,
method: "post",
data: body,
headers: { "Content-Type": "multipart/form-data" },
});
},
/** 登录前拉取站点参数:不带 Token,避免过期 JWT 导致 401 无法展示底部备案等 */
getInitConfig() {
return request<ApiResponse<ConfigTable[]>>({
url: `${API_PATH}/info`,
method: "get",
headers: {
Authorization: NO_AUTH_FLAG,
},
});
},
listParams(query: ConfigPageQuery) {
return request<ApiResponse<PageResult<ConfigTable>>>({
url: `${API_PATH}/list`,
method: "get",
params: query,
});
},
detailParams(query: number) {
return request<ApiResponse<ConfigTable>>({
url: `${API_PATH}/detail/${query}`,
method: "get",
});
},
createParams(body: ConfigForm) {
return request<ApiResponse>({
url: `${API_PATH}/create`,
method: "post",
data: body,
});
},
updateParams(id: number, body: ConfigForm) {
return request<ApiResponse>({
url: `${API_PATH}/update/${id}`,
method: "put",
data: body,
});
},
deleteParams(body: number[]) {
return request<ApiResponse>({
url: `${API_PATH}/delete`,
method: "delete",
data: body,
});
},
exportParams(body: ConfigPageQuery) {
return request<Blob>({
url: `${API_PATH}/export`,
method: "post",
data: body,
responseType: "blob",
});
},
};
export default ParamsAPI;
export interface ConfigPageQuery extends PageQuery {
config_name?: string;
config_key?: string;
config_type?: boolean;
created_time?: string[];
updated_time?: string[];
}
export interface ConfigTable extends BaseType {
config_name?: string;
config_key?: string;
config_value?: string;
config_type?: boolean;
}
export interface ConfigForm extends BaseFormType {
config_name?: string;
config_key?: string;
config_value?: string;
config_type?: boolean;
}