update:优化训练0环显示
This commit is contained in:
@@ -5,13 +5,19 @@ const props = defineProps({
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const getSum = (a, b, c) => {
|
||||
const sum = (Number(a) || 0) + (Number(b) || 0) + (Number(c) || 0);
|
||||
return sum > 0 ? sum + "环" : "-";
|
||||
const getSum = (...arrows) => {
|
||||
const recordedArrows = arrows.filter(Boolean);
|
||||
if (!recordedArrows.length) return "-";
|
||||
const sum = recordedArrows.reduce(
|
||||
(total, arrow) => total + (Number(arrow.ring) || 0),
|
||||
0
|
||||
);
|
||||
return `${sum}环`;
|
||||
};
|
||||
const roundsName = ["第一轮", "第二轮", "第三轮", "第四轮"];
|
||||
const getShowText = (arrow = {}) => {
|
||||
return arrow.ring ? (arrow.ringX ? "X" : arrow.ring + "环") : "-";
|
||||
const getShowText = (arrow) => {
|
||||
if (!arrow) return "-";
|
||||
return arrow.ringX ? "X" : `${Number(arrow.ring) || 0}环`;
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
|
||||
@@ -57,19 +57,22 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
const getRing = (arrow) => {
|
||||
if (!arrow) return "-";
|
||||
if (arrow.ringX) return "X";
|
||||
return arrow.ring ? arrow.ring : "-";
|
||||
return Number(arrow.ring) || 0;
|
||||
};
|
||||
|
||||
const arrows = computed(() => {
|
||||
const data = new Array(props.total).fill({ ring: 0 });
|
||||
const data = new Array(props.total).fill(null);
|
||||
(props.result.details || []).forEach((arrow, index) => {
|
||||
data[index] = arrow;
|
||||
});
|
||||
return data;
|
||||
});
|
||||
|
||||
const validArrows = computed(() => arrows.value.filter((a) => !!a.ring).length);
|
||||
const validArrows = computed(
|
||||
() => arrows.value.filter((a) => Number(a?.ring) > 0).length
|
||||
);
|
||||
const isMember = computed(() => user.value.vip === true || user.value.sVip === true);
|
||||
const openCoachComment = () => {
|
||||
if (!isMember.value) return;
|
||||
|
||||
Reference in New Issue
Block a user