diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 0f17b4ecf2fb9718f67dd28c92a40e17b997fe9f..4fcdac680e46ab593c28dab791b01615f87833a0 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -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); diff --git a/src/routes/Forms/AdvancedForm.js b/src/routes/Forms/AdvancedForm.js index 94bc3c54712d1254074e1ad71c85e0a4f342f097..5b5f03a12e25a71de9995d84511756234fad23f2 100644 --- a/src/routes/Forms/AdvancedForm.js +++ b/src/routes/Forms/AdvancedForm.js @@ -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)); diff --git a/src/routes/Forms/StepForm/Step1.js b/src/routes/Forms/StepForm/Step1.js index 5082c1a31c428b8dc88975687e36fb57d685df82..03062009d2fe6435f9d8122a229ee1c4644d1b5d 100644 --- a/src/routes/Forms/StepForm/Step1.js +++ b/src/routes/Forms/StepForm/Step1.js @@ -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); diff --git a/src/routes/Forms/StepForm/Step3.js b/src/routes/Forms/StepForm/Step3.js index 9a8d6d46cc92a7aa57881a1c9f83511c35b24560..196e0155d8b7ef36697ca6a06cce3502c4b9be23 100644 --- a/src/routes/Forms/StepForm/Step3.js +++ b/src/routes/Forms/StepForm/Step3.js @@ -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);