index.js 1.98 KB
Newer Older
zhanghaozhe committed
1 2
import React, { Component } from 'react';
import './set-password.scss'
zhanghaozhe committed
3
import { withFormik, Form, Field } from "formik";
zhanghaozhe committed
4 5 6
import PasswordInput from '../common/passwordInput'
import Button from '../common/Button'
import classnames from 'classnames'
zhanghaozhe committed
7
import { compose } from 'redux'
zhanghaozhe committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

class SetPassword extends Component {

    constructor(props) {
        super(props);
        this.state = {
            password: '',
            agree: true
        };
    }


    handleChange = (val) => {
        this.setState({password: val});
    }

    toggleAgree = () => {
        this.setState({agree: !this.state.agree});
    }

    render() {
zhanghaozhe committed
29

zhanghaozhe committed
30 31 32
        return (
            <div className={'set-password'}>
                <p className='title'>密码需要包含6-16位字母及数字</p>
zhanghaozhe committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
                <Form>
                    <Field
                        name='password'
                        render={({field}) => {
                            return (
                                <PasswordInput
                                    placeholder={'设置密码'}
                                    onChange={this.handleChange}
                                    {...field}
                                />
                            )
                        }}
                    />
                    <Button className={'btn-active'}>完成</Button>
                </Form>
zhanghaozhe committed
48 49 50 51 52 53 54 55 56 57 58 59 60
                <p className='user-agreement'>
                    <i className={classnames({
                        'iconfont iconiconfront-3': this.state.agree,
                        disagree: !this.state.agree
                    })} onClick={this.toggleAgree}/>
                    同意<span>《七月在线用户使用协议》</span>
                </p>
                <p className='skip'>跳过</p>
            </div>
        );
    }
}

zhanghaozhe committed
61 62 63 64 65 66 67 68 69 70 71 72
const formikConfig = {
    mapValuesToProps: () => ({
        password: ''
    }),
    handleSubmit: (values) => {

    }
}

export default compose(
    withFormik(formikConfig)
)(SetPassword);