日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ios微信本地视频上传到服务器,ios本地视频wx.uploadFile上传

發(fā)布時間:2023/12/20 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ios微信本地视频上传到服务器,ios本地视频wx.uploadFile上传 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

//上傳視頻

uploadVideo:function(){

let _this = this;

let list = ['camera', 'album'];

wx.showActionSheet({

itemList: ['拍攝視頻','從相冊選擇視頻','從視頻庫選擇視頻'],

success: function (res) {

if(res.tapIndex==0 || res.tapIndex==1){

wx.chooseVideo({

sourceType:[list[res.tapIndex]],

compressed:true,

maxDuration:app.globalData.isIos?60:180,

success:function(res){

_this.videoLink=null;

_this.setData({

videoUp:0

});

// 視頻上傳狀態(tài)

_this.videoUpStatus = true;

const uploadTask = wx.uploadFile({

url: app.globalData.baseUrl+'?r=mpupfile',

filePath: res.tempFilePath,

name: 'video',

header: {

'token': app.globalData.token,

'content-type': 'multipart/form-data'

},

formData:{

"test":"test"

},

success: function (res) {

console.log(res,'===')

let dat? = JSON.parse(res.data)

if(dat.code==1 && dat.data){

wx.showToast({

title: '上傳成功',

icon: 'none',

mask:true,

duration:2000

})

_this.setData({

videoLink:dat.data

})

}else if(dat.code==0){

wx.showToast({

title: dat.msg?dat.msg:'上傳失敗',

icon: 'none',

mask:true,

duration:2000

})

}

},

fail: function (err) {

wx.showToast({

title: '網(wǎng)絡(luò)出錯',

icon: 'none',

mask:true,

duration:2000

})

},

complete:function(){

_this.videoUpStatus = false;

}

})

uploadTask.onProgressUpdate((res) => {

_this.setData({

videoUp:res.progress

})

})

}

,fail:function(err){

console.log('選擇沒有用')

}

})

}else{

}

}

,fail:function(err){

console.log('fail',err)

}

})

},

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結(jié)

以上是生活随笔為你收集整理的ios微信本地视频上传到服务器,ios本地视频wx.uploadFile上传的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。