UserLayout.js 1.79 KB
Newer Older
1
import React, { useEffect } from 'react';
dengxiaofeng's avatar
dengxiaofeng committed
2

张烨's avatar
张烨 committed
3
import { Helmet, HelmetProvider } from 'react-helmet-async';
dengxiaofeng's avatar
dengxiaofeng committed
4 5
import { renderRoutes } from 'react-router-config';

dengxiaofeng's avatar
dengxiaofeng committed
6 7 8 9 10
import {
  DefaultFooter,
  getMenuData,
  getPageTitle,
} from '@ant-design/pro-layout';
dengxiaofeng's avatar
dengxiaofeng committed
11

12
import logo from '../assets/images/logo/panda-logo.svg';
dengxiaofeng's avatar
dengxiaofeng committed
13
import styles from './UserLayout.less';
14
import { BASENAME } from '@/utils/constants';
dengxiaofeng's avatar
dengxiaofeng committed
15 16 17 18 19 20

const UserLayout = props => {
  const {
    route = {
      routes: [],
    },
张烨's avatar
张烨 committed
21
    children,
dengxiaofeng's avatar
dengxiaofeng committed
22
  } = props;
dengxiaofeng's avatar
dengxiaofeng committed
23 24 25
  // const { formatMessage } = useIntl();
  const { breadcrumb } = getMenuData(route.routes);
  const title = getPageTitle({
张烨's avatar
张烨 committed
26
    pathname: window.location.pathname,
dengxiaofeng's avatar
dengxiaofeng committed
27 28 29 30
    // formatMessage,
    breadcrumb,
    ...props,
  });
31 32 33 34

  // useEffect(() => {
  //   window.location.href = `/${BASENAME}/user/login`;
  // });
dengxiaofeng's avatar
dengxiaofeng committed
35

dengxiaofeng's avatar
dengxiaofeng committed
36 37
  return (
    <HelmetProvider>
张烨's avatar
张烨 committed
38
      <Helmet>
张烨's avatar
张烨 committed
39
        <title>{title === 'Ant Design Pro' ? '熊猫运维平台' : title}</title>
dengxiaofeng's avatar
dengxiaofeng committed
40
        <meta name="description" content={title} />
dengxiaofeng's avatar
dengxiaofeng committed
41 42
      </Helmet>

dengxiaofeng's avatar
dengxiaofeng committed
43
      <div className={styles.container}>
张烨's avatar
张烨 committed
44
        <div className={styles.lang}>{/* <SelectLang /> */}</div>
dengxiaofeng's avatar
dengxiaofeng committed
45 46 47
        <div className={styles.content}>
          <div className={styles.top}>
            <div className={styles.header}>
张烨's avatar
张烨 committed
48
              <img alt="logo" className={styles.logo} src={logo} />
张烨's avatar
张烨 committed
49
              <span className={styles.title}>熊猫运维平台</span>
张烨's avatar
张烨 committed
50 51
            </div>
            <div className={styles.desc}>
52
              {/* Ant Design 是西湖区最具影响力的 Web 设计规范 */}
dengxiaofeng's avatar
dengxiaofeng committed
53 54
            </div>
          </div>
张烨's avatar
张烨 committed
55
          {children || renderRoutes(route.routes)}
dengxiaofeng's avatar
dengxiaofeng committed
56
        </div>
张烨's avatar
张烨 committed
57
        <DefaultFooter
张烨's avatar
张烨 committed
58
          copyright={`${new Date().getFullYear()} 熊猫智慧水务有限公司`}
59
          links={[]}
张烨's avatar
张烨 committed
60
        />
dengxiaofeng's avatar
dengxiaofeng committed
61 62 63 64 65 66
      </div>
    </HelmetProvider>
  );
};

export default UserLayout;