diff --git a/src/components/BowTarget.vue b/src/components/BowTarget.vue index a57f83e..c583cc0 100644 --- a/src/components/BowTarget.vue +++ b/src/components/BowTarget.vue @@ -30,6 +30,10 @@ const props = defineProps({ type: Array, default: () => [], }, + blueScores: { + type: Array, + default: () => [], + }, showE: { type: Boolean, default: true, @@ -88,13 +92,27 @@ function calcRealY(num) { + diff --git a/src/components/MeleeResult.vue b/src/components/MeleeResult.vue index fecc6df..d727a58 100644 --- a/src/components/MeleeResult.vue +++ b/src/components/MeleeResult.vue @@ -25,7 +25,7 @@ watch( () => props.data, (value) => { const mine = value.players.find((p) => p.playerId === user.value.id); - if (mine.arrowHistory) { + if (mine && mine.arrowHistory) { scores.value = mine.arrowHistory; } }, @@ -47,7 +47,7 @@ watch( {{ index + 1 }} - + 积分 {{ diff --git a/src/components/ScoreResult.vue b/src/components/ScoreResult.vue index b1300b7..d4722a4 100644 --- a/src/components/ScoreResult.vue +++ b/src/components/ScoreResult.vue @@ -96,9 +96,7 @@ setTimeout(() => { src="../static/review.png" :onClick="() => (showComment = true)" /> - 完成 + 完成 @@ -116,6 +114,7 @@ setTimeout(() => { top: 0; left: 0; background-color: rgba(0, 0, 0, 0.6); + z-index: 5; } .container-header { margin-top: 20vh; diff --git a/src/components/TeamResult.vue b/src/components/TeamResult.vue index 615071d..f65f4a5 100644 --- a/src/components/TeamResult.vue +++ b/src/components/TeamResult.vue @@ -18,21 +18,40 @@ const props = defineProps({ }, }); const selected = ref(0); -const scores = ref([]); +const redScores = ref([]); +const blueScores = ref([]); const tabs = ref(["所有轮次"]); const players = ref([]); const onClickTab = (index) => { selected.value = index; - scores.value = []; + redScores.value = []; + blueScores.value = []; + const { bluePlayers, redPlayers, roundsData } = props.data; if (index === 0) { - Object.values(props.data.roundsData).forEach((round) => { - Object.values(round).forEach((arrows) => { - scores.value = [...scores.value, ...Object.values(arrows)]; + Object.keys(bluePlayers).forEach((p) => { + Object.values(roundsData).forEach((round) => { + round[p].forEach((arrow) => { + blueScores.value.push(arrow); + }); + }); + }); + Object.keys(redPlayers).forEach((p) => { + Object.values(roundsData).forEach((round) => { + round[p].forEach((arrow) => { + redScores.value.push(arrow); + }); }); }); } else { - Object.values(props.data.roundsData[index]).forEach((arrows) => { - scores.value = [...scores.value, ...Object.values(arrows)]; + Object.keys(bluePlayers).forEach((p) => { + roundsData[index][p].forEach((arrow) => { + blueScores.value.push(arrow); + }); + }); + Object.keys(redPlayers).forEach((p) => { + roundsData[index][p].forEach((arrow) => { + redScores.value.push(arrow); + }); }); } }; @@ -54,7 +73,8 @@ watch( tabs.value.push(`第${roundsName[key]}轮`); }); onClickTab(0); - } + }, + { deep: true, immediate: true } ); @@ -77,7 +97,7 @@ watch( - + { if (options.id) { - const result = await getBattleDetailAPI(options.id); - console.log(11111, result); + const result = await getGameAPI(options.id); + data.value = result; + if (result.mode === 1) { + blueTeam.value = Object.values(result.bluePlayers || {}); + redTeam.value = Object.values(result.redPlayers || {}); + Object.values(result.roundsData).forEach((item) => { + let blueId = Object.keys(item)[0]; + let redId = Object.keys(item)[1]; + if (!result.bluePlayers[blueId]) { + blueId = Object.keys(item)[1]; + redId = Object.keys(item)[0]; + } + roundsData.value.push({ + blue: { + name: result.bluePlayers[blueId].name, + avatar: result.bluePlayers[blueId].avatar, + arrows: item[blueId], + totalRing: item[blueId].reduce((a, b) => a + b.ringScore, 0), + totalScore: item[blueId].reduce((a, b) => a + b.ringScore, 0), + }, + red: { + name: result.redPlayers[redId].name, + avatar: result.redPlayers[redId].avatar, + arrows: item[redId], + totalRing: item[redId].reduce((a, b) => a + b.ringScore, 0), + totalScore: item[redId].reduce((a, b) => a + b.ringScore, 0), + }, + }); + }); + } else if (result.mode === 2) { + players.value = result.players; + } } }); @@ -55,12 +57,11 @@ onLoad(async (options) => { - + + 查看靶纸 + - 第{{ item.round }}轮 - + 第{{ index + 1 }}轮 + 查看靶纸 - - 9环 - 10环 - 7环 + + + {{ arrow.ringScore }}环 + - 18环 - 得分 +1 + + {{ round.blue.totalRing }}环 + + 得分 {{ round.blue.totalScore }} - + - - 9环 - 10环 - 7环 + + + {{ arrow.ringScore }}环 + - 18环 - 得分 +1 + + {{ round.blue.totalRing }}环 + + 得分 {{ round.blue.totalScore }} + + diff --git a/src/static/hit-icon-blue.png b/src/static/hit-icon-blue.png new file mode 100644 index 0000000..d354907 Binary files /dev/null and b/src/static/hit-icon-blue.png differ