|
|
@@ -1,6 +1,6 @@
|
|
|
import React, {Component} from 'react';
|
|
|
|
|
|
-import {Layout, Input, Button, Spin} from 'antd';
|
|
|
+import {Input, Button, Spin, Icon} from 'antd';
|
|
|
import {ADD_USER, GET_USER, SEARCH_USER} from "../gql";
|
|
|
import {Mutation} from "react-apollo";
|
|
|
import axios from 'axios';
|
|
|
@@ -13,7 +13,7 @@ import {setCookie} from "../cookie";
|
|
|
|
|
|
axios.defaults.withCredentials = true;
|
|
|
|
|
|
-const {Content} = Layout;
|
|
|
+
|
|
|
const idGen = (kind) => {
|
|
|
return kind + '_' + Date.now() + '_' + Math.random().toString().slice(-8);
|
|
|
};
|
|
|
@@ -212,108 +212,100 @@ class LoginInput extends Component {
|
|
|
render() {
|
|
|
return (
|
|
|
<div>
|
|
|
- <Layout style={{padding: '24px', zIndex: '0'}}>
|
|
|
- <Content style={{padding: '24px', minHeight: 280, background: '#fff'}}>
|
|
|
- {
|
|
|
+ <div className='login'>
|
|
|
+ {
|
|
|
+ this.state.hasLogin ?
|
|
|
+ this.state.loginOnce ?
|
|
|
+ this.login()
|
|
|
+ :
|
|
|
+ ''
|
|
|
+ :
|
|
|
+ <div>
|
|
|
+ <span style={{marginRight: 20}}><b>login:</b></span>
|
|
|
+ <div style={{marginTop: 10}}>
|
|
|
+ <span>username: </span>
|
|
|
+ <Input
|
|
|
+ placeholder=""
|
|
|
+ onChange={(e) => {
|
|
|
+ e.persist();
|
|
|
+ this.setState({login_username: e.target.value});
|
|
|
+ }}
|
|
|
+ style={{width: 200}}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div style={{marginTop: 10}}>
|
|
|
+ <span>password: </span>
|
|
|
+ <Input
|
|
|
+ placeholder=""
|
|
|
+ onChange={(e) => {
|
|
|
+ e.persist();
|
|
|
+ this.setState({login_password: e.target.value});
|
|
|
+ }}
|
|
|
+ style={{width: 200}}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <Button type='primary' onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ hasLogin: true
|
|
|
+ })
|
|
|
+ }}>ok</Button>
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+ {
|
|
|
+ this.state.loginStatus === 'logined' ?
|
|
|
<div>
|
|
|
- <div className='login'>
|
|
|
- {
|
|
|
- this.state.hasLogin ?
|
|
|
- this.state.loginOnce ?
|
|
|
- this.login()
|
|
|
- :
|
|
|
- ''
|
|
|
- :
|
|
|
- <div>
|
|
|
- <span style={{marginRight: 20}}><b>login:</b></span>
|
|
|
- <div style={{marginTop: 10}}>
|
|
|
- <span>username: </span>
|
|
|
- <Input
|
|
|
- placeholder=""
|
|
|
- onChange={(e) => {
|
|
|
- e.persist();
|
|
|
- this.setState({login_username: e.target.value});
|
|
|
- }}
|
|
|
- style={{width: 200}}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div style={{marginTop: 10}}>
|
|
|
- <span>password: </span>
|
|
|
- <Input
|
|
|
- placeholder=""
|
|
|
- onChange={(e) => {
|
|
|
- e.persist();
|
|
|
- this.setState({login_password: e.target.value});
|
|
|
- }}
|
|
|
- style={{width: 200}}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <Button type='primary' onClick={() => {
|
|
|
- this.setState({
|
|
|
- hasLogin: true
|
|
|
- })
|
|
|
- }}>ok</Button>
|
|
|
- </div>
|
|
|
- }
|
|
|
- {
|
|
|
- this.state.loginStatus === 'logined' ?
|
|
|
- <div>
|
|
|
<span
|
|
|
style={{marginRight: '10px'}}>welcome, {this.state.nickname}</span>
|
|
|
- <Button onClick={() => {
|
|
|
- this.setState({
|
|
|
- hasLogin: false,
|
|
|
- loginStatus: '',
|
|
|
- loginOnce: true
|
|
|
- });
|
|
|
- // cookie.remove('ring-session')
|
|
|
- }}>exit</Button>
|
|
|
- <div style={{marginTop: 20}}>
|
|
|
- <Button type="primary" style={{marginRight: 10}} onClick={() => {
|
|
|
- this.props.history.push({
|
|
|
- pathname: '/login/account',
|
|
|
- })
|
|
|
- }}>user setting</Button>
|
|
|
- <Button type="primary" onClick={() => {
|
|
|
- this.props.history.push({
|
|
|
- pathname: '/login/cloud',
|
|
|
- })
|
|
|
- }}>cloud setting</Button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- :
|
|
|
- this.state.loginStatus === 'failed' ?
|
|
|
- <div>
|
|
|
- <span style={{marginRight: '10px'}}>login failed</span>
|
|
|
- <Button onClick={() => {
|
|
|
- this.setState({
|
|
|
- hasLogin: false,
|
|
|
- loginStatus: '',
|
|
|
- loginOnce: true
|
|
|
- })
|
|
|
- }}>relogin</Button>
|
|
|
- </div>
|
|
|
- :
|
|
|
- ''
|
|
|
- }
|
|
|
- </div>
|
|
|
- <div className='register' style={{marginTop: 20}}>
|
|
|
- {
|
|
|
- this.state.hasRegister ?
|
|
|
- <div>ok, login please</div>
|
|
|
- :
|
|
|
- this.state.loginStatus === 'logined' ?
|
|
|
- ''
|
|
|
- :
|
|
|
- this.register()
|
|
|
- }
|
|
|
+ <Button onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ hasLogin: false,
|
|
|
+ loginStatus: '',
|
|
|
+ loginOnce: true
|
|
|
+ });
|
|
|
+ // cookie.remove('ring-session')
|
|
|
+ }}>exit</Button>
|
|
|
+ <div style={{marginTop: 20}}>
|
|
|
+ <Button type="primary" style={{marginRight: 10}} onClick={() => {
|
|
|
+ this.props.history.push({
|
|
|
+ pathname: '/login/account',
|
|
|
+ })
|
|
|
+ }}>user setting</Button>
|
|
|
+ <Button type="primary" onClick={() => {
|
|
|
+ this.props.history.push({
|
|
|
+ pathname: '/login/cloud',
|
|
|
+ })
|
|
|
+ }}>cloud setting</Button>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
- }
|
|
|
- </Content>
|
|
|
- </Layout>
|
|
|
+ :
|
|
|
+ this.state.loginStatus === 'failed' ?
|
|
|
+ <div>
|
|
|
+ <span style={{marginRight: '10px'}}>login failed</span>
|
|
|
+ <Button onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ hasLogin: false,
|
|
|
+ loginStatus: '',
|
|
|
+ loginOnce: true
|
|
|
+ })
|
|
|
+ }}>relogin</Button>
|
|
|
+ </div>
|
|
|
+ :
|
|
|
+ ''
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ <div className='register' style={{marginTop: 20}}>
|
|
|
+ {
|
|
|
+ this.state.hasRegister ?
|
|
|
+ <div>ok, login please</div>
|
|
|
+ :
|
|
|
+ this.state.loginStatus === 'logined' ?
|
|
|
+ ''
|
|
|
+ :
|
|
|
+ this.register()
|
|
|
+ }
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
)
|
|
|
}
|
|
|
}
|