|
@@ -96,42 +96,15 @@
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
handlePlayFirst() {
|
|
handlePlayFirst() {
|
|
|
- let sectionPage = getKechengSectionPageFromHistory(this.operId)
|
|
|
|
|
- if (sectionPage) {
|
|
|
|
|
- const {
|
|
|
|
|
- zhangIndex,
|
|
|
|
|
- jieIndex
|
|
|
|
|
- } = getCurKjIndex(sectionPage.kjId,this.operId)
|
|
|
|
|
- sectionPage.iChapter = zhangIndex;
|
|
|
|
|
- sectionPage.iSection = jieIndex;
|
|
|
|
|
- sectionPage.kjId = sectionPage.kjId;
|
|
|
|
|
- sectionPage.operId = this.operId;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if (this.list && this.list[0].jieList && this.list[0].jieList[0].kejianList) {
|
|
|
// 设置默认展开项
|
|
// 设置默认展开项
|
|
|
- this.list[zhangIndex].open = true;
|
|
|
|
|
- this.list[zhangIndex].jieList[jieIndex].open = true;
|
|
|
|
|
-
|
|
|
|
|
- const kejian = this.list[0].jieList && this.list[zhangIndex].jieList[jieIndex].kejianList.find(item => item.kjId ==sectionPage.kjId )
|
|
|
|
|
|
|
+ this.list[0].open = true;
|
|
|
|
|
+ this.list[0].jieList[0].open = true;
|
|
|
|
|
+ // 设置播放可见
|
|
|
|
|
+ const kejian = this.list[0].jieList[0].kejianList[0];
|
|
|
this.handlePlay(kejian)
|
|
this.handlePlay(kejian)
|
|
|
- } else {
|
|
|
|
|
- if (this.list && this.list[0].jieList && this.list[0].jieList[0].kejianList) {
|
|
|
|
|
- // 设置默认展开项
|
|
|
|
|
- this.list[0].open = true;
|
|
|
|
|
- this.list[0].jieList[0].open = true;
|
|
|
|
|
- // 设置播放可见
|
|
|
|
|
- const kejian = this.list[0].jieList[0].kejianList[0];
|
|
|
|
|
- this.handlePlay(kejian)
|
|
|
|
|
- // 更新缓存
|
|
|
|
|
- sectionPage = {
|
|
|
|
|
- kjId: kejian.kjId,
|
|
|
|
|
- iChapter: 0,
|
|
|
|
|
- iSection: 0,
|
|
|
|
|
- operId: this.operId
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- saveKechengSectionPage(this.operId, sectionPage)
|
|
|
|
|
},
|
|
},
|
|
|
onPause() {
|
|
onPause() {
|
|
|
clearInterval(this.timer1);
|
|
clearInterval(this.timer1);
|
|
@@ -140,9 +113,9 @@
|
|
|
onPlay() {
|
|
onPlay() {
|
|
|
clearInterval(this.timer1);
|
|
clearInterval(this.timer1);
|
|
|
this.timer1 = null;
|
|
this.timer1 = null;
|
|
|
- this.timer = setInterval(() => {
|
|
|
|
|
- updateSectionProgress(this.operId);
|
|
|
|
|
- }, 1000 * 1 * 60) // 自动保存进度 1分钟已保存
|
|
|
|
|
|
|
+ // this.timer = setInterval(() => {
|
|
|
|
|
+ // updateSectionProgress(this.operId);
|
|
|
|
|
+ // }, 1000 * 1 * 60) // 自动保存进度 1分钟已保存
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
sectionPlayerProgress(progress) {
|
|
sectionPlayerProgress(progress) {
|
|
@@ -166,18 +139,18 @@
|
|
|
const progress = parseInt(time / this.curPlayData.duration * 100);
|
|
const progress = parseInt(time / this.curPlayData.duration * 100);
|
|
|
this.curPlayData.curProgress = parseInt(progress >= 100 ? '99' : progress);
|
|
this.curPlayData.curProgress = parseInt(progress >= 100 ? '99' : progress);
|
|
|
// 保存进度
|
|
// 保存进度
|
|
|
- saveCourseProgress(time, this.curPlayData.duration, this.operId)
|
|
|
|
|
|
|
+ // saveCourseProgress(time, this.curPlayData.duration, this.operId)
|
|
|
// 更新进度
|
|
// 更新进度
|
|
|
- this.sectionPlayerProgress(progress)
|
|
|
|
|
|
|
+ // this.sectionPlayerProgress(progress)
|
|
|
},
|
|
},
|
|
|
onPlayEnd() {
|
|
onPlayEnd() {
|
|
|
clearInterval(this.timer1);
|
|
clearInterval(this.timer1);
|
|
|
this.timer1 = null;
|
|
this.timer1 = null;
|
|
|
- saveCourseProgress(this.curPlayData.duration, this.curPlayData.duration, this.operId, 'end');
|
|
|
|
|
- updateSectionProgress(this.operId, 'end', 'video', () => {
|
|
|
|
|
- this.curPlayData.maxProcess = 99;
|
|
|
|
|
- this.curPlayData.curProcess = 99;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // saveCourseProgress(this.curPlayData.duration, this.curPlayData.duration, this.operId, 'end');
|
|
|
|
|
+ // updateSectionProgress(this.operId, 'end', 'video', () => {
|
|
|
|
|
+ // this.curPlayData.maxProcess = 99;
|
|
|
|
|
+ // this.curPlayData.curProcess = 99;
|
|
|
|
|
+ // });
|
|
|
console.log('end')
|
|
console.log('end')
|
|
|
},
|
|
},
|
|
|
goUpPage() {
|
|
goUpPage() {
|
|
@@ -231,7 +204,7 @@
|
|
|
sectionPage.iSection = jieIndex;
|
|
sectionPage.iSection = jieIndex;
|
|
|
sectionPage.kjId = data.kjId;
|
|
sectionPage.kjId = data.kjId;
|
|
|
sectionPage.operId = this.operId;
|
|
sectionPage.operId = this.operId;
|
|
|
- saveKechengSectionPage(this.operId, sectionPage)
|
|
|
|
|
|
|
+ // saveKechengSectionPage(this.operId, sectionPage)
|
|
|
kechengApi.getVideoAuth({
|
|
kechengApi.getVideoAuth({
|
|
|
videoId: data.url
|
|
videoId: data.url
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
@@ -246,42 +219,18 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
initFirstVideo() {
|
|
initFirstVideo() {
|
|
|
- let sectionPage = getKechengSectionPageFromHistory(this.operId)
|
|
|
|
|
- if (sectionPage) {
|
|
|
|
|
- const {
|
|
|
|
|
- zhangIndex,
|
|
|
|
|
- jieIndex
|
|
|
|
|
- } = getCurKjIndex(sectionPage.kjId,this.operId)
|
|
|
|
|
- sectionPage.iChapter = zhangIndex;
|
|
|
|
|
- sectionPage.iSection = jieIndex;
|
|
|
|
|
- sectionPage.kjId = sectionPage.kjId;
|
|
|
|
|
- sectionPage.operId = this.operId;
|
|
|
|
|
-
|
|
|
|
|
- // 设置默认展开项
|
|
|
|
|
- this.list[zhangIndex].open = true;
|
|
|
|
|
- this.list[zhangIndex].jieList[jieIndex].open = true;
|
|
|
|
|
-
|
|
|
|
|
- const kejian = this.list[0].jieList && this.list[zhangIndex].jieList[jieIndex].kejianList.find(item => item.kjId ==sectionPage.kjId )
|
|
|
|
|
- // this.handlePlay(kejian)
|
|
|
|
|
- } else {
|
|
|
|
|
- if (this.list && this.list[0].jieList && this.list[0].jieList[0].kejianList) {
|
|
|
|
|
- // 设置默认展开项
|
|
|
|
|
- this.list[0].open = true;
|
|
|
|
|
- this.list[0].jieList[0].open = true;
|
|
|
|
|
- // 设置播放可见
|
|
|
|
|
- const kejian = this.list[0].jieList[0].kejianList[0];
|
|
|
|
|
- // this.handlePlay(kejian)
|
|
|
|
|
- // 更新缓存
|
|
|
|
|
- sectionPage = {
|
|
|
|
|
- kjId: kejian.kjId,
|
|
|
|
|
- iChapter: 0,
|
|
|
|
|
- iSection: 0,
|
|
|
|
|
- operId: this.operId
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (this.list && this.list[0].jieList && this.list[0].jieList[0].kejianList) {
|
|
|
|
|
+ // 设置默认展开项
|
|
|
|
|
+ this.list[0].open = true;
|
|
|
|
|
+ this.list[0].jieList[0].open = true;
|
|
|
|
|
+ // 设置播放可见
|
|
|
|
|
+ const kejian = this.list[0].jieList[0].kejianList[0];
|
|
|
|
|
+ // this.handlePlay(kejian)
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- saveKechengSectionPage(this.operId, sectionPage)
|
|
|
|
|
|
|
+ //saveKechengSectionPage(this.operId, sectionPage)
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
init() {
|
|
init() {
|
|
@@ -304,25 +253,25 @@
|
|
|
this.list = kejianUserVo.zhangList;
|
|
this.list = kejianUserVo.zhangList;
|
|
|
this.intro = intro;
|
|
this.intro = intro;
|
|
|
this.operId = operId;
|
|
this.operId = operId;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 获取课程缓存 && 课件缓存(课件缓存点击后产生)
|
|
// 获取课程缓存 && 课件缓存(课件缓存点击后产生)
|
|
|
- let historyArrKecheng = getKechengDataFromHistory(this.operId)
|
|
|
|
|
- let sectionPageHistory = getKechengSectionPageFromHistory(this.operId)
|
|
|
|
|
- // 判断是否有前台缓存
|
|
|
|
|
- if (historyArrKecheng && sectionPageHistory) {
|
|
|
|
|
- // 有缓存---- 把start接口中,返回数据进度100%,更新到前台缓存
|
|
|
|
|
- const arrKecheng = mergeProgress(kejianUserVo && kejianUserVo.zhangList,
|
|
|
|
|
- historyArrKecheng);
|
|
|
|
|
- // 后台数据 同步前台缓存
|
|
|
|
|
- saveKechengData(this.operId, arrKecheng)
|
|
|
|
|
- } else {
|
|
|
|
|
- // 无缓存----把start接口中,返回的所有数据,更新到前台缓存
|
|
|
|
|
- saveKechengData(this.operId, kejianUserVo && kejianUserVo.zhangList)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //let historyArrKecheng = getKechengDataFromHistory(this.operId)
|
|
|
|
|
+ // let sectionPageHistory = getKechengSectionPageFromHistory(this.operId)
|
|
|
|
|
+ // // 判断是否有前台缓存
|
|
|
|
|
+ // if (historyArrKecheng && sectionPageHistory) {
|
|
|
|
|
+ // // 有缓存---- 把start接口中,返回数据进度100%,更新到前台缓存
|
|
|
|
|
+ // const arrKecheng = mergeProgress(kejianUserVo && kejianUserVo.zhangList,
|
|
|
|
|
+ // historyArrKecheng);
|
|
|
|
|
+ // // 后台数据 同步前台缓存
|
|
|
|
|
+ // saveKechengData(this.operId, arrKecheng)
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // // 无缓存----把start接口中,返回的所有数据,更新到前台缓存
|
|
|
|
|
+ // saveKechengData(this.operId, kejianUserVo && kejianUserVo.zhangList)
|
|
|
|
|
+ // }
|
|
|
// 初始化页面 常规数据
|
|
// 初始化页面 常规数据
|
|
|
- initCourseProgressAll(this.operId)
|
|
|
|
|
|
|
+ //initCourseProgressAll(this.operId)
|
|
|
|
|
|
|
|
- console.log('初始化播放首次')
|
|
|
|
|
|
|
+ console.log('初始化播放首1123次')
|
|
|
// 设置播放视频
|
|
// 设置播放视频
|
|
|
this.initFirstVideo();
|
|
this.initFirstVideo();
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|