From 80a20f365d7e8dd143eb1c4252fa0ec7319389b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Wed, 11 Feb 2026 10:36:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=86=E9=A2=91=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E5=99=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/plugins/video/detail/detail.vue | 57 ++++++++++++++++----------- pages/plugins/video/index/index.vue | 4 +- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/pages/plugins/video/detail/detail.vue b/pages/plugins/video/detail/detail.vue index 1ddd131a..d04a34c2 100644 --- a/pages/plugins/video/detail/detail.vue +++ b/pages/plugins/video/detail/detail.vue @@ -15,6 +15,7 @@ + @@ -287,14 +288,14 @@ this.get_last_or_next_data_list(this.params.id, 1, 1); } else { this.setData({ - data_tabs_loding_status: 2, + data_list_loding_status: 2, data_tabs_loding_msg: data.msg, }); } }, fail: (err) => { this.setData({ - data_tabs_loding_status: 2, + data_list_loding_status: 2, data_list_loding_msg: this.$t('common.internet_error_tips'), }); } @@ -332,17 +333,18 @@ } else if (is_next == 1 && new_data.next.length > 0) { // 下一页数据 data_list.push(...new_data.next); } - - const new_index = data_list.findIndex(item => item.id == this.params.id); + console.log(data_list); + const new_index = data_list.findIndex(item => item.id == this.params.id); this.setData({ video_data_list: data_list, - current_index: is_last == 1 && is_next == 1 ? (new_index < data_list.length - 1 ? new_index : 0) : this.current_index, + current_index: is_last == 1 && is_next == 1 ? (new_index == data_list.length - 1 ? 2 : (new_index == data_list.length - 2 ? 1 : 0)) : this.current_index, }); - // 更新数据信息 - this.update_display_data(); - + if (is_last == 1 && is_next == 1) { + // 更新数据信息 + this.update_display_data(); + setTimeout(() => { // // 更新分享信息 this.update_share_info(this.display_video_list[0]); @@ -354,33 +356,37 @@ setTimeout(() => { if (this.video_contexts[0]) { // 当前播放的视频索引为0 - this.video_play_event(this.video_contexts[0]); + this.video_play_event(this.video_contexts[0], true); } }, 200); }, 0); } } else { this.setData({ - data_tabs_loding_status: 2, + data_list_loding_status: 2, data_tabs_loding_msg: data.msg, }); } }, fail: (err) => { this.setData({ - data_tabs_loding_status: 2, + data_list_loding_status: 2, data_list_loding_msg: this.$t('common.internet_error_tips'), }); } }); }, - video_play_event(video_contexts) { + video_play_event(video_contexts, is_first_play = false) { try { - video_contexts.play().catch(() => { - this.setData({ - paused: true, + if (is_first_play) { + video_contexts.play().catch(() => { + this.setData({ + paused: true, + }); }); - }); + } else { + video_contexts.play(); + } } catch (error) { this.setData({ paused: true, @@ -558,8 +564,8 @@ const { current } = event.detail; const previousIndex = this.current_index; - if (this.video_contexts[previousIndex]) { - this.video_contexts[previousIndex].pause(); + if (this.create_video_contexts[previousIndex]) { + this.create_video_contexts[previousIndex].pause(); } this.setData({ current_index: current, @@ -608,32 +614,35 @@ swiper_key: get_math() }) } else { - this.is_slide_start = true; + this.setData({ + is_slide_start: true + }) // 预加载当前index之后的视频 this.update_display_data(); } + // 更新分享信息 this.update_share_info(this.display_video_list[current]); setTimeout(() => { // 播放当前视频 - if (this.video_contexts[current]) { - this.video_play_event(this.video_contexts[current]); + if (this.create_video_contexts[current]) { + this.video_play_event(this.create_video_contexts[current], false); } }, 100); }, // 切换播放暂停 toggle_play_pause() { - if (this.video_contexts[this.current_index] == null) return; // 当前播放的视频索引为1 + if (this.create_video_contexts[this.current_index] == null) return; // 当前播放的视频索引为1 this.setData({ paused: !this.paused }); // 判断是否暂停 if (this.paused) { - this.video_contexts[this.current_index].pause(); // 暂停中间的视频 + this.create_video_contexts[this.current_index].pause(); // 暂停中间的视频 } else { - this.video_play_event(this.video_contexts[this.current_index]); // 播放中间的视频 + this.video_play_event(this.create_video_contexts[this.current_index], false); // 播放中间的视频 } }, // 收藏 diff --git a/pages/plugins/video/index/index.vue b/pages/plugins/video/index/index.vue index bb2a94e8..e00e58a2 100644 --- a/pages/plugins/video/index/index.vue +++ b/pages/plugins/video/index/index.vue @@ -82,7 +82,7 @@ export default { // #endif search_query: '', tabs: [], - current_tabs_index: '', + current_tabs_index: 0, current_tabs_id: '', recommend_videos: [], isLoadingMore: false, @@ -94,7 +94,7 @@ export default { header_padding_left: '', }; }, - onshow() { + onShow() { this.init(); }, methods: {