refactor: ♻️ 字典重构,系统权限模块优化
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
import { FileInfo } from "./model";
|
||||
|
||||
class FileAPI {
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
static upload(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
return request<any, FileInfo>({
|
||||
url: "/api/v1/files",
|
||||
method: "post",
|
||||
data: formData,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param filePath 文件完整路径
|
||||
*/
|
||||
static deleteByPath(filePath?: string) {
|
||||
return request({
|
||||
url: "/api/v1/files",
|
||||
method: "delete",
|
||||
params: { filePath: filePath },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default FileAPI;
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* 文件API类型声明
|
||||
*/
|
||||
export interface FileInfo {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
Reference in New Issue
Block a user