diff --git a/src/apis.js b/src/apis.js index 32df37c..24fcf38 100644 --- a/src/apis.js +++ b/src/apis.js @@ -234,6 +234,7 @@ export const getGameAPI = async (battleId) => { goldenRoundRecords = [], } = result; const data = { + battleId, mode: battleStats.mode, // 1.几V几 2.大乱斗 gameMode: battleStats.gameMode, // 1.约战 2.排位 }; diff --git a/src/constants.js b/src/constants.js index b24f42a..42cf4e4 100644 --- a/src/constants.js +++ b/src/constants.js @@ -101,16 +101,22 @@ export const getBattleResultTips = ( if (mode === 1) { if (win) { const tests = [ - "你是朋友中的佼佼者哟!", - "你成功击败好友,成为大赢家!", - "你将好友“一举拿下”,超神无疑!", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq1fglywucyoh9zn.png", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq1fgls1trzqneeh.png", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq1fgm4fmv0tqico.png", + // "你是朋友中的佼佼者哟!", + // "你成功击败好友,成为大赢家!", + // "你将好友“一举拿下”,超神无疑!", ]; return tests[getRandomIndex(3)]; } else { const tests = [ - "失误啦失误啦,再多来几局吧~", - "惜败好友,下次再战定能反超!", - "友谊第一,下场胜利属于你!", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq0gmb12vjkonvzm.png", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq0gmo5gpiecqqgu.png", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq0gmtk8hjwqoecz.png", + // "失误啦失误啦,再多来几局吧~", + // "惜败好友,下次再战定能反超!", + // "友谊第一,下场胜利属于你!", ]; return tests[getRandomIndex(3)]; } @@ -129,16 +135,22 @@ export const getBattleResultTips = ( if (mode === 1) { if (win) { const tests = [ - "你已经奔跑在通向王者的路上了!", - "射灵星球最闪耀的前进者!", - "赞!你真是越战越勇", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq1fgtb29jbdus4g.png", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq1fgtbu8fzpbh3z.png", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq1fgtbu8fzpbh3z.png", + // "你已经奔跑在通向王者的路上了!", + // "射灵星球最闪耀的前进者!", + // "赞!你真是越战越勇", ]; return tests[getRandomIndex(3)]; } else { const tests = [ - "失败是成功之母,儿子在等你!", - "人生得意须尽欢,不过此关心不甘!", - "这回一定是打开方式不对。再来!", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq0gmovnd33hz5yj.png", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq0gmtu558juplj9.png", + "https://api.shelingxingqiu.com/attachment/2025-08-01/dbqq0gmuhb5aofghg4.png", + // "失败是成功之母,儿子在等你!", + // "人生得意须尽欢,不过此关心不甘!", + // "这回一定是打开方式不对。再来!", ]; return tests[getRandomIndex(3)]; } diff --git a/src/pages.json b/src/pages.json index ce08b29..4b27d32 100644 --- a/src/pages.json +++ b/src/pages.json @@ -3,6 +3,9 @@ { "path": "pages/index" }, + { + "path": "pages/battle-result" + }, { "path": "pages/match-page" }, @@ -75,9 +78,6 @@ { "path": "pages/match-detail" }, - { - "path": "pages/battle-result" - }, { "path": "pages/team-bow-data" }, diff --git a/src/pages/battle-result.vue b/src/pages/battle-result.vue index 79bd22a..c884aa4 100644 --- a/src/pages/battle-result.vue +++ b/src/pages/battle-result.vue @@ -21,23 +21,25 @@ function exit() { } onLoad(async (options) => { + const myId = user.value.id; if (options.battleId) { const result = await getGameAPI( - options.battleId || "BATTLE-1753787456813171958-86" - // options.battleId || "BATTLE-1753239612271030113-788" + options.battleId || "BATTLE-1753426540845671675-932" ); - const battleInfo = uni.getStorageSync("last-battle"); data.value = { ...result, - id: options.battleId, + redPlayers: Object.values(result.redPlayers), + bluePlayers: Object.values(result.bluePlayers), battleMode: result.gameMode, }; - if (result.mode === 1 && result.redPlayers[user.value.id]) { - totalPoints.value = result.redPlayers[user.value.id].totalScore; + if (result.mode === 1 && result.redPlayers[myId]) { + totalPoints.value = result.redPlayers[myId].totalScore; + data.value.myTeam = result.redPlayers[myId].team; ifWin.value = result.winner === 0; } - if (result.mode === 1 && result.bluePlayers[user.value.id]) { - totalPoints.value = result.bluePlayers[user.value.id].totalScore; + if (result.mode === 1 && result.bluePlayers[myId]) { + totalPoints.value = result.bluePlayers[myId].totalScore; + data.value.myTeam = result.bluePlayers[myId].team; ifWin.value = result.winner === 1; } if (result.mode === 2) { @@ -45,19 +47,27 @@ onLoad(async (options) => { ...p, id: p.playerId, })); - const mine = result.players.find((p) => p.playerId === user.value.id); + const mine = result.players.find((p) => p.playerId === myId); if (mine) totalPoints.value = mine.totalScore; - rank.value = - result.players.findIndex((p) => p.playerId === user.value.id) + 1; + rank.value = result.players.findIndex((p) => p.playerId === myId) + 1; } } else { const battleInfo = uni.getStorageSync("last-battle"); if (!battleInfo) return; data.value = battleInfo; - const mine = battleInfo.playerStats.find((p) => p.id === user.value.id); - rank.value = - battleInfo.playerStats.findIndex((p) => p.id === user.value.id) + 1; + if (battleInfo.mode === 1) { + battleInfo.playerStats.forEach((p) => { + if (p.team === 1) data.value.bluePlayers = [p]; + if (p.team === 0) data.value.redPlayers = [p]; + }); + } + rank.value = 0; + const mine = battleInfo.playerStats.find((p, index) => { + rank.value = index + 1; + return p.id === myId; + }); if (mine) { + data.value.myTeam = mine.team; totalPoints.value = mine.totalScore; ifWin.value = battleInfo.mode === 1 && mine.team === battleInfo.winner; } @@ -73,21 +83,55 @@ const checkBowData = () => {