UserLayout.js 2.44 KB
Newer Older
陈帅's avatar
陈帅 committed
1
import React, { Fragment } from 'react';
xiaohu's avatar
xiaohu committed
2
import { Link } from 'dva/router';
愚道's avatar
愚道 committed
3
// import DocumentTitle from 'react-document-title';
4
import { Icon } from 'antd';
愚道's avatar
愚道 committed
5
import GlobalFooter from '../../components/GlobalFooter';
6
import styles from './UserLayout.less';
愚道's avatar
愚道 committed
7
import logo from '../../assets/logo.svg';
xiaohu's avatar
xiaohu committed
8 9 10

// TODO:remove
// import { getRoutes, getPageQuery, getQueryPath } from '../utils/utils';
11

jim's avatar
jim committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
const links = [
  {
    key: 'help',
    title: '帮助',
    href: '',
  },
  {
    key: 'privacy',
    title: '隐私',
    href: '',
  },
  {
    key: 'terms',
    title: '条款',
    href: '',
  },
];
29

jim's avatar
jim committed
30 31 32 33 34
const copyright = (
  <Fragment>
    Copyright <Icon type="copyright" /> 2018 蚂蚁金服体验技术部出品
  </Fragment>
);
xiaohu's avatar
xiaohu committed
35 36 37 38 39 40 41 42
// TODO:remove
// function getLoginPathWithRedirectPath() {
//   const params = getPageQuery();
//   const { redirect } = params;
//   return getQueryPath('/user/login', {
//     redirect,
//   });
// }
43

44
class UserLayout extends React.PureComponent {
愚道's avatar
愚道 committed
45 46 47 48 49 50 51 52 53 54
  // TODO title
  // getPageTitle() {
  //   const { routerData, location } = this.props;
  //   const { pathname } = location;
  //   let title = 'Ant Design Pro';
  //   if (routerData[pathname] && routerData[pathname].name) {
  //     title = `${routerData[pathname].name} - Ant Design Pro`;
  //   }
  //   return title;
  // }
陈帅's avatar
陈帅 committed
55

56
  render() {
xiaohu's avatar
xiaohu committed
57
    const { children } = this.props;
58
    return (
愚道's avatar
愚道 committed
59 60 61 62 63 64 65 66 67
      // TODO <DocumentTitle title={this.getPageTitle()}>
      <div className={styles.container}>
        <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>
68
            </div>
愚道's avatar
愚道 committed
69 70 71 72
            <div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
          </div>
          {children}
          {/* <Switch>
jim's avatar
jim committed
73 74 75 76 77 78 79 80
              {getRoutes(match.path, routerData).map(item => (
                <Route
                  key={item.key}
                  path={item.path}
                  component={item.component}
                  exact={item.exact}
                />
              ))}
81
              <Redirect from="/user" to={getLoginPathWithRedirectPath()} />
xiaohu's avatar
xiaohu committed
82
            </Switch> */}
83
        </div>
愚道's avatar
愚道 committed
84 85 86
        <GlobalFooter links={links} copyright={copyright} />
      </div>
      // </DocumentTitle>
87 88 89 90 91
    );
  }
}

export default UserLayout;