in src/components/Login/LoginItem.js [71:120]
render() {
const { form } = this.context;
const { getFieldDecorator } = form;
const options = {};
let otherProps = {};
const { onChange, defaultValue, rules, name, ...restProps } =
this.props;
const { count } = this.state;
options.rules = rules || defaultRules;
if (onChange) {
options.onChange = onChange;
}
if (defaultValue) {
options.initialValue = defaultValue;
}
otherProps = restProps || otherProps;
if (type === "Captcha") {
const inputProps = omit(otherProps, ["onGetCaptcha"]);
return (
<FormItem>
<Row gutter={8}>
<Col span={16}>
{getFieldDecorator(
name,
options,
)(<WrappedComponent {...defaultProps} {...inputProps} />)}
</Col>
<Col span={8}>
<Button
disabled={count}
className={styles.getCaptcha}
size="large"
onClick={this.onGetCaptcha}
>
{count ? `${count} s` : "获取验证码"}
</Button>
</Col>
</Row>
</FormItem>
);
}
return (
<FormItem>
{getFieldDecorator(
name,
options,
)(<WrappedComponent {...defaultProps} {...otherProps} />)}
</FormItem>
);
}