auth-web/src/api/v1/files.ts

41 lines
1.5 KiB
TypeScript
Raw Normal View History

import { http } from '@/api/service/request';
import type { BaseResult, ResultTable } from '@/api/service/types';
2024-10-12 16:57:13 +08:00
/** 系统文件管理---获取系统文件管理列表 */
2025-04-27 22:16:06 +08:00
export const getFilesPage = (data: any) => {
return http.request<BaseResult<ResultTable>>('get', `files/${data.currentPage}/${data.pageSize}`, {
2025-04-24 13:43:37 +08:00
params: data,
});
};
2025-04-27 22:16:06 +08:00
/** 系统文件管理---添加系统文件 */
export const fetchAddFiles = (data: any) => {
2025-04-28 09:39:28 +08:00
return http.request<BaseResult<any>>('post', 'files', { data }, { headers: { 'Content-Type': 'multipart/form-data' } });
};
2025-04-27 22:16:06 +08:00
/** 系统文件管理---更新系统文件 */
export const updateFiles = (data: any) => {
2025-04-28 09:39:28 +08:00
return http.request<BaseResult<object>>('put', 'files', { data }, { headers: { 'Content-Type': 'multipart/form-data' } });
};
2025-04-27 22:16:06 +08:00
/** 系统文件管理---删除系统文件 */
export const deleteFiles = (data: any) => {
return http.request<BaseResult<any>>('delete', 'files', { data });
};
/** 系统文件管理---根据文件id下载文件 */
export const downloadFilesByFileId = (data: any) => {
2025-04-29 18:18:07 +08:00
return http.request<any>('get', `files/file/${data.id}`, {
responseType: 'blob',
});
2025-04-27 22:16:06 +08:00
};
/** 系统文件管理---获取所有文件类型 */
export const getMediaTypeList = () => {
return http.request<BaseResult<any>>('get', `files/private/getMediaTypeList`);
};
/** 系统文件管理---获取所有文件存储基础路径 */
export const getFilesStoragePath = () => {
return http.request<BaseResult<any>>('get', `files/private/getAllFilesStoragePath`);
};