chore: 线上能够播放音乐的版本

This commit is contained in:
2025-12-16 08:29:14 +08:00
parent 2d417cd631
commit ddef52e6ce
2 changed files with 46 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div @click.once="handleFirstInteraction">
<div @click="handleAnyInteraction" @scroll="handleAnyInteraction" @touchstart="handleAnyInteraction">
<!-- 第一部分百日大战主题 - 使用banner0.png图片 -->
<section class="theme-section card-game">
<div class="theme-container">
@@ -421,6 +421,15 @@ const handleFirstInteraction = () => {
}
};
// 添加任意交互处理函数(点击、滚动等都会触发)
const handleAnyInteraction = () => {
// 只有在音乐启用且当前未播放时才尝试播放
if (localMusicConfig.value.enabled && !musicPlayer.isPlaying) {
console.log("检测到用户交互,尝试播放音乐...");
musicPlayer.play();
}
};
// 加载任务设置和初始化所有数据
onBeforeMount(async () => {
try {