瀏覽代碼

manage init

xy 7 年之前
父節點
當前提交
26dccd062c

+ 37 - 0
src/app/common/manage/AliyunResult.js

@@ -0,0 +1,37 @@
+import React, {Component} from 'react';
+import {Switch, Input, Icon} from 'antd';
+
+class AliyunResult extends Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            url: '1111',
+            checked: true
+        }
+    }
+
+    render() {
+        return (
+            <div>
+                <div style={{width: 300}}>
+                    <span>URL: </span>
+                    <Input
+                        placeholder="display your URL"
+                        prefix={<Icon type="copy"/>}
+                        value={this.state.url}
+                        onChange={() => {}}
+                        disabled={!this.state.checked}
+                    />
+                </div>
+                <div style={{marginTop: 30}}>
+                    <span>fc switch </span>
+                    <Switch defaultChecked onChange={(checked) => {
+                        this.setState({checked})
+                    }}/>
+                </div>
+            </div>
+        )
+    }
+}
+
+export default AliyunResult;

+ 37 - 0
src/app/common/manage/AmazonResult.js

@@ -0,0 +1,37 @@
+import React, {Component} from 'react';
+import {Switch, Input, Icon} from 'antd';
+
+class AmazonResult extends Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            url: '1111',
+            checked: true
+        }
+    }
+
+    render() {
+        return (
+            <div>
+                <div style={{width: 300}}>
+                    <span>URL: </span>
+                    <Input
+                        placeholder="display your URL"
+                        prefix={<Icon type="copy"/>}
+                        value={this.state.url}
+                        onChange={() => {}}
+                        disabled={!this.state.checked}
+                    />
+                </div>
+                <div style={{marginTop: 30}}>
+                    <span>fc switch </span>
+                    <Switch defaultChecked onChange={(checked) => {
+                        this.setState({checked})
+                    }}/>
+                </div>
+            </div>
+        )
+    }
+}
+
+export default AmazonResult;

+ 50 - 20
src/app/common/manage/Manage.jsx

@@ -1,34 +1,64 @@
 import React, {Component} from 'react';
-import {Switch, Input, Icon} from 'antd';
+import {FormattedMessage} from 'react-intl';
+import {Card} from 'antd';
+
+import TencentResult from './TencentResult';
+import AliyunResult from './AliyunResult';
+import AmazonResult from './AmazonResult';
+
+
+const tabListNoTitle = [{
+    key: 'tencent',
+    tab: <FormattedMessage id='Tencent'/>,
+}];
+
+// [{
+//     key: 'tencent',
+//     tab: <FormattedMessage id='Tencent'/>,
+// }, {
+//     key: 'aliyun',
+//     tab: <FormattedMessage id='Aliyun'/>,
+// }, {
+//     key: 'amazon',
+//     tab: <FormattedMessage id='AWS'/>,
+// }];
+
 
 class Manage extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            url: '1111',
-            checked: true
-        }
+            cloud: 'tencent'
+        };
+    }
+
+    componentWillReceiveProps(next) {
+        this.setState({
+            projectID: next.projectID
+        })
     }
 
     render() {
+        const contentListNoTitle = {
+            tencent: <TencentResult userID={this.props.userID} projectID={this.props.projectID} trialcase={this.props.trialcase}/>,
+            aliyun: <AliyunResult/>,
+            amazon: <AmazonResult/>,
+        };
+
         return (
             <div>
-                <div style={{width: 300}}>
-                    <span>URL: </span>
-                    <Input
-                        placeholder="display your URL"
-                        prefix={<Icon type="copy"/>}
-                        value={this.state.url}
-                        onChange={() => {}}
-                        disabled={!this.state.checked}
-                    />
-                </div>
-                <div style={{marginTop: 30}}>
-                    <span>fc switch </span>
-                    <Switch defaultChecked onChange={(checked) => {
-                        this.setState({checked})
-                    }}/>
-                </div>
+                <Card
+                    style={{width: '100%'}}
+                    tabList={tabListNoTitle}
+                    activeTabKey={this.state.cloud}
+                    onTabChange={(cloud) => {
+                        this.setState({
+                            cloud
+                        })
+                    }}
+                >
+                    {contentListNoTitle[this.state.cloud]}
+                </Card>
             </div>
         )
     }

+ 38 - 0
src/app/common/manage/TencentResult.js

@@ -0,0 +1,38 @@
+import React, {Component} from 'react';
+import {Switch, Input, Icon} from 'antd';
+
+class TencentResult extends Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            url: '1111',
+            checked: true
+        }
+    }
+
+    render() {
+        return (
+            <div>
+                <div style={{width: 300}}>
+                    <span>Tencent</span>
+                    <span>URL: </span>
+                    <Input
+                        placeholder="display your URL"
+                        prefix={<Icon type="copy"/>}
+                        value={this.state.url}
+                        onChange={() => {}}
+                        disabled={!this.state.checked}
+                    />
+                </div>
+                <div style={{marginTop: 30}}>
+                    <span>fc switch </span>
+                    <Switch defaultChecked onChange={(checked) => {
+                        this.setState({checked})
+                    }}/>
+                </div>
+            </div>
+        )
+    }
+}
+
+export default TencentResult;

+ 1 - 1
src/app/graphqlService/TrialCase.jsx

@@ -82,7 +82,7 @@ class TrialCase extends Component {
                                     case 'deploy':
                                         return <Deploy trialcase={true} userID={this.state.userID} projectID={projectID}/>;
                                     case 'manage':
-                                        return <Manage/>;
+                                        return <Manage trialcase={true} userID={this.state.userID} projectID={projectID}/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'template':

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

@@ -78,7 +78,7 @@ class UserCreate extends Component {
                                     case 'deploy':
                                         return <Deploy trialcase={false} userID={this.state.userID} projectID={projectID}/>;
                                     case 'manage':
-                                        return <Manage/>;
+                                        return <Manage trialcase={false} userID={this.state.userID} projectID={projectID}/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'template':

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

@@ -57,7 +57,7 @@ class WxTrialCase extends Component {
                                 case 'wechat-deploy':
                                     return <WxDeploy trialcase={true} userID={this.state.userID} configID={configID}/>;
                                 case 'wechat-manage':
-                                    return <Manage/>;
+                                    return <Manage trialcase={true} userID={this.state.userID} configID={configID}/>;
                                 default:
                                     return <WxConfig/>
                             }

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

@@ -78,7 +78,7 @@ class WxUserCreate extends Component {
                                 case 'wechat-deploy':
                                     return <WxDeploy trialcase={false} userID={this.state.userID} configID={configID}/>;
                                 case 'wechat-manage':
-                                    return <Manage/>;
+                                    return <Manage trialcase={false} userID={this.state.userID} configID={configID}/>;
                                 default:
                                     return <WxConfig/>
                             }