|
@@ -17,6 +17,7 @@
|
|
|
:autoplay="autoplay"
|
|
|
:isAllowSeek="isAllowSeek"
|
|
|
:playbackRate="playbackRate"
|
|
|
+ :startTime="startTime"
|
|
|
></polyv-player>
|
|
|
</view>
|
|
|
<view>
|
|
@@ -229,7 +230,9 @@ export default {
|
|
|
ctxValue:'',
|
|
|
noteList:[],
|
|
|
noteValue:'',
|
|
|
- noteId:0
|
|
|
+ noteId:0,
|
|
|
+ recordObj:0,
|
|
|
+ needSeek:false //第一次播放是否需要跳转
|
|
|
};
|
|
|
},
|
|
|
onUnload() {},
|
|
@@ -254,7 +257,23 @@ export default {
|
|
|
|
|
|
},
|
|
|
mounted() {
|
|
|
+ eventHub.$on('changeSection', oldSectionId => {
|
|
|
+ this.ossAvatarUrl = ""
|
|
|
+ this.postStudyRecord(0,oldSectionId)
|
|
|
+ });
|
|
|
eventHub.$on('getSection', item => {
|
|
|
+ this.playVideo(item)
|
|
|
+ });
|
|
|
+ eventHub.$on('levelId', item => {
|
|
|
+ let arr = item.split('-')
|
|
|
+ //点击节获取的各层级ID
|
|
|
+ this.moduleId = arr[0]
|
|
|
+ this.chapterId = arr[1]
|
|
|
+ console.log(item,99)
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async playVideo(item){
|
|
|
if(this.timer){
|
|
|
clearInterval(this.timer);
|
|
|
}
|
|
@@ -265,20 +284,31 @@ export default {
|
|
|
}else{
|
|
|
this.vid = item.recordingUrl
|
|
|
}
|
|
|
+ this.recordObj = await this.getRecordLast();
|
|
|
+ if(this.recordObj.studyDuration){
|
|
|
+ this.needSeek = true //需要跳转到播放记录
|
|
|
+ }
|
|
|
+ console.log(this.startTime,789)
|
|
|
this.startStatus = true
|
|
|
- this.startTime = 0
|
|
|
+
|
|
|
//获取节笔记
|
|
|
this.getNoteList()
|
|
|
- });
|
|
|
- eventHub.$on('levelId', item => {
|
|
|
- let arr = item.split('-')
|
|
|
- //点击节获取的各层级ID
|
|
|
- this.moduleId = arr[0]
|
|
|
- this.chapterId = arr[1]
|
|
|
- console.log(item,99)
|
|
|
- });
|
|
|
- },
|
|
|
- methods: {
|
|
|
+ },
|
|
|
+ getRecordLast(){
|
|
|
+ let self = this
|
|
|
+ return new Promise(resolve=>{
|
|
|
+ let data = {
|
|
|
+ gradeId:self.gradeId,
|
|
|
+ goodsId:self.goodsId,
|
|
|
+ sectionId:self.playSectionId,
|
|
|
+ courseId: self.courseId,
|
|
|
+ }
|
|
|
+ self.$api.recordLast(data).then(res => {
|
|
|
+ resolve(res.data.data)
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
jumpNote(item){
|
|
|
this.noteId = item.noteId
|
|
|
this.$u.toast('即将跳到笔记位置');
|
|
@@ -297,7 +327,7 @@ export default {
|
|
|
this.$u.toast('请输入内容');
|
|
|
retun
|
|
|
}
|
|
|
- var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
+ var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
let noteDate = this.$method.getZeroTime()
|
|
|
let noteSecond= polyvPlayerContext.getCurrentTime()
|
|
|
if(!noteSecond){
|
|
@@ -312,7 +342,6 @@ export default {
|
|
|
noteText:this.noteValue,
|
|
|
noteDate:noteDate,
|
|
|
noteSecond:noteSecond}
|
|
|
- console.log(data,66)
|
|
|
this.$api.postNote(data).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
|
this.$u.toast('发布成功');
|
|
@@ -373,14 +402,19 @@ export default {
|
|
|
}
|
|
|
this.postAnswer()
|
|
|
},
|
|
|
- postStudyRecord(status=0) {
|
|
|
+ postStudyRecord(status=0,sectionId=self.playSectionId) {
|
|
|
+ let currentTime = 0
|
|
|
+ var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
+ if(polyvPlayerContext){
|
|
|
+ currentTime =polyvPlayerContext.getCurrentTime()
|
|
|
+ }
|
|
|
let self = this;
|
|
|
let data = {
|
|
|
photo:self.ossAvatarUrl,
|
|
|
- sectionId:parseInt(self.playSectionId),
|
|
|
+ sectionId:parseInt(sectionId),
|
|
|
goodsId:parseInt(self.goodsId),
|
|
|
courseId:parseInt(self.courseId),
|
|
|
- studyDuration:parseInt(self.studyDuration),
|
|
|
+ studyDuration:parseInt(currentTime>0?currentTime:self.studyDuration),
|
|
|
gradeId:parseInt(self.gradeId),
|
|
|
chapterId:parseInt(self.chapterId),
|
|
|
moduleId:parseInt(self.moduleId)
|
|
@@ -481,7 +515,7 @@ export default {
|
|
|
let self = this
|
|
|
var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
if (polyvPlayerContext != null) {
|
|
|
- let PlayCurrentTime = polyvPlayerContext.getCurrentTime();
|
|
|
+ let PlayCurrentTime = polyvPlayerContext.getVideoPlayDuration();
|
|
|
this.studyDuration = PlayCurrentTime
|
|
|
if(this.currentTime<PlayCurrentTime){
|
|
|
this.playTime+=(PlayCurrentTime-this.currentTime)
|
|
@@ -505,7 +539,14 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onStateChange(newstate, oldstate) {
|
|
|
+ console.log(newstate,6989)
|
|
|
if (newstate.detail.newstate == 'playing') {
|
|
|
+ if(this.needSeek){
|
|
|
+ var polyvPlayerContext = this.selectComponent('#playerVideo');
|
|
|
+ polyvPlayerContext.seek(this.recordObj.studyDuration)
|
|
|
+ polyvPlayerContext.play()
|
|
|
+ this.needSeek = false
|
|
|
+ }
|
|
|
//开始播放
|
|
|
if(this.timer){
|
|
|
clearInterval(this.timer);
|
|
@@ -569,6 +610,7 @@ export default {
|
|
|
this.$api.goodsDetail(this.goodsId).then(res => {
|
|
|
self.goodsData = res.data.data;
|
|
|
self.gradeId = self.goodsData.gradeId
|
|
|
+ console.log(self.gradeId,698)
|
|
|
self.getMenuList();
|
|
|
self.getReMenuList() //获取重修目录
|
|
|
|