修复决金箭bug

This commit is contained in:
kron
2025-07-08 13:23:29 +08:00
parent 06d8244e83
commit 4f56bdb8f0
4 changed files with 16 additions and 7 deletions

View File

@@ -165,12 +165,15 @@ export const getGameAPI = async (battleId) => {
mode: battleStats.mode, mode: battleStats.mode,
gameMode: battleStats.gameMode, gameMode: battleStats.gameMode,
}; };
if (battleStats.mode === 1) { if (battleStats && battleStats.mode === 1) {
data.winner = battleStats.winner; data.winner = battleStats.winner;
data.roundsData = {}; data.roundsData = {};
data.redPlayers = {}; data.redPlayers = {};
data.bluePlayers = {}; data.bluePlayers = {};
data.goldenRound = goldenRoundRecords && goldenRoundRecords.length ? goldenRoundRecords[0] : null; data.goldenRound =
goldenRoundRecords && 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) {
@@ -187,7 +190,7 @@ export const getGameAPI = async (battleId) => {
}); });
}); });
} }
if (battleStats.mode === 2) { if (battleStats && battleStats.mode === 2) {
data.players = []; data.players = [];
playerStats.forEach((item) => { playerStats.forEach((item) => {
data.players.push({ data.players.push({

View File

@@ -95,9 +95,9 @@ onUnmounted(() => {
<block v-if="isFinal"> <block v-if="isFinal">
<view class="point-view2"> <view class="point-view2">
<text>蓝队</text> <text>蓝队</text>
<text>{{ bluePoint }}</text> <text>5</text>
<text>红队</text> <text>红队</text>
<text>{{ redPoint }}</text> <text>5</text>
<text></text> <text></text>
</view> </view>
<text>同分僵局最后一箭定江山</text> <text>同分僵局最后一箭定江山</text>

View File

@@ -269,6 +269,7 @@ async function onReceiveMessage(messages = []) {
if (msg.constructor === MESSAGETYPES.FinalShoot) { if (msg.constructor === MESSAGETYPES.FinalShoot) {
isFinalShoot.value = true; isFinalShoot.value = true;
showRoundTip.value = true; showRoundTip.value = true;
tips.value = "准备开始决金箭";
} }
if (msg.constructor === MESSAGETYPES.HalfTimeOver) { if (msg.constructor === MESSAGETYPES.HalfTimeOver) {
startCount.value = false; startCount.value = false;
@@ -276,6 +277,7 @@ async function onReceiveMessage(messages = []) {
tips.value = "准备下半场"; tips.value = "准备下半场";
} }
if (msg.constructor === MESSAGETYPES.MatchOver) { if (msg.constructor === MESSAGETYPES.MatchOver) {
uni.setStorageSync("battle", msg.endStatus);
uni.redirectTo({ uni.redirectTo({
url: `/pages/battle-result?battleId=${msg.id}`, url: `/pages/battle-result?battleId=${msg.id}`,
}); });

View File

@@ -93,7 +93,9 @@ const checkBowData = () => {
/> />
<text <text
v-if="data.goldenRound.blueTotal" v-if="data.goldenRound.blueTotal"
v-for="(arrow, index) in data.goldenRound.arrowHistory" v-for="(arrow, index) in data.goldenRound.arrowHistory.filter(
(a) => a.playerId === blueTeam[0].playerId
)"
:key="index" :key="index"
> >
{{ arrow.ring }}环 {{ arrow.ring }}环
@@ -110,7 +112,9 @@ const checkBowData = () => {
<Avatar :src="redTeam[0].avatar" :size="25" borderColor="#FF6767" /> <Avatar :src="redTeam[0].avatar" :size="25" borderColor="#FF6767" />
<text <text
v-if="data.goldenRound.redTotal" v-if="data.goldenRound.redTotal"
v-for="(arrow, index) in data.goldenRound.arrowHistory" v-for="(arrow, index) in data.goldenRound.arrowHistory.filter(
(a) => a.playerId === redTeam[0].playerId
)"
:key="index" :key="index"
> >
{{ arrow.ring }}环 {{ arrow.ring }}环