|
@@ -1,10 +1,12 @@
|
|
|
import React, {Component} from 'react';
|
|
import React, {Component} from 'react';
|
|
|
-import {Layout, Menu, Input, Modal, 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 {BrowserRouter as Router, Route, Link, Switch, Redirect} from "react-router-dom";
|
|
|
|
|
+import {Mutation, Query} from "react-apollo";
|
|
|
|
|
+import gql from "graphql-tag";
|
|
|
|
|
|
|
|
import moment from 'moment';
|
|
import moment from 'moment';
|
|
|
import 'moment/locale/zh-cn';
|
|
import 'moment/locale/zh-cn';
|
|
|
-import { FormattedMessage } from 'react-intl';
|
|
|
|
|
|
|
+import {FormattedMessage} from 'react-intl';
|
|
|
import zhCN from 'antd/lib/locale-provider/zh_CN';
|
|
import zhCN from 'antd/lib/locale-provider/zh_CN';
|
|
|
|
|
|
|
|
import WechatService from "../wechatService/WechatService";
|
|
import WechatService from "../wechatService/WechatService";
|
|
@@ -13,16 +15,20 @@ import TrialCase from "../trialCase/TrialCase";
|
|
|
import Login from "../login/Login";
|
|
import Login from "../login/Login";
|
|
|
import '../common/graphql/index.css';
|
|
import '../common/graphql/index.css';
|
|
|
import './index.css'
|
|
import './index.css'
|
|
|
-import Create from "../common/schema/Create";
|
|
|
|
|
|
|
+import {SHOW_SCHEMA} from "../gql";
|
|
|
|
|
+import axios from 'axios';
|
|
|
|
|
+
|
|
|
|
|
+axios.defaults.withCredentials = true;
|
|
|
|
|
|
|
|
const {SubMenu} = Menu;
|
|
const {SubMenu} = Menu;
|
|
|
const {Header, Sider} = Layout;
|
|
const {Header, Sider} = Layout;
|
|
|
moment.locale('en');
|
|
moment.locale('en');
|
|
|
|
|
|
|
|
|
|
+
|
|
|
class App extends Component {
|
|
class App extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
- sessionStorage.setItem("language","English");
|
|
|
|
|
|
|
+ sessionStorage.setItem("language", "English");
|
|
|
this.state = {
|
|
this.state = {
|
|
|
menuLevel1: "trail",
|
|
menuLevel1: "trail",
|
|
|
sideBar: "e-commerce",
|
|
sideBar: "e-commerce",
|
|
@@ -30,9 +36,7 @@ class App extends Component {
|
|
|
inlineCollapsed: false,
|
|
inlineCollapsed: false,
|
|
|
locale: undefined,
|
|
locale: undefined,
|
|
|
language: sessionStorage.getItem("language"),
|
|
language: sessionStorage.getItem("language"),
|
|
|
- ModalText: 'Content of the modal',
|
|
|
|
|
- visible: false,
|
|
|
|
|
- confirmLoading: false,
|
|
|
|
|
|
|
+ userID: ''
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -48,33 +52,20 @@ class App extends Component {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- showModal = () => {
|
|
|
|
|
- this.setState({
|
|
|
|
|
- visible: true,
|
|
|
|
|
- });
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- hideModal = () => {
|
|
|
|
|
- this.setState({
|
|
|
|
|
- visible: false,
|
|
|
|
|
- });
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
changeLocale = (e) => {
|
|
changeLocale = (e) => {
|
|
|
- e.stopPropagation();
|
|
|
|
|
let language = sessionStorage.getItem("language");
|
|
let language = sessionStorage.getItem("language");
|
|
|
// console.log('app language',language);
|
|
// console.log('app language',language);
|
|
|
let local = language === "中文" ? zhCN : undefined;
|
|
let local = language === "中文" ? zhCN : undefined;
|
|
|
// console.log('app local',local);
|
|
// console.log('app local',local);
|
|
|
- let changeLanguage = language === "中文" ? "English" : "中文";
|
|
|
|
|
|
|
+ let changeLanguage = language === "中文" ? "English" : "中文";
|
|
|
// console.log('app changeLanguage',changeLanguage);
|
|
// console.log('app changeLanguage',changeLanguage);
|
|
|
- let nowLanguage = language === "中文" ? 'zh' : 'en';
|
|
|
|
|
|
|
+ let nowLanguage = language === "中文" ? 'zh' : 'en';
|
|
|
// console.log('app nowLanguage',nowLanguage);
|
|
// console.log('app nowLanguage',nowLanguage);
|
|
|
- sessionStorage.setItem("language",changeLanguage);
|
|
|
|
|
|
|
+ sessionStorage.setItem("language", changeLanguage);
|
|
|
this.props.changeLanguage(nowLanguage);
|
|
this.props.changeLanguage(nowLanguage);
|
|
|
this.setState({
|
|
this.setState({
|
|
|
- language:changeLanguage,
|
|
|
|
|
- locale:local
|
|
|
|
|
|
|
+ language: changeLanguage,
|
|
|
|
|
+ locale: local
|
|
|
});
|
|
});
|
|
|
if (!local) {
|
|
if (!local) {
|
|
|
moment.locale('en');
|
|
moment.locale('en');
|
|
@@ -83,9 +74,9 @@ class App extends Component {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- render() {
|
|
|
|
|
- const { locale,language,visible } = this.state;
|
|
|
|
|
|
|
|
|
|
|
|
+ render() {
|
|
|
|
|
+ const {locale, language} = this.state;
|
|
|
return (
|
|
return (
|
|
|
<Router>
|
|
<Router>
|
|
|
<Layout style={{minHeight: '100vh'}}>
|
|
<Layout style={{minHeight: '100vh'}}>
|
|
@@ -98,7 +89,7 @@ class App extends Component {
|
|
|
<Menu
|
|
<Menu
|
|
|
theme="dark"
|
|
theme="dark"
|
|
|
mode="horizontal"
|
|
mode="horizontal"
|
|
|
- defaultSelectedKeys={['graphql-service']}
|
|
|
|
|
|
|
+ // defaultSelectedKeys={['cloud-function']}
|
|
|
style={{lineHeight: '64px'}}
|
|
style={{lineHeight: '64px'}}
|
|
|
onClick={(e) => this.switchMenu('menuLevel1', e)}
|
|
onClick={(e) => this.switchMenu('menuLevel1', e)}
|
|
|
>
|
|
>
|
|
@@ -106,7 +97,8 @@ class App extends Component {
|
|
|
<Link to="/"><FormattedMessage id="Graphql Service"/></Link>
|
|
<Link to="/"><FormattedMessage id="Graphql Service"/></Link>
|
|
|
</Menu.Item>
|
|
</Menu.Item>
|
|
|
<Menu.Item key="wechat-service">
|
|
<Menu.Item key="wechat-service">
|
|
|
- <Link to="/wechat-service/trial-case/wechat case"><FormattedMessage id="Wechat Service"/></Link>
|
|
|
|
|
|
|
+ <Link to="/wechat-service/trial-case/wechat case"><FormattedMessage
|
|
|
|
|
+ id="Wechat Service"/></Link>
|
|
|
</Menu.Item>
|
|
</Menu.Item>
|
|
|
<Menu.Item key="quantization-service">
|
|
<Menu.Item key="quantization-service">
|
|
|
<Link to="/quant-service/"><FormattedMessage id="Quantization Service"/></Link>
|
|
<Link to="/quant-service/"><FormattedMessage id="Quantization Service"/></Link>
|
|
@@ -116,98 +108,34 @@ class App extends Component {
|
|
|
<Link to="/login"><Button className='login-button' type='primary'>Login</Button></Link>
|
|
<Link to="/login"><Button className='login-button' type='primary'>Login</Button></Link>
|
|
|
|
|
|
|
|
<div className="change-locale">
|
|
<div className="change-locale">
|
|
|
- <Button size="small" onClick={(e)=>this.changeLocale(e)}>{language}</Button>
|
|
|
|
|
|
|
+ <Button size="small" onClick={(e) => this.changeLocale(e)}>{language}</Button>
|
|
|
</div>
|
|
</div>
|
|
|
</Header>
|
|
</Header>
|
|
|
|
|
|
|
|
- <Sider
|
|
|
|
|
- width={200}
|
|
|
|
|
- style={{background: '#fff', marginTop: '64px', zIndex: '0'}}
|
|
|
|
|
- collapsible
|
|
|
|
|
- collapsed={this.state.collapsed}
|
|
|
|
|
- onCollapse={this.onCollapse}
|
|
|
|
|
- >
|
|
|
|
|
- {(() => {
|
|
|
|
|
- switch (this.state.menuLevel1) {
|
|
|
|
|
- case 'graphql-service':
|
|
|
|
|
- return (
|
|
|
|
|
- <Menu
|
|
|
|
|
- theme="dark"
|
|
|
|
|
- mode="inline"
|
|
|
|
|
- inlineCollapsed={this.state.inlineCollapsed}
|
|
|
|
|
- defaultSelectedKeys={['e-commerce']}
|
|
|
|
|
- defaultOpenKeys={['trial-case']}
|
|
|
|
|
- // openKeys={['cloud-function']}
|
|
|
|
|
- onClick={(e) => this.switchMenu('sideBar', e)}
|
|
|
|
|
- selectedKeys={[this.state.sideBar]}
|
|
|
|
|
- style={{
|
|
|
|
|
- borderRight: 0,
|
|
|
|
|
- overflow: 'auto',
|
|
|
|
|
- height: '100vh',
|
|
|
|
|
- left: '0',
|
|
|
|
|
- width: '200px',
|
|
|
|
|
- position: 'fixed'
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>Trial Case</span></span>}>
|
|
|
|
|
- <Menu.Item key="e-commerce"><Link to="/graphql-service/trial-case/e-commerce">e-commerce</Link></Menu.Item>
|
|
|
|
|
- <Menu.Item key="keep accounts"><Link to="/graphql-service/trial-case/keep accounts">keep accounts</Link></Menu.Item>
|
|
|
|
|
- <Menu.Item key="appointment"><Link to="/graphql-service/trial-case/appointment">appointment</Link></Menu.Item>
|
|
|
|
|
- </SubMenu>
|
|
|
|
|
-
|
|
|
|
|
- <Menu.Item key="create-graphql" onClick={this.showModal}>
|
|
|
|
|
- <Icon type="edit" theme="twoTone" />
|
|
|
|
|
- <span>Create</span>
|
|
|
|
|
- <Icon type="plus" style={{
|
|
|
|
|
- position: 'absolute',
|
|
|
|
|
- top: '35%',
|
|
|
|
|
- right: '6px',
|
|
|
|
|
- color: 'white'}}/>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
-
|
|
|
|
|
- <SubMenu key="my-create"
|
|
|
|
|
- title={<span><Icon type="user" theme="outlined"/><span>My Create</span></span>}>
|
|
|
|
|
- <Menu.Item key="my graphql"><Link to="/graphql-service/my-create/my graphql">my graphql</Link></Menu.Item>
|
|
|
|
|
- </SubMenu>
|
|
|
|
|
- </Menu>
|
|
|
|
|
- );
|
|
|
|
|
- case 'wechat-service':
|
|
|
|
|
- return (
|
|
|
|
|
- <Menu
|
|
|
|
|
- theme="dark"
|
|
|
|
|
- mode="inline"
|
|
|
|
|
- inlineCollapsed={this.state.inlineCollapsed}
|
|
|
|
|
- defaultSelectedKeys={['wechat']}
|
|
|
|
|
- defaultOpenKeys={['trial-case']}
|
|
|
|
|
- // openKeys={['cloud-function']}
|
|
|
|
|
- onClick={(e) => this.switchMenu('sideBar', e)}
|
|
|
|
|
- selectedKeys={[this.state.sideBar]}
|
|
|
|
|
- style={{
|
|
|
|
|
- borderRight: 0,
|
|
|
|
|
- overflow: 'auto',
|
|
|
|
|
- height: '100vh',
|
|
|
|
|
- left: '0',
|
|
|
|
|
- width: '200px',
|
|
|
|
|
- position: 'fixed'
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>Trial Case</span></span>}>
|
|
|
|
|
- <Menu.Item key="wechat"><Link to="/wechat-service/trial-case/wechat case">wechat case</Link></Menu.Item>
|
|
|
|
|
- </SubMenu>
|
|
|
|
|
|
|
|
|
|
- <SubMenu key="my-create"
|
|
|
|
|
- title={<span><Icon type="user" theme="outlined"/><span>My Create</span></span>}>
|
|
|
|
|
- <Menu.Item key="my wechat"><Link to="/wechat-service/my-create/my wechat">my wechat</Link></Menu.Item>
|
|
|
|
|
- </SubMenu>
|
|
|
|
|
- </Menu>
|
|
|
|
|
- );
|
|
|
|
|
- case 'quantization-service':
|
|
|
|
|
- return (
|
|
|
|
|
|
|
+ {(() => {
|
|
|
|
|
+ switch (this.state.menuLevel1) {
|
|
|
|
|
+ case 'graphql-service':
|
|
|
|
|
+ return (
|
|
|
|
|
+ <GraphqlSidebar collapsed={this.state.collapsed} onCollapse={this.onCollapse}
|
|
|
|
|
+ inlineCollapsed={this.state.inlineCollapsed}
|
|
|
|
|
+ sideBar={this.state.sideBar} switchMenu={this.switchMenu}
|
|
|
|
|
+ userID={this.state.userID}/>
|
|
|
|
|
+ );
|
|
|
|
|
+ case 'wechat-service':
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Sider
|
|
|
|
|
+ width={200}
|
|
|
|
|
+ style={{background: '#fff', marginTop: '64px', zIndex: '0'}}
|
|
|
|
|
+ collapsible
|
|
|
|
|
+ collapsed={this.state.collapsed}
|
|
|
|
|
+ onCollapse={this.onCollapse}
|
|
|
|
|
+ >
|
|
|
<Menu
|
|
<Menu
|
|
|
theme="dark"
|
|
theme="dark"
|
|
|
mode="inline"
|
|
mode="inline"
|
|
|
inlineCollapsed={this.state.inlineCollapsed}
|
|
inlineCollapsed={this.state.inlineCollapsed}
|
|
|
- defaultSelectedKeys={['quant-service']}
|
|
|
|
|
|
|
+ defaultSelectedKeys={['e-commerce']}
|
|
|
defaultOpenKeys={['trial-case']}
|
|
defaultOpenKeys={['trial-case']}
|
|
|
// openKeys={['cloud-function']}
|
|
// openKeys={['cloud-function']}
|
|
|
onClick={(e) => this.switchMenu('sideBar', e)}
|
|
onClick={(e) => this.switchMenu('sideBar', e)}
|
|
@@ -221,18 +149,32 @@ class App extends Component {
|
|
|
position: 'fixed'
|
|
position: 'fixed'
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
- <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>Trial Case</span></span>}>
|
|
|
|
|
- <Menu.Item key="quant-service"><Link to="/quant-service/">quant case</Link></Menu.Item>
|
|
|
|
|
|
|
+ <SubMenu key="trial-case"
|
|
|
|
|
+ title={<span><Icon type="appstore" theme="twoTone"/><span>Trial Case</span></span>}>
|
|
|
|
|
+ <Menu.Item key="wechat"><Link
|
|
|
|
|
+ to="/wechat-service/trial-case/wechat case">wechat
|
|
|
|
|
+ case</Link></Menu.Item>
|
|
|
</SubMenu>
|
|
</SubMenu>
|
|
|
|
|
|
|
|
<SubMenu key="my-create"
|
|
<SubMenu key="my-create"
|
|
|
- title={<span><Icon type="user" theme="outlined"/><span>My Create</span></span>}>
|
|
|
|
|
- <Menu.Item key="my quant"><Link to="/quant-service/">my quant</Link></Menu.Item>
|
|
|
|
|
|
|
+ title={<span><Icon type="user"
|
|
|
|
|
+ theme="outlined"/><span>My Create</span></span>}>
|
|
|
|
|
+ <Menu.Item key="my wechat"><Link
|
|
|
|
|
+ to="/wechat-service/my-create/my wechat">my
|
|
|
|
|
+ wechat</Link></Menu.Item>
|
|
|
</SubMenu>
|
|
</SubMenu>
|
|
|
</Menu>
|
|
</Menu>
|
|
|
- );
|
|
|
|
|
- default:
|
|
|
|
|
- return (
|
|
|
|
|
|
|
+ </Sider>
|
|
|
|
|
+ );
|
|
|
|
|
+ case 'quantization-service':
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Sider
|
|
|
|
|
+ width={200}
|
|
|
|
|
+ style={{background: '#fff', marginTop: '64px', zIndex: '0'}}
|
|
|
|
|
+ collapsible
|
|
|
|
|
+ collapsed={this.state.collapsed}
|
|
|
|
|
+ onCollapse={this.onCollapse}
|
|
|
|
|
+ >
|
|
|
<Menu
|
|
<Menu
|
|
|
theme="dark"
|
|
theme="dark"
|
|
|
mode="inline"
|
|
mode="inline"
|
|
@@ -251,37 +193,34 @@ class App extends Component {
|
|
|
position: 'fixed'
|
|
position: 'fixed'
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
- <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>Trial Case</span></span>}>
|
|
|
|
|
- <Menu.Item key="e-commerce"><Link to="/graphql-service/trial-case/e-commerce">e-commerce</Link></Menu.Item>
|
|
|
|
|
- <Menu.Item key="keep accounts"><Link to="/graphql-service/trial-case/keep accounts">keep accounts</Link></Menu.Item>
|
|
|
|
|
- <Menu.Item key="appointment"><Link to="/graphql-service/trial-case/appointment">appointment</Link></Menu.Item>
|
|
|
|
|
|
|
+ <SubMenu key="trial-case"
|
|
|
|
|
+ title={<span><Icon type="appstore" theme="twoTone"/><span>Trial Case</span></span>}>
|
|
|
|
|
+ <Menu.Item key="quant-service"><Link to="/quant-service/">quant
|
|
|
|
|
+ case</Link></Menu.Item>
|
|
|
</SubMenu>
|
|
</SubMenu>
|
|
|
|
|
|
|
|
- <Menu.Item key="create-graphql" onClick={this.showModal}>
|
|
|
|
|
- <Icon type="edit" theme="twoTone" />
|
|
|
|
|
- <span>Create</span>
|
|
|
|
|
- <Icon type="plus" style={{
|
|
|
|
|
- position: 'absolute',
|
|
|
|
|
- top: '35%',
|
|
|
|
|
- right: '6px',
|
|
|
|
|
- color: 'white'}}/>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
-
|
|
|
|
|
<SubMenu key="my-create"
|
|
<SubMenu key="my-create"
|
|
|
- title={<span><Icon type="user" theme="outlined"/><span>My Create</span></span>}>
|
|
|
|
|
- <Menu.Item key="my graphql"><Link to="/graphql-service/my-create/my graphql">my graphql</Link></Menu.Item>
|
|
|
|
|
|
|
+ title={<span><Icon type="user"
|
|
|
|
|
+ theme="outlined"/><span>My Create</span></span>}>
|
|
|
|
|
+ <Menu.Item key="my quant"><Link to="/quant-service/">my
|
|
|
|
|
+ quant</Link></Menu.Item>
|
|
|
</SubMenu>
|
|
</SubMenu>
|
|
|
</Menu>
|
|
</Menu>
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
- })()}
|
|
|
|
|
- </Sider>
|
|
|
|
|
- <Create visible={visible} hideModal={this.hideModal}/>
|
|
|
|
|
- {
|
|
|
|
|
- // todo: 路由如何传值是个问题,包括schema_id, user_id
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ </Sider>
|
|
|
|
|
+ );
|
|
|
|
|
+ default:
|
|
|
|
|
+ return (
|
|
|
|
|
+ <GraphqlSidebar collapsed={this.state.collapsed} onCollapse={this.onCollapse}
|
|
|
|
|
+ inlineCollapsed={this.state.inlineCollapsed}
|
|
|
|
|
+ sideBar={this.state.sideBar} switchMenu={this.switchMenu}
|
|
|
|
|
+ userID={this.state.userID}/>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ })()}
|
|
|
|
|
+
|
|
|
<LocaleProvider locale={locale}>
|
|
<LocaleProvider locale={locale}>
|
|
|
- <Layout style={{marginTop: '64px', zIndex: '0'}} key={locale ? locale.locale : 'en'/* Have to refresh for production environment */} >
|
|
|
|
|
|
|
+ <Layout style={{marginTop: '64px', zIndex: '0'}}
|
|
|
|
|
+ key={locale ? locale.locale : 'en'/* Have to refresh for production environment */}>
|
|
|
<Switch>
|
|
<Switch>
|
|
|
<Route path="/" exact component={TrialCase}/>
|
|
<Route path="/" exact component={TrialCase}/>
|
|
|
<Route path="/graphql-service/:sidebar/:caseId" component={TrialCase}/>
|
|
<Route path="/graphql-service/:sidebar/:caseId" component={TrialCase}/>
|
|
@@ -300,6 +239,110 @@ class App extends Component {
|
|
|
|
|
|
|
|
export default App;
|
|
export default App;
|
|
|
|
|
|
|
|
|
|
+class GraphqlSidebar extends Component {
|
|
|
|
|
+ constructor(props) {
|
|
|
|
|
+ super(props);
|
|
|
|
|
+ this.state = {
|
|
|
|
|
+ getID_url: 'http://123.206.193.98:8999/getuserid',
|
|
|
|
|
+ userID: '',
|
|
|
|
|
+ show: false
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ componentWillMount() {
|
|
|
|
|
+ let _this = this;
|
|
|
|
|
+ axios.get(this.state.getID_url)
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ if (res.data !== '') {
|
|
|
|
|
+ _this.setState({
|
|
|
|
|
+ userID: res.data,
|
|
|
|
|
+ show: true
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ _this.setState({
|
|
|
|
|
+ show: true
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((err) => {
|
|
|
|
|
+ console.log(err);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ render() {
|
|
|
|
|
+ return (
|
|
|
|
|
+ this.state.show ?
|
|
|
|
|
+ <Query query={gql(SHOW_SCHEMA)} variables={{user_id: this.state.userID}}>
|
|
|
|
|
+ {
|
|
|
|
|
+ ({loading, error, data}) => {
|
|
|
|
|
+ if (loading) return <Spin style={{marginLeft: 3}}/>;
|
|
|
|
|
+ if (error) return 'error!';
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Sider
|
|
|
|
|
+ width={200}
|
|
|
|
|
+ style={{background: '#fff', marginTop: '64px', zIndex: '0'}}
|
|
|
|
|
+ collapsible
|
|
|
|
|
+ collapsed={this.props.collapsed}
|
|
|
|
|
+ onCollapse={this.props.onCollapse}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Menu
|
|
|
|
|
+ theme="dark"
|
|
|
|
|
+ mode="inline"
|
|
|
|
|
+ inlineCollapsed={this.props.inlineCollapsed}
|
|
|
|
|
+ defaultSelectedKeys={['e-commerce']}
|
|
|
|
|
+ defaultOpenKeys={['trial-case', 'my-create']}
|
|
|
|
|
+ // openKeys={['cloud-function']}
|
|
|
|
|
+ onClick={(e) => this.props.switchMenu('sideBar', e)}
|
|
|
|
|
+ selectedKeys={[this.props.sideBar]}
|
|
|
|
|
+ style={{
|
|
|
|
|
+ borderRight: 0,
|
|
|
|
|
+ overflow: 'auto',
|
|
|
|
|
+ height: '100vh',
|
|
|
|
|
+ left: '0',
|
|
|
|
|
+ width: '200px',
|
|
|
|
|
+ position: 'fixed'
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <SubMenu key="trial-case"
|
|
|
|
|
+ title={<span><Icon type="appstore"
|
|
|
|
|
+ theme="twoTone"/><span>Trial Case</span></span>}>
|
|
|
|
|
+ <Menu.Item key="e-commerce"><Link
|
|
|
|
|
+ to="/graphql-service/trial-case/e-commerce">e-commerce</Link></Menu.Item>
|
|
|
|
|
+ <Menu.Item key="keep accounts"><Link
|
|
|
|
|
+ to="/graphql-service/trial-case/keep accounts">keep
|
|
|
|
|
+ accounts</Link></Menu.Item>
|
|
|
|
|
+ <Menu.Item key="appointment"><Link
|
|
|
|
|
+ to="/graphql-service/trial-case/appointment">appointment</Link></Menu.Item>
|
|
|
|
|
+ </SubMenu>
|
|
|
|
|
+
|
|
|
|
|
+ <Menu.Item key="1"><Icon type="edit" theme="twoTone"/><span>Create</span>
|
|
|
|
|
+ <Icon type="plus" style={{
|
|
|
|
|
+ position: 'absolute',
|
|
|
|
|
+ top: '35%',
|
|
|
|
|
+ right: '6px',
|
|
|
|
|
+ color: 'white'
|
|
|
|
|
+ }}/>
|
|
|
|
|
+ </Menu.Item>
|
|
|
|
|
+
|
|
|
|
|
+ <SubMenu key="my-create" title={<span><Icon type="user"
|
|
|
|
|
+ theme="outlined"/><span>My Create</span></span>}>
|
|
|
|
|
+ {
|
|
|
|
|
+ data.schema_by_props.map((schema) => <Menu.Item
|
|
|
|
|
+ key={schema.schemaName}><Link
|
|
|
|
|
+ to={`/graphql-service/my-create/${schema.id}`}>{schema.schemaName}</Link></Menu.Item>)
|
|
|
|
|
+ }
|
|
|
|
|
+ </SubMenu>
|
|
|
|
|
+ </Menu>
|
|
|
|
|
+ </Sider>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ </Query>
|
|
|
|
|
+ :
|
|
|
|
|
+ ''
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+}
|