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