import _axios from "@/utils/request"; export default { // 获取文件列表 api_getList: (params) => _axios.fetch( "api/fiee/resource/list", params, "GET", "json", "", true, false, import.meta.env.VITE_FIEE_API_URL_FILE ), // 获取预览文件地址 api_getPreviewUrl: (params) => _axios.fetch( "api/fiee/resource/raw", params, "GET", "json", "", true, false, import.meta.env.VITE_FIEE_API_URL_FILE ), // 删除文件 api_delete: (params) => { const path = params.path; const url = `api/fiee/resource?path=${encodeURIComponent(path)}`; return _axios.fetch( url, {}, "DELETE", "json", "application/json", // 明确指定Content-Type true, false, import.meta.env.VITE_FIEE_API_URL_FILE ); }, // 重命名 api_rename: (data) => _axios.fetch( "api/fiee/resource", data, "PUT", "json", "", true, false, import.meta.env.VITE_FIEE_API_URL_FILE ), // 创建文件夹 api_createFolder: (data) => _axios.fetch( "api/fiee/resource", data, "POST", "json", "", true, false, import.meta.env.VITE_FIEE_API_URL_FILE ), // 搜索 api_search: (params) => _axios.fetch( "api/fiee/resource/search", params, "GET", "json", "", true, false, import.meta.env.VITE_FIEE_API_URL_FILE ), // 磁盘使用率 api_usage: () => _axios.fetch( "api/fiee/resource/usage?path=/", {}, "GET", "json", "", true, false, import.meta.env.VITE_FIEE_API_URL_FILE ), // 上传文件 api_upload: (data) => { const formData = new FormData(); // 这里需要根据实际的数据结构调整 // 假设 data.file 已经是 FormData 对象 return _axios.fetch( `api/fiee/resource/upload?path=${data.path}`, data.file, "POST", "json", "", true, false, import.meta.env.VITE_FIEE_API_URL_FILE ); }, // 分片上传 - 创建空文件 api_createSliceUpload: (data) => _axios.fetch( "api/fiee/resource/tus/create", data, "POST", "json", "", true, false, import.meta.env.VITE_FIEE_API_URL_FILE ), // 分片上传文件 - 上传文件块 api_sliceUpload: (data, headers = {}) => { return _axios.fetch( `api/fiee/resource/tus/upload?path=${data.path}`, data.file, "POST", "json", "", // contentType 参数 true, // authToken true, // isFormData import.meta.env.VITE_FIEE_API_URL_FILE, headers // 传递请求头参数 ); }, };