|
|
@ -2,6 +2,7 @@ import React, { Component } from 'react'
|
|
|
|
import { PropTypes, connect } from '../../family'
|
|
|
|
import { PropTypes, connect } from '../../family'
|
|
|
|
import { login } from '../../actions/account'
|
|
|
|
import { login } from '../../actions/account'
|
|
|
|
import { Link } from 'react-router-dom'
|
|
|
|
import { Link } from 'react-router-dom'
|
|
|
|
|
|
|
|
import { serve } from '../../config'
|
|
|
|
import Mock from 'mockjs'
|
|
|
|
import Mock from 'mockjs'
|
|
|
|
import './LoginForm.css'
|
|
|
|
import './LoginForm.css'
|
|
|
|
|
|
|
|
|
|
|
@ -16,6 +17,8 @@ const mockUser = process.env.NODE_ENV === 'development'
|
|
|
|
password: ''
|
|
|
|
password: ''
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mockUser.captchaId = Date.now()
|
|
|
|
|
|
|
|
|
|
|
|
// 展示组件
|
|
|
|
// 展示组件
|
|
|
|
class LoginForm extends Component {
|
|
|
|
class LoginForm extends Component {
|
|
|
|
static contextTypes = {
|
|
|
|
static contextTypes = {
|
|
|
@ -44,14 +47,19 @@ class LoginForm extends Component {
|
|
|
|
<label>密码:</label>
|
|
|
|
<label>密码:</label>
|
|
|
|
<input value={this.state.password} type='password' onChange={e => this.setState({ password: e.target.value })} className='form-control' placeholder='Password' required />
|
|
|
|
<input value={this.state.password} type='password' onChange={e => this.setState({ password: e.target.value })} className='form-control' placeholder='Password' required />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className='form-group'>
|
|
|
|
|
|
|
|
<label>验证码:</label>
|
|
|
|
|
|
|
|
<input onChange={e => this.setState({ captcha: e.target.value })} className='form-control' placeholder='验证码' required />
|
|
|
|
|
|
|
|
<img src={`${serve}/captcha?t=${this.state.captchaId || ''}`} onClick={e => this.setState({ captchaId: Date.now() })} alt="captcha"/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='footer'>
|
|
|
|
<div className='footer'>
|
|
|
|
<button type='submit' className='btn btn-primary w140 mr20'>提交</button>
|
|
|
|
<button type='submit' className='btn btn-primary w140 mr20'>提交</button>
|
|
|
|
<Link to='/account/register'>注册</Link>
|
|
|
|
<Link to='/account/register'>注册</Link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{this.props.auth.errMsg &&
|
|
|
|
{this.props.auth.message &&
|
|
|
|
<div className='alert alert-danger fade show' role='alert'>
|
|
|
|
<div className='alert alert-danger fade show' role='alert'>
|
|
|
|
{this.props.auth.errMsg}
|
|
|
|
{this.props.auth.message}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|