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