From 33f3a66f0784349da2b6e776b41790831ea9066b Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 31 Oct 2022 20:01:44 +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 6bbb29f..6c1b64f 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 } from 'libs'; import store from './store'; import icons from './icons'; +import moment from 'moment'; function ComTable() { function handleDelete(text) { @@ -38,6 +39,21 @@ function ComTable() { } } + 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 )}/> + }/>