[add] 同步前端代码

This commit is contained in:
lcj
2025-06-24 10:44:10 +08:00
parent 0edd267f78
commit 8bf9f47d62
1841 changed files with 2445804 additions and 0 deletions

View File

@ -0,0 +1,118 @@
import { request } from '../../utils/requset2';
// 获取文件列表
export function getFiles(data) {
return request({
url: '/minio/file',
method: 'get',
data,
params: data
});
}
// 获取ai文件列表
export function getAiFiles(data) {
return request({
url: '/minio/ai/file',
method: 'get',
data,
params: data
});
}
// 获取文件信息
export function getInfo(data) {
return request({
url: '/minio/info',
method: 'get',
data,
params: data,
timeout: 30000
});
}
// 获取ai文件信息
export function getAiInfo(data) {
return request({
url: '/minio/ai/info',
method: 'get',
data,
params: data,
timeout: 30000
});
}
// 下载文件
export function fileDownload(params, onProgress) {
return request({
url: '/minio/download',
method: 'post',
params,
responseType: 'blob',
timeout: 0,
// header: {
// "Content-Length": Buffer.byteLength(JSON.stringify(params)),
// },
onDownloadProgress: (progressEvent) => {
if (onProgress && typeof onProgress === 'function') {
const { loaded, total } = progressEvent;
console.log('progressEvent', progressEvent);
const percentage = Math.round((loaded / total) * 100); // 计算百分比
onProgress(percentage); // 调用传入的 onProgress 回调函数
}
}
});
}
// 删除文件
export function deleteFile(data) {
return request({
url: '/minio/deleteBatch',
method: 'delete',
data,
timeout: 0
});
}
// 删除ai文件
export function deleteAiFile(data) {
return request({
url: '/minio/ai/deleteBatch',
method: 'delete',
data,
timeout: 0
});
}
// 批量下载文件或目录
export function downloadBatch(data, onProgress) {
return request({
url: '/minio/downloadBatch',
method: 'post',
responseType: 'blob',
data,
timeout: 0,
onDownloadProgress: (progressEvent) => {
if (onProgress && typeof onProgress === 'function') {
const { loaded, total } = progressEvent;
console.log('progressEvent', progressEvent);
const percentage = Math.round((loaded / total) * 100); // 计算百分比
onProgress(percentage); // 调用传入的 onProgress 回调函数
}
}
});
}
// 获取某个目录下面的所有文件的URL列表
export function getUrlList(data) {
return request({
url: '/minio/urlList',
method: 'post',
data,
params: data,
timeout: 0
});
}
// 获取某个目录下面的所有文件的URL列表
export function getAiUrlList(data) {
return request({
url: '/minio/ai/urlList',
method: 'post',
data,
params: data,
timeout: 0
});
}