视频进度

This commit is contained in:
zhangsir
2024-06-05 09:54:46 +08:00
parent 172e35f993
commit 0c315b48d3
2 changed files with 15 additions and 2 deletions

View File

@@ -166,6 +166,7 @@
let second=sliderValue / 100 * duration;
if (this.updateState) { //判断拖拽完成后才触发更新,避免拖拽失效
this.sliderValue=sliderValue;
this.$emit('progress',this.sliderValue);
}else{
}

View File

@@ -19,7 +19,8 @@
@ended="onPlayerEnded"
@timeupdate="onPlayerPlaying"
@fullscreenchange="onFullScreen"
:drag="curriculumData.isDrag"
:drag="curriculumData.isDrag"
@progress="progress"
style="width: 100%; object-fit: fill">
></video-player>
<view class="player-box" v-if="playerBoxShow">
@@ -427,6 +428,8 @@
export default {
data(){
return{
progressData: 0,
contentTypeV: '',
trueFalse: true,
loading:false,//加载中
courseId:'',//当前课程的id
@@ -627,6 +630,7 @@
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'});
@@ -880,6 +884,7 @@
//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){
@@ -1295,6 +1300,9 @@
//console.log(e);
this.scrollInfo = e.detail;
},
progress(val) {
this.progressData = (val).toFixed(2);
},
//以下是播放相关的处理
saveStudyDuration(duration) { //保存本地存储的学习时长
if (duration > 0) {
@@ -1311,8 +1319,12 @@
"objInfo": ""+this.courseInfo.name,
"aid":this.userInfo.aid, //当前登录人的id
"aname":this.userInfo.name,//当前人的姓名
"status": 1 //状态
"status": 1, //状态
"contentId": this.curContent.id,
}
if(this.contentTypeV == 10) {
postData.progress = this.progressData
}
//静默处理
apiStat.sendEvent(postData).then(rs=>{
if(rs.status == 200) {