123456789101112131415161718192021222324252627282930 |
- 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.tempFilePath,
- 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
|