捕梦者基础前端框架
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
659 B

import axios from '@/utils/request';
/**
* 上传文件
* @param file 文件
*/
export async function uploadFile(file) {
const formData = new FormData();
formData.append('file', file);
const res = await axios.post('/file/upload', formData);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 分页查询文件上传记录
* @param params 查询条件
*/
export async function pageFiles(params) {
const res = await axios.get('/file/page', {
params
});
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}