From fbac4c7c2b38f219859bc0b003869c6586d5a6f7 Mon Sep 17 00:00:00 2001 From: dushixiang <798148596@qq.com> Date: Wed, 6 Jan 2021 01:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E4=BB=8Epackage.json=E4=B8=AD=E8=AF=BB?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/package.json | 2 +- web/src/App.js | 6 ++++-- web/src/utils/utils.js | 12 +++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/web/package.json b/web/package.json index 47acea9..ddd757d 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "next-terminal", - "version": "0.0.3", + "version": "0.0.4", "private": true, "dependencies": { "@ant-design/icons": "^4.3.0", diff --git a/web/src/App.js b/web/src/App.js index a98c700..2138eb2 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -33,6 +33,7 @@ import request from "./common/request"; import {message} from "antd/es"; import Setting from "./components/setting/Setting"; import BatchCommand from "./components/command/BatchCommand"; +import {NT_PACKAGE} from "./utils/utils"; const {Footer, Sider} = Layout; @@ -46,7 +47,8 @@ class App extends Component { openKeys: sessionStorage.getItem('openKeys') ? JSON.parse(sessionStorage.getItem('openKeys')) : [], user: { 'nickname': '未定义' - } + }, + package: NT_PACKAGE() }; toggle = () => { @@ -226,7 +228,7 @@ class App extends Component { diff --git a/web/src/utils/utils.js b/web/src/utils/utils.js index fef15c2..f737ffd 100644 --- a/web/src/utils/utils.js +++ b/web/src/utils/utils.js @@ -144,6 +144,16 @@ export function differTime(start, end) { return show; } -export const isEmpty = (text) =>{ +export const isEmpty = (text) => { return text === undefined || text == null || text.length === 0; } + +export const NT_PACKAGE = () => { + const _package = require("../../package.json"); + const name = _package.name; + const version = _package.version; + return { + name: name, + version: version + } +}