|
|
@@ -18,7 +18,7 @@ import '../common/graphql/index.css';
|
|
|
import './index.css'
|
|
|
import Create from "../common/schema/Create";
|
|
|
|
|
|
-import {SHOW_ALL_SCHEMA} from "../gql";
|
|
|
+import {SHOW_ALL_SCHEMA, SHOW_ALL_WXCONFIG} from "../gql";
|
|
|
import axios from 'axios';
|
|
|
import {getCookie} from "../cookie";
|
|
|
|
|
|
@@ -191,36 +191,9 @@ class App extends Component {
|
|
|
collapsed={this.state.collapsed}
|
|
|
onCollapse={this.onCollapse}
|
|
|
>
|
|
|
- <Menu
|
|
|
- theme="dark"
|
|
|
- mode="inline"
|
|
|
- inlineCollapsed={this.state.inlineCollapsed}
|
|
|
- defaultSelectedKeys={['my-wechat']}
|
|
|
- defaultOpenKeys={['my-create']}
|
|
|
- // 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="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.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>
|
|
|
- </Menu>
|
|
|
+ <WxConfigSiderbar inlineCollapsed={this.state.inlineCollapsed}
|
|
|
+ sideBar={this.state.sideBar} switchMenu={this.switchMenu}
|
|
|
+ showModal={this.showModal}/>
|
|
|
</Sider>
|
|
|
);
|
|
|
case 'quant-service':
|
|
|
@@ -431,6 +404,98 @@ class GraphqlSidebar extends Component {
|
|
|
|
|
|
</Menu>
|
|
|
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </Query>
|
|
|
+ )
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class WxConfigSiderbar extends Component {
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ this.state = {
|
|
|
+ userID: getCookie('user_id'),
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ render() {
|
|
|
+ return (
|
|
|
+ <Query query={gql(SHOW_ALL_WXCONFIG)} variables={{user_id: this.state.userID}}>
|
|
|
+ {
|
|
|
+ ({loading, error, data}) => {
|
|
|
+ if (loading) return <Spin style={{marginLeft: 3}}/>;
|
|
|
+ if (error) return 'error!';
|
|
|
+ return (
|
|
|
+ <Menu
|
|
|
+ theme="dark"
|
|
|
+ mode="inline"
|
|
|
+ inlineCollapsed={this.props.inlineCollapsed}
|
|
|
+ defaultSelectedKeys={['my-wechat']}
|
|
|
+ defaultOpenKeys={['trial-case', 'my-create']}
|
|
|
+ // openKeys={['trial-case', 'my-create']}
|
|
|
+ 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>Case Show</span></span>}>
|
|
|
+ {
|
|
|
+ data.caseWxConfig.map((config) =>
|
|
|
+ <Menu.Item key={config.appName}>
|
|
|
+ <Link to={{
|
|
|
+ pathname: `/graphql-service/trial-case/${config.appName}`,
|
|
|
+ state:{
|
|
|
+ configName:config.appName,
|
|
|
+ configID:config.id
|
|
|
+ }
|
|
|
+ }}>{config.appName}</Link>
|
|
|
+ </Menu.Item>)
|
|
|
+ }
|
|
|
+ </SubMenu>
|
|
|
+
|
|
|
+ <Menu.Item key="create-config" onClick={this.props.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>}>
|
|
|
+ {
|
|
|
+ data.userWxConfig.map((config) =>
|
|
|
+ <Menu.Item key={config.appName}>
|
|
|
+ <Link to={{
|
|
|
+ pathname: `/wechat-service/my-create/${config.appName}`,
|
|
|
+ state:{
|
|
|
+ configName:config.appName,
|
|
|
+ configID:config.id
|
|
|
+ }
|
|
|
+ }}>{config.appName}</Link>
|
|
|
+ </Menu.Item>)
|
|
|
+ }
|
|
|
+ </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" />
|
|
|
+ <span>Instructions</span>
|
|
|
+ </a>
|
|
|
+ </Menu.Item>
|
|
|
+
|
|
|
+ </Menu>
|
|
|
+
|
|
|
)
|
|
|
}
|
|
|
}
|