diff --git a/src/components/VideoPlayer/progress-bar.vue b/src/components/VideoPlayer/progress-bar.vue index 84bc066d..a7dc1d8f 100644 --- a/src/components/VideoPlayer/progress-bar.vue +++ b/src/components/VideoPlayer/progress-bar.vue @@ -73,59 +73,51 @@ export default { }, methods: { down(e) { - // 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; - if(current>1) current = 1; - if(current<0) current = 0; - var time = localStorage.getItem('videoProgressData'); - var arr = time&&JSON.parse(time) || {} - //console.log('down arr:',this.isDrag,this.blobId,arr,arr[this.blobId],current) - // 禁止拖动 - if(!this.isDrag && time && arr[this.blobId] < current) return; - - this.$emit("updateProgress", current); - // } + if (!this.isDrag) return; + 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; + if(current>1) current = 1; + if(current<0) current = 0; + var time = localStorage.getItem('videoProgressData'); + var arr = time&&JSON.parse(time) || {} + // 禁止拖动 + if(time && arr[this.blobId] < current) return; + this.$emit("updateProgress", current); }, move(e) { - 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; - if(current>1) current = 1; - if(current<0) current = 0; - var time = localStorage.getItem('videoProgressData'); - var arr = time&&JSON.parse(time) || {} - //console.log('move arr:',this.isDrag,this.blobId,arr,arr[this.blobId],current) - // 禁止拖动 - if(!this.isDrag && time && arr[this.blobId] < current) return; - this.$emit("updateProgress", current); - } + if (!this.isDrag || !this.is_mousedown_progress) return; + 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; + if(current>1) current = 1; + if(current<0) current = 0; + var time = localStorage.getItem('videoProgressData'); + var arr = time&&JSON.parse(time) || {} + // 禁止拖动 + if(time && arr[this.blobId] < current) return; + this.$emit("updateProgress", current); }, up() { - if (this.is_mousedown_progress) { - // 标记鼠标不处于按下的状态了 - this.is_mousedown_progress = false; - // 松开鼠标后,即调整进度条后,此时的进度(0-1) - let current = this.current_width_px / this.dom_full.clientWidth; - if(current>1) current = 1; - if(current<0) current = 0; - var time = localStorage.getItem('videoProgressData'); - var arr = time&&JSON.parse(time) || {} - //console.log('up arr:',this.isDrag,this.blobId,arr,arr[this.blobId],current) - this.$emit("getMouseDownStatus", false); - // 禁止拖动 - if(!this.isDrag && time && arr[this.blobId] < current) return; - this.$emit("updateProgress", current); - - } + if (!this.isDrag || !this.is_mousedown_progress) return; + // 标记鼠标不处于按下的状态了 + this.is_mousedown_progress = false; + // 松开鼠标后,即调整进度条后,此时的进度(0-1) + let current = this.current_width_px / this.dom_full.clientWidth; + if(current>1) current = 1; + if(current<0) current = 0; + var time = localStorage.getItem('videoProgressData'); + var arr = time&&JSON.parse(time) || {} + this.$emit("getMouseDownStatus", false); + // 禁止拖动 + if(time && arr[this.blobId] < current) return; + this.$emit("updateProgress", current); }, }, }; diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index a0c8bf36..c3b60712 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -196,7 +196,7 @@