Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/app/graphqlService/component/generateJs/GenerateJs.jsx
#	src/app/graphqlService/component/schema/Create.js
#	src/language/en_US.js
#	src/language/zh_CN.js
Csy817 7 years ago
parent
commit
c388292edd
32 changed files with 820 additions and 606 deletions
  1. 18 236
      src/app/common/deploy/Deploy.jsx
  2. 0 82
      src/app/common/deploy/common/DisplayTable.js
  3. 1 1
      src/app/common/deploy/tencent/APIGroupCard.js
  4. 2 2
      src/app/common/deploy/tencent/DeployCard.js
  5. 137 106
      src/app/common/deploy/tencent/TencentConfig.js
  6. 2 2
      src/app/common/manage/Manage.jsx
  7. 9 2
      src/app/graphqlService/TrialCase.jsx
  8. 5 1
      src/app/graphqlService/UserCreate.jsx
  9. 7 6
      src/app/graphqlService/component/generateJs/GenerateJs.jsx
  10. 1 1
      src/app/graphqlService/component/graphql/Graphql.jsx
  11. 11 0
      src/app/index.css
  12. 4 4
      src/app/wechatService/WxTrialCase.js
  13. 4 4
      src/app/wechatService/WxUserCreate.js
  14. 73 0
      src/case/BillApp/src/App.css
  15. 19 14
      src/case/BillApp/src/App.js
  16. 136 24
      src/case/BillApp/src/api/billsGraphql.txt
  17. 48 2
      src/case/BillApp/src/api/graphql/bills.js
  18. 22 4
      src/case/BillApp/src/api/graphql/class.js
  19. 1 1
      src/case/BillApp/src/api/url_config.js
  20. 0 11
      src/case/BillApp/src/components/App/NavBar.css
  21. 17 2
      src/case/BillApp/src/components/Assets/Assets.jsx
  22. 150 0
      src/case/BillApp/src/components/Bill/Bill.jsx
  23. 1 0
      src/case/BillApp/src/components/Bill/TabBar.jsx
  24. 0 60
      src/case/BillApp/src/components/HomePage/Bill.jsx
  25. 15 32
      src/case/BillApp/src/components/HomePage/HomePage.jsx
  26. 12 2
      src/case/BillApp/src/components/My/My.jsx
  27. 15 0
      src/case/BillApp/src/components/common/Alert.jsx
  28. 1 1
      src/case/BillApp/src/components/common/Button.jsx
  29. 13 6
      src/case/BillApp/src/components/common/NavBar.jsx
  30. 6 0
      src/case/BillApp/src/components/common/Status.jsx
  31. 11 0
      src/case/BillApp/src/components/common/Toast.jsx
  32. 79 0
      src/gql.js

+ 18 - 236
src/app/common/deploy/Deploy.jsx

@@ -1,16 +1,12 @@
 import React, {Component} from 'react';
 import {FormattedMessage} from 'react-intl';
-import {Card, Spin} from 'antd';
+import {Card} from 'antd';
 
 import TencentConfig from './tencent/TencentConfig';
 import AliConfig from './ali/AliConfig';
 import AmazonConfig from './amazon/AmazonConfig';
 
 import './index.css';
-import {SHOW_FC_SCHEMA, SHOW_FC_CONFIG, SEARCH_SCHEMA, SHOW_CLOUD, SHOW_WXCONTENT} from "../../../gql";
-import {request} from 'graphql-request'
-import {graphqlUrl} from "../../../config";
-import DisplayTable from "./common/DisplayTable";
 
 const tabListNoTitle = [{
     key: 'tencent',
@@ -33,253 +29,39 @@ class Deploy extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            show: true,
             cloud: 'tencent',
-            tencentCloudID: 'tencent_CloudID',
-            aliyunCloudID: 'aliyun_CloudID',
-            amazonCloudID: '',
-            defalutName: '',
-            tencentFC: '',
-            aliyunFC: '',
-            amazonFC: '',
-            schemaID: props.schemaID,
-            configID: props.configID,
-            kind: ''
+            projectIDOK: 'project_by_mxy_already_deploy',
+            projectIDNULL: 'project_by_mxy_not_deploy'
         };
-        this.fetch();
     }
 
     componentWillReceiveProps(next) {
         this.setState({
-            schemaID: next.schemaID,
-            configID: next.configID
-        }, this.fetch)
+            projectID: next.projectID
+        })
     }
 
-
-
-    fetch = () => {
-        // if (this.state.schemaID !== '' && this.state.schemaID !== undefined) {
-        //     request(graphqlUrl, SHOW_FC_SCHEMA, {schema_id: this.state.schemaID}).then(
-        //         // 根据 schemaID 查询 fc 是否成功
-        //         data => {
-        //             request(graphqlUrl, SEARCH_SCHEMA, {id: this.state.schemaID}).then(
-        //                 // 根据 schemaID 查询 schemaName
-        //                 _data => {
-        //                     if (data.fc_by_props.length === 0) {
-        //                         // 如果没有 fc,根据 userID 查 cloudId
-        //                         request(graphqlUrl, SHOW_CLOUD, {user_id: this.props.userID}).then(
-        //                             __data => {
-        //                                 // 如果 user 未设置 cloudID
-        //                                 if(__data.cloud_by_props.length === 0) {
-        //                                     this.setState({
-        //                                         tencentFC: false,
-        //                                         aliyunFC: false,
-        //                                         amazonFC: false,
-        //                                         defalutName: _data.schema_by_id.schemaName,
-        //                                         show: true,
-        //                                         kind: 'graphql'
-        //                                     });
-        //                                 } else {
-        //                                     __data.cloud_by_props.forEach(cloud => {
-        //                                         switch (cloud.cloudName) {
-        //                                             case 'tencent':
-        //                                                 this.setState({
-        //                                                     tencentFC: false,
-        //                                                     tencentCloudID: cloud.id,
-        //                                                     defalutName: _data.schema_by_id.schemaName,
-        //                                                     show: true,
-        //                                                     kind: 'graphql'
-        //                                                 });
-        //                                                 break;
-        //                                             case 'aliyun':
-        //                                                 this.setState({
-        //                                                     aliyunFC: false,
-        //                                                     aliyunCloudID: cloud.id,
-        //                                                     defalutName: _data.schema_by_id.schemaName,
-        //                                                     show: true,
-        //                                                     kind: 'graphql'
-        //                                                 });
-        //                                                 break;
-        //                                             case 'amazon':
-        //                                                 this.setState({
-        //                                                     amazonFC: false,
-        //                                                     amazonCloudID: cloud.id,
-        //                                                     defalutName: _data.schema_by_id.schemaName,
-        //                                                     show: true,
-        //                                                     kind: 'graphql'
-        //                                                 });
-        //                                                 break;
-        //                                             default:
-        //                                                 break;
-        //                                         }
-        //                                     })
-        //                                 }
-        //                             }
-        //                         );
-        //                     } else {
-        //                         // 如果有 fc, 则获取 cloudID
-        //                         data.fc_by_props.forEach(cloud => {
-        //                             switch (cloud.cloud_id.cloudName) {
-        //                                 case 'tencent':
-        //                                     this.setState({
-        //                                         tencentFC: true,
-        //                                         tencentCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'graphql'
-        //                                     });
-        //                                     break;
-        //                                 case 'aliyun':
-        //                                     this.setState({
-        //                                         aliyunFC: true,
-        //                                         aliyunCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'graphql'
-        //                                     });
-        //                                     break;
-        //                                 case 'amazon':
-        //                                     this.setState({
-        //                                         amazonFC: true,
-        //                                         amazonCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'graphql'
-        //                                     });
-        //                                     break;
-        //                                 default:
-        //                                     break;
-        //                             }
-        //                         })
-        //                     }
-        //                 }
-        //             );
-        //         }
-        //     );
-        // } else {
-        //     request(graphqlUrl, SHOW_FC_CONFIG, {wxConfig_id: this.state.configID}).then(
-        //         // 根据 configID 查询 fc 是否成功
-        //         data => {
-        //             request(graphqlUrl, SHOW_WXCONTENT, {id: this.state.configID}).then(
-        //                 // 根据 configID 查询 appName
-        //                 _data => {
-        //                     if (data.fc_by_props.length === 0) {
-        //                         // 如果没有 fc,根据 userID 查 cloudId
-        //                         request(graphqlUrl, SHOW_CLOUD, {user_id: this.props.userID}).then(
-        //                             __data => {
-        //                                 // 如果 user 未设置 cloudID
-        //                                 if(__data.cloud_by_props.length === 0) {
-        //                                     this.setState({
-        //                                         tencentFC: false,
-        //                                         aliyunFC: false,
-        //                                         amazonFC: false,
-        //                                         defalutName: _data.wxConfig_by_id.appName,
-        //                                         show: true,
-        //                                         kind: 'wx'
-        //                                     });
-        //                                 } else {
-        //                                     __data.cloud_by_props.forEach(cloud => {
-        //                                         switch (cloud.cloudName) {
-        //                                             case 'tencent':
-        //                                                 this.setState({
-        //                                                     tencentFC: false,
-        //                                                     tencentCloudID: cloud.id,
-        //                                                     defalutName: _data.wxConfig_by_id.appName,
-        //                                                     show: true,
-        //                                                     kind: 'wx'
-        //                                                 });
-        //                                                 break;
-        //                                             case 'aliyun':
-        //                                                 this.setState({
-        //                                                     aliyunFC: false,
-        //                                                     aliyunCloudID: cloud.id,
-        //                                                     defalutName: _data.wxConfig_by_id.appName,
-        //                                                     show: true,
-        //                                                     kind: 'wx'
-        //                                                 });
-        //                                                 break;
-        //                                             case 'amazon':
-        //                                                 this.setState({
-        //                                                     amazonFC: false,
-        //                                                     amazonCloudID: cloud.id,
-        //                                                     defalutName: _data.wxConfig_by_id.appName,
-        //                                                     show: true,
-        //                                                     kind: 'wx'
-        //                                                 });
-        //                                                 break;
-        //                                             default:
-        //                                                 break;
-        //                                         }
-        //                                     })
-        //                                 }
-        //                             }
-        //                         );
-        //                     } else {
-        //                         // 如果有 fc, 则获取 cloudID
-        //                         data.fc_by_props.forEach(cloud => {
-        //                             switch (cloud.cloud_id.cloudName) {
-        //                                 case 'tencent':
-        //                                     this.setState({
-        //                                         tencentFC: true,
-        //                                         tencentCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'wx'
-        //                                     });
-        //                                     break;
-        //                                 case 'aliyun':
-        //                                     this.setState({
-        //                                         aliyunFC: true,
-        //                                         aliyunCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'wx'
-        //                                     });
-        //                                     break;
-        //                                 case 'amazon':
-        //                                     this.setState({
-        //                                         amazonFC: true,
-        //                                         amazonCloudID: cloud.cloud_id.id,
-        //                                         show: true,
-        //                                         kind: 'wx'
-        //                                     });
-        //                                     break;
-        //                                 default:
-        //                                     break;
-        //                             }
-        //                         })
-        //                     }
-        //                 }
-        //             );
-        //         }
-        //     );
-        // }
-    };
-
     render() {
         const contentListNoTitle = {
-            tencent: <DisplayTable configID={this.state.configID} schemaID={this.state.schemaID} cloudID={this.state.tencentCloudID} fc={this.state.tencentFC} defalutName={this.state.defalutName} userID={this.props.userID} kind={this.state.kind} trialcase={this.props.trialcase}/>,
+            tencent: <TencentConfig userID={this.props.userID} projectID={this.state.projectIDNULL} trialcase={this.props.trialcase}/>,
             aliyun: <AliConfig/>,
             amazon: <AmazonConfig/>,
         };
 
         return (
             <div>
-                <div>
-                    <Card
-                        style={{width: '100%'}}
-                        tabList={tabListNoTitle}
-                        activeTabKey={this.state.cloud}
-                        onTabChange={(cloud) => {
-                            this.setState({
-                                cloud
-                            })
-                        }}
-                    >
-                        {
-                            this.state.show ?
-                                contentListNoTitle[this.state.cloud]
-                                :
-                                <Spin/>
-                        }
-                    </Card>
-                </div>
+                <Card
+                    style={{width: '100%'}}
+                    tabList={tabListNoTitle}
+                    activeTabKey={this.state.cloud}
+                    onTabChange={(cloud) => {
+                        this.setState({
+                            cloud
+                        })
+                    }}
+                >
+                    {contentListNoTitle[this.state.cloud]}
+                </Card>
             </div>
         )
     }

