比赛详情添加决金箭部分

This commit is contained in:
kron
2025-07-06 12:36:20 +08:00
parent 0d21675013
commit dd51cfb81d
4 changed files with 105 additions and 41 deletions

View File

@@ -28,6 +28,7 @@ onLoad(async (options) => {
...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 }}
</view>
<view
v-if="selected > 0"
v-for="(score, index) in data.roundsData[selected][player.playerId]"
v-if="
selected === 1 &&
data.goldenRound &&
data.goldenRound.arrowHistory.find(
(a) => a.playerId === player.playerId
)
"
v-for="(score, index) in data.goldenRound.arrowHistory"
:key="index"
class="score-item"
:style="{ width: '13vw', height: '13vw' }"
>
{{ score.ring }}
</view>
<view
v-if="
(!data.goldenRound && selected > 0) ||
(data.goldenRound && selected > 1)
"
v-for="(score, index) in data.roundsData[
data.goldenRound ? selected - 1 : selected
][player.playerId]"
:key="index"
class="score-item"
:style="{ width: '13vw', height: '13vw' }"