From 666c95e8b9d26c4f7c956088d62a0a22274546d7 Mon Sep 17 00:00:00 2001 From: kron Date: Thu, 24 Jul 2025 10:24:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E=E6=AF=94?= =?UTF-8?q?=E8=B5=9B=E7=BB=93=E6=9D=9F=E8=B7=B3=E8=BD=AC=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/battle-result.vue | 39 ++++++++++++++++++++++--------------- src/util.js | 17 +++++++++------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/pages/battle-result.vue b/src/pages/battle-result.vue index b31925d..51c0650 100644 --- a/src/pages/battle-result.vue +++ b/src/pages/battle-result.vue @@ -22,23 +22,31 @@ function exit() { onLoad(async (options) => { if (options.battleId) { - battleId.value = options.battleId; const result = await getGameAPI( - options.battleId || "BATTLE-1752563964391008873-624" + options.battleId || "BATTLE-1753274533670200664-192" + // options.battleId || "BATTLE-1753239612271030113-788" ); - data.value = result; - // if (result.mode === 1 && result.redPlayers[user.value.id]) { - // totalPoints.value = result.redPlayers[user.value.id].totalScore; - // ifWin.value = result.winner === 0; - // } - // if (result.mode === 1 && result.bluePlayers[user.value.id]) { - // totalPoints.value = result.bluePlayers[user.value.id].totalScore; - // ifWin.value = result.winner === 1; - // } - // if (result.mode === 2) { - // const mine = result.players.find((p) => p.playerId === user.value.id); - // if (mine) totalPoints.value = mine.totalScore; - // } + const battleInfo = uni.getStorageSync("last-battle"); + data.value = { + ...result, + id: options.battleId, + battleMode: result.gameMode, + playerStats: result.players.map((p) => ({ ...p, id: p.playerId })), + }; + if (result.mode === 1 && result.redPlayers[user.value.id]) { + totalPoints.value = result.redPlayers[user.value.id].totalScore; + ifWin.value = result.winner === 0; + } + if (result.mode === 1 && result.bluePlayers[user.value.id]) { + totalPoints.value = result.bluePlayers[user.value.id].totalScore; + ifWin.value = result.winner === 1; + } + if (result.mode === 2) { + const mine = result.players.find((p) => p.playerId === user.value.id); + if (mine) totalPoints.value = mine.totalScore; + rank.value = + result.players.findIndex((p) => p.playerId === user.value.id) + 1; + } } else { const battleInfo = uni.getStorageSync("last-battle"); if (!battleInfo) return; @@ -58,7 +66,6 @@ const checkBowData = () => { url: `/pages/match-detail?id=${data.value.id}`, }); }; -