refactor(IndexCheckInPage): 移除未使用的视频播放器暂停逻辑并清理注释代码
清理了已注释掉的视频播放器相关代码,并移除了未使用的视频暂停逻辑,以简化代码并提高可读性
Showing
1 changed file
with
2 additions
and
23 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-05-29 15:34:17 | 2 | * @Date: 2025-05-29 15:34:17 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-05-30 20:27:29 | 4 | + * @LastEditTime: 2025-05-30 20:33:15 |
| 5 | * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue | 5 | * @FilePath: /mlaj/src/views/checkin/IndexCheckInPage.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -81,9 +81,7 @@ | ... | @@ -81,9 +81,7 @@ |
| 81 | <van-image width="30%" fit="cover" v-for="(image, index) in post.images" :key="index" :src="image" | 81 | <van-image width="30%" fit="cover" v-for="(image, index) in post.images" :key="index" :src="image" |
| 82 | @click="openImagePreview(index, post)" /> | 82 | @click="openImagePreview(index, post)" /> |
| 83 | </div> | 83 | </div> |
| 84 | - <van-image-preview v-if="currentPost" v-model:show="showImagePreview" :images="currentPost.images" | 84 | + <van-image-preview v-if="currentPost" v-model:show="showImagePreview" :images="currentPost.images" :start-position="startPosition" :show-index="true" @change="onChange" /> |
| 85 | - :start-position="startPosition" :show-index="true" @change="onChange" /> | ||
| 86 | - | ||
| 87 | <div v-for="(v, idx) in post.videoList" :key="idx"> | 85 | <div v-for="(v, idx) in post.videoList" :key="idx"> |
| 88 | <!-- 视频封面和播放按钮 --> | 86 | <!-- 视频封面和播放按钮 --> |
| 89 | <div v-if="v.video && !v.isPlaying" class="relative w-full rounded-lg overflow-hidden" style="aspect-ratio: 16/9; margin-bottom: 1rem;"> | 87 | <div v-if="v.video && !v.isPlaying" class="relative w-full rounded-lg overflow-hidden" style="aspect-ratio: 16/9; margin-bottom: 1rem;"> |
| ... | @@ -110,18 +108,6 @@ | ... | @@ -110,18 +108,6 @@ |
| 110 | @onPlay="handleVideoPlay(player, post)" | 108 | @onPlay="handleVideoPlay(player, post)" |
| 111 | @onPause="handleVideoPause(post)" /> | 109 | @onPause="handleVideoPause(post)" /> |
| 112 | </div> | 110 | </div> |
| 113 | - <!-- <VideoPlayer v-if="post.video && post.isPlaying" :video-url="post.video" | ||
| 114 | - class="post-video rounded-lg overflow-hidden" | ||
| 115 | - :ref="el => { | ||
| 116 | - if(el) { | ||
| 117 | - // 确保不重复添加 | ||
| 118 | - if (!videoPlayers?.includes(el)) { | ||
| 119 | - videoPlayers?.push(el); | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | - }" | ||
| 123 | - @onPlay="handleVideoPlay(player, post)" | ||
| 124 | - @onPause="handleVideoPause(post)" /> --> | ||
| 125 | <AudioPlayer | 111 | <AudioPlayer |
| 126 | v-if="post.audio.length" | 112 | v-if="post.audio.length" |
| 127 | :songs="post.audio" | 113 | :songs="post.audio" |
| ... | @@ -304,13 +290,6 @@ const stopAllVideos = () => { | ... | @@ -304,13 +290,6 @@ const stopAllVideos = () => { |
| 304 | // 确保videoPlayers.value是一个数组 | 290 | // 确保videoPlayers.value是一个数组 |
| 305 | if (!videoPlayers.value) return; | 291 | if (!videoPlayers.value) return; |
| 306 | 292 | ||
| 307 | - videoPlayers.value?.forEach(player => { | ||
| 308 | - // 使用组件暴露的pause方法 | ||
| 309 | - if (typeof player.pause === 'function') { | ||
| 310 | - player.pause(); | ||
| 311 | - } | ||
| 312 | - }); | ||
| 313 | - | ||
| 314 | // 更新所有帖子的播放状态 | 293 | // 更新所有帖子的播放状态 |
| 315 | mockPosts.value.forEach(p => { | 294 | mockPosts.value.forEach(p => { |
| 316 | p.videoList.forEach(v => { | 295 | p.videoList.forEach(v => { | ... | ... |
-
Please register or login to post a comment