mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-15 13:56:43 +08:00
学员端视频播放器逻辑调整
This commit is contained in:
@@ -68,7 +68,20 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
down(e) {
|
||||
if(this.isDrag) {
|
||||
// 是否禁止拖动
|
||||
// if(this.isDrag) {
|
||||
// // 可拖动
|
||||
// this.$emit("getMouseDownStatus", true);
|
||||
// this.is_mousedown_progress = true;
|
||||
// // 获取完整进度条的clientX(dom左上角)
|
||||
// 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;
|
||||
// 获取完整进度条的clientX(dom左上角)
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user