|
@@ -74,6 +74,7 @@
|
|
|
cancelTokenSource:null, //取消上传的操作对象
|
|
|
repeartFlag:false, //防止重复点击
|
|
|
videoSrc:'',
|
|
|
+ subscription:null, //七牛云上传的对象,用于取消上传
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -278,6 +279,9 @@
|
|
|
//上传到七牛云中
|
|
|
async uploadVideolFile(file,form){
|
|
|
var self = this;
|
|
|
+ self.uploadStatus = 1;//上传中
|
|
|
+ self.showPersonView = false;
|
|
|
+ self.addSilhouette();//添加剪影视频
|
|
|
let tokenObj = await requestConfig('getUploadToken', {});//获取上传token
|
|
|
|
|
|
var token = tokenObj.single.token;
|
|
@@ -294,13 +298,11 @@
|
|
|
retryCount: 6,
|
|
|
region: qiniu.region.z0
|
|
|
};
|
|
|
- self.uploadStatus = 1;//上传中
|
|
|
- self.showPersonView = false;
|
|
|
- self.addSilhouette();//添加剪影视频
|
|
|
+
|
|
|
let _name = Math.floor(Math.random()*1000);
|
|
|
var fileName = decodeURIComponent(encodeURIComponent(Date.now() + '/video' +_name )) + tp;
|
|
|
var observable = qiniu.upload(file, fileName, token, putExtra, config);
|
|
|
- var subscription = observable.subscribe(self.next, self.error, async function(res){
|
|
|
+ this.subscription = observable.subscribe(self.next, self.error, async function(res){
|
|
|
let videoUrl = resultUrl + fileName;
|
|
|
let realVideoUrl = 'https://dm.static.elab-plus.com/' + "video" + _name +'_elab.mp4';
|
|
|
console.warn("视频上传七牛成功",videoUrl ,realVideoUrl);
|
|
@@ -422,10 +424,12 @@
|
|
|
this.showPopView = false;//弹出确认框;
|
|
|
this.stopFlag = true;//停止上传标志打开
|
|
|
if(this.uploadStatus == 1){
|
|
|
- this.cancelTokenSource.cancel('上传已取消');//通知取消上传
|
|
|
+ this.subscription && this.subscription.unsubscribe();//上传取消
|
|
|
+ this.cancelTokenSource && this.cancelTokenSource.cancel('上传已取消');//通知取消上传
|
|
|
Toast({
|
|
|
message: '上传已取消',
|
|
|
});
|
|
|
+ this.initStatus();//还原初始状态
|
|
|
}
|
|
|
else if(this.uploadStatus==2 || this.uploadStatus==3){//绿幕抠图中 或者已经完成
|
|
|
let data = {
|
|
@@ -471,6 +475,9 @@
|
|
|
if(this.stopFlag){
|
|
|
return false;
|
|
|
}
|
|
|
+ this.uploadStatus = 1;//上传中
|
|
|
+ this.showPersonView = false;
|
|
|
+ this.addSilhouette();//添加剪影视频
|
|
|
var self = this;
|
|
|
let formData = new FormData();
|
|
|
formData.append('file', item.file);
|
|
@@ -478,9 +485,7 @@
|
|
|
formData.append('userId', this.userId);
|
|
|
console.warn("****uploadMaterielFile**",$config.brandId,this.userId)
|
|
|
// alert("***uploadMaterielFile***"+$config.brandId+this.userId);
|
|
|
- this.uploadStatus = 1;//上传中
|
|
|
- this.showPersonView = false;
|
|
|
- this.addSilhouette();//添加剪影视频
|
|
|
+
|
|
|
let res = await requestConfig('robust_video', formData, true, false,'post',this.uploadProgress,this.cancel)
|
|
|
// alert("***uploadMaterielFile1***"+JSON.stringify(res));
|
|
|
if (axios.isCancel(res)) {//取消上传处理
|