|
|
@@ -1,5 +1,5 @@
|
|
|
import React, {Component} from 'react';
|
|
|
-import {Layout, Menu, Input, Button, Spin,Breadcrumb, Icon,Radio,LocaleProvider } from 'antd';
|
|
|
+import {Layout, Menu, Input, Button, Spin, Breadcrumb, Icon, Radio, LocaleProvider} from 'antd';
|
|
|
import {BrowserRouter as Router, Route, Link, Switch, Redirect} from "react-router-dom";
|
|
|
import gql from "graphql-tag";
|
|
|
import {Query} from "react-apollo";
|
|
|
@@ -19,16 +19,16 @@ import '../common/graphql/index.css';
|
|
|
import './index.css'
|
|
|
import TrialCase from "../trialCase/TrialCase";
|
|
|
|
|
|
-const { SubMenu } = Menu;
|
|
|
-const { Header, Sider } = Layout;
|
|
|
+const {SubMenu} = Menu;
|
|
|
+const {Header, Sider} = Layout;
|
|
|
moment.locale('en');
|
|
|
|
|
|
class App extends Component {
|
|
|
constructor() {
|
|
|
super();
|
|
|
this.state = {
|
|
|
- menuLevel1:"trail",
|
|
|
- sideBar:"e-commerce",
|
|
|
+ menuLevel1: "trail",
|
|
|
+ sideBar: "e-commerce",
|
|
|
userID: '',
|
|
|
hasLogin: false,
|
|
|
user: {
|
|
|
@@ -36,13 +36,14 @@ class App extends Component {
|
|
|
avatar: ''
|
|
|
},
|
|
|
collapsed: false,
|
|
|
- inlineCollapsed:false,
|
|
|
+ inlineCollapsed: false,
|
|
|
locale: null,
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
onCollapse = (collapsed) => {
|
|
|
console.log(collapsed);
|
|
|
- this.setState({ collapsed });
|
|
|
+ this.setState({collapsed});
|
|
|
};
|
|
|
|
|
|
switchMenu = (menuName, e) => {
|
|
|
@@ -54,7 +55,7 @@ class App extends Component {
|
|
|
|
|
|
changeLocale = (e) => {
|
|
|
const localeValue = e.target.value;
|
|
|
- this.setState({ locale: localeValue });
|
|
|
+ this.setState({locale: localeValue});
|
|
|
if (!localeValue) {
|
|
|
moment.locale('en');
|
|
|
} else {
|
|
|
@@ -120,9 +121,11 @@ class App extends Component {
|
|
|
<Router>
|
|
|
<Layout style={{minHeight: '100vh'}}>
|
|
|
<Header className="header" style={{position: 'fixed', zIndex: 1, width: '100%'}}>
|
|
|
- <div className="logo-wrapper">
|
|
|
- <div className='logo'/>
|
|
|
- </div>
|
|
|
+ <Link to="/">
|
|
|
+ <div className="logo-wrapper">
|
|
|
+ <div className='logo'/>
|
|
|
+ </div>
|
|
|
+ </Link>
|
|
|
<Menu
|
|
|
theme="dark"
|
|
|
mode="horizontal"
|
|
|
@@ -133,37 +136,38 @@ class App extends Component {
|
|
|
<Menu.Item key="cloud-function"><Link to="/cloud-function">Cloud Function</Link></Menu.Item>
|
|
|
<Menu.Item key="data-storage"><Link to="/data-storage/">Data Storage</Link></Menu.Item>
|
|
|
<Menu.Item key="data-analysis"><Link to="/data-analysis/">Data Analysis</Link></Menu.Item>
|
|
|
- <Menu.Item key="monitor-notification"><Link to="/monitor-notification/">Monitor Notification</Link></Menu.Item>
|
|
|
+ <Menu.Item key="monitor-notification"><Link to="/monitor-notification/">Monitor
|
|
|
+ Notification</Link></Menu.Item>
|
|
|
</Menu>
|
|
|
|
|
|
{/*<div className="change-locale">*/}
|
|
|
- {/*<span style={{ marginRight: 16 }}>Change locale of components: </span>*/}
|
|
|
- {/*<Radio.Group defaultValue={undefined} onChange={this.changeLocale}>*/}
|
|
|
- {/*<Radio.Button key="en" value={undefined}>English</Radio.Button>*/}
|
|
|
- {/*<Radio.Button key="cn" value={zhCN}>中文</Radio.Button>*/}
|
|
|
- {/*</Radio.Group>*/}
|
|
|
+ {/*<span style={{ marginRight: 16 }}>Change locale of components: </span>*/}
|
|
|
+ {/*<Radio.Group defaultValue={undefined} onChange={this.changeLocale}>*/}
|
|
|
+ {/*<Radio.Button key="en" value={undefined}>English</Radio.Button>*/}
|
|
|
+ {/*<Radio.Button key="cn" value={zhCN}>中文</Radio.Button>*/}
|
|
|
+ {/*</Radio.Group>*/}
|
|
|
{/*</div>*/}
|
|
|
{/*<div className='login'>*/}
|
|
|
- {/*{*/}
|
|
|
- {/*this.state.hasLogin ?*/}
|
|
|
- {/*this.login(this.state.userID)*/}
|
|
|
- {/*:*/}
|
|
|
- {/*<div>*/}
|
|
|
- {/*<span style={{marginRight: 20}}>login:</span>*/}
|
|
|
- {/*<Input*/}
|
|
|
- {/*placeholder="id, eg: 'xy_1'"*/}
|
|
|
- {/*onChange={(e) => {*/}
|
|
|
- {/*// antd 获取不到 target,百度来的下面这句代码*/}
|
|
|
- {/*e.persist();*/}
|
|
|
- {/*this.setState({userID: e.target.value});*/}
|
|
|
- {/*}}*/}
|
|
|
- {/*onPressEnter={() => {*/}
|
|
|
- {/*this.setState({hasLogin: true})*/}
|
|
|
- {/*}}*/}
|
|
|
- {/*style={{width: 200}}*/}
|
|
|
- {/*/>*/}
|
|
|
- {/*</div>*/}
|
|
|
- {/*}*/}
|
|
|
+ {/*{*/}
|
|
|
+ {/*this.state.hasLogin ?*/}
|
|
|
+ {/*this.login(this.state.userID)*/}
|
|
|
+ {/*:*/}
|
|
|
+ {/*<div>*/}
|
|
|
+ {/*<span style={{marginRight: 20}}>login:</span>*/}
|
|
|
+ {/*<Input*/}
|
|
|
+ {/*placeholder="id, eg: 'xy_1'"*/}
|
|
|
+ {/*onChange={(e) => {*/}
|
|
|
+ {/*// antd 获取不到 target,百度来的下面这句代码*/}
|
|
|
+ {/*e.persist();*/}
|
|
|
+ {/*this.setState({userID: e.target.value});*/}
|
|
|
+ {/*}}*/}
|
|
|
+ {/*onPressEnter={() => {*/}
|
|
|
+ {/*this.setState({hasLogin: true})*/}
|
|
|
+ {/*}}*/}
|
|
|
+ {/*style={{width: 200}}*/}
|
|
|
+ {/*/>*/}
|
|
|
+ {/*</div>*/}
|
|
|
+ {/*}*/}
|
|
|
{/*</div>*/}
|
|
|
</Header>
|
|
|
|
|
|
@@ -193,9 +197,9 @@ class App extends Component {
|
|
|
}}
|
|
|
>
|
|
|
<SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>Trial Case</span></span>}>
|
|
|
- <Menu.Item key="e-commerce">e-commerce</Menu.Item>
|
|
|
- <Menu.Item key="keep accounts">keep accounts</Menu.Item>
|
|
|
- <Menu.Item key="appointment">appointment</Menu.Item>
|
|
|
+ <Menu.Item key="e-commerce"><Link to="/">e-commerce</Link></Menu.Item>
|
|
|
+ <Menu.Item key="keep accounts"><Link to="/">keep accounts</Link></Menu.Item>
|
|
|
+ <Menu.Item key="appointment"><Link to="/">appointment</Link></Menu.Item>
|
|
|
</SubMenu>
|
|
|
|
|
|
{(() => {
|
|
|
@@ -269,7 +273,7 @@ class App extends Component {
|
|
|
<Route path="/data-storage/" component={DataStorage}/>
|
|
|
<Route path="/data-analysis/" component={DataAnalysis}/>
|
|
|
<Route path="/monitor-notification/" component={MonitorNotify}/>
|
|
|
- <Redirect path="*" to="/" />
|
|
|
+ <Redirect path="*" to="/"/>
|
|
|
</Switch>
|
|
|
</Layout>
|
|
|
</Layout>
|