提交 c05851b2 authored 作者: pengxiaohui's avatar pengxiaohui 提交者: 王鹏飞

增加视频分享功能

上级 6a8ce330
......@@ -186,3 +186,22 @@ export function getChapterHomeworkOtherAll(semesterId, courseId, chapterId, para
export function addChapterHomeworkComment(data) {
return httpRequest.post('/api/lms/v2/education/homeworks/comment', data)
}
/**
* 我收到的评论
* @param {string} semesterId 学期ID
* @param {string} courseId 课程ID
* @param {string} chapterId 章节ID
*/
export function getChapterHomeworkComment(params) {
return httpRequest.get('/api/lms/v2/education/homeworks/fmcomment', params)
}
/**
* 获取营销数据
* @param {string} semesterId 学期ID
* @param {string} courseId 课程ID
* @param {string} chapterId 章节ID
*/
export function getShare(params) {
return httpRequest.get(`/api/lms/v3/activities/share/${params.semester_id}/${params.course_id}/${params.chapter_id}`)
}
......@@ -10,6 +10,7 @@
:video="chatperResources.video"
@timeupdate="onTimeupdate"
@ready="onReady"
@ended="onEnded"
ref="videoPlayer"
></video-player>
</div>
......@@ -151,6 +152,22 @@ export default {
this.player.seek(this.progress.cpt)
}
},
// 视频播放完毕
onEnded() {
const params = {
semester_id: this.sid,
course_id: this.cid,
chapter_id: this.chapter.id
}
api.getShare(params).then(res => {
if (res.code === 0) {
if (res.data.need_share) {
const url = `https://webapp-pub.ezijing.com/website/prod/share/index.html#/share?semesterId=${params.semester_id}&courseId=${params.course_id}&chapterId=${params.chapter_id}`
window.open(url)
}
}
})
},
// 当前播放时间更新
onTimeupdate(time) {
time = Math.floor(time)
......
......@@ -70,6 +70,9 @@ export default {
}
console.log(event)
})
player.on('ended', function () {
_this.$emit('ended')
})
}
)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论