提交 242a7c96 authored 作者: GOD_ZYX's avatar GOD_ZYX

update

上级 75935c53
......@@ -123,6 +123,8 @@ export default {
destroyed () {
window.removeEventListener('resize', this.resizeVideo)
this.destroyHeartTime()
/* 在定时器 被销毁时,再次执行 定时器,防止 最后几秒没有 被统计上 */
this.hearBeatFunc(10000)
},
watch: {
id: {
......@@ -273,36 +275,40 @@ export default {
}
return r
},
/* 计数器内部执行方法 */
hearBeatFunc (_time) {
if (this.chapterVideo && this.isPlaying) {
if (this._rProgress && this._rProgress.id) {
let _rProgress = this._rProgress
let tempTime = this.videoFlash.lastTime
let _speed = this.videoFlash.speed
let _isSeek = this.videoFlash.isSeek
let _queue = this.videoFlash.queueFrames
/* 拖动进度条,不记录时间 */
if (!_isSeek) {
/* 直接给出 增加定时器 循环定时 的每次 执行传输时间 */
_rProgress.pt += (_time / 1000) * _speed
/* cpt 和 mpt 应该没问题 */
_rProgress.cpt = tempTime
_rProgress.mpt = tempTime > _rProgress.mpt ? tempTime : _rProgress.mpt
_rProgress.ps = _queue
/* 调用接口执行刷新 */
this.$emit('updateProgress', this._rProgress)
}
} else {
this._rProgress = _.assignIn({}, this.chapterVideo.progress)
}
/* 实时监测 - 是否在播放中 */
this.isPlaying = false
}
},
/* 初始化定时器 */
createHeartTime (time) {
let _time = time || 5000
let _time = time || 10000
this.destroyHeartTime()
/* 增加 心跳 记录 视频学习时间 */
this.hearBeat = setInterval(() => {
if (this.chapterVideo && this.isPlaying) {
if (this._rProgress && this._rProgress.id) {
let _rProgress = this._rProgress
let tempTime = this.videoFlash.lastTime
let _speed = this.videoFlash.speed
let _isSeek = this.videoFlash.isSeek
let _queue = this.videoFlash.queueFrames
/* 拖动进度条,不记录时间 */
if (!_isSeek) {
/* 直接给出 增加定时器 循环定时 的每次 执行传输时间 */
_rProgress.pt += (_time / 1000) * _speed
/* cpt 和 mpt 应该没问题 */
_rProgress.cpt = tempTime
_rProgress.mpt = tempTime > _rProgress.mpt ? tempTime : _rProgress.mpt
_rProgress.ps = _queue
/* 调用接口执行刷新 */
this.$emit('updateProgress', this._rProgress)
}
} else {
this._rProgress = _.assignIn({}, this.chapterVideo.progress)
}
/* 实时监测 - 是否在播放中 */
this.isPlaying = false
}
this.hearBeatFunc(_time)
}, _time)
},
/* 消除定时器 */
......
......@@ -366,6 +366,7 @@ export default {
cAction.courseAction.getCourseAssess(this.cid, this.sid).then(json1 => {
let _courseArr = json.tabs1ChapterList.course
/* 进行一次 对照,将 视频 vid 赋值 */
/* BUG: 如果有某一章 都没有视频时,对照失败,从没有的那一章开始,后面全部没有vid */
for (let i = 0; i < json1.video.length; i++) {
let _tmp = json1.video[i].arr
let _tmp1 = _courseArr[i].chapters
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论