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

Merge branch 'dev-coursedetail-0817' of...

Merge branch 'dev-coursedetail-0817' of http://192.168.110.53/com.pica.cloud.education.frontend/pica-professional-exam into dev-coursedetail-0817

* 'dev-coursedetail-0817' of http://192.168.110.53/com.pica.cloud.education.frontend/pica-professional-exam:
  修改显示
  修改视频
......@@ -51,6 +51,7 @@ export default {
line-height: 14px;
display: flex;
flex-direction: row;
white-space: nowrap;
span {
font-size: 16px;
color: #676869;
......
......@@ -141,6 +141,7 @@ export default {
this.vid = `video_${this._uid}`;
const ua = navigator.userAgent;
this.isWechat = ua.match(/(MicroMessenger)\/([\d.]+)/);
this.isAndroid = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
},
mounted() {
if (this.isWechat) {
......@@ -172,15 +173,10 @@ export default {
if (this.proved && this.player.currentTime >= this.proved) {
return;
}
this.player.style.display = 'block';
if (isPaused) {
this.player.play();
if (this.opts.proved > 0) {
this.showProved = true;
this.provedTimer && clearTimeout(this.provedTimer);
this.provedTimer = setTimeout(() => {
this.showProved = false;
}, 5000)
}
} else {
this.player.pause();
}
......@@ -192,6 +188,7 @@ export default {
if (!this.isWechat) {
return;
}
this.player.style.display = 'block';
const { url = '', poster = '', proved = 0, history = 0, enable = true } = opts;
this.loaded = false;
this.player.src = url;
......@@ -205,6 +202,7 @@ export default {
this.opts = opts;
this.currentTime = null;
this.duration = null;
this.showProved = proved > 0;
this.showReplay = false;
if (this.showError) this.showError = false;
},
......@@ -237,11 +235,14 @@ export default {
},
// 重播
onReplay() {
this.player.style.display = 'block';
this.player.currentTime = 0;
this.player.play();
this.isPaused = false;
this.reportOnOff(1);
this.$emit('onReplay')
this.$emit('onReplay');
this.showReplay = false;
this.provedOver = false;
},
// 加载完毕,获取总时长和音量。问题:移动端点击播放才会触发,且不一定会获取时长
loadedMetaData() {
......@@ -260,10 +261,14 @@ export default {
},
// 播放中
onTimeUpdate(e) {
const { currentTime, duration } = e.target;
// 试看,且超过时间
if (this.proved && currentTime >= this.proved) {
this.provedEnd();
}
if (this.provedOver) {
return
}
const { currentTime, duration } = e.target;
if (currentTime) {
this.playTime = this.formatTime(currentTime);
}
......@@ -275,10 +280,6 @@ export default {
if (currentTime < 0.1 && !this.loaded) {
this.loadedMetaData();
}
// 试看,且超过时间
if (this.proved && currentTime >= this.proved) {
this.provedEnd();
}
},
// 设置进度条位置
setBarPosition(percent, target) {
......@@ -311,6 +312,7 @@ export default {
this.setBarPosition(percent, 'progressBar');
this.player.currentTime = percent * duration / 100;
if (this.isPaused) {
this.player.style.display = 'block';
this.player.play();
this.isPaused = false;
this.reportOnOff(1);
......@@ -360,17 +362,26 @@ export default {
},
// 试看结束
provedEnd() {
this.provedOver = true;
this.player.pause();
this.player.currentTime = this.proved;
if (this.isAndroid) {
this.player.style.display = 'none';
}
if (!this.provedOver) {
this.$emit('onVideoEnd', { type: 2 });
this.reportOnOff(2);
}
this.finish = true;
this.showReplay = true;
this.reportOnOff(2);
this.provedOver = true;
},
// 播放结束
onEnded() {
this.$emit('onVideoEnd', { type: 1 });
this.finish = true;
if (this.isAndroid) {
this.player.style.display = 'none';
}
this.reportOnOff(2);
},
onError() {
......
......@@ -32,7 +32,7 @@ const user = {
Toast('登录失效,请重新登录~')
}
const res = await fetch({
url: getBaseUrl('/account/login/web'),
url: getBaseUrl('account/login/web'),
method: 'get',
headers: { token: state.token }
}).catch(() => {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册