index.js 803 Bytes
Newer Older
ζ„šι“'s avatar
ζ„šι“ committed
1
import React from 'react';
xiaohu's avatar
xiaohu committed
2 3
import { getRouterData } from 'common/router';
import { getMenuData } from 'common/menu';
ζ„šι“'s avatar
ζ„šι“ committed
4
import BasecLayout from './BasicLayout';
xiaohu's avatar
xiaohu committed
5
import BlankLayout from './BlankLayout';
ζ„šι“'s avatar
ζ„šι“ committed
6 7

// TODO routerData menuData etc...
xiaohu's avatar
xiaohu committed
8
const openPages = ['/User', '/User/Login', '/User/Register', '/User/RegisterResult'];
ζ„šι“'s avatar
ζ„šι“ committed
9
export default props => {
xiaohu's avatar
xiaohu committed
10 11 12 13 14 15 16 17
  const { children, location } = props;
  const routerData = getRouterData({});
  const menuData = getMenuData({});
  let { pathname } = location;
  pathname = pathname.startsWith('/') ? pathname : `/${pathname}`;
  if (openPages && openPages.includes(pathname)) {
    return <BlankLayout>{children}</BlankLayout>;
  }
ζ„šι“'s avatar
ζ„šι“ committed
18
  return (
xiaohu's avatar
xiaohu committed
19
    <BasecLayout routerData={routerData} menuData={menuData} location={location}>
ζ„šι“'s avatar
ζ„šι“ committed
20 21 22 23
      {children}
    </BasecLayout>
  );
};