hookehuyr

refactor(视频播放器): 移除重复的视频播放控制逻辑

移除`HomePage.vue`中重复的视频播放控制逻辑,简化代码结构。同时隐藏`VideoPlayer.vue`中的大播放按钮,提升用户体验。
......@@ -103,4 +103,8 @@ defineExpose({
.video-player.loading {
opacity: 0.6;
}
:deep(.vjs-big-play-button) {
display: none !important;
}
</style>
......
<!--
* @Date: 2025-03-20 19:55:21
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-24 17:41:55
* @LastEditTime: 2025-03-24 18:00:18
* @FilePath: /mlaj/src/views/HomePage.vue
* @Description: 亲子学院首页组件
*
......@@ -499,7 +499,6 @@
v-else
:video-url="item.video_url"
ref="videoPlayerRefs"
@onPlay="handleVideoPlay(index)"
/>
</div>
</div>
......@@ -538,22 +537,10 @@ const videoPlayerRefs = ref([]); // 视频播放器组件引用数组
// 播放视频处理函数
const playVideo = (index, videoUrl) => {
// 如果当前有其他视频在播放,先暂停它
if (activeVideoIndex.value !== null && activeVideoIndex.value !== index) {
videoPlayerRefs.value[activeVideoIndex.value]?.pause();
}
// 更新当前播放的视频索引
activeVideoIndex.value = index;
};
// 视频播放事件处理
const handleVideoPlay = (index) => {
// 确保同一时间只有一个视频在播放
if (activeVideoIndex.value !== null && activeVideoIndex.value !== index) {
videoPlayerRefs.value[activeVideoIndex.value]?.pause();
}
};
// 路由相关
const $route = useRoute()
useTitle($route.meta.title) // 设置页面标题
......