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 )}/> + }/>