kulley 6 年 前
コミット
fa2cfa94e6
2 ファイル変更119 行追加110 行削除
  1. 97 98
      src/app/basicVersion/caseShow/UserCustom.js
  2. 22 12
      src/login/CloudConfig.js

+ 97 - 98
src/app/basicVersion/caseShow/UserCustom.js

@@ -98,6 +98,44 @@ class UserCustom extends Component {
 
 export default UserCustom;
 
+const Step1 = (props) => (
+    <div className='step-block'>
+        第一步:注册腾讯云账户
+        <Button style={{marginLeft: 20}}>使用帮助</Button>
+    </div>
+);
+
+class Step2 extends Component {
+    constructor(props) {
+        super(props);
+        this.state = {
+            check: 0
+        }
+    }
+
+    render() {
+        let {userID, getCloudDetail} = this.props;
+        let {check} = this.state;
+        return (
+            <div className='step-block'>
+                第二步:填写腾讯云秘钥,一键部署
+                <Button style={{marginLeft: 20}}>使用帮助</Button>
+                <div>
+                    <CloudQueryAndConfig
+                        userID={userID}
+                        getCloudDetail={getCloudDetail}
+                        cloudName='tencent'
+                        check={check}
+                        reCheck={() => {
+                            this.setState({check: check + 1})
+                        }}
+                    />
+                </div>
+            </div>
+        )
+    }
+}
+
 class CloudQueryAndConfig extends Component {
     constructor(props) {
         super(props);
@@ -193,13 +231,30 @@ class CloudQueryAndConfig extends Component {
                     footer={null}
                     onCancel={this.handleCancel}
                 >
-                    <CloudConfig cloudName={cloudName}/>
+                    <CloudConfig cloudName={cloudName} handleCancel={this.handleCancel}/>
                 </Modal>
             </div>
         )
     }
 }
 
+const Step3 = (props) => (
+    <div className='step-block'>
+        开始部署
+        <div>
+            <NameAndDB
+                userID={props.userID}
+                bucketName={props.bucketName}
+                secretID={props.secretID}
+                secretKey={props.secretKey}
+                appId={props.appId}
+                cloudID={props.cloudID}
+                history={props.history}
+            />
+        </div>
+    </div>
+);
+
 class NameAndDB extends Component {
     constructor(props) {
         super(props);
@@ -566,61 +621,6 @@ class NameAndDB extends Component {
     }
 }
 
-const Step1 = (props) => (
-    <div className='step-block'>
-        第一步:注册腾讯云账户
-        <Button style={{marginLeft: 20}}>使用帮助</Button>
-    </div>
-);
-
-class Step2 extends Component {
-    constructor(props) {
-        super(props);
-        this.state = {
-            check: 0
-        }
-    }
-
-    render() {
-        let {userID, getCloudDetail} = this.props;
-        let {check} = this.state;
-        return (
-            <div className='step-block'>
-                第二步:填写腾讯云秘钥,一键部署
-                <Button style={{marginLeft: 20}}>使用帮助</Button>
-                <div>
-                    <CloudQueryAndConfig
-                        userID={userID}
-                        getCloudDetail={getCloudDetail}
-                        cloudName='tencent'
-                        check={check}
-                        reCheck={() => {
-                            this.setState({check: check + 1})
-                        }}
-                    />
-                </div>
-            </div>
-        )
-    }
-}
-
-const Step3 = (props) => (
-    <div className='step-block'>
-        开始部署
-        <div>
-            <NameAndDB
-                userID={props.userID}
-                bucketName={props.bucketName}
-                secretID={props.secretID}
-                secretKey={props.secretKey}
-                appId={props.appId}
-                cloudID={props.cloudID}
-                history={props.history}
-            />
-        </div>
-    </div>
-);
-
 const Step4 = (props) => (
     <div className='step-block'>
         第三步:注册微信公众号/小程序
@@ -628,7 +628,6 @@ const Step4 = (props) => (
     </div>
 );
 
-
 class Step5 extends Component {
     constructor(props) {
         super(props)
@@ -671,47 +670,6 @@ class Step5 extends Component {
     }
 }
 
-class Step6 extends Component {
-    constructor(props) {
-        super(props)
-        this.state = {
-            visible: false
-        }
-    }
-
-    handleCancel = () => {
-        this.setState({
-            visible: false
-        })
-    }
-
-    render() {
-        let {visible} = this.state
-        let {userID, bucketName} = this.props
-        return (
-            <div className='step-block'>
-                开始使用
-                <div>
-                    <Button type='primary' onClick={() => {
-                        this.setState({visible: true})
-                    }}>使用</Button>
-                    <Modal
-                        title="公众号/小程序二次部署"
-                        visible={visible}
-                        footer={null}
-                        onCancel={this.handleCancel}
-                    >
-                        <WechatDeploy
-                            userID={userID}
-                            bucketName={bucketName}
-                        />
-                    </Modal>
-                </div>
-            </div>
-        )
-    }
-}
-
 class Wechat extends Component {
     constructor(props) {
         super(props)
@@ -871,6 +829,47 @@ class Wechat extends Component {
     }
 }
 
+class Step6 extends Component {
+    constructor(props) {
+        super(props)
+        this.state = {
+            visible: false
+        }
+    }
+
+    handleCancel = () => {
+        this.setState({
+            visible: false
+        })
+    }
+
+    render() {
+        let {visible} = this.state
+        let {userID, bucketName} = this.props
+        return (
+            <div className='step-block'>
+                开始使用
+                <div>
+                    <Button type='primary' onClick={() => {
+                        this.setState({visible: true})
+                    }}>使用</Button>
+                    <Modal
+                        title="公众号/小程序二次部署"
+                        visible={visible}
+                        footer={null}
+                        onCancel={this.handleCancel}
+                    >
+                        <WechatDeploy
+                            userID={userID}
+                            bucketName={bucketName}
+                        />
+                    </Modal>
+                </div>
+            </div>
+        )
+    }
+}
+
 class WechatDeploy extends Component {
     constructor(props) {
         super(props)

+ 22 - 12
src/login/CloudConfig.js

@@ -81,7 +81,8 @@ class CloudConfig extends Component {
                                 this.setState({
                                     showOK: ''
                                 });
-                                handleCancel();
+                                if (handleCancel)
+                                    handleCancel();
                             }, 1500)
                         } else {
                             this.setState({
@@ -113,7 +114,8 @@ class CloudConfig extends Component {
                                 this.setState({
                                     showOK: ''
                                 });
-                                handleCancel();
+                                if (handleCancel)
+                                    handleCancel();
                             }, 1500)
                         } else {
                             this.setState({
@@ -149,7 +151,7 @@ class CloudConfig extends Component {
                         <div>
                             <Collapse
                                 bordered={false}
-                                expandIcon={({ isActive }) => <Icon type="caret-right" rotate={isActive ? 90 : 0} />}
+                                expandIcon={({isActive}) => <Icon type="caret-right" rotate={isActive ? 90 : 0}/>}
                             >
                                 <Panel header="我为什么要填写这项配置?" key="1" style={customPanelStyle}>
                                     <p>如不填写,默认使用 ioobot 提供的账户进行体验。</p>
@@ -159,32 +161,40 @@ class CloudConfig extends Component {
                                     <p>2. 稳定长期存在</p>
                                 </Panel>
                                 <Panel header="我该如何获得这项配置?" key="2" style={customPanelStyle}>
-                                    <p>腾讯云请到:<a href="https://console.cloud.tencent.com/cam/capi" rel="noopener noreferrer" target='_blank'>腾讯云API</a></p>
+                                    <p>腾讯云请到:<a href="https://console.cloud.tencent.com/cam/capi"
+                                                rel="noopener noreferrer" target='_blank'>腾讯云API</a></p>
                                     <p>其他云请联系我们</p>
                                 </Panel>
                             </Collapse>
                             <p style={{color: 'orange'}}>该项配置填写错误将导致部署失败,默认使用系统配置!</p>
                             {
-                                (cloudName === 'all' || cloudName === 'tencent')?
+                                (cloudName === 'all' || cloudName === 'tencent') ?
                                     <div style={{marginTop: 15}}>
                                         <span className='cloud-name'><FormattedMessage id="Tencent"/>: </span>
                                         <div style={{marginBottom: 15}}>
                                             <div>
                                                 <div style={{marginBottom: 20}}>
                                                     <span className='item-title-cloud'>APPID:</span>
-                                                    <Input style={{width: 250}} value={tenAppID} placeholder={'不保存默认使用 ioobot 账户'} onChange={this.inputChange('tenAppID')}/>
+                                                    <Input style={{width: 250}} value={tenAppID}
+                                                           placeholder={'不保存默认使用 ioobot 账户'}
+                                                           onChange={this.inputChange('tenAppID')}/>
                                                 </div>
                                                 <div style={{marginBottom: 20}}>
                                                     <span className='item-title-cloud'>SecretId:</span>
-                                                    <Input type='password' style={{width: 250}} value={tenID} placeholder={'不保存默认使用 ioobot 账户'} onChange={this.inputChange('tenID')}/>
+                                                    <Input type='password' style={{width: 250}} value={tenID}
+                                                           placeholder={'不保存默认使用 ioobot 账户'}
+                                                           onChange={this.inputChange('tenID')}/>
                                                 </div>
                                                 <div style={{marginBottom: 20}}>
                                                     <span className='item-title-cloud'>SecretKey:</span>
-                                                    <Input type='password' style={{width: 250}} value={tenKey} placeholder={'不保存默认使用 ioobot 账户'} onChange={this.inputChange('tenKey')}/>
+                                                    <Input type='password' style={{width: 250}} value={tenKey}
+                                                           placeholder={'不保存默认使用 ioobot 账户'}
+                                                           onChange={this.inputChange('tenKey')}/>
                                                 </div>
                                                 {
                                                     showOK === 'tencent' ?
-                                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                                        <Icon type="check-circle" theme="twoTone"
+                                                              twoToneColor="#52c41a"/>
                                                         :
                                                         showNotOK === 'tencent' ?
                                                             <span>not ok</span>
@@ -201,7 +211,7 @@ class CloudConfig extends Component {
 
                             }
                             {
-                                (cloudName === 'all' || cloudName === 'aliyun')?
+                                (cloudName === 'all' || cloudName === 'aliyun') ?
                                     <div>
                                         <span className='cloud-name'><FormattedMessage id="Aliyun"/>: </span>
                                         <div style={{marginBottom: 15}}>
@@ -210,7 +220,7 @@ class CloudConfig extends Component {
                                     </div> : ''
                             }
                             {
-                                (cloudName === 'all' || cloudName === 'aws')?
+                                (cloudName === 'all' || cloudName === 'aws') ?
                                     <div>
                                         <span className='cloud-name'><FormattedMessage id="AWS"/>: </span>
                                         <div style={{marginBottom: 15}}>
@@ -219,7 +229,7 @@ class CloudConfig extends Component {
                                     </div> : ''
                             }
                             {
-                                (cloudName === 'all' || cloudName === 'huawei')?
+                                (cloudName === 'all' || cloudName === 'huawei') ?
                                     <div>
                                         <span className='cloud-name'><FormattedMessage id="Huawei"/>: </span>
                                         <div style={{marginBottom: 15}}>