From 0eee2e4f91ae24e41d7d7c060d075f47e6be7d32 Mon Sep 17 00:00:00 2001 From: Megghy Date: Wed, 3 Dec 2025 17:21:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=88=86=E6=9E=90=E9=A1=B5=E9=9D=A2=E6=97=B6=E9=97=B4=E6=88=B3?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=B9=B6=E6=94=B9=E8=BF=9B=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 formatDate 函数中添加时间戳单位自动检测(秒/毫秒) - 将日期格式从 M/D 改为 YYYY/M/D,提供更完整的时间信息 --- src/views/manage/AnalyzeView.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/views/manage/AnalyzeView.vue b/src/views/manage/AnalyzeView.vue index e28f37c..ed9b455 100644 --- a/src/views/manage/AnalyzeView.vue +++ b/src/views/manage/AnalyzeView.vue @@ -149,8 +149,9 @@ function getTrendType(value: number): 'success' | 'error' | 'info' { // 格式化时间戳为日期 function formatDate(timestamp: number): string { - const date = new Date(timestamp * 1000) - return `${date.getMonth() + 1}/${date.getDate()}` + // 如果时间戳超过 100亿,说明是毫秒,否则是秒 + const date = new Date(timestamp > 10000000000 ? timestamp : timestamp * 1000) + return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}` } // 从ChartData对象转换为数组,并按时间戳排序