Files
admin-sjzx/src/api/system-boot/file.ts

62 lines
1.2 KiB
TypeScript
Raw Normal View History

2024-03-08 10:33:06 +08:00
import createAxios from '@/utils/request'
const SYSTEM_PREFIX = '/system-boot'
/**
*
* @param file
*/
export const uploadFile = (file: any, path: string) => {
let form = new FormData()
form.append('file', file)
form.append('path', path)
return createAxios({
url: SYSTEM_PREFIX + '/file/upload',
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data'
},
data: form
})
}
/**
*
*/
export const deleteFile = (filePath: string) => {
let form = new FormData()
form.append('filePath', filePath)
return createAxios({
url: SYSTEM_PREFIX + '/file/delete',
method: 'POST',
data: form
})
}
/**
*
*/
export const downloadFile = (filePath: string) => {
let form = new FormData()
form.append('filePath', filePath)
return createAxios({
url: SYSTEM_PREFIX + '/file/download',
method: 'GET'
})
}
/**
* url展示
*/
export const getFileUrl = (filePath: string) => {
let form = new FormData()
form.append('filePath', filePath)
return createAxios({
url: SYSTEM_PREFIX + '/file/getFileUrl',
method: 'POST'
})
}