|
@@ -103,6 +103,9 @@
|
|
|
resolveIndex(index) {
|
|
|
this.selectIndex = index || 0;
|
|
|
},
|
|
|
+ catchTapEvent:function(){
|
|
|
+ return false;
|
|
|
+ },
|
|
|
specialChange(index) {
|
|
|
if (this.specialIndex == index) {
|
|
|
return false;
|
|
@@ -165,13 +168,12 @@
|
|
|
if(type==2){
|
|
|
this.initStatus();//重置上传状态到初始值
|
|
|
}
|
|
|
- this.uploadStatus = 0;
|
|
|
- this.peopleIndex = 0; //选中第一个
|
|
|
//上传图片
|
|
|
var file = e.target.files[0];
|
|
|
var fileSize = file.size / 1024 / 1024;
|
|
|
- if (!/\.(MP4|mp4)$/.test(e.target.value)) {
|
|
|
- this.$message.warning('文件片类型必须是MP4');
|
|
|
+ // alert('**文件**' + e.target.value + "-fileName=" + file.name);
|
|
|
+ if (!/\.(MP4|mp4|MOV|mov)$/.test(e.target.value)) {
|
|
|
+ this.$message.warning('文件类型必须是mp4或者mov');
|
|
|
var videoForm = document.getElementById(form); //获取表单对象
|
|
|
videoForm && videoForm.reset(); // 重置表单
|
|
|
return false
|
|
@@ -188,34 +190,67 @@
|
|
|
videoForm && videoForm.reset(); // 重置表单
|
|
|
return false;
|
|
|
}
|
|
|
- let reader = new FileReader();
|
|
|
- reader.onload = (event) => {
|
|
|
- let video = document.createElement('video');
|
|
|
- video.onloadedmetadata = (event) => {
|
|
|
- let duration = video.duration;
|
|
|
- let width = video.videoWidth;
|
|
|
- let height = video.videoHeight;
|
|
|
- // this.videoWidth = width;
|
|
|
- // this.videoHeight = height;
|
|
|
- console.warn('视频时长:', duration,this.stopFlag);
|
|
|
- console.warn('视频尺寸:x:', width, 'y:', height);
|
|
|
- if (duration > 20) {
|
|
|
- this.$message.warning('您的上传的视频过长,请低于20s');
|
|
|
- var videoForm = document.getElementById(form); //获取表单对象
|
|
|
- videoForm && videoForm.reset(); // 重置表单
|
|
|
- return false
|
|
|
- }else{
|
|
|
- if(!this.stopFlag){
|
|
|
- var item = {};
|
|
|
- item.file = file;
|
|
|
- console.warn("***uploadImgObj***",file)
|
|
|
- this.uploadMaterielFile(item, form); //正常上传图片
|
|
|
+ if(this.$parent.isIOS){//IOS则直接上传
|
|
|
+ // let reader = new FileReader();
|
|
|
+ // reader.onload = (event) => {
|
|
|
+ // alert("onloadedmetadata0")
|
|
|
+ // let video = document.getElementById('videoPlayer');
|
|
|
+ // video.setAttribute("crossOrigin", "Anonymous");
|
|
|
+ // video.src = event.target.result;
|
|
|
+ // video.controls = false;
|
|
|
+ // video.autoplay = true;
|
|
|
+ // video.preload = 'auto';
|
|
|
+ // video.setAttribute('webkit-playsinline', true);
|
|
|
+ // video.setAttribute('playsinline', true);
|
|
|
+ // video.load();
|
|
|
+ // // video.play();
|
|
|
+ // video.onloadedmetadata = (event) => {
|
|
|
+ // alert("onloadedmetadata1")
|
|
|
+ // if(!this.stopFlag){
|
|
|
+ // var item = {};
|
|
|
+ // item.file = file;
|
|
|
+ // console.warn("***uploadImgObj***",file)
|
|
|
+ // this.uploadMaterielFile(item, form); //正常上传图片
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // reader.readAsDataURL(file);
|
|
|
+ if(!this.stopFlag){
|
|
|
+ var item = {};
|
|
|
+ item.file = file;
|
|
|
+ console.warn("***uploadImgObj***",file)
|
|
|
+ this.uploadMaterielFile(item, form); //正常上传图片
|
|
|
+ }
|
|
|
+ }else{//安卓
|
|
|
+ let reader = new FileReader();
|
|
|
+ reader.onload = (event) => {
|
|
|
+ let video = document.createElement('video');
|
|
|
+ video.onloadedmetadata = (event) => {
|
|
|
+ let duration = video.duration;
|
|
|
+ let width = video.videoWidth;
|
|
|
+ let height = video.videoHeight;
|
|
|
+ // this.videoWidth = width;
|
|
|
+ // this.videoHeight = height;
|
|
|
+ console.warn('视频时长:', duration,this.stopFlag);
|
|
|
+ console.warn('视频尺寸:x:', width, 'y:', height);
|
|
|
+ if (duration > 20) {
|
|
|
+ this.$message.warning('您的上传的视频过长,请低于20s');
|
|
|
+ var videoForm = document.getElementById(form); //获取表单对象
|
|
|
+ videoForm && videoForm.reset(); // 重置表单
|
|
|
+ return false
|
|
|
+ }else{
|
|
|
+ if(!this.stopFlag){
|
|
|
+ var item = {};
|
|
|
+ item.file = file;
|
|
|
+ console.warn("***uploadImgObj***",file)
|
|
|
+ this.uploadMaterielFile(item, form); //正常上传图片
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
+ video.src = event.target.result;
|
|
|
};
|
|
|
- video.src = event.target.result;
|
|
|
- };
|
|
|
- reader.readAsDataURL(file);
|
|
|
+ reader.readAsDataURL(file);
|
|
|
+ }
|
|
|
},
|
|
|
//视频上传进度处理
|
|
|
uploadProgress(e){
|
|
@@ -277,6 +312,8 @@
|
|
|
}
|
|
|
},
|
|
|
async uploadMaterielFile(item, form) {
|
|
|
+ this.uploadStatus = 0;
|
|
|
+ this.peopleIndex = 0; //选中第一个
|
|
|
if(this.stopFlag){
|
|
|
return false;
|
|
|
}
|
|
@@ -358,6 +395,7 @@
|
|
|
this.leftList[0].width = single.widthHeight.split('x')[0],
|
|
|
this.leftList[0].height = single.widthHeight.split('x')[1],
|
|
|
this.uploadStatus = 3;//处理完毕
|
|
|
+ // alert("***virtualBg***"+single.virtualBg);
|
|
|
this.stopInterval();//停止轮询
|
|
|
if(this.peopleIndex==0 && this.tabIndex==0){//如果当前在个人形象上,则替换视频
|
|
|
this.addRealVideo();
|