修改内容处理

master
于肖磊 2026-02-26 16:37:53 +08:00
parent 59b26a3640
commit 7f4d4469fc
2 changed files with 32 additions and 36 deletions

View File

@ -50,6 +50,7 @@
</view>
<view v-if="!isEmpty(video_item.goods) && base_config_data && base_config_data.is_video_detail_show_goods && base_config_data.is_video_detail_show_goods == 1" class="product-card">
<view class="flex-col gap-10">
<text>{{ video_item.show_goods }}</text>
<view v-if="video_item.show_goods" class="flex-row align-c gap-10 product-card-item" :data-id="video_item.id" @tap.stop="handle_product_card_item">
<view class="product-image">
<image :src="video_item.goods.images" mode="aspectFill" class="product-image"></image>
@ -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);

View File

@ -248,6 +248,7 @@ export default {
<style lang="scss" scoped>
.search-record-container {
background: #fff;
height: 100vh;
}
.header-top {