+ 0 - 82
src/app/common/deploy/common/DisplayTable.js

@@ -1,82 +0,0 @@
-import React, {Component} from 'react';
-import {SHOW_APIGWGROUP} from "../../../../gql";
-import {Spin, Row, Col} from 'antd';
-import {Mutation, Query} from "react-apollo";
-import gql from "graphql-tag";
-import TencentConfig from "../tencent/TencentConfig";
-
-class DisplayTable extends Component {
-    constructor(props) {
-        super(props);
-        this.state = {
-            groupID: '',
-            groupName: ''
-        };
-    }
-
-
-    switchGroup = (groupID, groupName) => {
-        this.setState({
-            groupID,
-            groupName
-        })
-    };
-
-    render() {
-        let {schemaID} = this.props;
-        return (
-            <Query query={gql(SHOW_APIGWGROUP)} variables={{schema_id: schemaID}}>
-
-                {
-                    ({loading, error, data}) => {
-                        if (loading) {
-                            return <Spin style={{marginLeft: 3}}/>
-                        }
-                        if (error) {
-                            return 'error!';
-                        }
-                        return (
-                            <div>
-                                {
-                                    this.state.groupID === ''?
-                                        <div>
-                                            <div className={'schema-table-list-title'}>
-                                                <Row>
-                                                    <Col span={10}><span className={'schema-table-title'}>Name</span></Col>
-                                                    <Col span={10}><span className={'schema-table-title'}>District</span></Col>
-                                                    <Col span={2} offset={2}>
-                                                    </Col>
-                                                </Row>
-                                            </div>
-                                            {
-                                                data.apiGWGroup_by_props.map(group => (
-                                                    <div key={group.id} className={'schema-table-list-content'}>
-                                                        <Row>
-                                                            <Col
-                                                                span={10}
-                                                                onClick={() => this.switchGroup(group.id, group.groupName)}
-                                                            >
-                                                                <span className={'schema-table-content name'}>{group.groupName}</span>
-                                                            </Col>
-                                                            <Col span={10}>
-                                                                <span className={'schema-table-content'}>{group.region}</span>
-                                                            </Col>
-                                                        </Row>
-                                                    </div>
-                                                ))
-                                            }
-                                        </div>
-                                        :
-                                        <TencentConfig goBack={()=>{this.setState({groupID: ''})}} groupName={this.state.groupName} configID={this.props.configID} schemaID={this.props.schemaID} cloudID={this.props.tencentCloudID} fc={this.props.tencentFC} defalutName={this.props.defalutName} userID={this.props.userID} kind={this.props.kind} trialcase={this.props.trialcase}/>
-                                }
-
-                            </div>
-                        )
-                    }
-                }
-            </Query>
-        )
-    }
-}
-
-export default DisplayTable;

+ 1 - 1
src/app/common/deploy/tencent/APIGroupCard.js

@@ -65,7 +65,7 @@ class APIGroupCard extends Component {
                 frontType: 'http&https',
                 userDomain: '',
                 userStatus: 'open',
-                groupRegion: props.region
+                groupRegion: props.region === '' ? 'ap-beijing' : props.region,
             };
     }
 

+ 2 - 2
src/app/common/deploy/tencent/DeployCard.js

