import React, { Component } from 'react'; import { connect } from 'react-redux'; import { Picker, DatePicker } from 'antd-mobile'; import 'antd-mobile/dist/antd-mobile.less'; import styles from './index.less'; import router from 'umi/router'; import { formatDatetime, getQueryVariableBy } from '../../../utils/helper'; const CustomChildren = props => { return (
{props.extra}
); }; const photo = require('../assets/register/photo.png'); @connect(({ authentication }) => ({ authentication })) class Index extends Component { constructor(props) { super(props); this.state = { needKennel: false, }; } componentWillMount = () => { const { id } = this.props.authentication; if (!id) { this.props.dispatch({ type: 'authentication/info', payload: {}, }); } }; componentDidMount = () => { let needKennel = getQueryVariableBy(window.location.href, 'needKennel'); if (needKennel === 1 || needKennel === '1') { this.setState({ needKennel: true, }); } }; componentWillUnmount() { // this.props.dispatch({ // type: 'authentication/clearState', // payload: {}, // }); } onChangeText = type => e => { this.props.dispatch({ type: 'authentication/updateState', payload: { [type]: e.target.value, }, }); }; onChangeAddressText = type => e => { this.props.dispatch({ type: 'authentication/updateAddressState', payload: { [type]: e.target.value, }, }); }; onChangePicker = type => v => { let value = null; if (v instanceof Date) { value = formatDatetime(v, 'YYYY-MM-DD'); } else { value = v[0]; } this.props.dispatch({ type: 'authentication/updateState', payload: { [type]: value, }, }); }; submit = () => { this.props.dispatch({ type: 'authentication/save', payload: {}, }); }; render() { const { avatar, nickName, gender, birthday, memberName, cardNo, address, kennelNameCn, kennelNameEn, kennelFciName, kennelFciNameBackup, memberType, authentication, } = this.props.authentication; const { needKennel } = this.state; return (
会员信息
头像
昵称
性别
生日
{authentication === '1' ? '真实姓名' : '真实姓名'}
{authentication === '1' ? (
{memberName}
) : ( )}
{authentication === '1' ? '身份证' : '身份证'}
{authentication === '1' ? (
已认证
) : ( )}
{memberType === '20' || memberType === 20 || needKennel ? (
犬舍中文名
犬舍英文名
FCI英文名
FCI备用名
) : null}
收货地址
{ router.push('/ckuh5/authentication/locationPicker'); }} className={`${styles.select} ${address.area ? null : styles.placeholder}`} > {address.area ? address.province + address.city + address.area : '请添加收货地址'}
详细地址
完成
); } } export default Index;