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