12345678910111213141516171819202122232425262728 |
- const _my = require("../../__antmove/api/index.js")(my);
- const wx = _my;
- const { baseUrl } = require("../request/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: baseUrl + "/" + JSON.parse(res.data).data,
- relative_url: JSON.parse(res.data).data
- });
- },
- fail(err) {
- wx.showToast({
- title: "视频上传没有成功哦,再试一次吧~"
- });
- }
- });
- });
- };
- module.exports = upload_video;
|