|
@@ -247,7 +247,11 @@ export default {
|
|
|
gradeDetail:{},
|
|
|
needSeek: false, //第一次播放是否需要跳转
|
|
|
needProfileModal:false, //是否需要资料审核弹框
|
|
|
- liveObj:{}
|
|
|
+ liveObj:{},
|
|
|
+ photoNum:0,
|
|
|
+ photoList:[], //拍照的时间点
|
|
|
+ photoConfig:false, //是否配置好拍照次数
|
|
|
+ photoIndex:0 //当前位于拍照的区间下标 从0开始
|
|
|
};
|
|
|
},
|
|
|
computed: { ...mapGetters(['userInfo', 'playSectionId','playChannelId','playVID']) },
|
|
@@ -408,6 +412,96 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
+ getPhotoLastRecord() {
|
|
|
+ let self = this;
|
|
|
+ let data = {
|
|
|
+ sectionId: parseInt(self.playSectionId),
|
|
|
+ goodsId: parseInt(self.goodsId),
|
|
|
+ courseId: parseInt(self.courseId),
|
|
|
+ gradeId: parseInt(self.gradeId)}
|
|
|
+ this.$api.getPhotoLastRecord(data).then(res => {
|
|
|
+ if(res.data.code==200){
|
|
|
+ self.photoIndex = res.data.data //修改图片下标
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ postCoursePhotoRecord() {
|
|
|
+ let currentTime = 0;
|
|
|
+ var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
+ if (polyvPlayerContext) {
|
|
|
+ currentTime = polyvPlayerContext.getCurrentTime();
|
|
|
+ }
|
|
|
+ let self = this;
|
|
|
+ let data = {
|
|
|
+ photo: self.ossAvatarUrl,
|
|
|
+ sectionId: parseInt(self.playSectionId),
|
|
|
+ goodsId: parseInt(self.goodsId),
|
|
|
+ courseId: parseInt(self.courseId),
|
|
|
+ photoTime: parseInt(currentTime > 0 ? currentTime : 0),
|
|
|
+ gradeId: parseInt(self.gradeId),
|
|
|
+ photoIndex: parseInt(self.photoIndex),
|
|
|
+ photoNum:parseInt(self.photoNum)
|
|
|
+ };
|
|
|
+ console.log('提交接口', data);
|
|
|
+ this.$api.coursePhotoRecord(data).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ randomNum(minNum,maxNum){
|
|
|
+ switch(arguments.length){
|
|
|
+ case 1:
|
|
|
+ return parseInt(Math.random()*minNum+1,10);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ configPhoto(){
|
|
|
+ var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
+ let totalVideoTime = polyvPlayerContext.getDuration()
|
|
|
+ let duration = polyvPlayerContext.getCurrentTime()
|
|
|
+ if(!this.photoConfig){
|
|
|
+ this.photoConfig = true
|
|
|
+ let spaceTime = Math.floor(totalVideoTime/this.photoNum) //拍照时间区间
|
|
|
+ if(spaceTime<5){//区间小于5秒
|
|
|
+ this.photoNum = Math.floor(totalVideoTime/5)
|
|
|
+ spaceTime = 5
|
|
|
+ }
|
|
|
+ if(this.photoNum<1){
|
|
|
+ this.photoNum = 1 //只要设置,至少拍一次
|
|
|
+ spaceTime = totalVideoTime
|
|
|
+ }
|
|
|
+ let initSpace = 2
|
|
|
+ for(let i=0;i<this.photoNum;i++){
|
|
|
+ let s = this.randomNum(initSpace,initSpace+spaceTime)
|
|
|
+ if(s>totalVideoTime){
|
|
|
+ s = totalVideoTime-1
|
|
|
+ }
|
|
|
+ this.photoList.push(s)
|
|
|
+ initSpace+=spaceTime
|
|
|
+ }
|
|
|
+ console.log(this.photoList,7856)
|
|
|
+ console.log(duration,7856)
|
|
|
+ //兼容已有观看历史
|
|
|
+ for(let i=0;i<this.photoList.length-1;i++){
|
|
|
+ if(this.photoList[i]<duration&&this.photoList[i+1]>duration){
|
|
|
+ this.photoIndex = i
|
|
|
+ break
|
|
|
+ }
|
|
|
+ if(duration>this.photoList[this.photoList.length-1]){
|
|
|
+ this.photoIndex = this.photoList.length-1 //取最后一个下标
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(this.photoIndex,"已o")
|
|
|
+ }
|
|
|
+ },
|
|
|
getLiveUid(channelId) {
|
|
|
let self = this;
|
|
|
return new Promise(resolve => {
|
|
@@ -423,9 +517,13 @@ export default {
|
|
|
if (plv != null) {
|
|
|
if(this.livePlay){
|
|
|
this.liveDuration = this.liveDuration +1.5 //每隔1.5秒
|
|
|
- if(this.liveDuration==6){
|
|
|
- this.openPhoto();
|
|
|
- console.log(this.playSectionId,"实体")
|
|
|
+ if(this.liveDuration==1.5){ //第6秒拍照
|
|
|
+ if(this.goodsPhotographConfig){
|
|
|
+ if(this.goodsPhotographConfig.livephotograph==1){
|
|
|
+ //开启直播拍照
|
|
|
+ this.openPhoto();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -577,8 +675,7 @@ export default {
|
|
|
this.needSeek = true; //需要跳转到播放记录
|
|
|
}
|
|
|
this.startStatus = true;
|
|
|
- console.log(this.vid,78559)
|
|
|
- console.log(this.startStatus,78559)
|
|
|
+
|
|
|
//获取节笔记
|
|
|
this.getNoteList();
|
|
|
},
|
|
@@ -867,30 +964,36 @@ export default {
|
|
|
let self = this;
|
|
|
var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
if (polyvPlayerContext != null) {
|
|
|
- let PlayCurrentTime = polyvPlayerContext.getVideoPlayDuration();
|
|
|
- this.studyDuration = PlayCurrentTime;
|
|
|
- if (this.currentTime < PlayCurrentTime) {
|
|
|
- this.playTime += PlayCurrentTime - this.currentTime;
|
|
|
- this.currentTime = PlayCurrentTime;
|
|
|
- } else {
|
|
|
- this.currentTime = PlayCurrentTime;
|
|
|
- }
|
|
|
+
|
|
|
+ this.playTime = polyvPlayerContext.getCurrentTime() //播放时刻
|
|
|
//判断是否需要拍照
|
|
|
- if (this.intervalTimeList.length > this.intervalTimeIndex) {
|
|
|
- let photoTime = Number(this.intervalTimeList[this.intervalTimeIndex]) * 60; //获取拍照秒数
|
|
|
- if (photoTime < this.playTime) {
|
|
|
- //启动拍照
|
|
|
- //暂停
|
|
|
- polyvPlayerContext.exitFullScreen();
|
|
|
- polyvPlayerContext.pause();
|
|
|
- this.openPhoto();
|
|
|
- this.intervalTimeIndex++;
|
|
|
+ if (this.photoNum > 0) {
|
|
|
+ this.configPhoto()
|
|
|
+ if(this.photoIndex<this.photoList.length){
|
|
|
+ let photoTime = Number(this.photoList[this.photoIndex]); //获取拍照秒数
|
|
|
+ let nextIndex = this.photoIndex+1
|
|
|
+ let nextTime = 0
|
|
|
+ if(nextIndex<this.photoList.length){
|
|
|
+ nextTime = Number(this.photoList[nextIndex]); //获取下次拍照秒数
|
|
|
+ }
|
|
|
+ if (photoTime < this.playTime) {
|
|
|
+ //启动拍照
|
|
|
+ //暂停
|
|
|
+ polyvPlayerContext.exitFullScreen();
|
|
|
+ polyvPlayerContext.pause();
|
|
|
+ this.openPhoto();
|
|
|
+ this.photoIndex++;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
onStateChange(newstate, oldstate) {
|
|
|
if (newstate.detail.newstate == 'playing') {
|
|
|
+ //获取拍照历史
|
|
|
+ this.getPhotoLastRecord()
|
|
|
if (this.needSeek) {
|
|
|
var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
polyvPlayerContext.seek(this.recordObj.studyDuration);
|
|
@@ -924,6 +1027,7 @@ export default {
|
|
|
},
|
|
|
async submit() {
|
|
|
const waitYS = await this.imageInfos();
|
|
|
+ this.postCoursePhotoRecord()
|
|
|
this.postStudyRecord(); //提交记录
|
|
|
//恢复播放
|
|
|
var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
@@ -988,8 +1092,9 @@ export default {
|
|
|
}
|
|
|
if (self.goodsData.goodsPhotographConfig) {
|
|
|
self.goodsPhotographConfig = JSON.parse(self.goodsData.goodsPhotographConfig);
|
|
|
- if (self.goodsPhotographConfig.intervalTime) {
|
|
|
- self.intervalTimeList = self.goodsPhotographConfig.intervalTime.split(',');
|
|
|
+ if (self.goodsPhotographConfig.photoNum>0) {
|
|
|
+ self.photoNum = self.goodsPhotographConfig.photoNum
|
|
|
+ console.log(self.photoNum,777777)
|
|
|
}
|
|
|
}
|
|
|
});
|