学员端视频播放器逻辑调整

This commit is contained in:
joshen
2024-06-18 14:22:11 +08:00
parent e860454a2a
commit 5e3b122984
4 changed files with 153 additions and 22 deletions

View File

@@ -68,7 +68,20 @@ export default {
},
methods: {
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.is_mousedown_progress = true;
// 获取完整进度条的clientXdom左上角
@@ -76,28 +89,33 @@ export default {
// 计算调整后的当前进度条的长度
this.current_width_px = e.clientX - init_clientX;
// 设置当前的播放进度(同时作用于当前进度条的样式)
let current =
(e.clientX - init_clientX) / this.dom_full.clientWidth;
let current = (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);
}
// }
},
move(e) {
if (this.is_mousedown_progress && this.isDrag) {
if (this.is_mousedown_progress) {
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;
let current = (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);
}
},
up() {
if (this.is_mousedown_progress && this.isDrag) {
if (this.is_mousedown_progress) {
// 标记鼠标不处于按下的状态了
this.is_mousedown_progress = false;
// 松开鼠标后即调整进度条后此时的进度0-1
let current =
this.current_width_px / this.dom_full.clientWidth;
let current = 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("getMouseDownStatus", false);
}