Explorar o código

add something

kulley %!s(int64=7) %!d(string=hai) anos
pai
achega
4bc936eee4
Modificáronse 2 ficheiros con 88 adicións e 78 borrados
  1. 8 3
      src/app/basicVersion/caseShow/UserCustom.js
  2. 80 75
      src/login/LoginInput.js

+ 8 - 3
src/app/basicVersion/caseShow/UserCustom.js

@@ -47,6 +47,7 @@ class UserCustom extends Component {
     deploy = () => {
         this._isMounted = true;
         let _this = this;
+        console.log('props', this.props);
         let {userID, dbKind, bucketName, customName} = this.state;
         let {cloudID} = this.cloudState;
 
@@ -183,7 +184,6 @@ class UserCustom extends Component {
                                     });
                                 }
 
-                                _this.props.changeTabBar('my-deploy');
                                 _this.props.history.push({
                                     pathname: `/common/deploy`,
                                     state: {
@@ -239,13 +239,18 @@ class UserCustom extends Component {
                             value={customName}
                             onChange={(e) => {
                                 this.setState({customName: e.target.value})
-                            }}/>
+                            }}
+                        />
+                        {
+                            customName===''?
+                                <span style={{color: 'orange'}}>不能为空</span>:''
+                        }
                     </div>
                 </div>
                 <div style={{marginTop: 20}}>
                     <div className={'schema-name'}><FormattedMessage id='Cloud Setting'/></div>
                     <p><Link to="/common/communication">阿里云、华为云、亚马逊请联系我们</Link></p>
-                    <p style={{color: 'red'}}>该项配置填写错误将导致部署失败,你也可以忽略此项配置!</p>
+                    <p style={{color: 'orange'}}>该项配置填写错误将导致部署失败,你也可以忽略此项配置!</p>
                     <br/>
                     <RadioGroup
                         onChange={(e) => {

+ 80 - 75
src/login/LoginInput.js

@@ -33,15 +33,15 @@ class LoginInput extends Component {
             login_password: '',
             loginStatus: '',
             loginOnce: true,
-            usernameTip: false
+            usernameTip: false,
+            login_success: false
         }
     }
 
     login = () => {
         let _this = this;
         // let loginUrl = `http://localhost:8999/login`;
-
-        if (this.state.login_username !== '' && this.state.login_password !== '' ) {
+        if (this.state.login_username !== '' && this.state.login_password !== '') {
             axios.post(loginUrl, {
                 'user-name': this.state.login_username,
                 password: this.state.login_password
@@ -54,15 +54,18 @@ class LoginInput extends Component {
                     });
                     setCookie("user_id", res.data);
                     _this.props.getUserId(res.data);
-                    request(graphqlUrl, GET_USER, {id: res.data}).then(data => {
-                            if (this._isMounted) {
-                                this.setState({
-                                    avatar: data.user_by_id.avatar,
-                                    nickname: data.user_by_id.nickname
-                                })
-                            }
-                        }
-                    )
+
+                    _this.props.history.push({
+                        pathname: '/'
+                    });
+
+                    // request(graphqlUrl, GET_USER, {id: res.data}).then(data => {
+                    //         _this.setState({
+                    //             avatar: data.user_by_id.avatar,
+                    //             nickname: data.user_by_id.nickname
+                    //         });
+                    //     }
+                    // )
                 })
                 .catch((err) => {
                     _this.setState({
@@ -84,7 +87,8 @@ class LoginInput extends Component {
 
                     return (
                         <div>
-                            <span style={{marginRight: 20,color: '#1385e5'}} className='login-title'><b><FormattedMessage id="register"/>:</b></span>
+                            <span style={{marginRight: 20, color: '#1385e5'}}
+                                  className='login-title'><b><FormattedMessage id="register"/>:</b></span>
                             <div style={{marginTop: 15}}>
                                 <span className='login-item'><FormattedMessage id="username"/>: </span>
                                 <Input
@@ -126,54 +130,54 @@ class LoginInput extends Component {
                                 />
                             </div>
                             <Button type='primary'
-                                    style={{margin:'10px 0'}}
+                                    style={{margin: '10px 0'}}
                                     onClick={() => {
-                                request(graphqlUrl, SEARCH_USER, {username: this.state.register_username}).then(data => {
-                                    if (data.user_by_props.length === 0) {
-                                        let id = idGen('user');
-                                        let _this = this;
-                                        create_user({
-                                            variables: {
-                                                id,
-                                                email: '',
-                                                updatedAt: '',
-                                                password: '',
-                                                telephone: '',
-                                                nickname: this.state.register_nickname,
-                                                username: this.state.register_username,
-                                                createdAt: new Date().getTime(),
-                                                openid: '',
-                                                avatar: ''
-                                            }
-                                        });
-                                        axios.post(registerUrl,
-                                            {
-                                                'user-id': id,
-                                                password: this.state.register_password,
-                                                token: 'WXgraphql4Io'
-                                            })
-                                            .then(function (response) {
-                                                if (response.status === 200)
-                                                    _this.setState({
-                                                        hasRegister: true
+                                        request(graphqlUrl, SEARCH_USER, {username: this.state.register_username}).then(data => {
+                                            if (data.user_by_props.length === 0) {
+                                                let id = idGen('user');
+                                                let _this = this;
+                                                create_user({
+                                                    variables: {
+                                                        id,
+                                                        email: '',
+                                                        updatedAt: '',
+                                                        password: '',
+                                                        telephone: '',
+                                                        nickname: this.state.register_nickname,
+                                                        username: this.state.register_username,
+                                                        createdAt: new Date().getTime(),
+                                                        openid: '',
+                                                        avatar: ''
+                                                    }
+                                                });
+                                                axios.post(registerUrl,
+                                                    {
+                                                        'user-id': id,
+                                                        password: this.state.register_password,
+                                                        token: 'WXgraphql4Io'
                                                     })
-                                            })
-                                            .catch(function (error) {
-                                                console.log(error);
-                                            });
-                                    } else {
-                                        this.setState({
-                                            usernameTip: true
+                                                    .then(function (response) {
+                                                        if (response.status === 200)
+                                                            _this.setState({
+                                                                hasRegister: true
+                                                            })
+                                                    })
+                                                    .catch(function (error) {
+                                                        console.log(error);
+                                                    });
+                                            } else {
+                                                this.setState({
+                                                    usernameTip: true
+                                                });
+                                                setTimeout(() => {
+                                                    this.setState({
+                                                        usernameTip: false
+                                                    });
+                                                }, 1500)
+                                            }
                                         });
-                                        setTimeout(() => {
-                                            this.setState({
-                                                usernameTip: false
-                                            });
-                                        }, 1500)
-                                    }
-                                });
 
-                            }}>ok</Button>
+                                    }}>ok</Button>
                         </div>
                     );
                 }}
@@ -190,11 +194,11 @@ class LoginInput extends Component {
                 if (res.data !== '') {
                     setCookie("user_id", res.data);
                     _this.setState({
-                            userID: res.data,
-                            hasLogin: true,
-                            loginOnce: false,
-                            loginStatus: 'logined'
-                        }, () => {
+                        userID: res.data,
+                        hasLogin: true,
+                        loginOnce: false,
+                        loginStatus: 'logined'
+                    }, () => {
                         request(graphqlUrl, GET_USER, {id: res.data}).then(data => {
                                 if (this._isMounted) {
                                     this.setState({
@@ -228,7 +232,8 @@ class LoginInput extends Component {
                                 ''
                             :
                             <div>
-                                <span style={{marginRight: 20,color: '#1385e5'}} className='login-title'><b><FormattedMessage id="login"/>:</b></span>
+                                <span style={{marginRight: 20, color: '#1385e5'}}
+                                      className='login-title'><b><FormattedMessage id="login"/>:</b></span>
                                 <div style={{marginTop: 10}}>
                                     <span className='login-item'><FormattedMessage id="username"/>: </span>
                                     <Input
@@ -252,12 +257,12 @@ class LoginInput extends Component {
                                     />
                                 </div>
                                 <Button type='primary'
-                                        style={{margin:'10px 0'}}
+                                        style={{margin: '10px 0'}}
                                         onClick={() => {
-                                    this.setState({
-                                        hasLogin: true
-                                    })
-                                }}>ok</Button>
+                                            this.setState({
+                                                hasLogin: true
+                                            })
+                                        }}>ok</Button>
                             </div>
                     }
                     {
@@ -292,14 +297,14 @@ class LoginInput extends Component {
                                 <div>
                                     <span style={{marginRight: '10px'}}><FormattedMessage id="login failed"/></span>
                                     <Button
-                                        style={{margin:'10px 0'}}
+                                        style={{margin: '10px 0'}}
                                         onClick={() => {
-                                        this.setState({
-                                            hasLogin: false,
-                                            loginStatus: '',
-                                            loginOnce: true
-                                        })
-                                    }}><FormattedMessage id="relogin"/></Button>
+                                            this.setState({
+                                                hasLogin: false,
+                                                loginStatus: '',
+                                                loginOnce: true
+                                            })
+                                        }}><FormattedMessage id="relogin"/></Button>
                                 </div>
                                 :
                                 ''