Commit e9d8e007 authored by valleykid's avatar valleykid

Fix @luli reveiw

parent 6d619771
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { findDOMNode } from 'react-dom';
import moment from 'moment'; import moment from 'moment';
import { connect } from 'dva'; import { connect } from 'dva';
import { List, Card, Row, Col, Radio, Input, Progress, Button, Icon, Dropdown, Menu, Avatar, import { List, Card, Row, Col, Radio, Input, Progress, Button, Icon, Dropdown, Menu, Avatar,
...@@ -48,12 +49,14 @@ export default class BasicList extends PureComponent { ...@@ -48,12 +49,14 @@ export default class BasicList extends PureComponent {
}); });
} }
handleDone = () => { handleDone = () => {
setTimeout(() => this.addBtn.blur(), 0);
this.setState({ this.setState({
done: false, done: false,
visible: false, visible: false,
}); });
} }
handleCancel = () => { handleCancel = () => {
setTimeout(() => this.addBtn.blur(), 0);
this.setState({ this.setState({
visible: false, visible: false,
}); });
...@@ -63,6 +66,7 @@ export default class BasicList extends PureComponent { ...@@ -63,6 +66,7 @@ export default class BasicList extends PureComponent {
const { dispatch, form } = this.props; const { dispatch, form } = this.props;
const id = this.state.current ? this.state.current.id : ''; const id = this.state.current ? this.state.current.id : '';
setTimeout(() => this.addBtn.blur(), 0);
form.validateFields((err, fieldsValue) => { form.validateFields((err, fieldsValue) => {
if (err) return; if (err) return;
this.setState({ this.setState({
...@@ -171,7 +175,7 @@ export default class BasicList extends PureComponent { ...@@ -171,7 +175,7 @@ export default class BasicList extends PureComponent {
title="ζ“δ½œζˆεŠŸ" title="ζ“δ½œζˆεŠŸ"
description="δΈ€η³»εˆ—ηš„δΏ‘ζ―ζθΏ°οΌŒεΎˆηŸ­εŒζ ·δΉŸε―δ»₯带标点。" description="δΈ€η³»εˆ—ηš„δΏ‘ζ―ζθΏ°οΌŒεΎˆηŸ­εŒζ ·δΉŸε―δ»₯带标点。"
actions={<Button type="primary" onClick={this.handleDone}>ηŸ₯道了</Button>} actions={<Button type="primary" onClick={this.handleDone}>ηŸ₯道了</Button>}
style={{ width: '100%', marginBottom: '24px' }} className={styles.formResult}
/> />
); );
} }
...@@ -246,7 +250,17 @@ export default class BasicList extends PureComponent { ...@@ -246,7 +250,17 @@ export default class BasicList extends PureComponent {
bodyStyle={{ padding: '0 32px 40px 32px' }} bodyStyle={{ padding: '0 32px 40px 32px' }}
extra={extraContent} extra={extraContent}
> >
<Button type="dashed" style={{ width: '100%', marginBottom: 8 }} icon="plus" onClick={this.showModal}> <Button
type="dashed"
style={{ width: '100%', marginBottom: 8 }}
icon="plus"
onClick={this.showModal}
ref={(component) => {
/* eslint-disable */
this.addBtn = findDOMNode(component);
/* eslint-enable */
}}
>
添加 添加
</Button> </Button>
<List <List
...@@ -274,9 +288,10 @@ export default class BasicList extends PureComponent { ...@@ -274,9 +288,10 @@ export default class BasicList extends PureComponent {
</Card> </Card>
</div> </div>
<Modal <Modal
title={`任劑${this.state.current ? 'ηΌ–θΎ‘' : '添加'}`} title={done ? null : `任劑${this.state.current ? 'ηΌ–θΎ‘' : '添加'}`}
className={styles.standardListForm}
width={640} width={640}
bodyStyle={{ padding: '32px 0 8px' }} bodyStyle={done ? { padding: '72px 0' } : { padding: '28px 0 0' }}
destroyOnClose destroyOnClose
visible={visible} visible={visible}
{...modalFooter} {...modalFooter}
......
...@@ -174,3 +174,22 @@ ...@@ -174,3 +174,22 @@
} }
} }
} }
.standardListForm {
:global {
.ant-form-item {
margin-bottom: 12px;
&:last-child {
padding-top: 4px;
margin-bottom: 32px;
}
}
}
}
.formResult {
width: 100%;
[class^="title"] {
margin-bottom: 8px;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment