From 478c0bc2b2180f99f943bbd109a36c7df23beba6 Mon Sep 17 00:00:00 2001 From: chenlimao Date: Mon, 11 May 2026 10:10:23 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96=E5=AF=B9?= =?UTF-8?q?=E6=88=98=E8=BF=9B=E5=BA=A6=E6=9D=A1=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShootProgress2.vue | 5 +++++ src/pages/team-battle.vue | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/ShootProgress2.vue b/src/components/ShootProgress2.vue index 260837f..0c7a07f 100644 --- a/src/components/ShootProgress2.vue +++ b/src/components/ShootProgress2.vue @@ -36,7 +36,12 @@ const updateRemain = (value) => { if (value.team === 'blue') barColor.value = "linear-gradient( 180deg, #9AB3FF 0%, #4288FF 100%)"; if (value.reset) { + // 重置时瞬间跳满格,禁用 CSS 过渡避免从旧值「涨到满」的动画 + transitionStyle.value = "none"; remain.value = value.value; + setTimeout(() => { + transitionStyle.value = "all 1s linear"; + }, 50); return; } const newVal = Math.round(value.value); diff --git a/src/pages/team-battle.vue b/src/pages/team-battle.vue index 074bc3b..49cecb7 100644 --- a/src/pages/team-battle.vue +++ b/src/pages/team-battle.vue @@ -89,7 +89,8 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => { } tips.value = nextTips; uni.$emit("update-tips", nextTips); - uni.$emit("update-remain", {reset: true, value: 15, team: redTeam?'red':'blue'}); + // redPlayer 已在上方 find() 确认:不为 null 则当前射手在红队 + uni.$emit("update-remain", {reset: true, value: 15, team: redPlayer?'red':'blue'}); if (force) { const remain = (Date.now() - battleInfo.current.startTime) / 1000; console.log(`当前轮已进行${remain}秒`); From ea60371c44984d215f9b4f36afadcfe5f8340b4d Mon Sep 17 00:00:00 2001 From: chenlimao Date: Mon, 11 May 2026 11:04:05 +0800 Subject: [PATCH 2/4] =?UTF-8?q?bug=EF=BC=9A=E4=BF=AE=E5=A4=8D=E6=8E=92?= =?UTF-8?q?=E4=BD=8D=E8=B5=9B=E5=AF=B9=E6=8A=97=E7=B1=BB=E5=9E=8B=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E9=94=99=E6=AF=94=E8=B5=9B=E9=A1=B5=E9=9D=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/match-page.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/match-page.vue b/src/pages/match-page.vue index ea73d8d..c1c1102 100644 --- a/src/pages/match-page.vue +++ b/src/pages/match-page.vue @@ -26,13 +26,15 @@ async function onReceiveMessage(msg) { onComplete.value = () => {} } if (msg.type === MESSAGETYPESV2.AboutToStart) { - if (gameType.value == 1) { + // 使用后端下发的 mode 字段判断跳转目标,与好友约战(battle-room.vue)保持一致 + // mode <= 3 为团队对抗,mode > 3 为大乱斗,覆盖全部 gameType(1~5),不再遗漏 + if (msg.mode <= 3) { uni.redirectTo({ - url: `/pages/team-battle?battleId=${msg.id}&gameMode=2`, + url: `/pages/team-battle?battleId=${msg.id}`, }); - } else if (gameType.value == 2) { + } else { uni.redirectTo({ - url: `/pages/melee-battle?battleId=${msg.id}&gameMode=2`, + url: `/pages/melee-battle?battleId=${msg.id}`, }); } } From c8c2abf3e7507ba51364151af16a98e4315aa36f Mon Sep 17 00:00:00 2001 From: chenlimao Date: Mon, 11 May 2026 14:39:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96NvN=E6=AF=94?= =?UTF-8?q?=E8=B5=9B=E8=BF=9B=E5=BA=A6=E6=9D=A1=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShootProgress2.vue | 4 ++++ src/pages/team-battle.vue | 38 +++++++++++++++++++++++++------ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/components/ShootProgress2.vue b/src/components/ShootProgress2.vue index 0c7a07f..a8ee1dc 100644 --- a/src/components/ShootProgress2.vue +++ b/src/components/ShootProgress2.vue @@ -36,6 +36,8 @@ const updateRemain = (value) => { if (value.team === 'blue') barColor.value = "linear-gradient( 180deg, #9AB3FF 0%, #4288FF 100%)"; if (value.reset) { + // 重置前先清除旧计时器,防止超时未射箭时旧 interval 残留,导致进度条震荡 + if (timer.value) clearInterval(timer.value); // 重置时瞬间跳满格,禁用 CSS 过渡避免从旧值「涨到满」的动画 transitionStyle.value = "none"; remain.value = value.value; @@ -56,6 +58,8 @@ const updateRemain = (value) => { remain.value = newVal; } + // 启动前先清除旧计时器,防止多次 {stop:false} 事件叠加多个 interval + if (timer.value) clearInterval(timer.value); timer.value = setInterval(() => { loading.value = remain.value === 0; if (remain.value > 0) remain.value--; diff --git a/src/pages/team-battle.vue b/src/pages/team-battle.vue index 49cecb7..f0a2d69 100644 --- a/src/pages/team-battle.vue +++ b/src/pages/team-battle.vue @@ -23,6 +23,8 @@ const start = ref(null); const tips = ref(""); const battleId = ref(""); const currentRound = ref(0); +/** 专用于 RoundEndTip 展示的轮次,与进度条的 currentRound 解耦,避免 ToSomeoneShoot 提前更新 currentRound 导致 Tip 显示错误轮次 */ +const roundTipRound = ref(0); const goldenRound = ref(0); const currentRedPoint = ref(0); const currentBluePoint = ref(0); @@ -75,6 +77,8 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => { return; } if (!arrowOnly) { + // 在 ToSomeoneShoot 时同步更新当前轮次,使进度条轮次图片及时切换 + currentRound.value = battleInfo.current.round || 1; currentShooterId.value = battleInfo.current.playerId; const redPlayer = battleInfo.teams[2].players.find( (item) => item.id === battleInfo.current.playerId @@ -87,6 +91,13 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => { ) { nextTips += "你"; } + // 同队连续出手时 tips 值不变,HeaderProgress watch 不触发音频 + // 需在赋值前比较旧值,手动播放音频确保始终触发 onAudioEnded 启动计时器 + // 注意:使用 interrupt=false 避免打断上一支箭的环数播报音频 + if (tips.value === nextTips && !nextTips.includes("重回")) { + const audioKey = redPlayer ? "请红方射箭" : "请蓝方射箭"; + audioManager.play(audioKey, false); + } tips.value = nextTips; uni.$emit("update-tips", nextTips); // redPlayer 已在上方 find() 确认:不为 null 则当前射手在红队 @@ -118,8 +129,13 @@ const recoverData = (battleInfo, {force = false, arrowOnly = false} = {}) => { }; function onAudioEnded(s) { - if (s.indexOf('请红方射箭') >= 0 || s.indexOf('请蓝方射箭') >= 0) { - let team = s.indexOf('请红方射箭') >= 0 ? 'red' : 'blue'; + // "请红方射箭"/"请蓝方射箭":队友或对手轮次;"轮到你了":用户本人轮次(HeaderProgress特殊分支) + // 三者音频结束后均需启动倒计时进度条 + if (s.indexOf('请红方射箭') >= 0 || s.indexOf('请蓝方射箭') >= 0 || s.indexOf('轮到你了') >= 0) { + let team; + if (s.indexOf('请红方射箭') >= 0) team = 'red'; + else if (s.indexOf('请蓝方射箭') >= 0) team = 'blue'; + else team = tips.value.includes('红队') ? 'red' : 'blue'; // 轮到你了:从当前tips判断用户所在队伍 uni.$emit("update-remain", {stop: false, value: updateRemainSecond.value, team: team}); } if (s.indexOf("比赛结束") >= 0) { @@ -137,10 +153,16 @@ function onBattleEnd() { } } -function onNewRound(msg) { +/** + * @param {object} msg - NewRound 消息 + * @param {number} prevRound - 在 NewRound 消息到达时即时捕获的旧轮次,用于 Tip 展示,避免异步延迟内 currentRound 已被更新 + */ +function onNewRound(msg, prevRound) { showRoundTip.value = true; isFinalShoot.value = msg.current.goldRound; - const latestRound = msg.rounds[currentRound.value - 1]; + // 用传入的 prevRound(捕获时刻的旧轮次)展示结算 Tip,与进度条 currentRound 解耦 + roundTipRound.value = prevRound; + const latestRound = msg.rounds[prevRound - 1]; if (latestRound) { if (isFinalShoot.value) { currentBluePoint.value = msg.teams[1].score; @@ -163,8 +185,10 @@ async function onReceiveMessage(msg) { showRoundTip.value = false; recoverData(msg, {arrowOnly: true}); } else if (msg.type === MESSAGETYPESV2.NewRound) { + // 在进入延迟前先捕获当前轮次,供 onNewRound 使用,防止 800ms 内 ToSomeoneShoot 提前更新 currentRound 造成 Tip 展示错轮 + const prevRound = currentRound.value; setTimeout(() => { - onNewRound(msg) + onNewRound(msg, prevRound) }, 800) } else if (msg.type === MESSAGETYPESV2.BattleEnd) { matchStatus.value = msg.status; @@ -264,11 +288,11 @@ onShow(async () => { From b1238eff57ecc290da453643b3504478cb6529d7 Mon Sep 17 00:00:00 2001 From: chenlimao Date: Mon, 11 May 2026 15:14:30 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix=EF=BC=9A=E4=BC=98=E5=8C=96=E5=86=B3?= =?UTF-8?q?=E9=87=91=E7=AE=AD=E7=9A=84=E6=95=B0=E9=87=8F=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/team-battle.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/team-battle.vue b/src/pages/team-battle.vue index f0a2d69..3f5e7ea 100644 --- a/src/pages/team-battle.vue +++ b/src/pages/team-battle.vue @@ -160,6 +160,10 @@ function onBattleEnd() { function onNewRound(msg, prevRound) { showRoundTip.value = true; isFinalShoot.value = msg.current.goldRound; + // 决金箭轮每人只射一箭,重置箭数显示为 (0/1) + if (msg.current.goldRound) { + uni.$emit("update-shot", { currentShot: 0, totalShot: 1 }); + } // 用传入的 prevRound(捕获时刻的旧轮次)展示结算 Tip,与进度条 currentRound 解耦 roundTipRound.value = prevRound; const latestRound = msg.rounds[prevRound - 1];