Commit 3928e0d6 authored by ι™ˆεΈ…'s avatar ι™ˆεΈ…

feat:Decoupling component dependency

parent 4fdd2b03
import React, { createElement } from 'react'; import React, { createElement } from 'react';
import { injectIntl, FormattedMessage } from 'react-intl';
import classNames from 'classnames'; import classNames from 'classnames';
import { Button } from 'antd'; import { Button } from 'antd';
import config from './typeConfig'; import config from './typeConfig';
import styles from './index.less'; import styles from './index.less';
const Exception = ({ className, linkElement = 'a', type, title, desc, img, actions, ...rest }) => { class Excrption extends React.PureComponent {
static defaultProps = {
backText: 'back to home',
};
constructor(props) {
super(props);
this.state = {};
}
render() {
const {
className,
backText,
linkElement = 'a',
type,
title,
desc,
img,
actions,
...rest
} = this.props;
const pageType = type in config ? type : '404'; const pageType = type in config ? type : '404';
const clsString = classNames(styles.exception, className); const clsString = classNames(styles.exception, className);
return ( return (
...@@ -27,14 +45,13 @@ const Exception = ({ className, linkElement = 'a', type, title, desc, img, actio ...@@ -27,14 +45,13 @@ const Exception = ({ className, linkElement = 'a', type, title, desc, img, actio
to: '/', to: '/',
href: '/', href: '/',
}, },
<Button type="primary"> <Button type="primary">{backText}</Button>
<FormattedMessage id="app.exception.back" defaultMessage="Back to home" />
</Button>
)} )}
</div> </div>
</div> </div>
</div> </div>
); );
}; }
}
export default injectIntl(Exception); export default Excrption;
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
'menu.account.settings': 'Account Settings', 'menu.account.settings': 'Account Settings',
'menu.account.trigger': 'Trigger Error', 'menu.account.trigger': 'Trigger Error',
'app.home.introduce': 'introduce', 'app.home.introduce': 'introduce',
'app.analysis.test': 'Gongzhuan road No.{no} shop', 'app.analysis.test': 'Gongzhuan No.{no} shop',
'app.analysis.introduce': 'Introduce', 'app.analysis.introduce': 'Introduce',
'app.analysis.total-sales': 'total sales', 'app.analysis.total-sales': 'total sales',
'app.analysis.day-sales': 'Day Sales', 'app.analysis.day-sales': 'Day Sales',
......
...@@ -11,6 +11,7 @@ class Exception403 extends Component { ...@@ -11,6 +11,7 @@ class Exception403 extends Component {
desc={formatMessage({ id: 'app.exception.description.403' }, {})} desc={formatMessage({ id: 'app.exception.description.403' }, {})}
style={{ minHeight: 500, height: '80%' }} style={{ minHeight: 500, height: '80%' }}
linkElement={Link} linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/> />
); );
} }
......
...@@ -11,6 +11,7 @@ class Exception404 extends Component { ...@@ -11,6 +11,7 @@ class Exception404 extends Component {
desc={formatMessage({ id: 'app.exception.description.404' }, {})} desc={formatMessage({ id: 'app.exception.description.404' }, {})}
style={{ minHeight: 500, height: '80%' }} style={{ minHeight: 500, height: '80%' }}
linkElement={Link} linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/> />
); );
} }
......
...@@ -11,6 +11,7 @@ class Exception500 extends Component { ...@@ -11,6 +11,7 @@ class Exception500 extends Component {
desc={formatMessage({ id: 'app.exception.description.500' }, {})} desc={formatMessage({ id: 'app.exception.description.500' }, {})}
style={{ minHeight: 500, height: '80%' }} style={{ minHeight: 500, height: '80%' }}
linkElement={Link} linkElement={Link}
backText={formatMessage({ id: 'app.exception.back' })}
/> />
); );
} }
......
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