فهرست منبع

移动cloud config 到登录页面

xy 7 سال پیش
والد
کامیت
dc4b7d9871

+ 1 - 1
src/components/app/App.jsx

@@ -10,7 +10,7 @@ import zhCN from 'antd/lib/locale-provider/zh_CN';
 import WechatService from "../wechatService/WechatService";
 import QuantService from "../quantService/QuantService";
 import TrialCase from "../trialCase/TrialCase";
-import Login from "../login/login";
+import Login from "../login/Login";
 import '../common/graphql/index.css';
 import './index.css'
 

+ 0 - 0
src/components/common/config/index.css


+ 25 - 18
src/components/common/config/Config.js → src/components/login/Config.js

@@ -1,14 +1,9 @@
 import React, {Component} from 'react';
 import {Button, Input, Spin, Icon} from 'antd';
 
-import {SHOW_CLOUD, ADD_CLOUD, UPDATE_CLOUD} from "../../gql";
+import {SHOW_CLOUD, ADD_CLOUD, UPDATE_CLOUD} from "../gql";
 import {request} from 'graphql-request'
 
-// 需求:
-// 这个页面不应放在目录上
-// 检测用户是否有该字段
-// 如果没有,页面跳转到此
-
 const idGen = (kind) => {
     return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
 };
@@ -138,10 +133,14 @@ class Config extends Component {
                         <span className='cloud-name'>Tencent: </span>
                         <div style={{marginBottom: 15}}>
                             <div>
-                                ID: <Input style={{width: 250}} value={this.state.tenID}
-                                           onChange={this.inputChange('tenID')}/>
-                                Key: <Input style={{width: 250}} value={this.state.tenKey}
-                                            onChange={this.inputChange('tenKey')}/>
+                                <div>
+                                    ID: <Input style={{width: 250}} value={this.state.tenID}
+                                               onChange={this.inputChange('tenID')}/>
+                                </div>
+                                <div>
+                                    Key: <Input style={{width: 250}} value={this.state.tenKey}
+                                                onChange={this.inputChange('tenKey')}/>
+                                </div>
                                 {
                                     this.state.showOK === 'tencent'?
                                         <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
@@ -159,10 +158,14 @@ class Config extends Component {
                         <span className='cloud-name'>Aliyun: </span>
                         <div style={{marginBottom: 15}}>
                             <div>
-                                ID: <Input style={{width: 250}} value={this.state.aliID}
-                                           onChange={this.inputChange('aliID')}/>
-                                Key: <Input style={{width: 250}} value={this.state.aliKey}
-                                            onChange={this.inputChange('aliKey')}/>
+                                <div>
+                                    ID: <Input style={{width: 250}} value={this.state.aliID}
+                                               onChange={this.inputChange('aliID')}/>
+                                </div>
+                                <div>
+                                    Key: <Input style={{width: 250}} value={this.state.aliKey}
+                                                onChange={this.inputChange('aliKey')}/>
+                                </div>
                                 {
                                     this.state.showOK === 'aliyun'?
                                         <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
@@ -180,10 +183,14 @@ class Config extends Component {
                         <span className='cloud-name'>AWS: </span>
                         <div style={{marginBottom: 15}}>
                             <div>
-                                ID: <Input style={{width: 250}} value={this.state.awsID}
-                                           onChange={this.inputChange('awsID')}/>
-                                Key: <Input style={{width: 250}} value={this.state.awsKey}
-                                            onChange={this.inputChange('awsKey')}/>
+                                <div>
+                                    ID: <Input style={{width: 250}} value={this.state.awsID}
+                                               onChange={this.inputChange('awsID')}/>
+                                </div>
+                                <div>
+                                    Key: <Input style={{width: 250}} value={this.state.awsKey}
+                                                onChange={this.inputChange('awsKey')}/>
+                                </div>
                                 {
                                     this.state.showOK === 'amazon'?
                                         <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a" />

+ 6 - 2
src/components/login/login.js → src/components/login/Login.js

@@ -1,7 +1,7 @@
 import React, {Component} from 'react';
 
 import {Layout, Input, Button, Spin} from 'antd';
-
+import Config from './Config'
 import {ADD_USER, GET_USER, SEARCH_USER} from "../gql";
 import {Mutation} from "react-apollo";
 import axios from 'axios';
@@ -261,6 +261,7 @@ class Login extends Component {
                                                     });
                                                     // cookie.remove('ring-session')
                                                 }}>exit</Button>
+                                                <Config userID={this.state.userID}/>
                                             </div>
                                             :
                                             this.state.loginStatus === 'failed' ?
@@ -283,7 +284,10 @@ class Login extends Component {
                                         this.state.hasRegister ?
                                             <div>ok, login please</div>
                                             :
-                                            this.register()
+                                            this.state.loginStatus === 'logined' ?
+                                                ''
+                                                :
+                                                this.register()
                                     }
                                 </div>
 

+ 0 - 4
src/components/trialCase/TrialCase.jsx

@@ -3,7 +3,6 @@ import {Layout, Menu} from 'antd';
 
 import GenerateJs from "../common/generateJs/GenerateJs";
 import Deploy from '../common/deploy/Deploy';
-import Config from '../common/config/Config';
 import Schema from '../common/schema/Schema';
 import Graphql from "../common/graphql/Graphql";
 import CaseMetabase from "../common/caseMetabase/CaseMetabase";
@@ -61,7 +60,6 @@ class TrialCase extends Component {
                     selectedKeys={[this.state.menuLevel2]}
                 >
                     <Menu.Item key="schema">schema</Menu.Item>
-                    <Menu.Item key="config">config</Menu.Item>
                     <Menu.Item key="deploy">deploy</Menu.Item>
                     <Menu.Item key="graphql">graphql</Menu.Item>
                     <Menu.Item key="graphiql">graphql IDE</Menu.Item>
@@ -76,8 +74,6 @@ class TrialCase extends Component {
                                 switch (this.state.menuLevel2) {
                                     case 'schema':
                                         return <Schema userID={this.state.userID}/>;
-                                    case 'config':
-                                        return <Config userID={this.state.userID}/>;
                                     case 'deploy':
                                         return <Deploy userID={this.state.userID}/>;
                                     case 'graphql':