Kaynağa Gözat

tabbar根据location.pathname改变

Csy817 7 yıl önce
ebeveyn
işleme
921074cb03

+ 25 - 5
src/app/basicVersion/BasicVersion.jsx

@@ -32,13 +32,15 @@ class BasicVersion extends Component {
             userID: '',
             avatar: ''
         };
-        console.log(props);
+        // console.log('BasicVersion props',props);
         if(props.location) {
-            switch(props.location.pathname) {
-                case '/common/deploy':
+            let tabMenu = props.location.pathname.split('/')[2] || 'example';
+            // console.log('tabMenu',tabMenu);
+            switch(tabMenu) {
+                case 'deploy':
                     this.state.menuLevel1 = 'my-deploy';
                     break;
-                case '/common/communication':
+                case 'communication':
                     this.state.menuLevel1 = 'communication';
                     break;
                 default:
@@ -48,6 +50,24 @@ class BasicVersion extends Component {
         }
     }
 
+    componentWillReceiveProps(props){
+        if(props.location) {
+            let tabMenu = props.location.pathname.split('/')[2] || 'example';
+            // console.log('tabMenu1',tabMenu);
+            switch(tabMenu) {
+                case 'deploy':
+                    this.setState({menuLevel1: 'my-deploy'});
+                    break;
+                case 'communication':
+                    this.setState({menuLevel1: 'communication'});
+                    break;
+                default:
+                    this.setState({menuLevel1: 'example'});
+                    break;
+            }
+        }
+    }
+
     switchMenuLevel = (menuName, value) => {
         this.setState({
             [menuName]: value,
@@ -181,7 +201,7 @@ class BasicVersion extends Component {
                         <Route path="/common/example" exact component={CaseShow}/>
                         <Route path="/common/deploy" component={MyDeploy}/>
                         <Route path="/common/communication" component={Communication}/>
-                        <PrivateRoute path="/common/deploy-cloud-choose" component={CaseDetail} ownProps={ownProps}/>
+                        <PrivateRoute path="/common/example/deploy-cloud-choose" component={CaseDetail} ownProps={ownProps}/>
                     </Switch>
                 </Layout>
 

+ 1 - 1
src/app/basicVersion/caseShow/CaseDetail.js

@@ -116,7 +116,7 @@ class CaseDetail extends Component {
         let {userID, showCustom, caseID} = this.state;
         return (
             <div className={'deploy-choose-cloud'}>
-                <Layout style={{padding: '24px', minHeight: '600px'}}>
+                <Layout style={{padding: '24px', minHeight: '300px'}}>
                     <Content style={{padding: '20px 50px', background: '#fff'}}>
                         <Query query={gql(SHOW_CASE)} variables={{id: caseID}}>
                             {

+ 1 - 1
src/app/basicVersion/caseShow/CaseShow.jsx

@@ -68,7 +68,7 @@ class CaseShow extends Component {
                                                 <span><Icon type="like" />: {item.like}</span>,
                                                 <Button type="primary" onClick={() => {
                                                     this.props.history.push({
-                                                        pathname: `/common/deploy-cloud-choose`,
+                                                        pathname: `/common/example/deploy-cloud-choose`,
                                                         state: {caseID: item.id,}
                                                     });
                                                 }}><FormattedMessage id='step more'/></Button>

+ 5 - 2
src/app/basicVersion/caseShow/UserCustom.js

@@ -1,4 +1,5 @@
 import React, {Component} from 'react';
+import { Link } from 'react-router-dom';
 import {deployAll, graphqlUrl, storeFile} from "../../../config";
 import {ADD_APIGROUP, ADD_APIGWPATH, ADD_DEPLOY, ADD_PROJECT, SHOW_CLOUD} from "../../../gql";
 import {CloudConfig} from "../../../login/CloudConfig";
@@ -238,6 +239,8 @@ class UserCustom extends Component {
                 </div>
                 <div style={{marginTop: 20}}>
                     <div className={'schema-name'}><FormattedMessage id='Cloud Setting'/></div>
+                    <p><Link to="/common/communication">阿里云、华为云、亚马逊请联系我们</Link></p>
+                    <br/>
                     <RadioGroup
                         onChange={(e) => {
                             this.setState({cloudName: e.target.value})
@@ -273,9 +276,9 @@ class UserCustom extends Component {
                 </div>
                 {
                     disableDeployButton ?
-                        <Spin/>
+                        <Spin tip="部署大约需要几分钟..."/>
                         :
-                        <Button style={{marginTop: 20}} type='primary' onClick={() => {
+                        <Button style={{margin: '20px 0'}} type='primary' onClick={() => {
                             if (appId && secretID && secretKey) {
                                 this.setState({
                                     disableDeployButton: true