From 719feb03fc1d42a0c76cfcbe50f30c45511be02e Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Fri, 5 Sep 2025 18:06:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E9=A2=91=E5=BC=80=E5=85=B3=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E8=87=AA=E5=8A=A8=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/nearbystores/index.vue | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/pages/nearbystores/index.vue b/pages/nearbystores/index.vue index 2024599..97091f6 100644 --- a/pages/nearbystores/index.vue +++ b/pages/nearbystores/index.vue @@ -25,17 +25,16 @@ @@ -155,7 +154,7 @@ export default { endTime: "", audioUrl: "", }, - isAudioPlaying: false, + isAudioPlaying: true, // 改为默认开启 audioContext: null, }; }, @@ -296,6 +295,11 @@ export default { this.stopMarquee(); this.startMarquee(); + // 自动播放音频 + if (this.templeData.audioUrl) { + this.playAudio(); + } + console.log("寺庙数据加载成功"); } else { throw new Error("寺庙数据API响应无效"); @@ -442,6 +446,17 @@ export default { } }, + /** + * 切换音频播放状态 + */ + toggleAudio() { + if (this.isAudioPlaying) { + this.stopAudio(); + } else { + this.playAudio(); + } + }, + /** * 播放音频 */ @@ -716,14 +731,6 @@ page { transform: scale(0.9); opacity: 0.8; } - - &.playing { - animation: pulse 2s infinite; - } - - &.stopped { - opacity: 0.6; - } } }