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.
57 lines
1.3 KiB
57 lines
1.3 KiB
import request from '@/utils/request'
|
|
|
|
// api地址
|
|
const api = {
|
|
image: 'upload/image',
|
|
goods_detail_image:'upload/image',
|
|
}
|
|
// 图片上传
|
|
export const goods_detail_image = (files) => {
|
|
// 文件上传大小, 2M
|
|
const maxSize = 1024 * 1024 * 20000
|
|
// 执行上传
|
|
return new Promise((resolve, reject) => {
|
|
request.urlFileUpload({ files, maxSize })
|
|
.then(result => {
|
|
const fileIds = result.map(item => {
|
|
return item.data.fileInfo.preview_url
|
|
})
|
|
resolve(fileIds, result)
|
|
})
|
|
.catch(reject)
|
|
})
|
|
}
|
|
// 图片上传
|
|
export const image = (files) => {
|
|
// 文件上传大小, 2M
|
|
const maxSize = 1024 * 1024 * 20000
|
|
// 执行上传
|
|
return new Promise((resolve, reject) => {
|
|
request.urlFileUpload({ files, maxSize })
|
|
.then(result => {
|
|
const fileIds = result.map(item => {
|
|
return item.data.fileInfo.file_id
|
|
})
|
|
resolve(fileIds, result)
|
|
})
|
|
.catch(reject)
|
|
})
|
|
}
|
|
|
|
|
|
|
|
export const images = (files) => {
|
|
// 文件上传大小, 2M
|
|
const maxSize = 1024 * 1024 * 20000
|
|
// 执行上传
|
|
return new Promise((resolve, reject) => {
|
|
request.urlFileUpload({ files, maxSize })
|
|
.then(result => {
|
|
const fileIds = result.map(item => {
|
|
return item.data.fileInfo
|
|
})
|
|
resolve(fileIds, result)
|
|
})
|
|
.catch(reject)
|
|
})
|
|
}
|