diff --git a/src/components/Exception/index.js b/src/components/Exception/index.js index e64a961a2b98d7d3e8400819b3181d020bb60745..d514cf8ce2e031011fd8f93dadc5b485fe6412f4 100644 --- a/src/components/Exception/index.js +++ b/src/components/Exception/index.js @@ -1,40 +1,57 @@ import React, { createElement } from 'react'; -import { injectIntl, FormattedMessage } from 'react-intl'; import classNames from 'classnames'; import { Button } from 'antd'; import config from './typeConfig'; import styles from './index.less'; -const Exception = ({ className, linkElement = 'a', type, title, desc, img, actions, ...rest }) => { - const pageType = type in config ? type : '404'; - const clsString = classNames(styles.exception, className); - return ( -
-
-
-
-
-

{title || config[pageType].title}

-
{desc || config[pageType].desc}
-
- {actions || - createElement( - linkElement, - { - to: '/', - href: '/', - }, - - )} +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 clsString = classNames(styles.exception, className); + return ( +
+
+
+
+
+

{title || config[pageType].title}

+
{desc || config[pageType].desc}
+
+ {actions || + createElement( + linkElement, + { + to: '/', + href: '/', + }, + + )} +
-
- ); -}; + ); + } +} -export default injectIntl(Exception); +export default Excrption; diff --git a/src/locales/en-US.js b/src/locales/en-US.js index a9f37a99fe8483ac14bb8ebab1d78cfc610365ac..63a16bd925d8f397df07f7af0ccabfb6f9b23815 100644 --- a/src/locales/en-US.js +++ b/src/locales/en-US.js @@ -36,7 +36,7 @@ export default { 'menu.account.settings': 'Account Settings', 'menu.account.trigger': 'Trigger Error', '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.total-sales': 'total sales', 'app.analysis.day-sales': 'Day Sales', diff --git a/src/pages/Exception/403.js b/src/pages/Exception/403.js index b1c996e24e9c17baf27a945e28522bc553fee66f..84ee0fdcc0cbcb71bc0f808ff7ee6ccc3a6315d6 100644 --- a/src/pages/Exception/403.js +++ b/src/pages/Exception/403.js @@ -11,6 +11,7 @@ class Exception403 extends Component { desc={formatMessage({ id: 'app.exception.description.403' }, {})} style={{ minHeight: 500, height: '80%' }} linkElement={Link} + backText={formatMessage({ id: 'app.exception.back' })} /> ); } diff --git a/src/pages/Exception/404.js b/src/pages/Exception/404.js index 409fd3a1db3bb1b19a175503289207ddab617787..ebec5032a3275101e68aaf9daeb846510f7cd0e6 100644 --- a/src/pages/Exception/404.js +++ b/src/pages/Exception/404.js @@ -11,6 +11,7 @@ class Exception404 extends Component { desc={formatMessage({ id: 'app.exception.description.404' }, {})} style={{ minHeight: 500, height: '80%' }} linkElement={Link} + backText={formatMessage({ id: 'app.exception.back' })} /> ); } diff --git a/src/pages/Exception/500.js b/src/pages/Exception/500.js index c275e8f5bd17395046616c92a97864ce90306118..e7b36ae0e044da3f0d0290a43ab196aec6ba15ee 100644 --- a/src/pages/Exception/500.js +++ b/src/pages/Exception/500.js @@ -11,6 +11,7 @@ class Exception500 extends Component { desc={formatMessage({ id: 'app.exception.description.500' }, {})} style={{ minHeight: 500, height: '80%' }} linkElement={Link} + backText={formatMessage({ id: 'app.exception.back' })} /> ); }