UserLayout.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import React, { Component, Fragment } from 'react';
  2. import { formatMessage } from 'umi/locale';
  3. import { connect } from 'dva';
  4. import Link from 'umi/link';
  5. import { Icon } from 'antd';
  6. import GlobalFooter from '@/components/GlobalFooter';
  7. import DocumentTitle from 'react-document-title';
  8. import SelectLang from '@/components/SelectLang';
  9. import styles from './UserLayout.less';
  10. import logo from '../assets/logo.svg';
  11. import getPageTitle from '@/utils/getPageTitle';
  12. const links = [
  13. {
  14. key: 'help',
  15. title: formatMessage({ id: 'layout.user.link.help' }),
  16. href: '',
  17. },
  18. {
  19. key: 'privacy',
  20. title: formatMessage({ id: 'layout.user.link.privacy' }),
  21. href: '',
  22. },
  23. {
  24. key: 'terms',
  25. title: formatMessage({ id: 'layout.user.link.terms' }),
  26. href: '',
  27. },
  28. ];
  29. const copyright = (
  30. <Fragment>
  31. Copyright <Icon type="copyright" /> 2018 蚂蚁金服体验技术部出品
  32. </Fragment>
  33. );
  34. class UserLayout extends Component {
  35. componentDidMount() {
  36. const {
  37. dispatch,
  38. route: { routes, authority },
  39. } = this.props;
  40. dispatch({
  41. type: 'menu/getMenuData',
  42. payload: { routes, authority },
  43. });
  44. }
  45. render() {
  46. const {
  47. children,
  48. location: { pathname },
  49. breadcrumbNameMap,
  50. } = this.props;
  51. return (
  52. <DocumentTitle title={getPageTitle(pathname, breadcrumbNameMap)}>
  53. <div className={styles.container}>
  54. <div className={styles.lang}>
  55. <SelectLang />
  56. </div>
  57. <div className={styles.content}>
  58. <div className={styles.top}>
  59. <div className={styles.header}>
  60. <Link to="/">
  61. <img alt="logo" className={styles.logo} src={logo} />
  62. <span className={styles.title}>Ant Design</span>
  63. </Link>
  64. </div>
  65. <div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
  66. </div>
  67. {children}
  68. </div>
  69. <GlobalFooter links={links} copyright={copyright} />
  70. </div>
  71. </DocumentTitle>
  72. );
  73. }
  74. }
  75. export default connect(({ menu: menuModel }) => ({
  76. menuData: menuModel.menuData,
  77. breadcrumbNameMap: menuModel.breadcrumbNameMap,
  78. }))(UserLayout);