const _my = require("../../__antmove/api/index.js")(my);
const wx = _my;
const { baseUrl } = require("../../utils/func/request");

//单视频上传 file为上传文件暂存地址对象
const api = "/upload/video";
const upload_video = file => {
    return new Promise(reslove => {
        wx.uploadFile({
            url: baseUrl + api,
            filePath: file.url,
            name: "file",
            success(res) {
                reslove({
                    ...file,
                    url: JSON.parse(res.data).data,
                    relative_url: JSON.parse(res.data).data
                });
            },
            fail(err) {
                wx.showToast({
                    title: "视频上传失败",
                    icon: "none"
                });
            }
        });
    });
};
module.exports = upload_video;
