You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
519 B
JavaScript
24 lines
519 B
JavaScript
import request from '@/utils/request'
|
|
|
|
// api地址
|
|
const api = {
|
|
uploadUrl: 'clientApi/file/upload'
|
|
}
|
|
|
|
// 图片上传
|
|
export const image = (files) => {
|
|
// 文件上传大小, 2M
|
|
const maxSize = 1024 * 1024 * 2;
|
|
// 执行上传
|
|
return new Promise((resolve, reject) => {
|
|
request.urlFileUpload({ files, maxSize })
|
|
.then(result => {
|
|
const fileIds = result.map(item => {
|
|
return item.data;
|
|
})
|
|
resolve(fileIds, result)
|
|
})
|
|
.catch(err => reject(err))
|
|
})
|
|
}
|