@@ -69,10 +69,10 @@ class DeployCard extends Component {
                 description: '',
                 showOK: false,
                 functionName: props.defalutName,
-                region: props.region,
+                region: props.region === '' ? 'ap-beijing' : props.region,
                 cosBucketName: 'graphqlfc',
                 cosObjectName: props.defalutName,
-                cosBucketRegion: props.region,
+                cosBucketRegion: props.region === '' ? 'ap-beijing' : props.region,
                 serviceName: '',
                 vpcId: '',
                 subnetId: '',

+ 137 - 106
src/app/common/deploy/tencent/TencentConfig.js

@@ -1,100 +1,42 @@
 import React, {Component} from 'react';
-import {Row, Col, Card, Button, Icon} from 'antd';
+import {Row, Col, Card, Button, Spin} from 'antd';
 import axios from 'axios';
 import APIGroupCard from './APIGroupCard';
 import APIPathCard from './APIPathCard';
 import DeployCard from './DeployCard';
 import NotificationCard from './NotificationCard';
 
-import {SHOW_DEPLOY, SHOW_APIGWGROUP, SHOW_APIGWPATH, SEARCH_SCHEMA} from "../../../../gql";
-import {request} from 'graphql-request'
-import {graphqlUrl,deployUrl} from "../../../../config";
+import {SHOW_APIGWPATH, GET_PROJECT} from "../../../../gql";
+import {deployUrl} from "../../../../config";
 import {FormattedMessage} from 'react-intl';
+import gql from "graphql-tag";
+import {Query} from "react-apollo";
 
 class TencentConfig extends Component {
     constructor(props) {
         super(props);
         this.state = {
             region: '',
-            deploys: [],
-            currentDeploy: '',
-            groups: [],
-            currentGroup: '',
-            paths: [],
-            currentPath: '',
+            couldDeploy: false,
             deployIdPassToPath: '',
-            groupIdPassToPath: '',
-            cloudID: props.cloudID,
-            fc: props.fc,
-            couldDeploy: false
+            groupIdPassToPath: ''
         };
     }
 
-    componentDidMount() {
-        this.fetch();
-    }
-
     componentWillReceiveProps(next) {
         this.setState({
-            fc: next.fc,
-            cloudID: next.cloudID,
             couldDeploy: false,
-            region: ''
-        }, this.fetch);
+            region: '',
+            deployIdPassToPath: '',
+            groupIdPassToPath: ''
+        });
     }
 
-    fetch = () => {
-        // todo: 没做每个 deploy 和 apigroup 和 apipath 的切换
-        // todo: 换成 apollo 会更好
-        if (this.state.fc === true) {
-            request(graphqlUrl, SHOW_DEPLOY, {cloud_id: this.state.cloudID}).then(
-                data => {
-                    this.setState({
-                        deploys: data.deploy_by_props,
-                        currentDeploy: data.deploy_by_props[0]
-                    })
-                }
-            );
-            request(graphqlUrl, SHOW_APIGWGROUP, {cloud_id: this.state.cloudID}).then(
-                data => {
-                    this.setState({
-                        groups: data.apiGWGroup_by_props,
-                        currentGroup: data.apiGWGroup_by_props[0]
-                    }, () => {
-                        request(graphqlUrl, SHOW_APIGWPATH, {apiGWGroup_id: this.state.currentGroup.id}).then(
-                            data => {
-                                this.setState({
-                                    paths: data.apiGWPath_by_props,
-                                    currentPath: data.apiGWPath_by_props[0]
-                                });
-                            }
-                        );
-                    });
-                }
-            );
-        } else {
-            this.setState({
-                currentDeploy: '',
-                currentGroup: '',
-                currentPath: '',
-            })
-        }
-
-        if(this.props.schemaID === '' || this.props.schemaID === undefined) {
-            this.setState({
-                couldDeploy: true
-            });
-        } else {
-            request(graphqlUrl, SEARCH_SCHEMA, {id: this.props.schemaID}).then(
-                data => {
-                    if(data.schema_by_id.schemaState === 'ok')
-                        this.setState({
-                            couldDeploy: true
-                        });
-                }
-            );
-        }
 
+    switchRegion = (e) => {
+        this.setState({
+            region: e.target.value
+        });
     };
 
     pass = (value, kind) => {
@@ -108,12 +50,6 @@ class TencentConfig extends Component {
             })
     };
 
