提交 1a6ea8e1 编写于 作者: guofeng.chen's avatar guofeng.chen

修改无视频时报错

上级 39535c8c
...@@ -143,9 +143,11 @@ export default { ...@@ -143,9 +143,11 @@ export default {
this.isWechat = ua.match(/(MicroMessenger)\/([\d.]+)/); this.isWechat = ua.match(/(MicroMessenger)\/([\d.]+)/);
}, },
mounted() { mounted() {
const player = document.getElementById(this.vid); if (this.isWechat) {
player.addEventListener("timeupdate", this.onTimeUpdate, false); const player = document.getElementById(this.vid);
this.player = player; player.addEventListener("timeupdate", this.onTimeUpdate, false);
this.player = player;
}
}, },
beforeDestroy() { beforeDestroy() {
this.timer && clearTimeout(this.timer); this.timer && clearTimeout(this.timer);
...@@ -187,6 +189,9 @@ export default { ...@@ -187,6 +189,9 @@ export default {
}, },
// 切换视频 // 切换视频
switchUrl(opts = {}) { switchUrl(opts = {}) {
if (!this.isWechat) {
return;
}
const { url = '', poster = '', proved = 0, history = 0, enable = true } = opts; const { url = '', poster = '', proved = 0, history = 0, enable = true } = opts;
this.loaded = false; this.loaded = false;
this.player.src = url; this.player.src = url;
...@@ -205,6 +210,9 @@ export default { ...@@ -205,6 +210,9 @@ export default {
}, },
// 切换并播放 // 切换并播放
switchUrlAndPlay(opts = {}) { switchUrlAndPlay(opts = {}) {
if (!this.isWechat) {
return;
}
if (!this.isPaused && !this.finish) { if (!this.isPaused && !this.finish) {
this.reportOnOff(2); this.reportOnOff(2);
} }
......
...@@ -149,11 +149,11 @@ export default { ...@@ -149,11 +149,11 @@ export default {
if (token && !info.id) { if (token && !info.id) {
this.$store.dispatch('getUserInfo'); this.$store.dispatch('getUserInfo');
} }
this.projectId = sessionStorage.getItem('projectId'); // this.projectId = sessionStorage.getItem('projectId');
if (!this.projectId) { // if (!this.projectId) {
this.$router.replace('/not-found'); // this.$router.replace('/not-found');
return; // return;
} // }
this.getCourseInfo(); this.getCourseInfo();
this.getCourseQas(); this.getCourseQas();
const { height } = this.$el.querySelector('.video-box').getBoundingClientRect(); const { height } = this.$el.querySelector('.video-box').getBoundingClientRect();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册