This commit is contained in:
2025-05-09 21:04:56 +08:00
parent 14462000c5
commit 477197faef
2 changed files with 10 additions and 3 deletions

View File

@@ -32,12 +32,14 @@ const numbers = computed(() => {
icon: "streamline-emojis:scroll", icon: "streamline-emojis:scroll",
title: problem.value?.submission_number ?? 0, title: problem.value?.submission_number ?? 0,
content: "总提交", content: "总提交",
int: true,
suffix: "", suffix: "",
}, },
{ {
icon: "streamline-emojis:woman-raising-hand-2", icon: "streamline-emojis:woman-raising-hand-2",
title: problem.value?.accepted_number ?? 0, title: problem.value?.accepted_number ?? 0,
content: "通过数", content: "通过数",
int: true,
suffix: "", suffix: "",
}, },
{ {
@@ -47,12 +49,14 @@ const numbers = computed(() => {
problem.value?.submission_number ?? 0, problem.value?.submission_number ?? 0,
), ),
content: "通过率", content: "通过率",
int: false,
suffix: "%", suffix: "%",
}, },
{ {
icon: "streamline-emojis:sparkles", icon: "streamline-emojis:sparkles",
title: Number(beatRate.value), title: parseFloat(beatRate.value),
content: "你击败的用户", content: "你击败的用户",
int: false,
suffix: "%", suffix: "%",
}, },
] ]
@@ -108,7 +112,10 @@ onMounted(getBeatRate)
<Icon :icon="item.icon" width="40" /> <Icon :icon="item.icon" width="40" />
<div> <div>
<n-h2 class="number"> <n-h2 class="number">
<n-number-animation :to="item.title" /> <n-number-animation
:to="item.title"
:precision="item.int ? 0 : 2"
/>
<span v-if="item.suffix">{{ item.suffix }}</span> <span v-if="item.suffix">{{ item.suffix }}</span>
</n-h2> </n-h2>
<n-h4 class="number-label">{{ item.content }}</n-h4> <n-h4 class="number-label">{{ item.content }}</n-h4>

View File

@@ -18,7 +18,7 @@ export function getACRateNumber(acCount: number, totalCount: number) {
if (acCount >= totalCount) rate = "100.00" if (acCount >= totalCount) rate = "100.00"
else rate = ((acCount / totalCount) * 100).toFixed(2) else rate = ((acCount / totalCount) * 100).toFixed(2)
} }
return Number(rate) return parseFloat(rate)
} }
export function filterEmptyValue(object: any) { export function filterEmptyValue(object: any) {