提交 b93a1a7e 编写于 作者: guangjun.yang's avatar guangjun.yang

被接管时,监听上报

上级 2fa15ef8
此差异已折叠。
......@@ -152,6 +152,8 @@ export default {
if (this.isWechat) {
const player = document.getElementById(this.vid);
player.addEventListener("timeupdate", this.onTimeUpdate, false);
player.addEventListener("play", this.onPlay, false);
player.addEventListener("pause", this.onPause, false);
this.player = player;
}
},
......@@ -165,6 +167,15 @@ export default {
}
},
methods: {
// 被接管时,监听上报
onPlay() {
this.reportOnOff(1);
this.isPaused = false;
},
onPause() {
this.reportOnOff(2);
this.isPaused = true;
},
togglePlay() {
if (!this.logged) {
this.$store.dispatch('goLogin');
......@@ -186,7 +197,7 @@ export default {
} else {
this.player.pause();
}
this.reportOnOff(isPaused ? 1 : 2);
// this.reportOnOff(isPaused ? 1 : 2); // 使用监听发送
this.isPaused = !isPaused;
},
// 切换视频
......@@ -220,7 +231,9 @@ export default {
if (!this.isPaused && !this.finish) {
this.reportOnOff(2);
}
this.reportLeave();
if (!this.finish) {
this.reportLeave();
}
if (this.playTime === 0) {
this.player.play();
}
......@@ -384,6 +397,7 @@ export default {
if (!this.provedOver) {
this.$emit('onVideoEnd', { type: 2 });
this.reportOnOff(2);
this.reportLeave();
}
this.finish = true;
this.showReplay = true;
......@@ -398,6 +412,7 @@ export default {
this.player.style.display = 'none';
}
this.reportOnOff(2);
this.reportLeave();
this.$nextTick(() => {
if (this.coverType > 0 && this.coverType !== 13) {
this.isFullScreen = false;
......@@ -419,7 +434,7 @@ export default {
if (!chapterId || !courseId || !lectureId) {
return;
}
this.POST('/contents/files/resourceRecord', {
this.POST('contents/files/resourceRecord', {
fileType: 1,
resourceInfo1: courseId,
resourceInfo2: chapterId,
......@@ -439,7 +454,7 @@ export default {
if (!chapterId || !courseId || !lectureId) {
return;
}
this.POST('/contents/joinCourse/', {
this.POST('contents/joinCourse/', {
requestList: [{
chapterId,
courseId,
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册