From acf55f94a266a4ce415901ea17336880a131cc5e Mon Sep 17 00:00:00 2001 From: snowykami Date: Sat, 5 Oct 2024 05:43:23 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=96=B0=E5=A2=9E=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E7=89=88=E6=9C=AC=EF=BC=8C=E5=A4=84=E7=90=86=E5=99=A8?= =?UTF-8?q?=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 ++ src/api/index.ts | 2 ++ src/api/utils.ts | 13 +++++----- src/components/Host.vue | 54 +++++++++++++++++++--------------------- src/style.css | 4 ++- tsconfig.app.tsbuildinfo | 2 +- 6 files changed, 40 insertions(+), 37 deletions(-) diff --git a/index.html b/index.html index 065be23..efb830f 100644 --- a/index.html +++ b/index.html @@ -5,6 +5,8 @@ Server Status + +
diff --git a/src/api/index.ts b/src/api/index.ts index 21d6a97..4940f61 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -6,6 +6,8 @@ export interface Status { os: { name: string; version: string; + release: string; + machine: string; }; labels: string[]; // 服务器标签 location: string; // Chongqing, China diff --git a/src/api/utils.ts b/src/api/utils.ts index 92d7da1..44301e5 100644 --- a/src/api/utils.ts +++ b/src/api/utils.ts @@ -109,11 +109,10 @@ export function getBlankColor(percent: number, disable: boolean = false) { // 1727998501 export function formatUptime(uptime: number): string { - - const seconds = uptime - const d = Math.floor(seconds / 86400) - const h = Math.floor((seconds % 86400) / 3600) - const m = Math.floor((seconds % 3600) / 60) - const s = Math.floor(seconds % 60) - return `${d}:${h}:${m}:${s}` + const seconds = uptime; + const d = Math.floor(seconds / 86400); + const h = Math.floor((seconds % 86400) / 3600).toString().padStart(2, '0'); + const m = Math.floor((seconds % 3600) / 60).toString().padStart(2, '0'); + const s = Math.floor(seconds % 60).toString().padStart(2, '0'); + return `${d}:${h}:${m}:${s}`; } \ No newline at end of file diff --git a/src/components/Host.vue b/src/components/Host.vue index 1d55429..5f0ce4f 100644 --- a/src/components/Host.vue +++ b/src/components/Host.vue @@ -340,33 +340,35 @@ onMounted(