BUG修复
This commit is contained in:
20
src/apis.js
20
src/apis.js
@@ -268,10 +268,8 @@ export const getGameAPI = async (battleId) => {
|
||||
data.redPlayers = {};
|
||||
data.bluePlayers = {};
|
||||
data.mvps = [];
|
||||
data.goldenRound =
|
||||
goldenRoundRecords && goldenRoundRecords.length
|
||||
? goldenRoundRecords[0]
|
||||
: null;
|
||||
data.goldenRounds =
|
||||
goldenRoundRecords && goldenRoundRecords.length ? goldenRoundRecords : [];
|
||||
playerStats.forEach((item) => {
|
||||
const { playerBattleStats = {}, roundRecords = [] } = item;
|
||||
if (playerBattleStats.team === 0) {
|
||||
@@ -290,6 +288,20 @@ export const getGameAPI = async (battleId) => {
|
||||
};
|
||||
});
|
||||
});
|
||||
(goldenRoundRecords || []).forEach((item, index) => {
|
||||
item.arrowHistory.forEach((arrow) => {
|
||||
if (!data.roundsData[playerStats.length + index + 1]) {
|
||||
data.roundsData[playerStats.length + index + 1] = {};
|
||||
}
|
||||
if (!data.roundsData[playerStats.length + index + 1][arrow.playerId]) {
|
||||
data.roundsData[playerStats.length + index + 1][arrow.playerId] = [];
|
||||
}
|
||||
data.roundsData[playerStats.length + index + 1][arrow.playerId].push(
|
||||
arrow
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
data.mvps.sort((a, b) => b.totalRings - a.totalRings);
|
||||
}
|
||||
if (battleStats && battleStats.mode === 2) {
|
||||
|
||||
@@ -19,6 +19,10 @@ defineProps({
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
goldenRound: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -43,7 +47,21 @@ defineProps({
|
||||
<view class="players">
|
||||
<view>
|
||||
<view v-for="(result, index) in roundResults" :key="index">
|
||||
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
|
||||
<block
|
||||
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
|
||||
>
|
||||
<image
|
||||
:src="
|
||||
RoundImages[
|
||||
`gold${index + 1 - (roundResults.length - goldenRound)}`
|
||||
]
|
||||
"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
|
||||
</block>
|
||||
<view>
|
||||
<text>{{
|
||||
result.blueArrows.length
|
||||
@@ -70,7 +88,21 @@ defineProps({
|
||||
</view>
|
||||
<view>
|
||||
<view v-for="(result, index) in roundResults" :key="index">
|
||||
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
|
||||
<block
|
||||
v-if="goldenRound > 0 && index >= roundResults.length - goldenRound"
|
||||
>
|
||||
<image
|
||||
:src="
|
||||
RoundImages[
|
||||
`gold${index + 1 - (roundResults.length - goldenRound)}`
|
||||
]
|
||||
"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image :src="RoundImages[`round${index + 1}`]" mode="widthFix" />
|
||||
</block>
|
||||
<view>
|
||||
<text>{{
|
||||
result.redArrows.length
|
||||
|
||||
@@ -137,9 +137,10 @@ defineProps({
|
||||
}
|
||||
.players > view > image:last-child {
|
||||
position: absolute;
|
||||
width: 40px;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 50px;
|
||||
top: -10%;
|
||||
left: -5%;
|
||||
transform: rotate(-12deg);
|
||||
}
|
||||
.players > view > view {
|
||||
display: flex;
|
||||
|
||||
@@ -9,7 +9,6 @@ const { user } = storeToRefs(store);
|
||||
|
||||
const tips = ref("");
|
||||
const melee = ref(false);
|
||||
const battleId = ref("");
|
||||
const timer = ref(null);
|
||||
const sound = ref(true);
|
||||
const currentSound = ref("");
|
||||
@@ -51,16 +50,15 @@ const updateSound = () => {
|
||||
async function onReceiveMessage(messages = []) {
|
||||
if (!sound.value || ended.value) return;
|
||||
messages.forEach((msg) => {
|
||||
if (battleId.value && msg.constructor === MESSAGETYPES.ShootResult) {
|
||||
if (msg.constructor === MESSAGETYPES.ShootResult) {
|
||||
if (melee.value && msg.userId !== user.value.id) return;
|
||||
if (!halfTime.value && msg.target) {
|
||||
currentSound.value = msg.target.ring
|
||||
? `${msg.target.ring}环`
|
||||
: "未上靶";
|
||||
console.log(currentSound.value);
|
||||
audioManager.play(currentSound.value);
|
||||
}
|
||||
} else if (msg.constructor === MESSAGETYPES.WaitForAllReady) {
|
||||
battleId.value = msg.id;
|
||||
} else if (msg.constructor === MESSAGETYPES.AllReady) {
|
||||
currentRoundEnded.value = true;
|
||||
audioManager.play("比赛开始");
|
||||
@@ -84,6 +82,10 @@ async function onReceiveMessage(messages = []) {
|
||||
ended.value = true;
|
||||
} else if (msg.constructor === MESSAGETYPES.MatchOver) {
|
||||
ended.value = true;
|
||||
} else if (msg.constructor === MESSAGETYPES.BackToGame) {
|
||||
if (msg.battleInfo) {
|
||||
melee.value = msg.battleInfo.config.battleMode === 2;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,9 +101,9 @@ onUnmounted(() => {
|
||||
<block v-if="isFinal">
|
||||
<view class="point-view2">
|
||||
<text>蓝队</text>
|
||||
<text>5</text>
|
||||
<text>{{ bluePoint }}</text>
|
||||
<text>分,红队</text>
|
||||
<text>5</text>
|
||||
<text>{{ redPoint }}</text>
|
||||
<text>分</text>
|
||||
</view>
|
||||
<text>同分僵局!最后一箭定江山</text>
|
||||
|
||||
@@ -177,23 +177,39 @@ export const getBattleResultTips = (
|
||||
};
|
||||
|
||||
export const RoundImages = {
|
||||
"round1":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggifbnw9snvs.png",
|
||||
"round2":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgf0swue5xzpd.png",
|
||||
"round3":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slglkylhmq8beb.png",
|
||||
"round4":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggc88nasmxf5.png",
|
||||
"round5":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeloitb8mixf.png",
|
||||
"round6":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgsjbyyuu1des.png",
|
||||
"round7":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgdysd1wqulj5.png",
|
||||
"round8":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgm82ny3qjd8m.png",
|
||||
}
|
||||
round1:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggifbnw9snvs.png",
|
||||
round2:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgf0swue5xzpd.png",
|
||||
round3:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slglkylhmq8beb.png",
|
||||
round4:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggc88nasmxf5.png",
|
||||
round5:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeloitb8mixf.png",
|
||||
gold1:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgsjbyyuu1des.png",
|
||||
gold2:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgdysd1wqulj5.png",
|
||||
gold3:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgm82ny3qjd8m.png",
|
||||
};
|
||||
|
||||
export const RoundGoldImages = {
|
||||
"round1":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slg7kfzzwwiwcb.png",
|
||||
"round2":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgs5htghfh3a9.png",
|
||||
"round3":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgc9ge3paqkba.png",
|
||||
"round4":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgehduk96yurp.png",
|
||||
"round5":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgefz3hdmwbnz.png",
|
||||
"round6":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeyb4cqwezgc.png",
|
||||
"round7":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggu3tlh97v5p.png",
|
||||
"round8":"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgszmdtmaotch.png",
|
||||
}
|
||||
round1:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slg7kfzzwwiwcb.png",
|
||||
round2:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgs5htghfh3a9.png",
|
||||
round3:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgc9ge3paqkba.png",
|
||||
round4:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgehduk96yurp.png",
|
||||
round5:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgefz3hdmwbnz.png",
|
||||
gold1:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgeyb4cqwezgc.png",
|
||||
gold2:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slggu3tlh97v5p.png",
|
||||
gold3:
|
||||
"https://static.shelingxingqiu.com/attachment/2025-08-13/dc12slgszmdtmaotch.png",
|
||||
};
|
||||
|
||||
@@ -120,7 +120,11 @@ const checkBowData = () => {
|
||||
:src="`../static/${data.winner === 1 ? 'blue' : 'red'}-team-win.png`"
|
||||
mode="widthFix"
|
||||
/>
|
||||
<view>
|
||||
<view
|
||||
:style="{
|
||||
transform: `translateY(50px) rotate(-${5 + data.mvps.length}deg)`,
|
||||
}"
|
||||
>
|
||||
<view v-if="data.mvps && data.mvps[0].totalRings">
|
||||
<image src="../static/title-mvp.png" mode="widthFix" />
|
||||
<text
|
||||
@@ -132,7 +136,7 @@ const checkBowData = () => {
|
||||
</view>
|
||||
<view v-if="data.mvps && data.mvps.length">
|
||||
<view v-for="(player, index) in data.mvps" :key="index">
|
||||
<view class="team-avatar">
|
||||
<view class="team-avatar" :style="{ transform: 'rotate(10deg)' }">
|
||||
<Avatar
|
||||
:src="player.avatar"
|
||||
:size="40"
|
||||
@@ -495,13 +499,11 @@ const checkBowData = () => {
|
||||
.header-mvp > view {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
transform: translateY(55px);
|
||||
}
|
||||
.header-mvp > view > view:first-child {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-right: 5vw;
|
||||
}
|
||||
.header-mvp > view > view:first-child > image {
|
||||
width: 24vw;
|
||||
@@ -509,24 +511,24 @@ const checkBowData = () => {
|
||||
.header-mvp > view > view:first-child > text {
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
transform: translateY(-4px) rotate(-5deg);
|
||||
transform: skewX(-10deg);
|
||||
}
|
||||
.header-mvp > view > view:last-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #fff;
|
||||
font-size: 8px;
|
||||
font-size: 9px;
|
||||
text-align: center;
|
||||
transform: translateY(-16px) rotate(-5deg);
|
||||
min-width: 40%;
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
.header-mvp > view > view:last-child > view {
|
||||
margin-right: 4vw;
|
||||
margin-left: 4vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.header-mvp > view > view:last-child > view > text {
|
||||
margin-top: 4px;
|
||||
width: 40px;
|
||||
transform: skewX(-10deg) translateX(-3px);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -12,6 +12,7 @@ import { getGameAPI } from "@/apis";
|
||||
const blueTeam = ref([]);
|
||||
const redTeam = ref([]);
|
||||
const roundsData = ref([]);
|
||||
const goldenRoundsData = ref([]);
|
||||
const battleId = ref("");
|
||||
const data = ref({
|
||||
players: [],
|
||||
@@ -20,7 +21,7 @@ const data = ref({
|
||||
|
||||
onLoad(async (options) => {
|
||||
if (options.id) {
|
||||
battleId.value = options.id || "BATTLE-1755239389665389000-812";
|
||||
battleId.value = options.id || "BATTLE-1755484626207409508-955";
|
||||
const result = await getGameAPI(battleId.value);
|
||||
data.value = result;
|
||||
if (result.mode === 1) {
|
||||
@@ -34,10 +35,12 @@ onLoad(async (options) => {
|
||||
let blueArrows = [];
|
||||
let redArrows = [];
|
||||
blueTeam.value.forEach((p) => {
|
||||
if (!item[p.playerId]) return;
|
||||
blueTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0);
|
||||
blueArrows = [...blueArrows, ...item[p.playerId]];
|
||||
});
|
||||
redTeam.value.forEach((p) => {
|
||||
if (!item[p.playerId]) return;
|
||||
redTotalRings += item[p.playerId].reduce((a, b) => a + b.ring, 0);
|
||||
redArrows = [...redArrows, ...item[p.playerId]];
|
||||
});
|
||||
@@ -50,14 +53,12 @@ onLoad(async (options) => {
|
||||
}
|
||||
roundsData.value.push({
|
||||
blue: {
|
||||
names: blueTeam.value.map((p) => p.name),
|
||||
avatars: blueTeam.value.map((p) => p.avatar),
|
||||
arrows: blueArrows,
|
||||
totalRing: blueTotalRings,
|
||||
totalScore: bluePoint,
|
||||
},
|
||||
red: {
|
||||
names: redTeam.value.map((p) => p.name),
|
||||
avatars: redTeam.value.map((p) => p.avatar),
|
||||
arrows: redArrows,
|
||||
totalRing: redTotalRings,
|
||||
@@ -65,6 +66,19 @@ onLoad(async (options) => {
|
||||
},
|
||||
});
|
||||
});
|
||||
result.goldenRounds.forEach((round) => {
|
||||
goldenRoundsData.value.push({
|
||||
blue: {
|
||||
avatars: blueTeam.value.map((p) => p.avatar),
|
||||
arrows: round.arrowHistory.filter((a) => a.team === 1),
|
||||
},
|
||||
red: {
|
||||
avatars: redTeam.value.map((p) => p.avatar),
|
||||
arrows: round.arrowHistory.filter((a) => a.team === 0),
|
||||
},
|
||||
winner: round.winner,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -113,7 +127,7 @@ const checkBowData = () => {
|
||||
:totalRing="player.totalRings"
|
||||
:rank="index + 1"
|
||||
/>
|
||||
<block v-if="data.goldenRound">
|
||||
<block v-for="(round, index) in goldenRoundsData" :key="index">
|
||||
<view class="score-header">
|
||||
<text>决金箭轮(环数)</text>
|
||||
<view @click="checkBowData">
|
||||
@@ -121,61 +135,6 @@ const checkBowData = () => {
|
||||
<image src="../static/back.png" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="score-row">
|
||||
<view>
|
||||
<Avatar
|
||||
:src="blueTeam[0].avatar"
|
||||
:size="25"
|
||||
borderColor="#64BAFF"
|
||||
/>
|
||||
<text
|
||||
v-if="data.goldenRound.blueTotal"
|
||||
v-for="(arrow, index) in data.goldenRound.arrowHistory.filter(
|
||||
(a) => a.playerId === blueTeam[0].playerId
|
||||
)"
|
||||
:key="index"
|
||||
>
|
||||
{{ arrow.ring }}环
|
||||
</text>
|
||||
</view>
|
||||
<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="redTeam[0].avatar" :size="25" borderColor="#FF6767" />
|
||||
<text
|
||||
v-if="data.goldenRound.redTotal"
|
||||
v-for="(arrow, index) in data.goldenRound.arrowHistory.filter(
|
||||
(a) => a.playerId === redTeam[0].playerId
|
||||
)"
|
||||
:key="index"
|
||||
>
|
||||
{{ arrow.ring }}环
|
||||
</text>
|
||||
</view>
|
||||
<image
|
||||
v-if="data.goldenRound.winner === 0"
|
||||
src="../static/winner-badge.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
</block>
|
||||
<view
|
||||
v-for="(round, index) in roundsData"
|
||||
:key="index"
|
||||
:style="{ marginBottom: '5px' }"
|
||||
>
|
||||
<view class="score-header">
|
||||
<text>第{{ index + 1 }}轮</text>
|
||||
<view @click="checkBowData">
|
||||
<text>查看靶纸</text>
|
||||
<image src="../static/back.png" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="score-row">
|
||||
<view>
|
||||
<view>
|
||||
@@ -190,18 +149,17 @@ const checkBowData = () => {
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<text v-for="(arrow, index2) in round.blue.arrows" :key="index2">
|
||||
<text v-for="(arrow, index) in round.blue.arrows" :key="index">
|
||||
{{ arrow.ring }}环
|
||||
</text>
|
||||
</view>
|
||||
<view>
|
||||
<text :style="{ color: '#64BAFF' }">
|
||||
{{ round.blue.totalRing }}环
|
||||
</text>
|
||||
<text>得分 {{ round.blue.totalScore }}</text>
|
||||
</view>
|
||||
<image
|
||||
v-if="round.winner === 1"
|
||||
src="../static/winner-badge.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<view class="score-row">
|
||||
<view class="score-row" :style="{ marginBottom: '5px' }">
|
||||
<view>
|
||||
<view>
|
||||
<image
|
||||
@@ -215,17 +173,85 @@ const checkBowData = () => {
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<text v-for="(arrow, index2) in round.red.arrows" :key="index2">
|
||||
<text v-for="(arrow, index) in round.red.arrows" :key="index">
|
||||
{{ arrow.ring }}环
|
||||
</text>
|
||||
</view>
|
||||
<view>
|
||||
<text :style="{ color: '#FF6767' }">
|
||||
{{ round.red.totalRing }}环
|
||||
</text>
|
||||
<text>得分 {{ round.red.totalScore }}</text>
|
||||
</view>
|
||||
<image
|
||||
v-if="round.winner === 0"
|
||||
src="../static/winner-badge.png"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
</block>
|
||||
<view
|
||||
v-for="(round, index) in roundsData"
|
||||
:key="index"
|
||||
:style="{ marginBottom: '5px' }"
|
||||
>
|
||||
<block
|
||||
v-if="
|
||||
index < Object.keys(roundsData).length - goldenRoundsData.length
|
||||
"
|
||||
>
|
||||
<view class="score-header">
|
||||
<text>第{{ index + 1 }}轮</text>
|
||||
<view @click="checkBowData">
|
||||
<text>查看靶纸</text>
|
||||
<image src="../static/back.png" mode="widthFix" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="score-row">
|
||||
<view>
|
||||
<view>
|
||||
<image
|
||||
v-for="(src, index) in round.blue.avatars"
|
||||
:style="{
|
||||
borderColor: '#64BAFF',
|
||||
transform: `translateX(-${index * 15}px)`,
|
||||
}"
|
||||
:src="src"
|
||||
:key="index"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<text v-for="(arrow, index2) in round.blue.arrows" :key="index2">
|
||||
{{ arrow.ring }}环
|
||||
</text>
|
||||
</view>
|
||||
<view>
|
||||
<text :style="{ color: '#64BAFF' }">
|
||||
{{ round.blue.totalRing }}环
|
||||
</text>
|
||||
<text>得分 {{ round.blue.totalScore }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="score-row">
|
||||
<view>
|
||||
<view>
|
||||
<image
|
||||
v-for="(src, index) in round.red.avatars"
|
||||
:style="{
|
||||
borderColor: '#FF6767',
|
||||
transform: `translateX(-${index * 15}px)`,
|
||||
}"
|
||||
:src="src"
|
||||
:key="index"
|
||||
mode="widthFix"
|
||||
/>
|
||||
</view>
|
||||
<text v-for="(arrow, index2) in round.red.arrows" :key="index2">
|
||||
{{ arrow.ring }}环
|
||||
</text>
|
||||
</view>
|
||||
<view>
|
||||
<text :style="{ color: '#FF6767' }">
|
||||
{{ round.red.totalRing }}环
|
||||
</text>
|
||||
<text>得分 {{ round.red.totalScore }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view :style="{ height: '20px' }"></view>
|
||||
</view>
|
||||
@@ -299,10 +325,10 @@ const checkBowData = () => {
|
||||
.score-row > image:last-child {
|
||||
width: 40px;
|
||||
}
|
||||
.score-row > view:last-child {
|
||||
.score-row > view:nth-child(2) {
|
||||
padding-right: 5px;
|
||||
}
|
||||
.score-row > view:last-child > text:last-child {
|
||||
.score-row > view:nth-child(2) > text:last-child {
|
||||
margin-left: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -16,25 +16,28 @@ const addBg = ref("");
|
||||
onMounted(async () => {
|
||||
const menuBtnInfo = uni.getMenuButtonBoundingClientRect();
|
||||
capsuleHeight.value = menuBtnInfo.top - 9;
|
||||
currentList.value = rankData.value.rank;
|
||||
if (rankData.value.myRankPos) myData.value = rankData.value.myRankPos;
|
||||
handleSelect(0);
|
||||
});
|
||||
|
||||
const handleSelect = (index) => {
|
||||
selectedIndex.value = index;
|
||||
myData.value = {};
|
||||
currentList.value = [];
|
||||
if (index === 0) {
|
||||
currentList.value = rankData.value.rank;
|
||||
if (rankData.value.myRankPos) myData.value = rankData.value.myRankPos;
|
||||
} else if (index === 1) {
|
||||
currentList.value = rankData.value.mvpRank;
|
||||
if (rankData.value.myMvpRankPos) myData.value = rankData.value.myMvpRankPos;
|
||||
} else if (index === 2) {
|
||||
currentList.value = rankData.value.ringRank;
|
||||
if (rankData.value.myRingRankPos)
|
||||
myData.value = rankData.value.myRingRankPos;
|
||||
} else {
|
||||
myData.value = {};
|
||||
currentList.value = [];
|
||||
}
|
||||
if (user.value.id) {
|
||||
currentList.value.some((item) => {
|
||||
if (item.userId === user.value.id) {
|
||||
myData.value = item;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -172,18 +175,24 @@ const subTitles = ["排位赛积分", "本周MVP次数", "本周十环次数"];
|
||||
<text class="truncate">{{ user.nickName }}</text>
|
||||
<text>{{ user.lvlName }},{{ myData.TotalGames }}场</text>
|
||||
</view>
|
||||
<text class="rank-item-integral" v-if="selectedIndex === 0">
|
||||
<text
|
||||
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
||||
>{{ myData.totalScore }}</text
|
||||
>次</text
|
||||
>
|
||||
<text class="rank-item-integral" v-if="selectedIndex === 1">
|
||||
<text
|
||||
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
||||
>{{ myData.TotalGames }}</text
|
||||
>次</text
|
||||
>
|
||||
<text class="rank-item-integral" v-if="selectedIndex === 2">
|
||||
<text
|
||||
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
||||
>{{ rankData.myRankPos.TenRings }}</text
|
||||
>{{ myData.TenRings }}</text
|
||||
>次</text
|
||||
>
|
||||
<text class="rank-item-integral" v-else>
|
||||
<text
|
||||
:style="{ fontSize: '14px', color: '#fff', marginRight: '5px' }"
|
||||
>{{ rankData.myRingRankPos.totalScore }}</text
|
||||
>分</text
|
||||
>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
@@ -25,6 +25,7 @@ const start = ref(false);
|
||||
const tips = ref("");
|
||||
const battleId = ref("");
|
||||
const currentRound = ref(1);
|
||||
const goldenRound = ref(0);
|
||||
const currentRedPoint = ref(0);
|
||||
const currentBluePoint = ref(0);
|
||||
const totalRounds = ref(0);
|
||||
@@ -105,6 +106,7 @@ function recoverData(battleInfo) {
|
||||
const { ShotCount, RedRecords, BlueRecords } = battleInfo.goldenRound;
|
||||
const roundCount = Math.max(RedRecords.length, BlueRecords.length);
|
||||
currentRound.value += roundCount;
|
||||
goldenRound.value += roundCount;
|
||||
isFinalShoot.value = true;
|
||||
for (let i = 0; i < roundCount; i++) {
|
||||
const roundData = {
|
||||
@@ -112,6 +114,7 @@ function recoverData(battleInfo) {
|
||||
RedRecords && RedRecords[i] ? RedRecords[i].Arrows || [] : [],
|
||||
blueArrows:
|
||||
BlueRecords && BlueRecords[i] ? BlueRecords[i].Arrows || [] : [],
|
||||
gold: true,
|
||||
};
|
||||
if (roundResults.value[5 + i]) {
|
||||
roundResults.value[5 + i] = roundData;
|
||||
@@ -185,6 +188,7 @@ async function onReceiveMessage(messages = []) {
|
||||
roundResults.value.push({
|
||||
redArrows: [],
|
||||
blueArrows: [],
|
||||
gold: goldenRound.value > 0,
|
||||
});
|
||||
}
|
||||
roundResults.value[currentRound.value - 1][
|
||||
@@ -211,11 +215,13 @@ async function onReceiveMessage(messages = []) {
|
||||
}
|
||||
if (msg.constructor === MESSAGETYPES.FinalShoot) {
|
||||
currentShooterId.value = 0;
|
||||
currentRound.value += 1;
|
||||
goldenRound.value += 1;
|
||||
roundResults.value.push({
|
||||
redArrows: [],
|
||||
blueArrows: [],
|
||||
});
|
||||
currentBluePoint.value = bluePoints.value;
|
||||
currentRedPoint.value = redPoints.value;
|
||||
if (!isFinalShoot.value) {
|
||||
isFinalShoot.value = true;
|
||||
showRoundTip.value = true;
|
||||
@@ -307,7 +313,12 @@ onHide(() => {
|
||||
:isRed="false"
|
||||
:currentShooterId="currentShooterId"
|
||||
/>
|
||||
<ShootProgress2 :tips="tips" :currentRound="'round' + currentRound" />
|
||||
<ShootProgress2
|
||||
:tips="tips"
|
||||
:currentRound="
|
||||
goldenRound > 0 ? 'gold' + goldenRound : 'round' + currentRound
|
||||
"
|
||||
/>
|
||||
<TeamAvatars :team="redTeam" :currentShooterId="currentShooterId" />
|
||||
</view>
|
||||
<BowTarget
|
||||
@@ -322,6 +333,7 @@ onHide(() => {
|
||||
:roundResults="roundResults"
|
||||
:redPoints="redPoints"
|
||||
:bluePoints="bluePoints"
|
||||
:goldenRound="goldenRound"
|
||||
:power="power"
|
||||
/>
|
||||
<Timer v-if="!start" />
|
||||
|
||||
@@ -12,11 +12,13 @@ const blueScores = ref([]);
|
||||
const tabs = ref(["所有轮次"]);
|
||||
const players = ref([]);
|
||||
const allRoundsScore = ref({});
|
||||
const data = ref({});
|
||||
const data = ref({
|
||||
goldenRounds: [],
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
if (options.battleId) {
|
||||
const result = await getGameAPI(
|
||||
options.battleId || "BATTLE-1754988051086075885-926"
|
||||
options.battleId || "BATTLE-1755484626207409508-955"
|
||||
);
|
||||
data.value = result;
|
||||
Object.values(result.bluePlayers).forEach((p, index) => {
|
||||
@@ -28,9 +30,18 @@ onLoad(async (options) => {
|
||||
players.value.push(Object.values(result.redPlayers)[index]);
|
||||
}
|
||||
});
|
||||
if (result.goldenRound) tabs.value.push("决金箭");
|
||||
Object.keys(result.roundsData).forEach((key) => {
|
||||
tabs.value.push(`第${roundsName[key]}轮`);
|
||||
if (result.goldenRounds) {
|
||||
result.goldenRounds.forEach(() => {
|
||||
tabs.value.push("决金箭");
|
||||
});
|
||||
}
|
||||
Object.keys(result.roundsData).forEach((key, index) => {
|
||||
if (
|
||||
index <
|
||||
Object.keys(result.roundsData).length - result.goldenRounds.length
|
||||
) {
|
||||
tabs.value.push(`第${roundsName[key]}轮`);
|
||||
}
|
||||
});
|
||||
onClickTab(0);
|
||||
}
|
||||
@@ -39,11 +50,13 @@ const onClickTab = (index) => {
|
||||
selected.value = index;
|
||||
redScores.value = [];
|
||||
blueScores.value = [];
|
||||
const { bluePlayers, redPlayers, roundsData, goldenRound } = data.value;
|
||||
const { bluePlayers, redPlayers, roundsData, goldenRounds } = data.value;
|
||||
let maxArrowLength = 0;
|
||||
if (index === 0) {
|
||||
Object.keys(bluePlayers).forEach((p) => {
|
||||
allRoundsScore.value[p] = [];
|
||||
Object.values(roundsData).forEach((round) => {
|
||||
if (!round[p]) return;
|
||||
allRoundsScore.value[p].push(
|
||||
round[p].reduce((last, next) => last + next.ring, 0)
|
||||
);
|
||||
@@ -55,6 +68,7 @@ const onClickTab = (index) => {
|
||||
Object.keys(redPlayers).forEach((p) => {
|
||||
allRoundsScore.value[p] = [];
|
||||
Object.values(roundsData).forEach((round) => {
|
||||
if (!round[p]) return;
|
||||
allRoundsScore.value[p].push(
|
||||
round[p].reduce((last, next) => last + next.ring, 0)
|
||||
);
|
||||
@@ -63,20 +77,29 @@ const onClickTab = (index) => {
|
||||
});
|
||||
});
|
||||
});
|
||||
} else if (index === 1 && goldenRound) {
|
||||
if (goldenRound.winner === 1) {
|
||||
blueScores.value = goldenRound.arrowHistory;
|
||||
} else {
|
||||
redScores.value = goldenRound.arrowHistory;
|
||||
}
|
||||
} else {
|
||||
} else if (index <= goldenRounds.length) {
|
||||
const dataIndex =
|
||||
Object.keys(roundsData).length - goldenRounds.length + index;
|
||||
Object.keys(bluePlayers).forEach((p) => {
|
||||
roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => {
|
||||
if (!roundsData[dataIndex][p]) return;
|
||||
roundsData[dataIndex][p].forEach((arrow) => {
|
||||
blueScores.value.push(arrow);
|
||||
});
|
||||
});
|
||||
Object.keys(redPlayers).forEach((p) => {
|
||||
roundsData[goldenRound ? index - 1 : index][p].forEach((arrow) => {
|
||||
if (!roundsData[dataIndex][p]) return;
|
||||
roundsData[dataIndex][p].forEach((arrow) => {
|
||||
redScores.value.push(arrow);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
Object.keys(bluePlayers).forEach((p) => {
|
||||
roundsData[index - goldenRounds.length][p].forEach((arrow) => {
|
||||
blueScores.value.push(arrow);
|
||||
});
|
||||
});
|
||||
Object.keys(redPlayers).forEach((p) => {
|
||||
roundsData[index - goldenRounds.length][p].forEach((arrow) => {
|
||||
redScores.value.push(arrow);
|
||||
});
|
||||
});
|
||||
@@ -127,25 +150,23 @@ const onClickTab = (index) => {
|
||||
</view>
|
||||
<view
|
||||
v-if="
|
||||
selected === 1 &&
|
||||
data.goldenRound &&
|
||||
data.goldenRound.arrowHistory.find(
|
||||
(a) => a.playerId === player.playerId
|
||||
)
|
||||
selected >= data.goldenRounds.length &&
|
||||
selected <= data.goldenRounds.length
|
||||
"
|
||||
v-for="(score, index) in data.goldenRound.arrowHistory"
|
||||
v-for="(score, index) in data.roundsData[
|
||||
Object.keys(data.roundsData).length -
|
||||
data.goldenRounds.length +
|
||||
selected
|
||||
][player.playerId]"
|
||||
:key="index"
|
||||
class="score-item"
|
||||
>
|
||||
{{ score.ring }}
|
||||
</view>
|
||||
<view
|
||||
v-if="
|
||||
(!data.goldenRound && selected > 0) ||
|
||||
(data.goldenRound && selected > 1)
|
||||
"
|
||||
v-if="selected > data.goldenRounds.length"
|
||||
v-for="(score, index) in data.roundsData[
|
||||
data.goldenRound ? selected - 1 : selected
|
||||
selected - data.goldenRounds.length
|
||||
][player.playerId]"
|
||||
:key="index"
|
||||
class="score-item"
|
||||
@@ -196,7 +217,9 @@ const onClickTab = (index) => {
|
||||
.score-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-left: 5px;
|
||||
margin-bottom: 5px;
|
||||
width: calc(50% - 5px);
|
||||
padding-left: 5px;
|
||||
}
|
||||
.score-row > view:last-child {
|
||||
margin-left: 10px;
|
||||
@@ -204,6 +227,7 @@ const onClickTab = (index) => {
|
||||
grid-template-columns: repeat(3, auto);
|
||||
gap: 5px;
|
||||
margin-right: 5px;
|
||||
min-width: 26%;
|
||||
}
|
||||
.score-item {
|
||||
background-image: url("../static/score-bg.png");
|
||||
@@ -219,8 +243,8 @@ const onClickTab = (index) => {
|
||||
height: 10vw;
|
||||
}
|
||||
.score-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
row-gap: 15px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user