📖 CRM:code review 前端直接上传

This commit is contained in:
YunaiV 2024-02-17 20:35:35 +08:00
parent ffeaa891df
commit d3fab9a0fd
3 changed files with 6 additions and 6 deletions

View File

@ -27,10 +27,10 @@ export const deleteFile = (id: number) => {
}
// 获取文件预签名地址
export const getFilePresignedUrl = (fileName: string) => {
export const getFilePresignedUrl = (path: string) => {
return request.get<FilePresignedUrlRespVO>({
url: '/infra/file/presigned-url',
params: { fileName }
params: { path }
})
}

View File

@ -20,7 +20,7 @@ export const useUpload = () => {
const presignedInfo = await FileApi.getFilePresignedUrl(fileName)
// 1.3 上传文件(不能使用 ElUpload 的 ajaxUpload 方法的原因:其使用的是 FormData 上传Minio 不支持)
return axios.put(presignedInfo.uploadUrl, options.file).then(() => {
// 1.4. 记录文件信息到后端
// 1.4. 记录文件信息到后端(异步)
createFile(presignedInfo, fileName, options.file)
// 通知成功,数据格式保持与后端上传的返回结果一致
return { data: presignedInfo.url }