From c98d5b17779163e99862579e35cc9d794e84c4d8 Mon Sep 17 00:00:00 2001 From: shi-lai-mu <478889187@qq.com> Date: Mon, 7 Oct 2019 20:03:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=AB=99=E7=82=B9=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=9A=B4=E9=9C=B2=E8=87=B3=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/default.config.ts | 5 ++++- interface/config.ts | 9 +++++++++ layouts/default/footer.tsx | 16 +++++++++------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/config/default.config.ts b/config/default.config.ts index a1ec3e09..2e1db050 100644 --- a/config/default.config.ts +++ b/config/default.config.ts @@ -9,7 +9,10 @@ const config: DefaultConfig = { host: 'http://localhost', port: 3000, apiHost: 'http://localhost:7001', - } + }, + web: { + runDate: 1535150280000, + }, } export default { diff --git a/interface/config.ts b/interface/config.ts index ed7dd8ad..d980f204 100644 --- a/interface/config.ts +++ b/interface/config.ts @@ -19,4 +19,13 @@ export interface DefaultConfig { */ apiHost: string; }; + /** + * 网站相关 + */ + web: { + /** + * 运行时间 + */ + runDate: number; + } } \ No newline at end of file diff --git a/layouts/default/footer.tsx b/layouts/default/footer.tsx index b1d801b5..8bc0e1e6 100644 --- a/layouts/default/footer.tsx +++ b/layouts/default/footer.tsx @@ -1,12 +1,13 @@ import React from 'react' import Link from 'next/link' import { unForm } from '../../utils/date' +import config from '../../config/default.config' export default class LayoutsDefauleFooter extends React.Component { state = { loadTime: 0, - currentTime: Date.now(), + currentTime: '-年-月-日-时-分-秒', } componentDidMount() { @@ -17,9 +18,10 @@ export default class LayoutsDefauleFooter extends React.Component { }) }) // 站点运行时间计算 + const webRunDate: number = config.web.runDate setInterval(() => { this.setState({ - currentTime: unForm(1535150280000), + currentTime: unForm(webRunDate), }) }, 1000) } @@ -31,7 +33,11 @@ export default class LayoutsDefauleFooter extends React.Component {