From 3c43095daabeecb336aa1b473140f4394020aa05 Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 31 Oct 2022 20:04:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E6=9C=BA=E5=88=97=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_web/src/pages/host/Table.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spug_web/src/pages/host/Table.js b/spug_web/src/pages/host/Table.js index 3eb95d7..53a9d6b 100644 --- a/spug_web/src/pages/host/Table.js +++ b/spug_web/src/pages/host/Table.js @@ -12,6 +12,7 @@ import IPAddress from './IPAddress'; import { http, hasPermission, blobToExcel, humanDate } from 'libs'; import store from './store'; import icons from './icons'; +import moment from 'moment'; function ComTable() { const [loading, setLoading] = useState(false) @@ -47,6 +48,21 @@ function ComTable() { .finally(() => setLoading(false)) } + function ExpTime(props) { + if (!props.value) return null + let value = moment(props.value) + const days = value.diff(moment(), 'days') + if (days > 30) { + return 剩余 {days} + } else if (days > 7) { + return 剩余 {days} + } else if (days >= 0) { + return 剩余 {days} + } else { + return 过期 {Math.abs(days)} + } + } + return ( {info.cpu}核 {info.memory}GB )}/> + }/>