射箭记录完善
This commit is contained in:
@@ -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 }
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -77,7 +97,7 @@ watch(
|
||||
</view>
|
||||
</view>
|
||||
<view :style="{ width: '95%' }">
|
||||
<BowTarget :scores="scores" :showE="false" />
|
||||
<BowTarget :scores="redScores" :blueScores="blueScores" :showE="false" />
|
||||
</view>
|
||||
<view class="score-row" v-for="(player, index) in players" :key="index">
|
||||
<Avatar
|
||||
|
||||
Reference in New Issue
Block a user