|
|
@@ -9,14 +9,17 @@ import 'moment/locale/zh-cn';
|
|
|
import {FormattedMessage} from 'react-intl';
|
|
|
import zhCN from 'antd/lib/locale-provider/zh_CN';
|
|
|
|
|
|
-import WechatService from "../wechatService/WechatService";
|
|
|
-import QuantService from "../quantService/QuantService";
|
|
|
-import TrialCase from "../trialCase/TrialCase";
|
|
|
-import UserCreate from "../userCreate/UserCreate";
|
|
|
+import QuantService from "./quantService/QuantService";
|
|
|
+import TrialCase from "./graphqlService/trialCase/TrialCase";
|
|
|
+import UserCreate from "./graphqlService/userCreate/UserCreate";
|
|
|
+import WXTrialCase from "./wechatService/wxTrialCase/WXTrialCase";
|
|
|
+import WXUserCreate from "./wechatService/wxUserCreate/WXUserCreate";
|
|
|
import Login from "../login/Login";
|
|
|
-import '../common/graphql/index.css';
|
|
|
+import './graphqlService/common/graphql/index.css';
|
|
|
import './index.css'
|
|
|
-import Create from "../common/schema/Create";
|
|
|
+import Create from "./graphqlService/common/schema/Create";
|
|
|
+import WxCreate from "./wechatService/wxCreate/WxCreate";
|
|
|
+
|
|
|
|
|
|
import {SHOW_ALL_SCHEMA, SHOW_ALL_WXCONFIG} from "../gql";
|
|
|
import axios from 'axios';
|
|
|
@@ -36,33 +39,30 @@ class App extends Component {
|
|
|
sideBar: "ecommerce",
|
|
|
collapsed: false,
|
|
|
inlineCollapsed: false,
|
|
|
- language:props.language,
|
|
|
+ language: props.language,
|
|
|
locale: props.language === "中文" ? zhCN : undefined,
|
|
|
- languageButton:props.language === "中文" ? "English" : "中文",
|
|
|
- visible: false
|
|
|
+ languageButton: props.language === "中文" ? "English" : "中文",
|
|
|
+ visible: false,
|
|
|
+ wxVisible: false
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- componentWillMount(){
|
|
|
- console.log('window.location',window.location);
|
|
|
+ componentWillMount() {
|
|
|
let urlList = window.location.pathname.split("/");
|
|
|
let urlListLength = urlList.length;
|
|
|
- console.log('urlList',urlList,urlListLength);
|
|
|
if (urlListLength > 2) {
|
|
|
- this.setState({menuLevel1:urlList[1]});
|
|
|
- if(urlList[3] !== 'index'){
|
|
|
- this.setState({sideBar:urlList[3]});
|
|
|
+ this.setState({menuLevel1: urlList[1]});
|
|
|
+ if (urlList[3] !== 'index') {
|
|
|
+ this.setState({sideBar: urlList[3]});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
onCollapse = (collapsed) => {
|
|
|
- // console.log(collapsed);
|
|
|
this.setState({collapsed});
|
|
|
};
|
|
|
|
|
|
switchMenu = (menuName, e) => {
|
|
|
- // console.log('menuName', menuName, 'e', e);
|
|
|
this.setState({
|
|
|
[menuName]: e.key,
|
|
|
});
|
|
|
@@ -72,14 +72,14 @@ class App extends Component {
|
|
|
this.setState({
|
|
|
[menuName]: e.key,
|
|
|
});
|
|
|
- if(e.key === "graphql-service"){
|
|
|
+ if (e.key === "graphql-service") {
|
|
|
this.setState({sideBar: "ecommerce"});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
switchSidebar = (value) => {
|
|
|
this.setState({
|
|
|
- sideBar:value,
|
|
|
+ sideBar: value,
|
|
|
});
|
|
|
};
|
|
|
|
|
|
@@ -95,26 +95,38 @@ class App extends Component {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ wxShowModal = () => {
|
|
|
+ this.setState({
|
|
|
+ wxVisible: true,
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
hideModal = () => {
|
|
|
this.setState({
|
|
|
visible: false,
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ wxHideModal = () => {
|
|
|
+ this.setState({
|
|
|
+ wxVisible: false,
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
changeLocale = (e) => {
|
|
|
e.stopPropagation();
|
|
|
let {language} = this.state;
|
|
|
// console.log('app language',language);
|
|
|
let changeLanguage = language === "中文" ? "English" : "中文";
|
|
|
let local = language === "中文" ? undefined : zhCN;
|
|
|
- let languageButton = language === "中文" ? "中文" : "English";
|
|
|
+ let languageButton = language === "中文" ? "中文" : "English";
|
|
|
|
|
|
sessionStorage.setItem("language", changeLanguage);
|
|
|
this.props.changeLanguage(changeLanguage);
|
|
|
this.setState({
|
|
|
language: changeLanguage,
|
|
|
locale: local,
|
|
|
- languageButton:languageButton
|
|
|
+ languageButton: languageButton
|
|
|
});
|
|
|
if (!local) {
|
|
|
moment.locale('en');
|
|
|
@@ -124,13 +136,14 @@ class App extends Component {
|
|
|
};
|
|
|
|
|
|
render() {
|
|
|
- const {locale, languageButton, visible} = this.state;
|
|
|
+ const {locale, languageButton, visible, wxVisible} = this.state;
|
|
|
|
|
|
return (
|
|
|
<Router>
|
|
|
<Layout style={{minHeight: '100vh'}}>
|
|
|
<Header className="header" style={{position: 'fixed', zIndex: 1, width: '100%'}}>
|
|
|
- <Link to="/" onClick={() => this.setState({menuLevel1:"graphql-service",sideBar:"ecommerce"})}>
|
|
|
+ <Link to="/"
|
|
|
+ onClick={() => this.setState({menuLevel1: "graphql-service", sideBar: "ecommerce"})}>
|
|
|
<div className="logo-wrapper">
|
|
|
<div className='logo'/>
|
|
|
</div>
|
|
|
@@ -138,13 +151,13 @@ class App extends Component {
|
|
|
<Menu
|
|
|
theme="dark"
|
|
|
mode="horizontal"
|
|
|
- // defaultSelectedKeys={['graphql-service']}
|
|
|
selectedKeys={[this.state.menuLevel1]}
|
|
|
style={{lineHeight: '64px'}}
|
|
|
onClick={(e) => this.switchMenuTab('menuLevel1', e)}
|
|
|
>
|
|
|
<Menu.Item key="graphql-service">
|
|
|
- <Link to="/graphql-service/trial-case/index"><FormattedMessage id="Graphql Service"/></Link>
|
|
|
+ <Link to="/graphql-service/trial-case/index"><FormattedMessage
|
|
|
+ id="Graphql Service"/></Link>
|
|
|
</Menu.Item>
|
|
|
<Menu.Item key="wechat-service">
|
|
|
<Link to="/wechat-service/trial-case/index"><FormattedMessage
|
|
|
@@ -156,7 +169,8 @@ class App extends Component {
|
|
|
</Menu>
|
|
|
|
|
|
<Link to="/login">
|
|
|
- <Button className='login-button' type='primary' onClick={()=>this.switchMenuLevel('menuLevel1','user')} >Login</Button>
|
|
|
+ <Button className='login-button' type='primary'
|
|
|
+ onClick={() => this.switchMenuLevel('menuLevel1', 'user')}>Login</Button>
|
|
|
</Link>
|
|
|
|
|
|
<div className="change-locale">
|
|
|
@@ -192,8 +206,8 @@ class App extends Component {
|
|
|
onCollapse={this.onCollapse}
|
|
|
>
|
|
|
<WxConfigSiderbar inlineCollapsed={this.state.inlineCollapsed}
|
|
|
- sideBar={this.state.sideBar} switchMenu={this.switchMenu}
|
|
|
- showModal={this.showModal}/>
|
|
|
+ sideBar={this.state.sideBar} switchMenu={this.switchMenu}
|
|
|
+ wxShowModal={this.wxShowModal}/>
|
|
|
</Sider>
|
|
|
);
|
|
|
case 'quant-service':
|
|
|
@@ -223,15 +237,17 @@ class App extends Component {
|
|
|
position: 'fixed'
|
|
|
}}
|
|
|
>
|
|
|
- <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>Case Show</span></span>}>
|
|
|
+ <SubMenu key="trial-case" title={<span><Icon type="appstore"
|
|
|
+ theme="twoTone"/><span>Case Show</span></span>}>
|
|
|
<Menu.Item key="quant-service">
|
|
|
<Link to="/quant-service/trial-case/quant case">quant case</Link>
|
|
|
</Menu.Item>
|
|
|
</SubMenu>
|
|
|
|
|
|
- <Menu.Item key="instructions" >
|
|
|
- <a href="https://ioobot-document.netlify.com/" title="instructions" target="instructions">
|
|
|
- <Icon type="file-text" theme="twoTone" />
|
|
|
+ <Menu.Item key="instructions">
|
|
|
+ <a href="https://ioobot-document.netlify.com/" title="instructions"
|
|
|
+ target="instructions">
|
|
|
+ <Icon type="file-text" theme="twoTone"/>
|
|
|
<span>Instructions</span>
|
|
|
</a>
|
|
|
</Menu.Item>
|
|
|
@@ -262,13 +278,13 @@ class App extends Component {
|
|
|
}}
|
|
|
>
|
|
|
<Menu.Item key="account">
|
|
|
- <Icon type="setting" theme="twoTone" />
|
|
|
+ <Icon type="setting" theme="twoTone"/>
|
|
|
<span>Account center</span>
|
|
|
<Link to="/login/account"/>
|
|
|
</Menu.Item>
|
|
|
|
|
|
<Menu.Item key="cloud-settings">
|
|
|
- <Icon type="cloud" theme="twoTone" />
|
|
|
+ <Icon type="cloud" theme="twoTone"/>
|
|
|
<span>Cloud settings</span>
|
|
|
<Link to="/login/cloud"/>
|
|
|
</Menu.Item>
|
|
|
@@ -292,6 +308,7 @@ class App extends Component {
|
|
|
}
|
|
|
})()}
|
|
|
<Create visible={visible} hideModal={this.hideModal} switchSidebar={this.switchSidebar}/>
|
|
|
+ <WxCreate visible={wxVisible} hideModal={this.wxHideModal} switchSidebar={this.switchSidebar}/>
|
|
|
|
|
|
<LocaleProvider locale={locale}>
|
|
|
<Layout style={{marginTop: '64px', zIndex: '0'}}
|
|
|
@@ -300,7 +317,8 @@ class App extends Component {
|
|
|
<Route path="/" exact component={TrialCase}/>
|
|
|
<Route path="/graphql-service/trial-case/:case" component={TrialCase}/>
|
|
|
<Route path="/graphql-service/my-create/:case" component={UserCreate}/>
|
|
|
- <Route path="/wechat-service/:sidebar/:case" component={WechatService}/>
|
|
|
+ <Route path="/wechat-service/trial-case/:case" component={WXTrialCase}/>
|
|
|
+ <Route path="/wechat-service/my-create/:case" component={WXUserCreate}/>
|
|
|
<Route path="/quant-service/:sidebar/:case" component={QuantService}/>
|
|
|
<Route path="/login/:setting" component={Login}/>
|
|
|
<Route path="/login" component={Login}/>
|
|
|
@@ -332,9 +350,9 @@ class GraphqlSidebar extends Component {
|
|
|
// console.log('user schema data',data);
|
|
|
if (loading) return <Spin style={{marginLeft: 3}}/>;
|
|
|
if (error) return 'error!';
|
|
|
- localStorage.setItem('ecommerce', data.caseSchema.find(obj=>obj.schemaName==='ecommerce').schemaData);
|
|
|
- localStorage.setItem('subscribe', data.caseSchema.find(obj=>obj.schemaName==='subscribe').schemaData);
|
|
|
- localStorage.setItem('bills', data.caseSchema.find(obj=>obj.schemaName==='bills').schemaData);
|
|
|
+ localStorage.setItem('ecommerce', data.caseSchema.find(obj => obj.schemaName === 'ecommerce').schemaData);
|
|
|
+ localStorage.setItem('subscribe', data.caseSchema.find(obj => obj.schemaName === 'subscribe').schemaData);
|
|
|
+ localStorage.setItem('bills', data.caseSchema.find(obj => obj.schemaName === 'bills').schemaData);
|
|
|
return (
|
|
|
<Menu
|
|
|
theme="dark"
|
|
|
@@ -360,9 +378,9 @@ class GraphqlSidebar extends Component {
|
|
|
<Menu.Item key={schema.schemaName}>
|
|
|
<Link to={{
|
|
|
pathname: `/graphql-service/trial-case/${schema.schemaName}`,
|
|
|
- state:{
|
|
|
- schemaName:schema.schemaName,
|
|
|
- schemaID:schema.id
|
|
|
+ state: {
|
|
|
+ schemaName: schema.schemaName,
|
|
|
+ schemaID: schema.id
|
|
|
}
|
|
|
}}>{schema.schemaName}</Link>
|
|
|
</Menu.Item>)
|
|
|
@@ -386,9 +404,9 @@ class GraphqlSidebar extends Component {
|
|
|
<Menu.Item key={schema.schemaName}>
|
|
|
<Link to={{
|
|
|
pathname: `/graphql-service/my-create/${schema.schemaName}`,
|
|
|
- state:{
|
|
|
- schemaName:schema.schemaName,
|
|
|
- schemaID:schema.id
|
|
|
+ state: {
|
|
|
+ schemaName: schema.schemaName,
|
|
|
+ schemaID: schema.id
|
|
|
}
|
|
|
}}>{schema.schemaName}</Link>
|
|
|
</Menu.Item>)
|
|
|
@@ -396,8 +414,9 @@ class GraphqlSidebar extends Component {
|
|
|
</SubMenu>
|
|
|
|
|
|
<Menu.Item key="instructions">
|
|
|
- <a href="https://ioobot-document.netlify.com/" title="instructions" target="_blank" rel="noopener noreferrer">
|
|
|
- <Icon type="file-text" theme="twoTone" />
|
|
|
+ <a href="https://ioobot-document.netlify.com/" title="instructions" target="_blank"
|
|
|
+ rel="noopener noreferrer">
|
|
|
+ <Icon type="file-text" theme="twoTone"/>
|
|
|
<span>Instructions</span>
|
|
|
</a>
|
|
|
</Menu.Item>
|
|
|
@@ -452,16 +471,16 @@ class WxConfigSiderbar extends Component {
|
|
|
<Menu.Item key={config.appName}>
|
|
|
<Link to={{
|
|
|
pathname: `/graphql-service/trial-case/${config.appName}`,
|
|
|
- state:{
|
|
|
- configName:config.appName,
|
|
|
- configID:config.id
|
|
|
+ state: {
|
|
|
+ configName: config.appName,
|
|
|
+ configID: config.id
|
|
|
}
|
|
|
}}>{config.appName}</Link>
|
|
|
</Menu.Item>)
|
|
|
}
|
|
|
</SubMenu>
|
|
|
|
|
|
- <Menu.Item key="create-config" onClick={this.props.showModal}>
|
|
|
+ <Menu.Item key="create-config" onClick={this.props.wxShowModal}>
|
|
|
<Icon type="edit" theme="twoTone"/>
|
|
|
<span>Create</span>
|
|
|
<Icon type="plus" style={{
|
|
|
@@ -478,9 +497,9 @@ class WxConfigSiderbar extends Component {
|
|
|
<Menu.Item key={config.appName}>
|
|
|
<Link to={{
|
|
|
pathname: `/wechat-service/my-create/${config.appName}`,
|
|
|
- state:{
|
|
|
- configName:config.appName,
|
|
|
- configID:config.id
|
|
|
+ state: {
|
|
|
+ configName: config.appName,
|
|
|
+ configID: config.id
|
|
|
}
|
|
|
}}>{config.appName}</Link>
|
|
|
</Menu.Item>)
|
|
|
@@ -488,8 +507,9 @@ class WxConfigSiderbar extends Component {
|
|
|
</SubMenu>
|
|
|
|
|
|
<Menu.Item key="instructions">
|
|
|
- <a href="https://ioobot-document.netlify.com/" title="instructions" target="_blank" rel="noopener noreferrer">
|
|
|
- <Icon type="file-text" theme="twoTone" />
|
|
|
+ <a href="https://ioobot-document.netlify.com/" title="instructions" target="_blank"
|
|
|
+ rel="noopener noreferrer">
|
|
|
+ <Icon type="file-text" theme="twoTone"/>
|
|
|
<span>Instructions</span>
|
|
|
</a>
|
|
|
</Menu.Item>
|