比赛详情添加决金箭部分
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
<!-- <view class="score-header">
|
||||
<block v-if="data.goldenRound">
|
||||
<view class="score-header">
|
||||
<text>决金箭轮(环数)</text>
|
||||
<view>
|
||||
<view @click="checkBowData">
|
||||
<text>查看靶纸</text>
|
||||
<image src="../static/back.png" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="score-row">
|
||||
<view>
|
||||
<Avatar src="../static/avatar.png" :size="25" :borderColor="1" />
|
||||
<text>9环</text>
|
||||
<text>10环</text>
|
||||
<text>7环</text>
|
||||
<Avatar
|
||||
:src="blueTeam[0].avatar"
|
||||
:size="25"
|
||||
borderColor="#64BAFF"
|
||||
/>
|
||||
<text
|
||||
v-if="data.goldenRound.blueTotal"
|
||||
v-for="(arrow, index) in data.goldenRound.arrowHistory"
|
||||
:key="index"
|
||||
>
|
||||
{{ arrow.ring }}环
|
||||
</text>
|
||||
</view>
|
||||
<image src="../static/winner-badge.png" mode="widthFix" />
|
||||
<image
|
||||
v-if="data.goldenRound.winner === 1"
|
||||
src="../static/winner-badge.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<view class="score-row" :style="{ marginBottom: '5px' }">
|
||||
<view>
|
||||
<Avatar src="../static/avatar.png" :size="25" :borderColor="2" />
|
||||
<text>9环</text>
|
||||
<text>10环</text>
|
||||
<text>7环</text>
|
||||
<Avatar :src="redTeam[0].avatar" :size="25" borderColor="#FF6767" />
|
||||
<text
|
||||
v-if="data.goldenRound.redTotal"
|
||||
v-for="(arrow, index) in data.goldenRound.arrowHistory"
|
||||
:key="index"
|
||||
>
|
||||
{{ arrow.ring }}环
|
||||
</text>
|
||||
</view>
|
||||
</view> -->
|
||||
<image
|
||||
v-if="data.goldenRound.winner === 0"
|
||||
src="../static/winner-badge.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
</block>
|
||||
<view
|
||||
v-if="data.players && data.players.length"
|
||||
class="score-header"
|
||||
|
||||
@@ -134,19 +134,28 @@ const onPractiseLoading = async (page) => {
|
||||
<image src="../static/back.png" mode="widthFix" />
|
||||
</view>
|
||||
<view v-if="item.mode === 1" class="contest-team">
|
||||
<view
|
||||
class="player"
|
||||
v-for="(p, index2) in item.players"
|
||||
:key="index2"
|
||||
>
|
||||
<Avatar frame :src="p.avatar" />
|
||||
<text>{{ p.name }}</text>
|
||||
<block v-if="item.bluePlayers[0]">
|
||||
<view class="player">
|
||||
<Avatar frame :src="item.bluePlayers[0].avatar" />
|
||||
<text>{{ item.bluePlayers[0].name }}</text>
|
||||
<image
|
||||
v-if="index2 === 0"
|
||||
v-if="item.winner === 1"
|
||||
src="../static/winner-badge.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="item.redPlayers[0]">
|
||||
<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 v-if="item.mode === 2" class="contest-melee">
|
||||
<view
|
||||
|
||||
@@ -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' }"
|
||||
|
||||
Reference in New Issue
Block a user