Commit f0ccf032 by zhanghaozhe

验证码登录

parent f5161cb7
......@@ -29,13 +29,6 @@ class WechatLogin extends Component {
}
}
handleClick = () => {
/*setTimeout(() => {
console.log(this.props.errors)
})*/
console.log(this.props.errors)
}
getCaptchaInstance = instance => {
this.setState({
captchaInstance: instance
......@@ -76,28 +69,31 @@ class WechatLogin extends Component {
)}
>
</Field>
<Field
type='number'
name='veriCode'
render={({field}) => (
<VeriCodeInput
{...field}
className={'verification'}
icon={<i className={'iconfont iconduanxin'}
style={{fontSize: '20px', left: '12px'}}
/>}
tel={values.tel}
challenge={this.state.validate}
errors={errors}
placeholder={'请输入验证码'}
instance={this.state.captchaInstance}
/>
)}
/>
{
this.state.validate &&
<Field
type='number'
name='veriCode'
render={({field}) => (
<VeriCodeInput
{...field}
className={'verification'}
icon={<i className={'iconfont iconduanxin'}
style={{fontSize: '20px', left: '12px'}}
/>}
tel={values.tel}
challenge={this.state.validate}
errors={errors}
placeholder={'请输入验证码'}
instance={this.state.captchaInstance}
/>
)}
/>
}
<Captcha getInstance={this.getCaptchaInstance}
onVerify={this.onVerify}
/>
<LoginButton onClick={this.handleClick} active={values.tel && values.veriCode && isEmpty(errors)}/>
<LoginButton active={values.tel && values.veriCode && isEmpty(errors)}/>
</Form>
<LoginWays onClick={this.loginWaysClick} loginWays={loginWays}/>
......@@ -118,7 +114,7 @@ const FormikConfig = {
}).then(res => {
if (res.hasError) {
Toast.info(res.msg);
}else {
} else {
let state = props.location.state || {from: {pathname: '/'}}
props.history.replace(state.from)
......@@ -139,7 +135,6 @@ const FormikConfig = {
}
export default compose(
connect(
null,
{quickLogin}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment