From 72b9a182062fd824431e7e40a66f32a721a4df5f Mon Sep 17 00:00:00 2001 From: daihh Date: Wed, 1 Mar 2023 11:46:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9scorm=E7=9A=84=E5=AD=A6?= =?UTF-8?q?=E4=B9=A0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/study/courseStudy.vue | 45 ++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/pages/study/courseStudy.vue b/pages/study/courseStudy.vue index 97a20ac..857db41 100644 --- a/pages/study/courseStudy.vue +++ b/pages/study/courseStudy.vue @@ -918,13 +918,20 @@ if(con.contentType>20){ let $this=this; //用户的学习时长,音视频课程学习,单独的处理,不再追加学习时长 - this.isAppendTime = false; - this.appendStudyOtherHandle = setTimeout(function() { + this.isAppendTime = false; + this.appendStudyOtherHandle = setTimeout(function() { $this.appendStudyOtherTime(); - }, 1000*60*2); //非音视频课程学习,2分钟后记录,因为一次记录是60秒 - //this.appendStudyTime(); + }, 1000*60*2); //非音视频课程学习,2分钟后记录,因为一次记录是60秒 + //this.appendStudyTime(); //非视频,音频的5秒后学习完成 - this.handleTimeout = setTimeout(function(){$this.saveStudyInfo();},5000);//5秒后记录学习完成 + if(con.contentType!=50){ + this.handleTimeout = setTimeout(function(){$this.saveStudyInfo();},5000);//5秒后记录学习完成 + }else{ + //scorm课件不记录完成情况,由播放回调记录完成情况 + //当前先保存学习记录,未学习状态 + this.saveScormStudy(); + } + } }, followUser(tea){ @@ -1522,6 +1529,34 @@ }) } }, + saveScormStudy() { + //只记录SCORM课件的学习 + if(this.curContent.contentType!=50){ + return; + } + if(this.curContent.status==9){ + //已学习完的,不用再添加 + return; + } + let params ={ + studyId: this.studyId,//学习id, + courseId: this.courseId,//课程id, + contentId: this.curContent.id,//内容id, + contentType: this.curContent.contentType, + contentName: this.curContent.contentName,//内容名称 + progress: 1, + status: 2, + contentTotal:this.totalContent + } + apiCourseStudy.studyContent(params).then(res=>{ + if(res.status == 200) { + this.curContent.status=2;//完成 + this.curContent.studyItemId=res.result;//学习记录id + }else{ + console.log('记录学习失败:'+res.message+','+res.error); + } + }) + }, //还需要记录播放时间 saveStudyInfo() { //记录课件学习信息 if(this.curContent.contentType>=60){