Merge branch 'pingcode-20240615' into dev0515

# Conflicts:
#	src/views/study/coursenew.vue
This commit is contained in:
zhangsir
2024-06-18 14:36:13 +08:00
4 changed files with 71 additions and 17 deletions

View File

@@ -314,9 +314,17 @@ export default {
setInterval(() => { setInterval(() => {
// 定时更新进度条 // 定时更新进度条
if (this.isPlaying && !this.isMousedownProgress) { if (this.isPlaying && !this.isMousedownProgress) {
this.currentProgress = this.currentProgress = this.videoDom.currentTime / this.videoDom.duration;
this.videoDom.currentTime / this.videoDom.duration;
} }
// 视频播放时本地记录视频实时播放时长
// console.log(this.src,this.currentProgress,'定时更新进度条');
var time = localStorage.getItem('videoProgressData')
var arr = time&&JSON.parse(time) || {}
if(arr[this.src] < this.currentProgress || !arr[this.src]){
arr[this.src] = this.currentProgress
localStorage.setItem('videoProgressData',JSON.stringify(arr))
}
// 定时更新进度的文字显示 // 定时更新进度的文字显示
this.updateProgressText(); this.updateProgressText();
// 音量提示面板的定时隐藏 // 音量提示面板的定时隐藏
@@ -349,7 +357,7 @@ export default {
// 根据视频的readyState判断下一帧是否已加载并控制loading的显示 // 根据视频的readyState判断下一帧是否已加载并控制loading的显示
this.isShowLoading = this.videoDom.readyState < 3; this.isShowLoading = this.videoDom.readyState < 3;
//if() //if()
//console.log(this.videoDom.readyState,'this.videoDom.readyState'); // console.log(this.videoDom.readyState,'视频播放');
}, 1000); }, 1000);
// 视频dom监听器用于控制鼠标的显示 // 视频dom监听器用于控制鼠标的显示
this.videoDom.addEventListener("mousemove", () => { this.videoDom.addEventListener("mousemove", () => {
@@ -429,6 +437,13 @@ export default {
*/ */
forwardCurrentTime() { forwardCurrentTime() {
let newCurrentTime = this.videoDom.currentTime + this.timeFastBack; let newCurrentTime = this.videoDom.currentTime + this.timeFastBack;
// 禁止拖拽视频前进时,未观看视频不让前进播放
if(!this.isDrag){
var time = localStorage.getItem('videoProgressData')
if(time && parseFloat(time) * this.videoDom.duration<newCurrentTime){
return
}
}
this.videoDom.currentTime = newCurrentTime; this.videoDom.currentTime = newCurrentTime;
this.barrageTimelineStart = newCurrentTime; this.barrageTimelineStart = newCurrentTime;
this.updateProgressBySetTime(newCurrentTime); this.updateProgressBySetTime(newCurrentTime);
@@ -554,6 +569,10 @@ export default {
}, },
//开始播放 //开始播放
startPlay:function(newTime){ startPlay:function(newTime){
// console.log('开始播放::',newTime)
// window.playVideoInterTime = setInterval(()=>{
// console.log('视频播放:',newTime)
// },2000)
if(newTime){ if(newTime){
this.videoDom.currentTime = newTime; this.videoDom.currentTime = newTime;
this.barrageTimelineStart = newTime; this.barrageTimelineStart = newTime;
@@ -576,7 +595,6 @@ export default {
// 进度条到终点时修改播放状态 // 进度条到终点时修改播放状态
this.isShowPlayer = false this.isShowPlayer = false
this.$emit('onPlayerPlaying', this.videoDom.currentTime,this.videoDom.duration) this.$emit('onPlayerPlaying', this.videoDom.currentTime,this.videoDom.duration)
this.$emit('progress',this.currentProgress)
if (this.currentProgress === 1) { if (this.currentProgress === 1) {
this.isPlaying = false; this.isPlaying = false;
this.$emit('onPlayerEnded', {}) this.$emit('onPlayerEnded', {})
@@ -592,7 +610,6 @@ export default {
src: function () { src: function () {
// 当视频地址变更时,重载视频 // 当视频地址变更时,重载视频
this.videoDom.load(); this.videoDom.load();
this.isPlaying = false
}, },
}, },
}; };

View File

@@ -68,7 +68,20 @@ export default {
}, },
methods: { methods: {
down(e) { down(e) {
if(this.isDrag) { // 是否禁止拖动
// if(this.isDrag) {
// // 可拖动
// this.$emit("getMouseDownStatus", true);
// this.is_mousedown_progress = true;
// // 获取完整进度条的clientXdom左上角
// let init_clientX = this.dom_full.getBoundingClientRect().left;
// // 计算调整后的当前进度条的长度
// this.current_width_px = e.clientX - init_clientX;
// // 设置当前的播放进度(同时作用于当前进度条的样式)
// let current = (e.clientX - init_clientX) / this.dom_full.clientWidth;
// this.$emit("updateProgress", current);
// }else{
// 禁止拖动
this.$emit("getMouseDownStatus", true); this.$emit("getMouseDownStatus", true);
this.is_mousedown_progress = true; this.is_mousedown_progress = true;
// 获取完整进度条的clientXdom左上角 // 获取完整进度条的clientXdom左上角
@@ -76,28 +89,33 @@ export default {
// 计算调整后的当前进度条的长度 // 计算调整后的当前进度条的长度
this.current_width_px = e.clientX - init_clientX; this.current_width_px = e.clientX - init_clientX;
// 设置当前的播放进度(同时作用于当前进度条的样式) // 设置当前的播放进度(同时作用于当前进度条的样式)
let current = let current = (e.clientX - init_clientX) / this.dom_full.clientWidth;
(e.clientX - init_clientX) / this.dom_full.clientWidth;
var time = localStorage.getItem('videoProgressData');
if(!this.isDrag && time && parseFloat(time) < current) return;
this.$emit("updateProgress", current); this.$emit("updateProgress", current);
} // }
}, },
move(e) { move(e) {
if (this.is_mousedown_progress && this.isDrag) { if (this.is_mousedown_progress) {
let init_clientX = this.dom_full.getBoundingClientRect().left; let init_clientX = this.dom_full.getBoundingClientRect().left;
this.current_width_px = e.clientX - init_clientX; this.current_width_px = e.clientX - init_clientX;
let current = let current = (e.clientX - init_clientX) / this.dom_full.clientWidth;
(e.clientX - init_clientX) / this.dom_full.clientWidth; var time = localStorage.getItem('videoProgressData');
if(!this.isDrag && time && parseFloat(time) < current) return;
this.$emit("updateProgress", current); this.$emit("updateProgress", current);
} }
}, },
up() { up() {
if (this.is_mousedown_progress && this.isDrag) { if (this.is_mousedown_progress) {
// 标记鼠标不处于按下的状态了 // 标记鼠标不处于按下的状态了
this.is_mousedown_progress = false; this.is_mousedown_progress = false;
// 松开鼠标后即调整进度条后此时的进度0-1 // 松开鼠标后即调整进度条后此时的进度0-1
let current = let current = this.current_width_px / this.dom_full.clientWidth;
this.current_width_px / this.dom_full.clientWidth; var time = localStorage.getItem('videoProgressData');
if(!this.isDrag && time && parseFloat(time) < current) return;
this.$emit("updateProgress", current); this.$emit("updateProgress", current);
this.$emit("getMouseDownStatus", false); this.$emit("getMouseDownStatus", false);
} }

View File

@@ -644,6 +644,8 @@ export default {
this.params.sysType1 = this.sysTypeList[0]; this.params.sysType1 = this.sysTypeList[0];
this.params.sysType2 = this.sysTypeList[1]; this.params.sysType2 = this.sysTypeList[1];
this.params.sysType3 = this.sysTypeList[2]; this.params.sysType3 = this.sysTypeList[2];
if(this.$route.query.couresIds) this.params.couresIds = this.$route.query.couresIds.split(',');
if(this.$route.query.isSystemAdmin) this.params.isSystemAdmin = this.$route.query.isSystemAdmin;
apiCourse.pageList(this.params).then(rs=>{ apiCourse.pageList(this.params).then(rs=>{
if(rs.status==200){ if(rs.status==200){
this.pageData = rs.result.list; this.pageData = rs.result.list;

View File

@@ -437,6 +437,7 @@
cumulativeDuration:0, //非音频累计时长 cumulativeDuration:0, //非音频累计时长
maxDuration:0, //非音频最大时长 maxDuration:0, //非音频最大时长
defaultMaxTime:1800, //非音频默认最大时间 defaultMaxTime:1800, //非音频默认最大时间
videoIndex: 0 // 当前视频index
} }
}, },
mounted() { mounted() {
@@ -1170,6 +1171,13 @@
itemId: this.contentData.studyItemId, itemId: this.contentData.studyItemId,
videoTime: intTime videoTime: intTime
}; };
var time = localStorage.getItem('videoProgressData')
var arr = time&&JSON.parse(time) || {}
if(arr[this.blobUrl]) {
postData.progressVideo = arr[this.blobUrl]
postData.contentId = this.contentList[this.videoIndex].id
postData.courseId = this.contentList[this.videoIndex].courseId
}
//console.log('记录播放时间') //console.log('记录播放时间')
apiStudy.studyVideoTime(postData).then(rs => { apiStudy.studyVideoTime(postData).then(rs => {
if (rs.status != 200) { if (rs.status != 200) {
@@ -1211,6 +1219,13 @@
itemId: this.contentData.studyItemId, itemId: this.contentData.studyItemId,
videoTime: intTime videoTime: intTime
}; };
var time = localStorage.getItem('videoProgressData')
var arr = time&&JSON.parse(time) || {}
if(arr[this.blobUrl]) {
postData.progressVideo = arr[this.blobUrl]
postData.contentId = this.contentList[this.videoIndex].id
postData.courseId = this.contentList[this.videoIndex].courseId
}
//console.log('记录播放时间') //console.log('记录播放时间')
apiStudy.studyVideoTime(postData).then(rs => { apiStudy.studyVideoTime(postData).then(rs => {
if (rs.status != 200) { if (rs.status != 200) {
@@ -1381,9 +1396,11 @@
// this.showRes(this.contentList[0]); // this.showRes(this.contentList[0]);
//console.log(this.catalogTree,'ccccc22222') //console.log(this.catalogTree,'ccccc22222')
this.showRes(this.catalogTree[0].children[0]) this.showRes(this.catalogTree[0].children[0])
this.videoIndex = 0
} else { } else {
//console.log(this.contentList[0],'ccccc3333') //console.log(this.contentList[0],'ccccc3333')
this.showRes(this.contentList[playIndex]); this.showRes(this.contentList[playIndex]);
this.videoIndex = playIndex
} }
} }
}, },
@@ -1590,7 +1607,7 @@
finishStudyItem() { //设置完成学习的内容,针对于音视频的内容 finishStudyItem() { //设置完成学习的内容,针对于音视频的内容
if (!this.contentData.studyItemId) { if (!this.contentData.studyItemId) {
// 这种可能没有不过这里也是为了万中那个1 //这种可能没有不过这里也是为了万中那个1
this.saveStudyInfo(); this.saveStudyInfo();
} else { } else {
let params = { let params = {