|
1 | 1 | import React, { PropTypes, Component } from 'react'; |
2 | 2 | import _ from 'lodash'; |
3 | 3 | import withStyles from 'isomorphic-style-loader/lib/withStyles'; |
4 | | -import s from './Login.css'; |
| 4 | +import { |
| 5 | + Col, |
| 6 | + ControlLabel, |
| 7 | + Form, |
| 8 | + FormGroup, |
| 9 | + FormControl, |
| 10 | + Checkbox, |
| 11 | + Button, |
| 12 | +} from 'react-bootstrap'; |
5 | 13 | import Link from '../Link'; |
6 | | -import Button from '../Button'; |
7 | 14 |
|
8 | 15 | class Login extends Component { |
9 | 16 | static propTypes = { |
@@ -36,61 +43,75 @@ class Login extends Component { |
36 | 43 | } |
37 | 44 | this.props.submit(); |
38 | 45 | } |
| 46 | + |
39 | 47 | setInputAccount(event) { |
40 | 48 | this.props.accountInputChange(event.target.value); |
41 | 49 | } |
| 50 | + |
42 | 51 | setInputPassword(event) { |
43 | 52 | this.props.passwordInputChange(event.target.value); |
44 | 53 | } |
| 54 | + |
45 | 55 | render() { |
46 | 56 | return ( |
47 | | - <div className={s.root}> |
48 | | - <div className={s.container}> |
49 | | - <h1>登录</h1> |
50 | | - <div className={s.formGroup}> |
51 | | - <label className={s.label} htmlFor="usernameOrEmail"> |
52 | | - 请输入邮箱地址: |
53 | | - </label> |
54 | | - <input |
55 | | - className={s.input} |
56 | | - onChange={this.setInputAccount} |
57 | | - id="usernameOrEmail" |
58 | | - type="text" |
59 | | - value={this.props.account} |
60 | | - placeholder="请输入邮箱地址" |
61 | | - autoFocus |
| 57 | + <Form style={{ height:600 }} horizontal> |
| 58 | + <br/> |
| 59 | + <FormGroup> |
| 60 | + <Col smOffset={3}> |
| 61 | + <h1>请登录</h1> |
| 62 | + </Col> |
| 63 | + </FormGroup> |
| 64 | + <FormGroup controlId="formHorizontalEmail"> |
| 65 | + <Col componentClass={ControlLabel} sm={3}> |
| 66 | + 邮箱地址 |
| 67 | + </Col> |
| 68 | + <Col sm={4}> |
| 69 | + <FormControl |
| 70 | + onChange={this.setInputAccount} |
| 71 | + value={this.props.account} |
| 72 | + type="email" |
| 73 | + placeholder="请输入邮箱地址" |
| 74 | + autoFocus |
62 | 75 | /> |
63 | | - </div> |
64 | | - <div className={s.formGroup}> |
65 | | - <label className={s.label} htmlFor="password"> |
66 | | - 请输入登录密码: |
67 | | - </label> |
68 | | - <input |
69 | | - className={s.input} |
70 | | - onChange={this.setInputPassword} |
71 | | - id="password" |
72 | | - type="password" |
73 | | - value={this.props.password} |
74 | | - placeholder="请输入登录密码" |
| 76 | + </Col> |
| 77 | + </FormGroup> |
| 78 | + |
| 79 | + <FormGroup controlId="formHorizontalPassword"> |
| 80 | + <Col componentClass={ControlLabel} sm={3}> |
| 81 | + 登录密码 |
| 82 | + </Col> |
| 83 | + <Col sm={4}> |
| 84 | + <FormControl |
| 85 | + onChange={this.setInputPassword} |
| 86 | + value={this.props.password} |
| 87 | + type="password" |
| 88 | + placeholder="请输入登录密码" |
75 | 89 | /> |
76 | | - </div> |
77 | | - <div className={s.formGroup}> |
78 | | - <p className={s.errorTips}>{_.get(this.props, 'error.errorMessage')}</p> |
79 | | - </div> |
80 | | - <div className={s.formGroup}> |
| 90 | + </Col> |
| 91 | + </FormGroup> |
| 92 | + <FormGroup> |
| 93 | + <Col smOffset={3} sm={4} style={{ color:'red' }} > |
| 94 | + {_.get(this.props, 'error.errorMessage')} |
| 95 | + </Col> |
| 96 | + </FormGroup> |
| 97 | + <FormGroup> |
| 98 | + <Col smOffset={3} sm={2}> |
81 | 99 | <Button |
82 | | - style={this.props.isFetching ? { backgroundColor:'grey' } : null } |
83 | 100 | onClick={this.submit} |
84 | | - value="登录" |
85 | | - /> |
86 | | - </div> |
87 | | - <div className={s.registerText}> |
88 | | - <span style={{ float:'left' }}>没有账号?</span> |
89 | | - <Link className={s.registerLink} to="/register">立即注册</Link> |
90 | | - </div> |
91 | | - </div> |
92 | | - </div> |
| 101 | + disabled={this.props.isFetching} |
| 102 | + > |
| 103 | + 登录 |
| 104 | + </Button> |
| 105 | + </Col> |
| 106 | + </FormGroup> |
| 107 | + <FormGroup> |
| 108 | + <Col smOffset={3} sm={4}> |
| 109 | + <span style={{ marginRight:"20px" }}>还没有账号?</span> |
| 110 | + <Link to="/register">立即注册</Link> |
| 111 | + </Col> |
| 112 | + </FormGroup> |
| 113 | + </Form> |
93 | 114 | ); |
94 | 115 | } |
95 | 116 | } |
96 | | -export default withStyles(s)(Login); |
| 117 | +export default Login; |
0 commit comments