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.
yanzong_qianduan/api/upload.js

18 lines
538 B

11 months ago
import request from '@/utils/request'
// api地址
const api = {
image: 'upload/image'
}
// 图片上传
export const image = (files, checkLogin = true) => {
6 months ago
// 文件上传大小, 5M
const maxSize = 1024 * 1024 * 5
11 months ago
// 执行上传
return new Promise((resolve, reject) => {
6 months ago
request.urlFileUpload({ name: 'file', files, maxSize, data: { filename: files[0].name, test: 123, checkLogin: Number(checkLogin) } })
11 months ago
.then(result => resolve(result.map(item => item.data.fileInfo.file_id), result))
.catch(reject)
})
}