提交 368b5931 authored 作者: vipcxj's avatar vipcxj

修复可选多种验证方式的输入控件样式错误

上级 527da337
......@@ -53,11 +53,14 @@ class UCA extends Component {
const onChange = (e) => {
return this.onChange(e.target.value);
};
const { loading, value, ...rest } = this.props;
const { loading, value, style, ...rest } = this.props;
const { width, height } = style || {};
return (
<Spin spinning={!this.state.ready || loading} size="small">
<Input {...rest} disabled={!this.state.ready || loading} value={this.objToValue(value)} onChange={onChange} type="password" />
</Spin>
<div style={{ width, height }}>
<Spin spinning={!this.state.ready || loading} size="small">
<Input {...rest} disabled={!this.state.ready || loading} value={this.objToValue(value)} onChange={onChange} type="password" />
</Spin>
</div>
);
}
}
......
......@@ -20,13 +20,18 @@ class AuthInputs extends React.Component {
if (data.length > 0) {
return (
<Input.Group compact>
<Select value={select} onChange={this.onChange}>
<Select value={select} onChange={this.onChange} style={{ width: '30%' }}>
{
data.map(item => (<Select.Option value={item.key} key={item.key}> { item.label } </Select.Option>))
}
</Select>
{
React.cloneElement(data[this.state.index >= 0 ? this.state.index : 0].node, { value: this.props.value, onChange: this.props.onChange })
React.cloneElement(data[this.state.index >= 0 ? this.state.index : 0].node,
{
value: this.props.value,
onChange: this.props.onChange,
style: { width: '70%' },
})
}
</Input.Group>
);
......
......@@ -19,7 +19,9 @@ class LoginForm extends React.Component {
onUserBlur = (e) => {
const { value } = e.target;
this.props.dispatch({ type: 'login/login', payload: value });
if (value) {
this.props.dispatch({ type: 'login/login', payload: value });
}
};
handleSubmit = (e) => {
e.preventDefault();
......@@ -173,4 +175,10 @@ const mapStateToProps = ({ login, loading }) => {
};
};
export default connect(mapStateToProps)(Form.create()(LoginForm));
export default connect(mapStateToProps)(Form.create({
onValuesChange: (props, values) => {
if (values.userName) {
props.dispatch({ type: 'login/setStatus', payload: 'login' });
}
},
})(LoginForm));
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论