From 59b26a364088b22deeb336745d14b1fc5f41ffff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 26 Feb 2026 16:05:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/plugins/video/search/search-record.vue | 8 ++++---- pages/plugins/video/search/search.vue | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pages/plugins/video/search/search-record.vue b/pages/plugins/video/search/search-record.vue index 6c884ab8..5c0cdb8d 100644 --- a/pages/plugins/video/search/search-record.vue +++ b/pages/plugins/video/search/search-record.vue @@ -147,7 +147,7 @@ export default { menu_button_info: menu_button_info }); // 搜索历史记录 - this.search_history = uni.getStorageSync('search_history_key') || []; + this.search_history = uni.getStorageSync('cache_plugins_video_search_history_key') || []; if (this.search_history.length > 0) { this.show_search_history = this.search_history.filter((item, index) => index < 5); } else { @@ -193,7 +193,7 @@ export default { // 保存搜索历史记录 if (!isEmpty(e) && !this.search_history.includes(e)) { this.search_history.push(e); - uni.setStorageSync('search_history_key', this.search_history); + uni.setStorageSync('cache_plugins_video_search_history_key', this.search_history); } this.search_query = e; // 跳转到搜索页 @@ -212,7 +212,7 @@ export default { this.search_history.splice(newIndex, 1); } this.show_search_history.splice(index, 1); - uni.setStorageSync('search_history_key', this.search_history); + uni.setStorageSync('cache_plugins_video_search_history_key', this.search_history); }, perform_url(e) { const url = e?.currentTarget?.dataset?.url || ''; @@ -235,7 +235,7 @@ export default { }); }, clear_history() { - uni.setStorageSync('search_history_key', []); + uni.setStorageSync('cache_plugins_video_search_history_key', []); this.setData({ search_history: [], show_search_history: [], diff --git a/pages/plugins/video/search/search.vue b/pages/plugins/video/search/search.vue index 26f44485..fb3e1e0b 100644 --- a/pages/plugins/video/search/search.vue +++ b/pages/plugins/video/search/search.vue @@ -154,7 +154,8 @@ export default { data_tabs_loding_status: 1, data_tabs_loding_msg: '', data_list_loding_status: 1, - data_list_loding_msg: '' + data_list_loding_msg: '', + search_history: [], }; }, onLoad(params) { @@ -207,6 +208,8 @@ export default { }) .exec(); // 执行查询 }, 500); + this.search_history = uni.getStorageSync('cache_plugins_video_search_history_key') || []; + // 初始化搜索页数据 this.init_data(); }, @@ -263,6 +266,10 @@ export default { data_list_loding_status: 1, recommend_videos: [] }) + if (!isEmpty(e) && !this.search_history.includes(e)) { + this.search_history.push(e); + uni.setStorageSync('cache_plugins_video_search_history_key', this.search_history); + } // 更新数据信息 this.load_recommend_videos(); }, From 7f4d4469fc1d30db4c9d15a234dc8ca8704a960e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 26 Feb 2026 16:37:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/plugins/video/detail/detail.vue | 67 +++++++++----------- pages/plugins/video/search/search-record.vue | 1 + 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/pages/plugins/video/detail/detail.vue b/pages/plugins/video/detail/detail.vue index ebd3ced0..beccf4c6 100644 --- a/pages/plugins/video/detail/detail.vue +++ b/pages/plugins/video/detail/detail.vue @@ -50,6 +50,7 @@ + {{ video_item.show_goods }} @@ -320,6 +321,7 @@ listener_height: 0, comments_data: {}, editor_path_type: 'video', + is_manual_pause: false, // 是否手动暂停 }; }, computed: { @@ -350,6 +352,11 @@ params: app.globalData.launch_params_handle(params), }); }, + onShow() { + if (!this.is_manual_pause && this.video_contexts != null) { + this.video_play_event(this.video_contexts[this.current_index], true); + } + }, onHide() { // 清理定时器 if (this.video_switch_debounce_timer) { @@ -549,18 +556,16 @@ }); setTimeout(() => { - if (!this.paused) { - //#ifdef H5 - if (this.video_contexts[this.current_index]) { // 当前播放的视频索引为0 - this.video_play_event(this.video_contexts[this.current_index], true); - } - //#endif - //#ifndef H5 - if (this.create_video_contexts[this.current_index]) { // 当前播放的视频索引为0 - this.video_play_event(this.create_video_contexts[this.current_index], true); - } - //#endif + //#ifdef H5 + if (this.video_contexts[this.current_index]) { // 当前播放的视频索引为0 + this.video_play_event(this.video_contexts[this.current_index], true); } + //#endif + //#ifndef H5 + if (this.create_video_contexts[this.current_index]) { // 当前播放的视频索引为0 + this.video_play_event(this.create_video_contexts[this.current_index], true); + } + //#endif }, 200); }, 0); } @@ -603,6 +608,7 @@ this.setData({ current_index: current, paused: false, + is_manual_pause: false, current_video_progress: 0, current_video_duration: 1, is_seeking: false, @@ -675,6 +681,9 @@ if (index !== exceptIndex && context) { try { context.pause(); + this.setData({ + is_manual_pause: false, + }); } catch (error) { console.warn(`暂停视频 ${index} 失败:`, error); } @@ -694,7 +703,6 @@ // 切换播放暂停 toggle_play_pause() { const currentIndex = this.current_index; - // 检查视频上下文是否存在 const videoContext = this.create_video_contexts[currentIndex] || this.video_contexts[currentIndex]; if (!videoContext) { @@ -703,7 +711,8 @@ } this.setData({ - paused: !this.paused + paused: !this.paused, + is_manual_pause: !this.paused, }); if (this.paused) { @@ -736,7 +745,7 @@ // 安全的视频播放事件处理 video_play_event(videoContext, is_first_play = false) { if (!videoContext) { - this.setData({ paused: true }); + this.setData({ paused: true, is_manual_pause: false }); return; } @@ -744,7 +753,7 @@ if (is_first_play) { //#ifdef H5 videoContext.play().catch((error) => { - this.setData({ paused: true }); + this.setData({ paused: true, is_manual_pause: false }); }); //#endif //#ifndef H5 @@ -755,7 +764,7 @@ } } catch (error) { console.error('视频播放异常:', error); - this.setData({ paused: true }); + this.setData({ paused: true, is_manual_pause: false }); } }, // 安全获取视频数据的方法,处理索引超限情况 @@ -839,11 +848,11 @@ }, on_transition(e) { const dy = e.detail.dy; - let status = 'direction' + let status = 'direction'; if (dy > 0) { - status = 'next' + status = 'next'; } else if (dy < 0) { - status = 'prev' + status = 'prev'; } // 如果历史的是向下滑动,这次也是向下滑动,就不更新数据 if (this.direction != status) { @@ -852,22 +861,8 @@ }) } }, - // 切换播放暂停 - toggle_play_pause() { - if (this.create_video_contexts[this.current_index] == null) return; // 当前播放的视频索引为1 - - this.setData({ - paused: !this.paused - }); - // 判断是否暂停 - if (this.paused) { - this.create_video_contexts[this.current_index].pause(); // 暂停中间的视频 - } else { - this.video_play_event(this.create_video_contexts[this.current_index], false); // 播放中间的视频 - } - }, handle_play() { - this.setData({ paused: false }); + this.setData({ paused: false, is_manual_pause: false }); }, // 收藏 handle_like(e) { @@ -1327,8 +1322,8 @@ // 暂停所有视频 this.pause_all_videos_except(-1); // 清空视频上下文数组 - this.create_video_contexts = []; - this.video_contexts = []; + // this.create_video_contexts = []; + // this.video_contexts = []; console.log('视频资源清理完成'); } catch (error) { console.error('清理视频资源时出错:', error); diff --git a/pages/plugins/video/search/search-record.vue b/pages/plugins/video/search/search-record.vue index 5c0cdb8d..2eb87500 100644 --- a/pages/plugins/video/search/search-record.vue +++ b/pages/plugins/video/search/search-record.vue @@ -248,6 +248,7 @@ export default {