Commit 0196493a authored by KJlmfe's avatar KJlmfe Committed by 偏右

refactor: connect,Form.create use decorator

parent 784d71e2
......@@ -88,7 +88,13 @@ enquireScreen(b => {
isMobile = b;
});
class BasicLayout extends React.PureComponent {
@connect(({ user, global = {}, loading }) => ({
currentUser: user.currentUser,
collapsed: global.collapsed,
fetchingNotices: loading.effects['global/fetchNotices'],
notices: global.notices,
}))
export default class BasicLayout extends React.PureComponent {
static childContextTypes = {
location: PropTypes.object,
breadcrumbNameMap: PropTypes.object,
......@@ -301,10 +307,3 @@ class BasicLayout extends React.PureComponent {
);
}
}
export default connect(({ user, global = {}, loading }) => ({
currentUser: user.currentUser,
collapsed: global.collapsed,
fetchingNotices: loading.effects['global/fetchNotices'],
notices: global.notices,
}))(BasicLayout);
......@@ -57,7 +57,12 @@ const tableData = [
},
];
class AdvancedForm extends PureComponent {
@connect(({ global, loading }) => ({
collapsed: global.collapsed,
submitting: loading.effects['form/submitAdvancedForm'],
}))
@Form.create()
export default class AdvancedForm extends PureComponent {
render() {
const { form, dispatch, submitting } = this.props;
const { getFieldDecorator, validateFieldsAndScroll, getFieldsError } = form;
......@@ -277,8 +282,3 @@ class AdvancedForm extends PureComponent {
);
}
}
export default connect(({ global, loading }) => ({
collapsed: global.collapsed,
submitting: loading.effects['form/submitAdvancedForm'],
}))(Form.create()(AdvancedForm));
......@@ -15,8 +15,11 @@ const formItemLayout = {
},
};
@connect(({ form }) => ({
data: form.step,
}))
@Form.create()
class Step1 extends React.PureComponent {
export default class Step1 extends React.PureComponent {
render() {
const { form, dispatch, data } = this.props;
const { getFieldDecorator, validateFields } = form;
......@@ -108,7 +111,3 @@ class Step1 extends React.PureComponent {
);
}
}
export default connect(({ form }) => ({
data: form.step,
}))(Step1);
......@@ -5,7 +5,10 @@ import { routerRedux } from 'dva/router';
import Result from 'components/Result';
import styles from './style.less';
class Step3 extends React.PureComponent {
@connect(({ form }) => ({
data: form.step,
}))
export default class Step3 extends React.PureComponent {
render() {
const { dispatch, data } = this.props;
const onFinish = () => {
......@@ -67,7 +70,3 @@ class Step3 extends React.PureComponent {
);
}
}
export default connect(({ form }) => ({
data: form.step,
}))(Step3);
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