function getVideoStting(url) { return new Promise((reslove, reject) => { if (url) { wx.showLoading({ title: '保存中', mask: true }) wx.getSetting({ success(res) { wx.downloadFile({ url: url, success: function (res) { console.log(res) var temp = res.tempFilePath wx.saveVideoToPhotosAlbum({ filePath: temp, success: function (res) { reslove(res) }, fail: function (err) { wx.hideLoading() reject(err) } }) }, fail: function (err) { wx.hideLoading() wx.utils.alert('保存失败') } }) }, fail(res) { } }) } else { wx.showLoading({ title: '请稍等', mask: true }) setTimeout(() => { wx.hideLoading() }, 1000) } })}module.exports = { getVideoStting}然后 调用方法就可以啦
挂在到wx
var utils = require('./utils/utils.js'), wx.utils = utils wx.utils.getVideoStting(url).then((){ //成功的逻辑}).catch(()=>{ // 失败后的逻辑})比较简单,有小程序兴趣.疑难.兼职.外包.可以加QQ一起交流 978744151---转载的话记得加上来自来哪!!!!小程序













