diff --git a/src/pages/battle-result.vue b/src/pages/battle-result.vue index 4248687..02b9237 100644 --- a/src/pages/battle-result.vue +++ b/src/pages/battle-result.vue @@ -25,7 +25,7 @@ onLoad(async (options) => { const myId = user.value.id; if (options.battleId) { const result = await getGameAPI( - options.battleId || "BATTLE-1755841244966457660-735" + options.battleId || "BATTLE-1758270367040321900-868" ); data.value = { ...result, @@ -44,7 +44,6 @@ onLoad(async (options) => { data.value.myTeam = result.bluePlayers[myId].team; ifWin.value = result.winner === 1; } - audioManager.play(ifWin.value ? "胜利" : "失败"); } if (result.mode === 2) { data.value.playerStats = result.players.map((p) => ({ @@ -54,9 +53,6 @@ onLoad(async (options) => { const mine = result.players.find((p) => p.playerId === myId); if (mine) totalPoints.value = mine.totalScore; rank.value = result.players.findIndex((p) => p.playerId === myId) + 1; - if (rank.value > result.players.length * 0.3) { - audioManager.play("胜利"); - } } } else { const battleInfo = uni.getStorageSync("last-battle"); @@ -83,11 +79,21 @@ onLoad(async (options) => { totalPoints.value = mine.totalScore; if (battleInfo.mode === 1) { ifWin.value = mine.team === battleInfo.winner; - audioManager.play(ifWin.value ? "胜利" : "失败"); - } else { - if (rank.value > battleInfo.playerStats.length * 0.3) { - audioManager.play("胜利"); - } + } + } + } + if (data.value.mode === 1) { + audioManager.play(ifWin.value ? "胜利" : "失败"); + } else if (data.value.mode === 2) { + if (data.value.battleMode === 1) { + if (rank.value <= data.value.playerStats.length * 0.3) { + audioManager.play("胜利"); + } + } else if (data.value.battleMode === 2) { + if (totalPoints.value > 0) { + audioManager.play("胜利"); + } else if (totalPoints.value < 0) { + audioManager.play("失败"); } } } @@ -273,10 +279,14 @@ const checkBowData = () => { :size="40" :borderColor="data.myTeam === 1 ? '#5fadff' : '#ff6060'" /> - 蓝队 - 红队