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

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

上级 527da337
...@@ -53,11 +53,14 @@ class UCA extends Component { ...@@ -53,11 +53,14 @@ class UCA extends Component {
const onChange = (e) => { const onChange = (e) => {
return this.onChange(e.target.value); return this.onChange(e.target.value);
}; };
const { loading, value, ...rest } = this.props; const { loading, value, style, ...rest } = this.props;
const { width, height } = style || {};
return ( return (
<div style={{ width, height }}>
<Spin spinning={!this.state.ready || loading} size="small"> <Spin spinning={!this.state.ready || loading} size="small">
<Input {...rest} disabled={!this.state.ready || loading} value={this.objToValue(value)} onChange={onChange} type="password" /> <Input {...rest} disabled={!this.state.ready || loading} value={this.objToValue(value)} onChange={onChange} type="password" />
</Spin> </Spin>
</div>
); );
} }
} }
......
...@@ -20,13 +20,18 @@ class AuthInputs extends React.Component { ...@@ -20,13 +20,18 @@ class AuthInputs extends React.Component {
if (data.length > 0) { if (data.length > 0) {
return ( return (
<Input.Group compact> <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>)) data.map(item => (<Select.Option value={item.key} key={item.key}> { item.label } </Select.Option>))
} }
</Select> </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> </Input.Group>
); );
......
...@@ -19,7 +19,9 @@ class LoginForm extends React.Component { ...@@ -19,7 +19,9 @@ class LoginForm extends React.Component {
onUserBlur = (e) => { onUserBlur = (e) => {
const { value } = e.target; const { value } = e.target;
if (value) {
this.props.dispatch({ type: 'login/login', payload: value }); this.props.dispatch({ type: 'login/login', payload: value });
}
}; };
handleSubmit = (e) => { handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
...@@ -173,4 +175,10 @@ const mapStateToProps = ({ login, loading }) => { ...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论