提交 f7cb574b authored 作者: pengxiaohui's avatar pengxiaohui

增加视频分享功能

上级 6a12b8e5
......@@ -196,3 +196,12 @@ export function addChapterHomeworkComment(data) {
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}`)
}
......@@ -9,6 +9,7 @@
:video="chatperResources.video"
@timeupdate="onTimeupdate"
@ready="onReady"
@ended="onEnded"
ref="videoPlayer"
></video-player>
</div>
......@@ -150,6 +151,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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论