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

72 lines
1.5 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
})
}
/**
*
*/
2024-09-18 15:52:50 +08:00
export const downloadFile = (filePath: any) => {
// let form = new FormData()
// form.append('filePath', filePath)
2024-03-08 10:33:06 +08:00
return createAxios({
url: SYSTEM_PREFIX + '/file/download',
2024-09-18 15:52:50 +08:00
method: 'GET',
params: filePath,
responseType: 'blob'
2024-03-08 10:33:06 +08:00
})
}
/**
* url展示
*/
export const getFileUrl = (filePath: string) => {
let form = new FormData()
form.append('filePath', filePath)
return createAxios({
url: SYSTEM_PREFIX + '/file/getFileUrl',
method: 'POST'
})
2024-05-14 08:51:30 +08:00
}
/**
* url及文件名
*/
export const getFileNameAndFilePath = (query: any) => {
return createAxios({
2024-09-18 15:52:50 +08:00
url: SYSTEM_PREFIX + '/file/getFileVO',
2024-05-14 08:51:30 +08:00
method: 'GET',
2024-09-18 15:52:50 +08:00
params: query
2024-05-14 08:51:30 +08:00
})
2024-09-18 15:52:50 +08:00
}