1234567891011121314151617181920212223 |
- 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
|