mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-07 18:06:47 +08:00
Merge branch 'pingcode-20240615' into master-0726
# Conflicts: # pages/study/courseStudy.vue
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
<view style="position: relative;">
|
||||
<video-player
|
||||
:url="blobUrl"
|
||||
:blobId="blobId"
|
||||
controls
|
||||
:enable-play-gesture="true"
|
||||
:inittime="curContent.lastStudyTime"
|
||||
@@ -20,7 +21,6 @@
|
||||
@timeupdate="onPlayerPlaying"
|
||||
@fullscreenchange="onFullScreen"
|
||||
:drag="curriculumData.isDrag"
|
||||
@progress="progress"
|
||||
style="width: 100%; object-fit: fill">
|
||||
></video-player>
|
||||
<view class="player-box" v-if="playerBoxShow">
|
||||
@@ -488,6 +488,7 @@
|
||||
appentInterval:15,//追加学习时间的间隔 3秒加一次
|
||||
preTime:-1,
|
||||
blobUrl:'',//音视频的播放地址
|
||||
blobId: '',
|
||||
localTimeKey:'boeu-study-time' ,//本地存储的学习时长的key json格式
|
||||
localTimeValue:0,//计算的时间
|
||||
appendStudyOtherHandle:null,
|
||||
@@ -495,7 +496,7 @@
|
||||
scormUrl:'',
|
||||
maxDuration:0, //非音频最大时长
|
||||
cumulativeDuration:0, //非音频累计时长
|
||||
defaultMaxTime:1800, //非音频默认最大时间
|
||||
defaultMaxTime:1800 //非音频默认最大时间
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -559,6 +560,7 @@
|
||||
},
|
||||
onShow(){
|
||||
uni.setNavigationBarTitle({ title:'\u200E' })
|
||||
|
||||
//实时渲染当前的播放状态
|
||||
},
|
||||
onReady() {
|
||||
@@ -579,6 +581,7 @@
|
||||
getSysTypeTree:'sysType/getSysTypeTree',
|
||||
loadSysTypes:'sysType/loadSysTypes'
|
||||
}),
|
||||
|
||||
// 没有写播放时间
|
||||
onPlayerPlay() {
|
||||
this.playerBoxShow = false;
|
||||
@@ -632,7 +635,6 @@
|
||||
let $this=this;
|
||||
uni.showLoading({title:'加载中...'})
|
||||
apiCourseStudy.studyIndex(this.courseId).then(rs=>{
|
||||
// this.courseType = rs.result.course.type
|
||||
if(rs.status != 200) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({title:rs.message,type:'fail'});
|
||||
@@ -780,6 +782,26 @@
|
||||
},
|
||||
playContent(con,conIndex,catIndex){
|
||||
this.isShowPdt = true
|
||||
// 视频设置禁用处理逻辑,如果用户已全部观看完该视频,则设置为能全部拖动的逻辑,把isDrag设置为true即可,同时删除本地存储的数据
|
||||
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))
|
||||
}
|
||||
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) {
|
||||
if(this.courseInfo.orderStudy) {
|
||||
@@ -801,6 +823,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//切换播放内容
|
||||
this.changePlayRes(con);
|
||||
},
|
||||
@@ -887,7 +910,6 @@
|
||||
//this.curContent=0;
|
||||
// console.log(con,'con');
|
||||
this.playerBoxShow=false;
|
||||
this.contentTypeV = con.contentType
|
||||
if(con.contentType==40){
|
||||
//如果是文档,需要再次加载pdf
|
||||
if(con.content!='' && con.content.indexOf('.pdf')==-1){
|
||||
@@ -939,14 +961,17 @@
|
||||
location.href=this.conLink.url
|
||||
}
|
||||
} else if(con.contentType==10 || con.contentType==20) {
|
||||
|
||||
if(con.content.startsWith('\{')){
|
||||
this.curriculumData=JSON.parse(con.content);
|
||||
var d = JSON.parse(con.content)
|
||||
// if(d.url=="/course/2024/4/1224670812274712576.mp4") d.isDrag = false
|
||||
this.curriculumData=d;
|
||||
}else{
|
||||
this.curriculumData.url=con.content;
|
||||
}
|
||||
console.log('this.curriculumData:::',this.curriculumData)
|
||||
|
||||
this.blobUrl=this.fileBaseUrl+this.curriculumData.url;
|
||||
//console.log(this.blobUrl,'this.blobUrl');
|
||||
this.blobId = con.id;
|
||||
}
|
||||
//console.log(con.contentType,'con.contentType');
|
||||
this.curContent=con;
|
||||
@@ -1309,9 +1334,6 @@
|
||||
//console.log(e);
|
||||
this.scrollInfo = e.detail;
|
||||
},
|
||||
progress(val) {
|
||||
this.progressData = (val).toFixed(2);
|
||||
},
|
||||
//以下是播放相关的处理
|
||||
saveStudyDuration(duration) { //保存本地存储的学习时长
|
||||
if (duration > 0) {
|
||||
@@ -1328,12 +1350,8 @@
|
||||
"objInfo": ""+this.courseInfo.name,
|
||||
"aid":this.userInfo.aid, //当前登录人的id
|
||||
"aname":this.userInfo.name,//当前人的姓名
|
||||
"status": 1, //状态
|
||||
"contentId": this.curContent.id,
|
||||
"status": 1 //状态
|
||||
}
|
||||
if(this.contentTypeV == 10) {
|
||||
postData.progress = this.progressData
|
||||
}
|
||||
//静默处理
|
||||
apiStat.sendEvent(postData).then(rs=>{
|
||||
if(rs.status == 200) {
|
||||
@@ -1566,8 +1584,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){
|
||||
@@ -1591,6 +1608,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;
|
||||
@@ -1600,6 +1618,19 @@
|
||||
itemId:this.curContent.studyItemId,
|
||||
videoTime:intTime
|
||||
}
|
||||
|
||||
//alert(3+'--'+this.curriculumData.isDrag +'---'+this.curContent.progressVideo)
|
||||
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 +1693,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;
|
||||
//记录播放时间
|
||||
@@ -1671,6 +1704,16 @@
|
||||
itemId:this.curContent.studyItemId,
|
||||
videoTime:intTime
|
||||
}
|
||||
if(!this.curriculumData.isDrag && this.curContent.progressVideo !=1){
|
||||
var time = localStorage.getItem('videoProgressData')
|
||||
var arr = time&&JSON.parse(time) || {}
|
||||
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(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