UserLayout.js 2.23 KB
Newer Older
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
1
import React, { Component, Fragment } from 'react';
2
import { formatMessage } from 'umi-plugin-react/locale';
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
3
import { connect } from 'dva';
zinkey's avatar
zinkey committed
4
import Link from 'umi/link';
5
import { Icon } from 'antd';
6
import GlobalFooter from '@/components/GlobalFooter';
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
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';
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
11
import getPageTitle from '@/utils/getPageTitle';
xiaohu's avatar
xiaohu committed
12

jim's avatar
jim committed
13 14 15
const links = [
  {
    key: 'help',
16
    title: formatMessage({ id: 'layout.user.link.help' }),
jim's avatar
jim committed
17 18 19 20
    href: '',
  },
  {
    key: 'privacy',
21
    title: formatMessage({ id: 'layout.user.link.privacy' }),
jim's avatar
jim committed
22 23 24 25
    href: '',
  },
  {
    key: 'terms',
26
    title: formatMessage({ id: 'layout.user.link.terms' }),
jim's avatar
jim committed
27 28 29
    href: '',
  },
];
30

jim's avatar
jim committed
31 32 33 34 35
const copyright = (
  <Fragment>
    Copyright <Icon type="copyright" /> 2018 ่š‚่š้‡‘ๆœไฝ“้ชŒๆŠ€ๆœฏ้ƒจๅ‡บๅ“
  </Fragment>
);
36

้™ˆๅธ…'s avatar
้™ˆๅธ… committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
class UserLayout extends Component {
  componentDidMount() {
    const {
      dispatch,
      route: { routes, authority },
    } = this.props;
    dispatch({
      type: 'menu/getMenuData',
      payload: { routes, authority },
    });
  }

  render() {
    const {
      children,
      location: { pathname },
      breadcrumbNameMap,
    } = this.props;
    return (
      <DocumentTitle title={getPageTitle(pathname, breadcrumbNameMap)}>
        <div className={styles.container}>
          <div className={styles.lang}>
            <SelectLang />
          </div>
          <div className={styles.content}>
            <div className={styles.top}>
              <div className={styles.header}>
                <Link to="/">
                  <img alt="logo" className={styles.logo} src={logo} />
                  <span className={styles.title}>Ant Design</span>
                </Link>
              </div>
              <div className={styles.desc}>Ant Design ๆ˜ฏ่ฅฟๆน–ๅŒบๆœ€ๅ…ทๅฝฑๅ“ๅŠ›็š„ Web ่ฎพ่ฎก่ง„่Œƒ</div>
            </div>
            {children}
          </div>
          <GlobalFooter links={links} copyright={copyright} />
74
        </div>
้™ˆๅธ…'s avatar
้™ˆๅธ… committed
75 76 77 78
      </DocumentTitle>
    );
  }
}
79

้™ˆๅธ…'s avatar
้™ˆๅธ… committed
80 81 82 83
export default connect(({ menu: menuModel }) => ({
  menuData: menuModel.menuData,
  breadcrumbNameMap: menuModel.breadcrumbNameMap,
}))(UserLayout);