比赛详情添加决金箭部分

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

@@ -156,7 +156,11 @@ export const getGameAPI = async (battleId) => {
const result = await request("POST", "/user/battle/detail", { const result = await request("POST", "/user/battle/detail", {
id: battleId, id: battleId,
}); });
const { battleStats = {}, playerStats = {} } = result; const {
battleStats = {},
playerStats = {},
goldenRoundRecords = [],
} = result;
const data = { const data = {
mode: battleStats.mode, mode: battleStats.mode,
gameMode: battleStats.gameMode, gameMode: battleStats.gameMode,
@@ -166,6 +170,7 @@ export const getGameAPI = async (battleId) => {
data.roundsData = {}; data.roundsData = {};
data.redPlayers = {}; data.redPlayers = {};
data.bluePlayers = {}; data.bluePlayers = {};
data.goldenRound = goldenRoundRecords.length ? goldenRoundRecords[0] : null;
playerStats.forEach((item) => { playerStats.forEach((item) => {
const { playerBattleStats = {}, roundRecords = [] } = item; const { playerBattleStats = {}, roundRecords = [] } = item;
if (playerBattleStats.team === 0) { if (playerBattleStats.team === 0) {

View File

@@ -20,7 +20,7 @@ const data = ref({
onLoad(async (options) => { onLoad(async (options) => {
if (options.id) { if (options.id) {
battleId.value = options.id || "BATTLE-1750946182966867665-941"; battleId.value = options.id || "BATTLE-1751732742024840058-732";
const result = await getGameAPI(battleId.value); const result = await getGameAPI(battleId.value);
data.value = result; data.value = result;
if (result.mode === 1) { if (result.mode === 1) {
@@ -76,30 +76,53 @@ const checkBowData = () => {
:redTeam="redTeam" :redTeam="redTeam"
:players="data.players" :players="data.players"
/> />
<!-- <view class="score-header"> <block v-if="data.goldenRound">
<text>决金箭轮环数</text> <view class="score-header">
<view> <text>决金箭轮环数</text>
<text>查看靶纸</text> <view @click="checkBowData">
<image src="../static/back.png" mode="widthFix" /> <text>查看靶纸</text>
<image src="../static/back.png" mode="widthFix" />
</view>
</view> </view>
</view> <view class="score-row">
<view class="score-row"> <view>
<view> <Avatar
<Avatar src="../static/avatar.png" :size="25" :borderColor="1" /> :src="blueTeam[0].avatar"
<text>9</text> :size="25"
<text>10</text> borderColor="#64BAFF"
<text>7</text> />
<text
v-if="data.goldenRound.blueTotal"
v-for="(arrow, index) in data.goldenRound.arrowHistory"
:key="index"
>
{{ arrow.ring }}
</text>
</view>
<image
v-if="data.goldenRound.winner === 1"
src="../static/winner-badge.png"
mode="widthFix"
/>
</view> </view>
<image src="../static/winner-badge.png" mode="widthFix" /> <view class="score-row" :style="{ marginBottom: '5px' }">
</view> <view>
<view class="score-row" :style="{ marginBottom: '5px' }"> <Avatar :src="redTeam[0].avatar" :size="25" borderColor="#FF6767" />
<view> <text
<Avatar src="../static/avatar.png" :size="25" :borderColor="2" /> v-if="data.goldenRound.redTotal"
<text>9</text> v-for="(arrow, index) in data.goldenRound.arrowHistory"
<text>10</text> :key="index"
<text>7</text> >
{{ arrow.ring }}
</text>
</view>
<image
v-if="data.goldenRound.winner === 0"
src="../static/winner-badge.png"
mode="widthFix"
/>
</view> </view>
</view> --> </block>
<view <view
v-if="data.players && data.players.length" v-if="data.players && data.players.length"
class="score-header" class="score-header"

View File

@@ -134,19 +134,28 @@ const onPractiseLoading = async (page) => {
<image src="../static/back.png" mode="widthFix" /> <image src="../static/back.png" mode="widthFix" />
</view> </view>
<view v-if="item.mode === 1" class="contest-team"> <view v-if="item.mode === 1" class="contest-team">
<view <block v-if="item.bluePlayers[0]">
class="player" <view class="player">
v-for="(p, index2) in item.players" <Avatar frame :src="item.bluePlayers[0].avatar" />
:key="index2" <text>{{ item.bluePlayers[0].name }}</text>
> <image
<Avatar frame :src="p.avatar" /> v-if="item.winner === 1"
<text>{{ p.name }}</text> src="../static/winner-badge.png"
<image mode="widthFix"
v-if="index2 === 0" />
src="../static/winner-badge.png" </view>
mode="widthFix" </block>
/> <block v-if="item.redPlayers[0]">
</view> <view class="player">
<Avatar frame :src="item.redPlayers[0].avatar" />
<text>{{ item.redPlayers[0].name }}</text>
<image
v-if="item.winner === 0"
src="../static/winner-badge.png"
mode="widthFix"
/>
</view>
</block>
</view> </view>
<view v-if="item.mode === 2" class="contest-melee"> <view v-if="item.mode === 2" class="contest-melee">
<view <view

View File

@@ -28,6 +28,7 @@ onLoad(async (options) => {
...Object.values(result.redPlayers), ...Object.values(result.redPlayers),
]; ];
} }
if (result.goldenRound) tabs.value.push("决金箭");
Object.keys(result.roundsData).forEach((key) => { Object.keys(result.roundsData).forEach((key) => {
tabs.value.push(`${roundsName[key]}`); tabs.value.push(`${roundsName[key]}`);
}); });
@@ -38,7 +39,7 @@ const onClickTab = (index) => {
selected.value = index; selected.value = index;
redScores.value = []; redScores.value = [];
blueScores.value = []; blueScores.value = [];
const { bluePlayers, redPlayers, roundsData } = data.value; const { bluePlayers, redPlayers, roundsData, goldenRound } = data.value;
if (index === 0) { if (index === 0) {
Object.keys(bluePlayers).forEach((p) => { Object.keys(bluePlayers).forEach((p) => {
allRoundsScore.value[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 { } else {
Object.keys(bluePlayers).forEach((p) => { Object.keys(bluePlayers).forEach((p) => {
roundsData[index][p].forEach((arrow) => { roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => {
blueScores.value.push(arrow); blueScores.value.push(arrow);
}); });
}); });
Object.keys(redPlayers).forEach((p) => { Object.keys(redPlayers).forEach((p) => {
roundsData[index][p].forEach((arrow) => { roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => {
redScores.value.push(arrow); redScores.value.push(arrow);
}); });
}); });
@@ -114,8 +121,28 @@ const onClickTab = (index) => {
{{ ring }} {{ ring }}
</view> </view>
<view <view
v-if="selected > 0" v-if="
v-for="(score, index) in data.roundsData[selected][player.playerId]" 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" :key="index"
class="score-item" class="score-item"
:style="{ width: '13vw', height: '13vw' }" :style="{ width: '13vw', height: '13vw' }"