新增最后一个和第一个的提示

master
于肖磊 2026-03-11 18:43:54 +08:00
parent 4c468099b2
commit 0c8ca980d6
1 changed files with 75 additions and 2 deletions

View File

@ -18,7 +18,7 @@
<!-- 视频列表 -->
<swiper class="swiper-container" :key="'top-or-buttom-' + swiper_key" :style="swiperStyle" :duration="500" :vertical="true" :circular="close_circular ? false : true" :skip-hidden-item-layout="true" :current="current_index" easing-function="linear" @transition="on_transition" @change="handle_swiper_change">
<swiper-item v-for="(video_item, index) in display_video_list" :key="video_item.id">
<view class="video-container pr" @tap.stop="toggle_play_pause">
<view class="video-container pr" @tap.stop="toggle_play_pause" @touchstart.prevent="handle_swiper_touch_start" @touchmove.prevent="handle_swiper_touch_move" @touchend="handle_swiper_touch_end">
<view class="video-bg" :style="!isEmpty(video_item.cover) ? 'background-image: url(' + video_item.cover + ')' : ''"></view>
<video class="video" :src="video_item.video_url" :poster="video_item.cover" :id="`video_${index}`" :loop="true" :show-fullscreen-btn="false" :show-center-play-btn="false" :show-play-btn="false" :controls="false" :show-mute-btn="true" object-fit="contain" @timeupdate="handle_time_update" @play="handle_play"></video>
@ -317,6 +317,11 @@
comments_reply_data: {},
editor_path_type: 'video',
is_manual_pause: false, //
//
swiper_start_y: 0,
swiper_current_y: 0,
swiper_move_distance: 0,
swiper_move_throttle_timer: null,
};
},
components: {
@ -786,7 +791,75 @@
this.video_play_event(videoContext);
}
},
//
handle_swiper_touch_start(e) {
try {
//
this.swiper_start_y = e?.touches[0]?.pageY || 0;
this.swiper_current_y = this.swiper_start_y;
this.swiper_move_distance = 0;
} catch (error) {
console.error('handle_swiper_touch_start error:', error);
}
},
//
handle_swiper_touch_move(e) {
try {
const current_y = e?.touches[0]?.pageY || 0;
const distance = current_y - this.swiper_start_y;
// 10px
if (Math.abs(distance) > 10) {
this.swiper_current_y = current_y;
// 使 move_distance
if (this.swiper_move_throttle_timer) {
return;
}
this.move_distance = distance;
// 16ms 60fps
this.swiper_move_throttle_timer = setTimeout(() => {
this.swiper_move_throttle_timer = null;
}, 80);
}
} catch(error) {
console.error('handle_swiper_touch_move error:', error);
}
},
//
handle_swiper_touch_end(e) {
try {
const move_distance = this.swiper_current_y - this.swiper_start_y;
// 15%
if (move_distance > 0) {
//
if (this.current_video_index <= 0) {
app.globalData.showToast('已经是第一个视频了');
return;
}
} else {
//
if (this.current_video_index >= this.video_data_list.length - 1) {
app.globalData.showToast('已经是最后一个视频了');
return;
}
}
//
if (this.swiper_move_throttle_timer) {
clearTimeout(this.swiper_move_throttle_timer);
this.swiper_move_throttle_timer = null;
}
//
this.swiper_start_y = 0;
this.swiper_current_y = 0;
} catch (error) {
console.error('handle_swiper_touch_end error:', error);
}
},
//
update_share_info(data) {
const info = {