mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-06 17:36:45 +08:00
video progress edit
This commit is contained in:
@@ -778,19 +778,24 @@
|
||||
playContent(con,conIndex,catIndex){
|
||||
|
||||
// 视频设置禁用处理逻辑,如果用户已全部观看完该视频,则设置为能全部拖动的逻辑,把isDrag设置为true即可,同时删除本地存储的数据
|
||||
|
||||
// if(con.progressVideo ===1){
|
||||
// var obj = JSON.parse(con.content)
|
||||
// obj.isDrag = true
|
||||
// con.content = JSON.stringify(obj)
|
||||
if(con.progressVideo ===1){
|
||||
var obj = JSON.parse(con.content)
|
||||
obj.isDrag = true
|
||||
con.content = JSON.stringify(obj)
|
||||
|
||||
// var time = localStorage.getItem('videoProgressData')
|
||||
// var arr = time&&JSON.parse(time) || {}
|
||||
// alert(con.progressVideo+'--'+con.id + '--'+JSON.stringify(arr))
|
||||
// delete arr[con.id];
|
||||
// localStorage.setItem('videoProgressData',JSON.stringify(arr))
|
||||
|
||||
// }
|
||||
var time = localStorage.getItem('videoProgressData')
|
||||
var arr = time&&JSON.parse(time) || {}
|
||||
//alert(con.progressVideo+'--'+con.id + '--'+JSON.stringify(arr))
|
||||
delete arr[con.id];
|
||||
localStorage.setItem('videoProgressData',JSON.stringify(arr))
|
||||
}
|
||||
if(con.progressVideo>0 && con.progressVideo !==1){
|
||||
var time = localStorage.getItem('videoProgressData')
|
||||
var arr = time&&JSON.parse(time) || {}
|
||||
arr[con.id] = con.progressVideo
|
||||
localStorage.setItem('videoProgressData',JSON.stringify(arr))
|
||||
}
|
||||
|
||||
console.log('更换播放内容 playContent::',con,conIndex,catIndex)
|
||||
//对于需要控制学习顺序的
|
||||
if(conIndex!=undefined && catIndex!=undefined) {
|
||||
@@ -1554,8 +1559,7 @@
|
||||
let intTime=parseInt(e.detail.currentTime);
|
||||
if(intTime>this.videoPlayingTime){
|
||||
this.videoPlayingTime=intTime;
|
||||
|
||||
//判断是否完成
|
||||
//判断是否完成
|
||||
let completeType=this.curriculumData.completeSetup;
|
||||
let completeSecond=this.curriculumData.second;
|
||||
if(!completeSecond){
|
||||
@@ -1579,6 +1583,7 @@
|
||||
//以下是每隔10秒存储一下进度
|
||||
let saveTime=Math.floor(intTime%10);
|
||||
//console.log(intTime,saveTime,'aa',this.curContent.studyItemId)
|
||||
console.log('3333:',this.preTime,intTime , saveTime,this.curContent.studyItemId)
|
||||
if(this.preTime!=intTime && saveTime==0 && this.curContent.studyItemId!=''){
|
||||
this.preTime=intTime;
|
||||
this.curContent.lastStudyTime=intTime;
|
||||
@@ -1593,13 +1598,14 @@
|
||||
if(!this.curriculumData.isDrag && this.curContent.progressVideo !=1){
|
||||
var time = localStorage.getItem('videoProgressData')
|
||||
var arr = time&&JSON.parse(time) || {}
|
||||
console.log('this.curContent.progressVideo::',arr[this.blobId],this.curContent.progressVideo,arr[this.blobId])
|
||||
if(arr[this.blobId] && this.curContent.progressVideo<arr[this.blobId]) {
|
||||
postData.progressVideo = arr[this.blobId]
|
||||
postData.contentId = this.curContent.id
|
||||
postData.courseId = this.curContent.courseId
|
||||
}
|
||||
}
|
||||
|
||||
//alert(intTime+'----'+this.videoPlayingTime)
|
||||
apiCourseStudy.studyVideoTime(postData).then(rs=>{
|
||||
if(rs.status!=200){
|
||||
console.log('记录播放时间错误');
|
||||
@@ -1662,7 +1668,9 @@
|
||||
//以下是每隔10秒存储一下进度
|
||||
let saveTime=Math.floor(intTime%10);
|
||||
//console.log(intTime,saveTime,'aa',this.curContent.studyItemId)
|
||||
|
||||
if(this.preTime!=intTime && saveTime==0 && this.curContent.studyItemId!=''){
|
||||
|
||||
this.preTime=intTime;
|
||||
this.curContent.lastStudyTime=intTime;
|
||||
//记录播放时间
|
||||
@@ -1680,6 +1688,7 @@
|
||||
postData.courseId = this.curContent.courseId
|
||||
}
|
||||
}
|
||||
//alert(this.preTime!=intTime +'---'+ saveTime +'---'+ this.curContent.studyItemId)
|
||||
apiCourseStudy.studyVideoTime(postData).then(rs=>{
|
||||
if(rs.status!=200){
|
||||
console.log('记录播放时间错误');
|
||||
|
||||
Reference in New Issue
Block a user