Commit f0ccf032 by zhanghaozhe

验证码登录

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