From 067e46e065db19d95d3710c5ce2688240f56c7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Fri, 13 Mar 2026 10:57:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0nvue=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/plugins/video/detail/detail.nvue | 95 +++----------------------- 1 file changed, 8 insertions(+), 87 deletions(-) diff --git a/pages/plugins/video/detail/detail.nvue b/pages/plugins/video/detail/detail.nvue index 4b4e84bd..e1392ce4 100644 --- a/pages/plugins/video/detail/detail.nvue +++ b/pages/plugins/video/detail/detail.nvue @@ -159,7 +159,7 @@ - + @@ -222,7 +222,7 @@ - + @@ -280,7 +280,6 @@ data_list_loding_status: 1, data_list_loding_msg: '', video_data_list: [], - display_video_list: [], current_index: 0, video_contexts: [], // 原生的video视频 create_video_contexts: [], // 使用uni.createVideoContext创建的视频上下文 @@ -299,15 +298,12 @@ move_distance: 0, // 评论拖拽距离 is_dragging: false, // 是否正在拖拽中 current_video_id: '', // 当前播放视频的 ID - is_slide_start: false, - swiper_key: get_math(), comment_scroll_top: 0, // 评论滚动距离顶部的距离 comment_input_value: '', - propMaxNum: 1, + propMaxNum: 1, // 上传数量 form_images_list: [], share_info: {}, menu_button_info: '', - direction: 'direction', base_config_data: {}, comment_scroll_debounce_timer: null, // 评论滚动防抖定时器 comment_move_throttle_timer: null, // 评论拖拽节流定时器 @@ -320,10 +316,9 @@ current_main_index: 0, // 默认选中第一个举报原因 current_sub_index: 0, // 默认选中第一个具体类型 report_comment_id: '', // 举报的评论id - comment_value: '', + comment_value: '', + // 监听键盘高度变化事件 is_add_comment: false, - - // 监听键盘高度变化事件 listener_height: 0, comments_reply_data: {}, editor_path_type: 'video', @@ -431,13 +426,6 @@ // 初始化 this.init(); - // #ifdef H5 - // 添加全局点击事件监听 - document.addEventListener('click', this.handle_global_click); - // 添加触摸事件监听(移动端兼容) - document.addEventListener('touchstart', this.handle_global_click); - //#endif - // 创建监听事件 this.bind_keyboard_listener(); } catch { @@ -455,16 +443,6 @@ // 清理所有视频资源 this.cleanup_all_videos(); - - // 移除键盘事件监听器 - // #ifdef H5 - if (typeof document !== 'undefined') { - document.removeEventListener('keydown', this.handle_keydown); - } - // 移除全局事件监听器 - document.removeEventListener('click', this.handle_global_click); - document.removeEventListener('touchstart', this.handle_global_click); - // #endif this.unbind_keyboard_listener(); }, methods: { @@ -731,29 +709,6 @@ console.error('toggle_play_pause error:', error); } }, - // 播放数组更新 - update_display_video_list(list) { - try { - // 不理解为什么这里时undefined的 - // 根据 weex 的通用做法,需要同时改变“引用”和“长度”两个维度才能被识别数组更新。 - // 1. 先清空原数组(触发长度变化) - if (this.display_video_list && this.display_video_list.length > 0) { - this.display_video_list.splice(0, this.display_video_list.length) - } else { - this.display_video_list = []; - } - // this.display_video_list.splice(0, this.display_video_list.length, ...list); - - // this.$nextTick(() => { - // setTimeout(() => { - // 2. 再把新数据 push 进去(触发内容变化) - list.forEach(item => this.display_video_list.push(item)) - // }, 0); - // }); - } catch (e) { - console.log('update_display_video_list', e); - } - }, // 更新分享信息 update_share_info(data) { @@ -1364,11 +1319,8 @@ if (e.detail.duration > 0) { duration = e.detail.duration; } - // #endif - // this.$nextTick(() => { - // this.current_video_duration = duration; - // this.current_video_progress = e.detail.currentTime; - // }) + // #endif + this.$set(this, 'current_video_duration', duration); this.$set(this, 'current_video_progress', e.detail.currentTime) } catch (error) { @@ -1404,7 +1356,7 @@ setTimeout(() => { this.is_seeking = false; }, 100); - e.stopPropagation(); + // e.stopPropagation(); } catch (error) { console.error('handle_slider_change error:', error); } @@ -1621,37 +1573,6 @@ console.error('delete_comment_handle error:', error); } }, - // 处理全局点击事件 - handle_global_click(e) { - try { - // 检查点击目标是否在下拉菜单相关元素内 - const target = e.target || e.srcElement; - - // 查找点击元素是否在comment-option或dropdown-menu内 - let isInDropdown = false; - let currentElement = target; - - while (currentElement && currentElement !== document) { - // 检查是否点击了下拉菜单触发器或菜单本身 - if (currentElement.classList && - (currentElement.classList.contains('comment-option') || - currentElement.classList.contains('dropdown-menu') || - currentElement.closest('.comment-option') || - currentElement.closest('.dropdown-menu'))) { - isInDropdown = true; - break; - } - currentElement = currentElement.parentNode; - } - - // 如果点击的不是下拉菜单相关元素,则关闭所有下拉菜单 - if (!isInDropdown && this.active_dropdown_id !== null) { - this.active_dropdown_id = null; - } - } catch (error) { - console.error('handle_global_click error:', error); - } - }, // 关闭举报弹窗 popup_report_close_event() { try {