diff --git a/web/src/components/BaseInfoCard.vue b/web/src/components/BaseInfoCard.vue index 6d4c0e0..7f89db5 100644 --- a/web/src/components/BaseInfoCard.vue +++ b/web/src/components/BaseInfoCard.vue @@ -14,11 +14,8 @@ const formatValue = (value: number, type: "count" | "rate" = "count"): string => if (type === "rate") { return `${value.toFixed(2)}%`; } - if (value >= 10000) { - return `${(value / 10000).toFixed(1)}w`; - } if (value >= 1000) { - return `${(value / 1000).toFixed(1)}k`; + return `${(value / 1000).toFixed(1)}K`; } return value.toString(); }; @@ -39,12 +36,14 @@ const fetchStats = async () => { // 添加动画效果 setTimeout(() => { animatedValues.value = { - key_count: 1, + key_count: + (stats.value?.key_count?.value ?? 0) / + ((stats.value?.key_count?.value ?? 1) + (stats.value?.key_count?.sub_value ?? 1)), group_count: 1, - request_count: 1, - error_rate: 1, + request_count: Math.min(100 + (stats.value?.request_count?.trend ?? 0), 100) / 100, + error_rate: (100 - (stats.value?.error_rate?.value ?? 0)) / 100, }; - }, 150); + }, 0); } catch (error) { console.error("获取统计数据失败:", error); } finally { @@ -78,7 +77,7 @@ onMounted(() => {