feat: 封装多图上传组件

Former-commit-id: d36f4fb6fb9e2c3da42518f6689a78ab2370af57
This commit is contained in:
haoxr
2022-11-21 00:03:16 +08:00
parent 6f001a7713
commit fe6669d813
6 changed files with 246 additions and 92 deletions

View File

@@ -1,32 +0,0 @@
import request from '@/utils/request';
/**
* 上传文件
*
* @param file
*/
export function uploadFile(file: File) {
const formData = new FormData();
formData.append('file', file);
return request({
url: '/api/v1/files',
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data'
}
});
}
/**
* 删除文件
*
* @param path
*/
export function deleteFile(path?: string) {
return request({
url: '/api/v1/files',
method: 'delete',
params: { path: path }
});
}