diff --git a/src/apis.js b/src/apis.js index c8c5759..35b8e88 100644 --- a/src/apis.js +++ b/src/apis.js @@ -156,7 +156,11 @@ export const getGameAPI = async (battleId) => { const result = await request("POST", "/user/battle/detail", { id: battleId, }); - const { battleStats = {}, playerStats = {} } = result; + const { + battleStats = {}, + playerStats = {}, + goldenRoundRecords = [], + } = result; const data = { mode: battleStats.mode, gameMode: battleStats.gameMode, @@ -166,6 +170,7 @@ export const getGameAPI = async (battleId) => { data.roundsData = {}; data.redPlayers = {}; data.bluePlayers = {}; + data.goldenRound = goldenRoundRecords.length ? goldenRoundRecords[0] : null; playerStats.forEach((item) => { const { playerBattleStats = {}, roundRecords = [] } = item; if (playerBattleStats.team === 0) { diff --git a/src/pages/match-detail.vue b/src/pages/match-detail.vue index 3575abf..ecf796d 100644 --- a/src/pages/match-detail.vue +++ b/src/pages/match-detail.vue @@ -20,7 +20,7 @@ const data = ref({ onLoad(async (options) => { if (options.id) { - battleId.value = options.id || "BATTLE-1750946182966867665-941"; + battleId.value = options.id || "BATTLE-1751732742024840058-732"; const result = await getGameAPI(battleId.value); data.value = result; if (result.mode === 1) { @@ -76,30 +76,53 @@ const checkBowData = () => { :redTeam="redTeam" :players="data.players" /> - + { - - - {{ p.name }} - - + + + + {{ item.bluePlayers[0].name }} + + + + + + + {{ item.redPlayers[0].name }} + + + { ...Object.values(result.redPlayers), ]; } + if (result.goldenRound) tabs.value.push("决金箭"); Object.keys(result.roundsData).forEach((key) => { tabs.value.push(`第${roundsName[key]}轮`); }); @@ -38,7 +39,7 @@ const onClickTab = (index) => { selected.value = index; redScores.value = []; blueScores.value = []; - const { bluePlayers, redPlayers, roundsData } = data.value; + const { bluePlayers, redPlayers, roundsData, goldenRound } = data.value; if (index === 0) { Object.keys(bluePlayers).forEach((p) => { allRoundsScore.value[p] = []; @@ -62,14 +63,20 @@ const onClickTab = (index) => { }); }); }); + } else if (index === 1 && goldenRound) { + if (goldenRound.winner === 1) { + blueScores.value = goldenRound.arrowHistory; + } else { + redScores.value = goldenRound.arrowHistory; + } } else { Object.keys(bluePlayers).forEach((p) => { - roundsData[index][p].forEach((arrow) => { + roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => { blueScores.value.push(arrow); }); }); Object.keys(redPlayers).forEach((p) => { - roundsData[index][p].forEach((arrow) => { + roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => { redScores.value.push(arrow); }); }); @@ -114,8 +121,28 @@ const onClickTab = (index) => { {{ ring }} + {{ score.ring }} + +