const { baseUrl } = require("../../utils/func/request"); //单图片上传 file为上传文件暂存地址对象 const api = '/upload/pictureLocal' const upload_image = (file) => { return new Promise((reslove, reject) => { wx.uploadFile({ url: baseUrl + api, filePath: file.url, name: 'file', success(res) { reslove({ ...file, url: JSON.parse(res.data).data }) }, fail (err) { reject() wx.showToast({ title: '上传没有成功哦,再试一次吧~', icon: 'error' }) } }); }) } module.exports = upload_image