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