1、loading页增加背景颜色,同时压缩loading_bg图片
2、点击开始按钮时,检测并进行音乐播放
3、调整视频播放关闭按钮位置
This commit is contained in:
Wenzhe 2026-02-04 14:54:29 +08:00
parent f58436e0fe
commit 3ed1978442
5 changed files with 51 additions and 30 deletions

View File

@ -137,6 +137,7 @@ onMounted(() => {
align-items: center;
justify-content: center;
z-index: 9999;
background-color: #fd4336;
}
.loading-bg {

View File

@ -234,6 +234,12 @@ const handleStart = () => {
hasScrolled.value = false
console.log('点击开始按钮hasScrolled:', hasScrolled.value)
//
if (!isMusicPlaying.value) {
console.log('背景音乐未播放,开始播放')
toggleMusic()
}
//
initPage()
}
@ -330,9 +336,27 @@ const toggleMusic = () => {
console.log('音乐已暂停')
} else {
//
audioPlayer.value.play()
try {
const result = audioPlayer.value.play()
// play()PromiseWeb
if (result && typeof result.then === 'function') {
// Web使Promise
result.then(() => {
isMusicPlaying.value = true
console.log('音乐已开始播放')
}).catch(error => {
console.error('音乐播放失败(需要用户交互):', error)
// isMusicPlayingfalse
})
} else {
//
isMusicPlaying.value = true
console.log('音乐已开始播放')
}
} catch (error) {
console.error('音乐播放失败(需要用户交互):', error)
// isMusicPlayingfalse
}
}
}
@ -343,10 +367,8 @@ onMounted(() => {
//
initMusicPlayer()
//
setTimeout(() => {
toggleMusic()
}, 1000)
//
//
})
//

View File

@ -63,7 +63,7 @@ const handlePlayClick = () => {
/* 鼠标悬停效果 */
.video-play-button-container:hover .video-play-button-bg {
background-color: rgba(0, 0, 0, 0.9);
background-color: rgba(0, 0, 0, 0.4);
transform: scale(1.05);
animation: none;
}

View File

@ -37,9 +37,6 @@ const handleContentClick = (e) => {
<template>
<div v-if="visible" class="video-modal">
<div class="video-modal-content" @click="handleContentClick">
<div class="video-close-button" @click="handleClose">
<span>×</span>
</div>
<video
:src="videoUrl"
class="video-player"
@ -48,6 +45,10 @@ const handleContentClick = (e) => {
loop
></video>
</div>
<!-- 关闭按钮放在视频下方 -->
<div class="video-close-button" @click="handleClose">
<img src="/static/images/btn_close.png" alt="关闭" class="close-icon" />
</div>
</div>
</template>
@ -63,6 +64,7 @@ const handleContentClick = (e) => {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
z-index: 999;
}
@ -70,18 +72,22 @@ const handleContentClick = (e) => {
position: relative;
border-radius: 20rpx;
overflow: hidden;
width: 720rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.video-player {
width: 720rpx;
height: 405rpx;
background-color: #000;
}
.video-close-button {
position: absolute;
top: 10rpx;
right: 10rpx;
width: 40rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 50%;
margin-top: 30rpx;
width: 68rpx;
height: 68rpx;
display: flex;
align-items: center;
justify-content: center;
@ -89,17 +95,9 @@ const handleContentClick = (e) => {
z-index: 10;
}
.video-close-button span {
color: white;
font-size: 30rpx;
font-weight: bold;
line-height: 30rpx;
height: 30rpx;
}
.video-player {
width: 100%;
height: 100%;
background-color: #000;
.close-icon {
width: 68rpx;
height: 68rpx;
object-fit: contain;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 41 KiB