-    switchRegion = (e) => {
-        this.setState({
-            region: e.target.value
-        });
-    };
-
     deployFC = () => {
         let _this = this;
 
@@ -139,34 +75,129 @@ class TencentConfig extends Component {
     };
 
     render() {
-        let {groupName, trialcase} = this.props;
+        let {userID, projectID, trialcase} = this.props;
         return (
-            <div>
-                <div className="column-menu" onClick={this.props.goBack}>
-                    <Icon type="left" style={{color: '#3187FA'}}/> {groupName}
-                </div>
-                <div style={{padding: '30px'}}>
-                    <Row gutter={16}>
-                        <Col span={14}>
-                            <FormattedMessage id="API Group">{msg => <Card title={msg} style={{marginBottom: 10}}><APIGroupCard group={this.state.currentGroup} switchRegion={this.switchRegion} region={this.state.region} userID={this.props.userID} cloudID={this.props.cloudID} pass={this.pass} kind={this.props.kind} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
-                            <FormattedMessage id="fc Deploy">{msg => <Card title={msg} style={{marginBottom: 10}}><DeployCard deploy={this.state.currentDeploy} switchRegion={this.switchRegion} region={this.state.region} defalutName={this.props.defalutName} userID={this.props.userID} cloudID={this.props.cloudID} pass={this.pass} kind={this.props.kind} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
-                            <FormattedMessage id="API Path">{msg => <Card title={msg} style={{marginBottom: 10}}><APIPathCard path={this.state.currentPath} defalutName={this.props.defalutName} userID={this.props.userID} deployID={this.state.currentDeploy? this.state.currentDeploy.id : this.state.deployIdPassToPath} groupID={this.state.currentGroup? this.state.currentGroup.id : this.state.groupIdPassToPath} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
-                            <FormattedMessage id="Notification">{msg => <Card title={msg}><NotificationCard userID={this.props.userID} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
-                        </Col>
-                        <Col offset={2} span={6}>
-                            <Button type='primary' disabled={this.state.couldDeploy? '': 'disabled'} onClick={()=>this.deployFC()}><FormattedMessage id="deploy"/>!</Button>
-                            {
-                                this.state.couldDeploy?
-                                    ''
-                                    :
-                                    <div>
-                                        <span>if button is disabled, check your schema</span>
-                                    </div>
-                            }
-                        </Col>
-                    </Row>
-                </div>
-            </div>
+            <Query query={gql(GET_PROJECT)} variables={{id: projectID}}>
+                {
+                    ({loading, error, data}) => {
+                        if (loading) {
+                            return <Spin style={{marginLeft: 3}}/>
+                        }
+                        if (error) {
+                            return 'error!';
+                        }
+
+                        let group = '',
+                            deploy = '',
+                            path = '',
+                            cloudID= 'tencent_CloudID';
+
+                        if(data.project_by_id.cloud_id !== null && data.project_by_id.cloud_id.cloudName === 'tencent') {
+                            group = data.project_by_id.apiGWGroup_id;
+                            deploy = data.project_by_id.deploy_id;
+                            cloudID = data.project_by_id.cloud_id.id;
+                        }
+                        let defaultName = data.project_by_id.projectName;
+                        return (
+                            <div>
+                                <div style={{padding: '30px'}}>
+                                    <Row gutter={16}>
+                                        <Col span={14}>
+                                            <FormattedMessage id="fc Deploy">
+                                                {
+                                                    msg =>
+                                                        <Card title={msg} style={{marginBottom: 10}}>
+                                                            <DeployCard
+                                                                deploy={deploy}
+                                                                switchRegion={this.switchRegion}
+                                                                region={this.state.region}
+                                                                defalutName={defaultName}
+                                                                userID={this.props.userID}
+                                                                cloudID={cloudID}
+                                                                trialcase={this.props.trialcase}
+                                                                pass={this.pass}
+                                                            />
+                                                        </Card>
+                                                }
+                                            </FormattedMessage>
+                                            <FormattedMessage id="API Group">
+                                                {
+                                                    msg =>
+                                                        <Card title={msg} style={{marginBottom: 10}}>
+                                                            <APIGroupCard
+                                                                group={group}
+                                                                userID={this.props.userID}
+                                                                switchRegion={this.switchRegion}
+                                                                region={this.state.region}
+                                                                cloudID={cloudID}
+                                                                trialcase={this.props.trialcase}
+                                                                pass={this.pass}
+                                                            />
+                                                        </Card>
+                                                }
+                                            </FormattedMessage>
+                                            <Query query={gql(SHOW_APIGWPATH)} variables={{apiGWGroup_id: data.project_by_id.apiGWGroup_id? data.project_by_id.apiGWGroup_id.id : ''}}>
+                                                {
+                                                    ({loading, error, data}) => {
+                                                        if (loading) {
+                                                            return <Spin style={{marginLeft: 3}}/>
+                                                        }
+                                                        if (error) {
+                                                            return 'error!';
+                                                        }
+                                                        if(data.apiGWPath_by_props.length>0)
+                                                            path = data.apiGWPath_by_props[0];
+                                                        return (
+                                                            <FormattedMessage id="API Path">
+                                                                {
+                                                                    msg =>
+                                                                        <Card title={msg} style={{marginBottom: 10}}>
+                                                                            <APIPathCard
+                                                                                path={path}
+                                                                                defalutName={defaultName}
+                                                                                userID={this.props.userID}
+                                                                                trialcase={this.props.trialcase}
+                                                                                deployID={deploy? deploy.id : this.state.deployIdPassToPath}
+                                                                                groupID={group? group.id : this.state.groupIdPassToPath}
+                                                                            />
+                                                                        </Card>
+                                                                }
+                                                                </FormattedMessage>
+                                                        )
+                                                    }
+                                                }
+                                            </Query>
+                                            <FormattedMessage id="Notification">
+                                                {
+                                                    msg =>
+                                                        <Card title={msg}>
+                                                            <NotificationCard
+                                                                userID={this.props.userID}
+                                                                trialcase={this.props.trialcase}
+                                                            />
+                                                        </Card>
+                                                }
+                                            </FormattedMessage>
+                                        </Col>
+                                        <Col offset={2} span={6}>
+                                            <Button type='primary' disabled={this.state.couldDeploy? '': 'disabled'} onClick={()=>this.deployFC()}><FormattedMessage id="deploy"/>!</Button>
+                                            {
+                                                this.state.couldDeploy?
+                                                    ''
+                                                    :
+                                                    <div>
+                                                        <span>if button is disabled, check your schema</span>
+                                                    </div>
+                                            }
+                                        </Col>
+                                    </Row>
+                                </div>
+                            </div>
+                        )
+                    }
+                }
+            </Query>
+
         )
     }
 }

+ 2 - 2
src/app/wechatService/wxResult/WxResult.jsx → src/app/common/manage/Manage.jsx

@@ -1,7 +1,7 @@
 import React, {Component} from 'react';
 import {Switch, Input, Icon} from 'antd';
 
-class WxResult extends Component {
+class Manage extends Component {
     constructor(props) {
         super(props);
         this.state = {
@@ -34,4 +34,4 @@ class WxResult extends Component {
     }
 }
 
-export default WxResult;
+export default Manage;

+ 9 - 2
src/app/graphqlService/TrialCase.jsx

@@ -4,12 +4,14 @@ import {FormattedMessage} from 'react-intl';
 
 import GenerateJs from "./component/generateJs/GenerateJs";
 import Deploy from '../common/deploy/Deploy';
+import Manage from '../common/manage/Manage';
 import Schema from './component/schema/Schema';
 import Graphql from "./component/graphql/Graphql";
 import CaseMetabase from "./component/caseMetabase/CaseMetabase";
 import Application from "./component/application/Application";
 import axios from 'axios';
 import {getIdUrl} from "../../config";
+import classnames from 'classnames';
 
 axios.defaults.withCredentials = true;
 
@@ -22,6 +24,7 @@ class TrialCase extends Component {
             menuLevel2: "schema",
             // default user
             userID: "ioobot",
+            showPadding: true
         }
     }
 
@@ -49,6 +52,7 @@ class TrialCase extends Component {
     render() {
         let schemaID = this.props.history.location.state ? this.props.history.location.state.schemaID : "ecommerce_schemaID";
         let schemaName = this.props.history.location.state ? this.props.history.location.state.schemaName : "ecommerce";
+        let _this = this;
         return (
             <div>
                 <Menu
@@ -60,6 +64,7 @@ class TrialCase extends Component {
                 >
                     <Menu.Item key="schema"><FormattedMessage id="schema"/></Menu.Item>
                     <Menu.Item key="deploy"><FormattedMessage id="deploy"/></Menu.Item>
+                    <Menu.Item key="manage"><FormattedMessage id="manage"/></Menu.Item>
                     <Menu.Item key="graphiql"><FormattedMessage id="graphql IDE"/></Menu.Item>
                     <Menu.Item key="template"><FormattedMessage id="template"/></Menu.Item>
                     <Menu.Item key="preview"><FormattedMessage id="preview"/></Menu.Item>
@@ -68,14 +73,16 @@ class TrialCase extends Component {
 
 
                 <Layout style={{padding: '24px', zIndex: '0'}}>
-                    <Content style={{padding: '24px', minHeight: 280, background: '#fff', marginTop: '48px'}}>
+                    <Content className={classnames({'layout-content': this.state.showPadding})}>
                         {
                             (() => {
                                 switch (this.state.menuLevel2) {
                                     case 'schema':
                                         return <Schema trialcase={true} userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
                                     case 'deploy':
-                                        return <Deploy trialcase={true} userID={this.state.userID} schemaID={schemaID}/>;
+                                        return <Deploy trialcase={true} userID={this.state.userID} projectID={'need fill, test use state'}/>;
+                                    case 'manage':
+                                        return <Manage/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'template':

+ 5 - 1
src/app/graphqlService/UserCreate.jsx

@@ -4,6 +4,7 @@ import {FormattedMessage} from 'react-intl';
 
 import GenerateJs from "./component/generateJs/GenerateJs";
 import Deploy from '../common/deploy/Deploy';
+import Manage from '../common/manage/Manage';
 import Schema from './component/schema/Schema';
 import Graphql from "./component/graphql/Graphql";
 import CaseMetabase from "./component/caseMetabase/CaseMetabase";
@@ -59,6 +60,7 @@ class UserCreate extends Component {
                 >
                     <Menu.Item key="schema"><FormattedMessage id="schema"/></Menu.Item>
                     <Menu.Item key="deploy"><FormattedMessage id="deploy"/></Menu.Item>
+                    <Menu.Item key="manage"><FormattedMessage id="manage"/></Menu.Item>
                     <Menu.Item key="graphiql"><FormattedMessage id="graphql IDE"/></Menu.Item>
                     <Menu.Item key="template"><FormattedMessage id="template"/></Menu.Item>
                     <Menu.Item key="metabase"><FormattedMessage id="metabase"/></Menu.Item>
@@ -73,7 +75,9 @@ class UserCreate extends Component {
                                     case 'schema':
                                         return <Schema trialcase={false} userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
                                     case 'deploy':
-                                        return <Deploy trialcase={false} userID={this.state.userID} schemaID={schemaID}/>;
+                                        return <Deploy trialcase={false} userID={this.state.userID} projectID={'need fill, test use state'}/>;
+                                    case 'manage':
+                                        return <Manage/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'template':

+ 7 - 6
src/app/graphqlService/component/generateJs/GenerateJs.jsx

@@ -1,7 +1,7 @@
 import React, {Component} from 'react';
 import {FormattedMessage} from 'react-intl';
 import axios from 'axios';
-import {BackTop, Tabs, Button, Spin} from 'antd';
+import {BackTop, Tabs, Button, Spin, Alert} from 'antd';
 import saveAs from 'file-saver';
 import beautify from 'js-beautify';
 import {genJsUrl} from '../../../../config';
@@ -25,8 +25,7 @@ class GenerateJs extends Component {
     componentDidMount() {
         this._isMounted = true;
         let _this = this;
-        // let {schemaID} = this.state;
-        let schemaID = "schema_1544405636137_14283164";
+        let {schemaID} = this.state;
         axios.get(`${genJsUrl}?schema=${schemaID}`)
             .then((res) => {
                 if(this._isMounted){
@@ -59,9 +58,9 @@ class GenerateJs extends Component {
     componentDidUpdate() {
         this._isMounted = true;
         let _this = this;
-        // let {schemaID} = this.state;
-        let schemaID = "schema_1544405636137_14283164";
-        axios.get(`${genJsUrl}?schema=${schemaID}`)
+        let {schemaID} = this.state;
+        axios.get(`${genJsUrl}?schema=${'schema_1544405636137_14283164'}`)
+        // axios.get(`${genJsUrl}?schema=${schemaID}`)
             .then((res) => {
                 if(this._isMounted){
                     if (res.data !== '') {
@@ -108,6 +107,8 @@ class GenerateJs extends Component {
         // console.log('mutationList',mutationList);
         return (
             <div>
+                <Alert message="online 数据库,非开发环境请移除"
+                       type="warning" banner closable style={{marginBottom: 10}}/>
                 <Tabs
                     defaultActiveKey="query"
                     tabPosition="left"

+ 1 - 1
src/app/graphqlService/component/graphql/Graphql.jsx

@@ -32,7 +32,7 @@ class Graphql extends Component {
   render() {
     return (
       <div>
-        <Alert message="下面的 graphql api 对应的是是 online 数据库"
+        <Alert message="online 数据库,非开发环境请移除"
                type="warning" banner closable/>
         <Input style={{marginTop: 10}} addonBefore="POST" defaultValue={this.state.api}
                onChange={(e) => {

+ 11 - 0
src/app/index.css

@@ -23,4 +23,15 @@
     top: 15px;
     right: 100px;
     float: right;
+}
+
+.layout-content {
+    padding: 24px;
+    min-height: 280px;
+    background: #fff;
+    margin-top: 48px;
+}
+
+.layout-content-deploy {
+    padding: 0;
 }

+ 4 - 4
src/app/wechatService/WxTrialCase.js

@@ -4,7 +4,7 @@ import {FormattedMessage} from 'react-intl';
 
 import WxConfig from "./wxConfig/WxConfig";
 import WxDeploy from "../common/deploy/Deploy";
-import WxResult from './wxResult/WxResult';
+import Manage from '../common/manage/Manage';
 
 const {Content} = Layout;
 
@@ -44,7 +44,7 @@ class WxTrialCase extends Component {
                 >
                     <Menu.Item key="wechat-config"><FormattedMessage id="config"/></Menu.Item>
                     <Menu.Item key="wechat-deploy"><FormattedMessage id="deploy"/></Menu.Item>
-                    <Menu.Item key="wechat-result"><FormattedMessage id="manage"/></Menu.Item>
+                    <Menu.Item key="wechat-manage"><FormattedMessage id="manage"/></Menu.Item>
                 </Menu>
 
                 <Layout style={{padding: '24px', zIndex: '0'}}>
@@ -55,8 +55,8 @@ class WxTrialCase extends Component {
                                     return <WxConfig defaultAppName={'ecommerce'} defaultConfigID={'ecommerce_wxConfigID'} trialcase={true} history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
                                     return <WxDeploy trialcase={true} userID={this.state.userID} configID={configID}/>;
-                                case 'wechat-result':
-                                    return <WxResult/>;
+                                case 'wechat-manage':
+                                    return <Manage/>;
                                 default:
                                     return <WxConfig/>
                             }

+ 4 - 4
src/app/wechatService/WxUserCreate.js

@@ -6,7 +6,7 @@ import {getIdUrl} from '../../config'
 
 import WxConfig from "./wxConfig/WxConfig";
 import WxDeploy from "../common/deploy/Deploy";
-import WxResult from './wxResult/WxResult';
+import Manage from '../common/manage/Manage';
 import axios from 'axios';
 import {FormattedMessage} from 'react-intl';
 axios.defaults.withCredentials = true;
@@ -65,7 +65,7 @@ class WxUserCreate extends Component {
                 >
                     <Menu.Item key="wechat-config"><FormattedMessage id="config"/></Menu.Item>
                     <Menu.Item key="wechat-deploy"><FormattedMessage id="deploy"/></Menu.Item>
-                    <Menu.Item key="wechat-result"><FormattedMessage id="result"/></Menu.Item>
+                    <Menu.Item key="wechat-manage"><FormattedMessage id="manage"/></Menu.Item>
                 </Menu>
 
                 <Layout style={{padding: '24px', zIndex: '0'}}>
@@ -76,8 +76,8 @@ class WxUserCreate extends Component {
                                     return <WxConfig history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
                                     return <WxDeploy trialcase={false} userID={this.state.userID} configID={configID}/>;
-                                case 'wechat-result':
-                                    return <WxResult/>;
+                                case 'wechat-manage':
+                                    return <Manage/>;
                                 default:
                                     return <WxConfig/>
                             }

+ 73 - 0
src/case/BillApp/src/App.css

@@ -2,11 +2,14 @@
     position: relative;
     z-index: 2;
     height: 100%;
+    margin-top: 0;
+    padding-top: 45px;
 }
 .scrollPage{
     height: 440px;
     overflow-y: hidden;
     overflow:scroll;
+    margin-top: 1px;
 }
 
 .billApp div.am-tabs-default-bar-tab{
@@ -14,3 +17,73 @@
 }
 
 
+.billApp  .navBars{
+    position: absolute;
+    width: 100%;
+    top: 0;
+    left: 0;
+    z-index:100;
+}
+
+.billApp  div.am-navbar{
+    background-color: black;
+}
+
+.billWrap form{
+    margin-top: 20px;
+    padding: 0;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+}
+
+.billWrap .row{
+    width: 283px;
+    padding: 19px;
+    font-size: 10px;
+    border-bottom: 1px solid #ddd;
+} 
+
+.billWrap .input{
+    padding-left: 53px;
+    border: none;
+}
+
+.billWrap .submit{
+    color: #ffffff;
+    background: green;
+    margin-top: 30px;
+    border: none;
+    border-radius: 3px;
+    padding: 11px 93px;
+}
+
+.billWrap .assetsWrap{
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    
+}
+
+
+
+.assetsWrap .collect{
+    text-align: center;
+    margin-top: 150px;
+}
+
+.assetsWrap .buttonWrap{
+    margin-top: 30px;
+}
+
+.assetsWrap .tips{
+    margin-top: 5px;
+    color: #ddd;
+    font-size: 8px;
+    text-align: center;
+}
+
+
+
+

+ 19 - 14
src/case/BillApp/src/App.js

@@ -4,40 +4,35 @@ import {PageContext} from './components/context'
 import config from './api/url_config'
 
 
-
-import NavBars from './components/App/NavBar'
 import TabBarBottom from './components/App/TabBarBottom'
 import HomePage from './components/HomePage/HomePage'
 import Assets from './components/Assets/Assets'
 import My from './components/My/My'
+import Bill from './components/Bill/Bill'
 
 
 import './App.css';
 
-window.sessionStorage.setItem('opeind',config.APPID)
+window.sessionStorage.setItem('openid',config.APPID)
 
 class BillApp extends Component{
   constructor(){
     super()
     //初始化状态
     this.state={
-      page:"home",
-      navBarText:'微记账本'
+      page:"home"
     }
 
     this.changePage=this.changePage.bind(this)
-    this.setNavBarText=this.setNavBarText.bind(this)
+
   }
 
   //更改页面
-  changePage(page){
+  changePage(page=''){
     console.log(page)
     this.setState({page})
   }
 
-  setNavBarText(text){
-    this.setState({navBarText:text})
-  }
 
   renderBottom(){
     let page=this.state.page
@@ -53,7 +48,7 @@ class BillApp extends Component{
         return(
           <div className="pageWrap">
             <div className="scrollPage">
-              <HomePage setNavBarText={this.setNavBarText}/>
+              <HomePage changePage={this.changePage}/>
             </div>
           </div>
           )
@@ -61,18 +56,29 @@ class BillApp extends Component{
           return(
             <div className="pageWrap">
               <div className="scrollPage">
-                <Assets setNavBarText={this.setNavBarText}/>
+                <Assets changePage={this.changePage}/>
               </div>
             </div>
           )
+
      case('my'):
           return(
             <div className="pageWrap">
               <div className="scrollPage">
-                <My setNavBarText={this.setNavBarText}/>
+                <My changePage={this.changePage}/>
+              </div>
+            </div>
+          )
+
+      case('bill'):
+          return(
+            <div className="pageWrap">
+              <div className="scrollPage">
+                <Bill changePage={this.changePage}/>
               </div>
             </div>
           )
+          
       default:
           return(
             <div>页面加载失败,请刷新页面</div>
@@ -87,7 +93,6 @@ class BillApp extends Component{
         <div className="phone6s">
           <div className="App billApp">
             <PageContext.Provider value={changePage}>
-              <NavBars navBarText={this.state.navBarText} changePage={this.changePage}/>
               {this.renderPage(this.state.page)}
               {this.renderBottom()}
             </PageContext.Provider>

+ 136 - 24
src/case/BillApp/src/api/graphql/billsGraphql.txt → src/case/BillApp/src/api/billsGraphql.txt

@@ -60,6 +60,15 @@ query accountbyid($id: ID) {
 query classbyid($id: ID) {
     classbyid: class_by_id(id: $id) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -73,9 +82,18 @@ query classbyid($id: ID) {
     }
 }
 
-query tagbyprops($account_id: ID, $name: String, $icon: String, $createdAt: String, $updateAt: String) {
-    tagbyprops: tag_by_props(account_id: $account_id name: $name icon: $icon createdAt: $createdAt updateAt: $updateAt) {
+query tagbyprops($user_id: ID, $account_id: ID, $name: String, $icon: String, $createdAt: String, $updateAt: String) {
+    tagbyprops: tag_by_props(user_id: $user_id account_id: $account_id name: $name icon: $icon createdAt: $createdAt updateAt: $updateAt) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -106,9 +124,19 @@ query billbyid($id: ID) {
         createdAt
         id
         class
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         tag_id {
             id
 
+
             name
             icon
             createdAt
@@ -117,9 +145,18 @@ query billbyid($id: ID) {
     }
 }
 
-query classbyprops($account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
-    classbyprops: class_by_props(account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
+query classbyprops($user_id: ID, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
+    classbyprops: class_by_props(user_id: $user_id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -154,6 +191,15 @@ query accountbyprops($user_id: ID, $accountName: String, $createdAt: String, $up
 query tagbyid($id: ID) {
     tagbyid: tag_by_id(id: $id) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -197,8 +243,8 @@ query collectbyprops($updateAt: String, $remark: String, $account_id: ID, $month
     }
 }
 
-query billbyprops($account_id: ID, $tag_id: ID, $time: String, $money: Float, $class: String, $remark: String, $createdAt: String, $updateAt: String) {
-    billbyprops: bill_by_props(account_id: $account_id tag_id: $tag_id time: $time money: $money class: $class remark: $remark createdAt: $createdAt updateAt: $updateAt) {
+query billbyprops($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $class: String, $user_id: ID, $tag_id: ID) {
+    billbyprops: bill_by_props(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt class: $class user_id: $user_id tag_id: $tag_id) {
         money
         updateAt
         remark
@@ -213,9 +259,19 @@ query billbyprops($account_id: ID, $tag_id: ID, $time: String, $money: Float, $c
         createdAt
         id
         class
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         tag_id {
             id
 
+
             name
             icon
             createdAt
@@ -252,8 +308,8 @@ mutation deleteaccount($id: ID, $user_id: ID, $accountName: String, $createdAt:
     deleteaccount: delete_account(id: $id user_id: $user_id accountName: $accountName createdAt: $createdAt updateAt: $updateAt)
 }
 
-mutation updatebill($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $id: ID, $class: String, $tag_id: ID) {
-    updatebill: update_bill(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt id: $id class: $class tag_id: $tag_id) {
+mutation updatebill($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $id: ID, $class: String, $user_id: ID, $tag_id: ID) {
+    updatebill: update_bill(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt id: $id class: $class user_id: $user_id tag_id: $tag_id) {
         money
         updateAt
         remark
@@ -268,9 +324,19 @@ mutation updatebill($money: Float, $updateAt: String, $remark: String, $account_
         createdAt
         id
         class
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         tag_id {
             id
 
+
             name
             icon
             createdAt
@@ -295,13 +361,22 @@ mutation updateuser($id: ID, $openid: String, $username: String, $password: Stri
     }
 }
 
-mutation deleteclass($id: ID, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
-    deleteclass: delete_class(id: $id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt)
+mutation deleteclass($id: ID, $user_id: ID, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
+    deleteclass: delete_class(id: $id user_id: $user_id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt)
 }
 
-mutation updateclass($id: ID, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
-    updateclass: update_class(id: $id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
+mutation updateclass($id: ID, $user_id: ID, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
+    updateclass: update_class(id: $id user_id: $user_id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -315,9 +390,18 @@ mutation updateclass($id: ID, $account_id: ID, $name: String, $createdAt: String
     }
 }
 
-mutation updatetag($id: ID, $account_id: ID, $name: String, $icon: String, $createdAt: String, $updateAt: String) {
-    updatetag: update_tag(id: $id account_id: $account_id name: $name icon: $icon createdAt: $createdAt updateAt: $updateAt) {
+mutation updatetag($id: ID, $user_id: ID, $account_id: ID, $name: String, $icon: String, $createdAt: String, $updateAt: String) {
+    updatetag: update_tag(id: $id user_id: $user_id account_id: $account_id name: $name icon: $icon createdAt: $createdAt updateAt: $updateAt) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -361,9 +445,18 @@ mutation createcollect($updateAt: String, $remark: String, $account_id: ID, $mon
     }
 }
 
-mutation createtag($id: ID!, $account_id: ID, $name: String, $icon: String, $createdAt: String, $updateAt: String) {
-    createtag: create_tag(id: $id account_id: $account_id name: $name icon: $icon createdAt: $createdAt updateAt: $updateAt) {
+mutation createtag($id: ID!, $user_id: ID, $account_id: ID, $name: String, $icon: String, $createdAt: String, $updateAt: String) {
+    createtag: create_tag(id: $id user_id: $user_id account_id: $account_id name: $name icon: $icon createdAt: $createdAt updateAt: $updateAt) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -418,12 +511,12 @@ mutation createaccount($id: ID!, $user_id: ID, $accountName: String, $createdAt:
     }
 }
 
-mutation deletebill($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $id: ID, $class: String, $tag_id: ID) {
-    deletebill: delete_bill(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt id: $id class: $class tag_id: $tag_id)
+mutation deletebill($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $id: ID, $class: String, $user_id: ID, $tag_id: ID) {
+    deletebill: delete_bill(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt id: $id class: $class user_id: $user_id tag_id: $tag_id)
 }
 
-mutation deletetag($id: ID, $account_id: ID, $name: String, $icon: String, $createdAt: String, $updateAt: String) {
-    deletetag: delete_tag(id: $id account_id: $account_id name: $name icon: $icon createdAt: $createdAt updateAt: $updateAt)
+mutation deletetag($id: ID, $user_id: ID, $account_id: ID, $name: String, $icon: String, $createdAt: String, $updateAt: String) {
+    deletetag: delete_tag(id: $id user_id: $user_id account_id: $account_id name: $name icon: $icon createdAt: $createdAt updateAt: $updateAt)
 }
 
 mutation updatecollect($updateAt: String, $remark: String, $account_id: ID, $month: String, $createdAt: String, $allIncome: Float, $allPay: Float, $year: String, $id: ID, $user_id: ID) {
@@ -455,9 +548,18 @@ mutation updatecollect($updateAt: String, $remark: String, $account_id: ID, $mon
     }
 }
 
-mutation createclass($id: ID!, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
-    createclass: create_class(id: $id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
+mutation createclass($id: ID!, $user_id: ID, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
+    createclass: create_class(id: $id user_id: $user_id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -471,8 +573,8 @@ mutation createclass($id: ID!, $account_id: ID, $name: String, $createdAt: Strin
     }
 }
 
-mutation createbill($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $id: ID!, $class: String, $tag_id: ID) {
-    createbill: create_bill(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt id: $id class: $class tag_id: $tag_id) {
+mutation createbill($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $id: ID!, $class: String, $user_id: ID, $tag_id: ID) {
+    createbill: create_bill(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt id: $id class: $class user_id: $user_id tag_id: $tag_id) {
         money
         updateAt
         remark
@@ -487,9 +589,19 @@ mutation createbill($money: Float, $updateAt: String, $remark: String, $account_
         createdAt
         id
         class
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         tag_id {
             id
 
+
             name
             icon
             createdAt

+ 48 - 2
src/case/BillApp/src/api/graphql/bills.js

@@ -1,5 +1,5 @@
-export const  BILL_BY_PROPS=`query billbyprops($account_id: ID, $tag_id: ID, $time: String, $money: Float, $class: String, $remark: String, $createdAt: String, $updateAt: String) {
-    billbyprops: bill_by_props(account_id: $account_id tag_id: $tag_id time: $time money: $money class: $class remark: $remark createdAt: $createdAt updateAt: $updateAt) {
+export const  BILL_BY_PROPS=`query billbyprops($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $class: String, $user_id: ID, $tag_id: ID) {
+    billbyprops: bill_by_props(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt class: $class user_id: $user_id tag_id: $tag_id) {
         money
         updateAt
         remark
@@ -13,8 +13,54 @@ export const  BILL_BY_PROPS=`query billbyprops($account_id: ID, $tag_id: ID, $ti
         createdAt
         id
         class
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
+        tag_id {
+            id
+            name
+            icon
+            createdAt
+            updateAt
+        }
+    }
+}`
+
+export const CREATE_BILL=`mutation createbill($money: Float, $updateAt: String, $remark: String, $account_id: ID, $time: String, $createdAt: String, $id: ID!, $class: String, $user_id: ID, $tag_id: ID) {
+    createbill: create_bill(money: $money updateAt: $updateAt remark: $remark account_id: $account_id time: $time createdAt: $createdAt id: $id class: $class user_id: $user_id tag_id: $tag_id) {
+        money
+        updateAt
+        remark
+        account_id {
+            id
+
+            accountName
+            createdAt
+            updateAt
+        }
+        time
+        createdAt
+        id
+        class
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         tag_id {
             id
+
+
             name
             icon
             createdAt

+ 22 - 4
src/case/BillApp/src/api/graphql/class.js

@@ -1,6 +1,15 @@
-export const CREATE_CLASS=`mutation createclass($id: ID!, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
-    createclass: create_class(id: $id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
+export const CREATE_CLASS=`mutation createclass($id: ID!, $user_id: ID, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
+    createclass: create_class(id: $id user_id: $user_id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 
@@ -14,9 +23,18 @@ export const CREATE_CLASS=`mutation createclass($id: ID!, $account_id: ID, $name
     }
 }`
 
-export const CLASS_BY_PROPS=`query classbyprops($account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
-    classbyprops: class_by_props(account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
+export const CLASS_BY_PROPS=`query classbyprops($user_id: ID, $account_id: ID, $name: String, $createdAt: String, $updateAt: String) {
+    classbyprops: class_by_props(user_id: $user_id account_id: $account_id name: $name createdAt: $createdAt updateAt: $updateAt) {
         id
+        user_id {
+            id
+            openid
+            username
+            password
+            avatar
+            createdAt
+            updateAt
+        }
         account_id {
             id
 

+ 1 - 1
src/case/BillApp/src/api/url_config.js

@@ -1,5 +1,5 @@
 var config={
-    APPID:"wxc4831335ae194243",
+    APPID:"ovtkn4zONC3IzhpykQ7cSLZ85YFg",
     HTTP_DATA_URL:'http://bills.ioobot.cn/graphql',
     HTTP_PAY_URL:'https://xcx.ioobot.com/payinfo'
 }

+ 0 - 11
src/case/BillApp/src/components/App/NavBar.css

@@ -1,11 +0,0 @@
-.navBars{
-    position: absolute;
-    width: 100%;
-    top: 0;
-    left: 0;
-    z-index:100;
-}
-
-div.am-navbar{
-    background-color: black;
-}

+ 17 - 2
src/case/BillApp/src/components/Assets/Assets.jsx

@@ -1,13 +1,28 @@
 import React, { Component } from 'react'
 
+import NavBars from '../common/NavBar'
+import Buttons from '../common/Button'
+
 export default class Assets extends Component {
+  constructor(props){
+    super(props)
+    this.state={
+      navBarText:'资产统计',
+      collect:'0.00'
+    }
+  }
   componentWillMount(){
-    this.props.setNavBarText('资产统计')
+   
   }
   render() {
     return (
       <div>
-        资产
+       <NavBars navBarText={this.state.navBarText} changePage={this.props.changePage}/>
+       <div className="assetsWrap">
+        <div className="collect">¥<span>{this.state.collect}</span>元</div>
+        <div className="buttonWrap"><Buttons changePage={this.props.changePage} toPage='assets' buttonText='去统计资产'/></div>
+        <div className="tips">tip:总资产使用统计自己每个月内的消费的情况</div>
+       </div>
       </div>
     )
   }

+ 150 - 0
src/case/BillApp/src/components/Bill/Bill.jsx

@@ -0,0 +1,150 @@
+import React, { Component } from 'react'
+import TabBar from './TabBar'
+import NavBars from '../common/NavBar'
+
+import {graphqls} from '../../api/graphql_request'
+import {ACCOUNT_BY_PROPS} from '../../api/graphql/account'
+import {CLASS_BY_PROPS} from '../../api/graphql/class'
+import {CREATE_BILL} from '../../api/graphql/bills'
+
+import {failToast} from '../common/Toast'
+
+let user_id=sessionStorage.getItem('openid')
+
+export default class Bill extends Component {
+  constructor(props){
+      super(props)
+      this.state={
+          tabs:[{title:'收入'},{title:'支出'}],
+          class:'收入',
+          account:[],
+          classs:[],
+          account_id:'',
+          time:'',
+          remark:'',
+          money:'',
+          tag_id:''
+
+      }
+
+    this.tabChange=this.tabChange.bind(this)
+    this.handleSubmit=this.handleSubmit.bind(this)
+  }
+
+  componentDidMount(){
+    this.getAccount()
+    this.getClass()
+  }
+
+  getAccount(){
+   
+    console.log(user_id)
+    graphqls(ACCOUNT_BY_PROPS,{user_id}).then((e)=>{
+        console.log(e.accountbyprops)
+        this.setState({
+            account:e.accountbyprops
+        })
+    })
+  }
+
+  getClass(){
+    let user_id=sessionStorage.getItem('openid')
+    graphqls(CLASS_BY_PROPS,{user_id}).then((e)=>{
+        console.log(e.classbyprops)
+        this.setState({
+            classs:e.classbyprops
+        })
+    })
+  }
+
+
+  tabChange(e){
+      console.log(e)
+      this.setState({class:e.title})
+  }
+
+  handleSubmit(e){
+    e.preventDefault()
+    let data={
+        id:new Date().getTime()+parseInt(Math.random(),10),
+        class:this.state.class,
+        account_id:this.state.account_id,
+        money:this.state.money,
+        remark:this.state.remark,
+        tag_id:this.state.tag_id,
+        time:this.state.time,
+        user_id,
+        createdAt:new Date().toLocaleString('chinese', { hour12: false }),
+        updateAt:new Date().toLocaleString('chinese', { hour12: false })
+    }
+
+    let key =Object.keys(data)
+    let submit =true
+    key.forEach((item)=>{
+        if(data[item]===''){
+            submit=false
+        }
+    })
+
+    if(submit){
+        graphqls(CREATE_BILL,data).then((e)=>{
+            console.log(e)
+        })
+    }else{
+        failToast('所有选项不能为空',1)
+    }
+  }
+
+
+
+  render() {
+    const account=this.state.account
+    const classs=this.state.classs
+    return (
+      <div className="billWrap">
+        <NavBars page='home' navBarText='记一笔' changePage={this.props.changePage}/>
+        <TabBar tabs={this.state.tabs} tabChange={this.tabChange}/>
+        <form onSubmit={this.handleSubmit}>
+            <div className="moneyWrap row">
+                <label>金额:</label>
+                <input type="text" name="money" className="input" onChange={(e)=>this.setState({money:e.currentTarget.value})}/>
+            </div>
+            <div className="accountWrap row">
+                <label>账户:</label>
+                <select name="account" className="input" onChange={(e)=>this.setState({account_id:e.currentTarget.value})}>
+                    <option value="0">下拉选择你的账户</option>
+                    {
+                        account.map((item)=>{
+                            return(
+                                <option key={item.id} value={item.id}>{item.accountName}</option> 
+                            )
+                        })            
+                    } 
+                </select>
+            </div>
+
+            <div className="classWrap row">
+                <label>分类:</label>
+                <select name="class" className="input" onChange={(e)=>this.setState({tag_id:e.currentTarget.value})}>
+                    <option value="0">下拉选择你的分类</option>
+                    {
+                        classs.map((item)=>{
+                            return(
+                                <option key={item.id} value={item.id}>{item.name}</option> 
+                            )
+                        })            
+                    } 
+                </select>
+            </div>
+            <div className="timeWrap row">
+                <label>时间:</label><input type="text" name="time" className="input" placeholder="格式:2018/12/1 00:00:00" onChange={(e)=>this.setState({time:e.currentTarget.value})}/>
+            </div> 
+            <div className="remarkWrap row">
+                <label>备注:</label><input type="text" name="remark" className="input" onChange={(e)=>this.setState({remark:e.currentTarget.value})}/>
+            </div> 
+            <button className="submit" type="submit">保存</button>
+        </form>
+      </div>
+    )
+  }
+}

+ 1 - 0
src/case/BillApp/src/components/HomePage/TabBar.jsx → src/case/BillApp/src/components/Bill/TabBar.jsx

@@ -4,6 +4,7 @@ import { Tabs, WhiteSpace } from 'antd-mobile';
 
 
 class TabBar extends Component {
+  
     render() {
       //console.log('this.state.products',this.state.products)
       return (

+ 0 - 60
src/case/BillApp/src/components/HomePage/Bill.jsx

@@ -1,60 +0,0 @@
-import React, { Component } from 'react'
-
-import TabBar from './TabBar'
-
-export default class Bill extends Component {
-  constructor(props){
-      super(props)
-      this.state={
-          tabs:[{title:'收入'},{title:'支出'}],
-          class:'收入'
-      }
-
-    this.tabChange=this.tabChange.bind(this)
-  }
-
-  tabChange(e){
-      console.log(e)
-      this.setState({class:e.title})
-  }
-
-
-    /*
-    account_id: ID
-    class: String
-    createdAt: String
-    id: ID!
-    money: Float
-    remark: String
-    tag_id: ID
-    time: String
-    updateAt: String
-
-    金额
-
-    类别
-    账户
-    成员
-    时间
-
-    备注
-    */
-
-  render() {
-    return (
-      <div>
-        <TabBar tabs={this.state.tabs} tabChange={this.tabChange}/>
-        <input className="money"/>
-
-        <div className="class">
-            {}
-        </div>
-        <select name="select">
-            <option value="value1">Value 1</option> 
-            <option value="value2" selected>Value 2</option>
-            <option value="value3">Value 3</option>
-        </select>
-      </div>
-    )
-  }
-}

+ 15 - 32
src/case/BillApp/src/components/HomePage/HomePage.jsx

@@ -1,9 +1,12 @@
 import React, { Component } from 'react';
 
+
+import NavBars from '../common/NavBar'
 import Lists from './List'
-import Buttons from './Button'
+import Buttons from '../common/Button'
 import IconList from './IconList'
-import Bill from './Bill'
+
+
 
 import {graphqls} from '../../api/graphql_request'
 import {BILL_BY_PROPS} from '../../api/graphql/bills'
@@ -27,15 +30,14 @@ class HomePage  extends Component{
             weekBottom:'',
             weekTop:'',
             bills:[],
-            page:'index'
+            navBarText:'微记账本'
         }
 
-        this.handleChange=this.handleChange.bind(this)
+        //this.handleChange=this.handleChange.bind(this)
     }
 
     componentDidMount(){
         //console.log('组件已加载')
-        this.props.setNavBarText('微记账本')
         this.getBills()
         let today=new Date().toLocaleString('chinese', { hour12: false }).slice(0,10)
 
@@ -59,39 +61,20 @@ class HomePage  extends Component{
         })
     }
 
-    handleChange(){
-        console.log('---')
-        this.setState({page:'bill'})
-    }
-
-    renderPage(){
+    render(){
         const page=this.state.page
         const weekTop=this.state.weekTop
         const weekBottom=this.state.weekBottom
-        if(page==='index'){
-            return(
-                <div>
-                    <div className="dateWrap"><span className="month"> {this.state.month} </span> / {this.state.year}</div>
+        return(
+            <div>
+                <NavBars navBarText={this.state.navBarText} changePage={this.props.changePage} />
+                <div className="dateWrap"><span className="month"> {this.state.month} </span> / {this.state.year}</div>
                     <Lists bills={this.state.bills} year={this.state.year} month={this.state.month}/>
                     <div className="buttonWrap">
-                    <Buttons handleChange={this.handleChange}/>
-                    </div>
-                    <IconList bills={this.state.bills} week={{weekTop,weekBottom}}/>
+                    <Buttons changePage={this.props.changePage} toPage='bill' buttonText='+ 记一笔'/>
                 </div>
-            )
-        }else{
-            return(
-                <div>
-                    <Bill />
-                </div>
-            )
-        }
-
-    }
-
-    render(){
-        return(
-            <div>{this.renderPage()}</div>
+                <IconList bills={this.state.bills} week={{weekTop,weekBottom}}/>
+            </div>
         )
     }
 }

+ 12 - 2
src/case/BillApp/src/components/My/My.jsx

@@ -1,13 +1,23 @@
 import React, { Component } from 'react'
 
+
+import NavBars from '../common/NavBar'
+
 export default class My extends Component {
+  constructor(props){
+    super(props)
+    this.state={
+      navBarText:'我的'
+    }
+  }
   componentWillMount(){
-    this.props.setNavBarText('我的')
+    
   }
   render() {
     return (
       <div>
-        My
+        <NavBars navBarText={this.state.navBarText} changePage={this.props.changePage}/>
+        my
       </div>
     )
   }

+ 15 - 0
src/case/BillApp/src/components/common/Alert.jsx

@@ -0,0 +1,15 @@
+import React from 'react'
+import { Modal, Button, WhiteSpace, WingBlank, Toast } from 'antd-mobile';
+
+const alert = Modal.alert;
+
+export const dialog =(type,message)=>{
+    return new Promise((resolve,reject)=>{
+        alert(type, message, [
+            { text: '取消', onPress: () => {reject.call(null,0)}},
+            { text: '确认', onPress: () => {resolve.call(null,1)} },
+          ])
+    })
+}
+
+

+ 1 - 1
src/case/BillApp/src/components/HomePage/Button.jsx → src/case/BillApp/src/components/common/Button.jsx

@@ -17,7 +17,7 @@ export default class Buttons extends Component{
     render(){
         return (
             <WingBlank>
-                <Button type="primary" style={this.state.buttonStyle} onClick={this.props.handleChange}>+记一笔</Button><WhiteSpace />
+                <Button type="primary" style={this.state.buttonStyle} onClick={()=>this.props.changePage(this.props.toPage)}>{this.props.buttonText}</Button><WhiteSpace />
             </WingBlank>
         )
     }

+ 13 - 6
src/case/BillApp/src/components/App/NavBar.jsx → src/case/BillApp/src/components/common/NavBar.jsx

@@ -1,19 +1,20 @@
 import React, { Component } from 'react';
 import { NavBar, Icon } from 'antd-mobile';
 
-import './NavBar.css'
+import {PageContext} from '../context'
+
+
 
 export default class NavBars extends Component{
-    goBack(){
-        console.log('back')
-    }
     render(){
+        let page=this.props.page||'home'
+        console.log(page)
         return(
             <div className="navBars">
                 <NavBar
                 mode="dark"
-                icon={<Icon type="left" />}
-                onLeftClick={() => this.props.changePage('home')}
+                icon={ <Icon type="left" /> }
+                onLeftClick={() => this.props.changePage(page)}
                 rightContent={[
                     <Icon key="0" type="search" style={{ marginRight: '16px' }} />,
                     <Icon key="1" type="ellipsis" />,
@@ -27,3 +28,9 @@ export default class NavBars extends Component{
 
 
 
+
+
+
+
+
+

+ 6 - 0
src/case/BillApp/src/components/common/Status.jsx

@@ -0,0 +1,6 @@
+import React from 'react'
+import { ActivityIndicator } from 'antd-mobile';
+
+export const Loading=(text,show)=>{
+    return(<ActivityIndicator toast text={text} animating={show}/>)
+}

+ 11 - 0
src/case/BillApp/src/components/common/Toast.jsx

@@ -0,0 +1,11 @@
+//封装Toast
+import React, { Component } from 'react'
+import { Toast, WhiteSpace, WingBlank, Button } from 'antd-mobile';
+
+
+export const successToast=(message,time)=> {
+  Toast.success(message, time);
+}
+export const failToast=(message,time)=> {
+  Toast.fail(message, time);
+}

+ 79 - 0
src/gql.js

@@ -739,6 +739,84 @@ const DELETE_WXCONFIG = `
             }
         `;
 
+const GET_PROJECT = `
+            query projectbyid($id: ID) {
+                project_by_id(id: $id) {
+                    updatedAt
+                    database_id {
+                        id
+                    }
+                    apiGWGroup_id {
+                        id
+                        groupName
+                        region
+                        frontType
+                        defaultDomain
+                        userStatus
+                        userDomain
+                    }
+                    projectName
+                    deploy_id {
+                      description
+                      updatedAt
+                      cosBucketName
+                      memorySize
+                      createdAt
+                      subnetId
+                      cosObjectName
+                      region
+                      vpcId
+                      cosBucketRegion
+                      id
+                      serviceName
+                      timeout
+                      handler
+                      functionName
+                    }
+                    id
+                    projectType
+                    cloud_id {
+                      id
+                      cloudName
+                      secretId
+                      secretKey
+                      appId
+                      createdAt
+                      updatedAt
+                    }
+                    user_id {
+                        id
+                    }
+                    wxConfig_id {
+                      updatedAt
+                      mch_id
+                      appName
+                      notify_url
+                      appSecret
+                      createdAt
+                      appID
+                      token
+                      spbill_create_ip
+                      enter_url
+                      id
+                      pay_api_key
+                      body
+                      welcome_words
+                      attach
+                    }
+                    schema_id {
+                      updatedAt
+                      schemaState
+                      createdAt
+                      schemaName
+                      reference
+                      id
+                      schemaData
+                    }
+                  }
+                }
+        `;
+
 export {
     ADD_USER,
     GET_USER,
@@ -777,4 +855,5 @@ export {
     SHOW_WXCONTENT,
     UPDATE_WXCONFIG,
     DELETE_WXCONFIG,
+    GET_PROJECT
 }