|
|
@ -29,6 +29,7 @@ const { check } = Authorized; |
|
|
* @param {Object} routerData 路由配置 |
|
|
* @param {Object} routerData 路由配置 |
|
|
*/ |
|
|
*/ |
|
|
const getBreadcrumbNameMap = memoizeOne((meun, router) => { |
|
|
const getBreadcrumbNameMap = memoizeOne((meun, router) => { |
|
|
|
|
|
console.log(meun, router); |
|
|
const routerMap = {}; |
|
|
const routerMap = {}; |
|
|
const mergeMeunAndRouter = meunData => { |
|
|
const mergeMeunAndRouter = meunData => { |
|
|
meunData.forEach(meunItem => { |
|
|
meunData.forEach(meunItem => { |
|
|
@ -71,6 +72,7 @@ class BasicLayout extends React.PureComponent { |
|
|
constructor(props) { |
|
|
constructor(props) { |
|
|
super(props); |
|
|
super(props); |
|
|
const { routerData, menuData } = this.props; |
|
|
const { routerData, menuData } = this.props; |
|
|
|
|
|
this.getPageTitle = memoizeOne(this.getPageTitle); |
|
|
this.breadcrumbNameMap = getBreadcrumbNameMap(menuData, routerData); |
|
|
this.breadcrumbNameMap = getBreadcrumbNameMap(menuData, routerData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -148,19 +150,14 @@ class BasicLayout extends React.PureComponent { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
render() { |
|
|
render() { |
|
|
// TODO remove old router code
|
|
|
|
|
|
const { |
|
|
const { |
|
|
isMobile, |
|
|
isMobile, |
|
|
// redirectData,
|
|
|
|
|
|
// routerData,
|
|
|
|
|
|
silderTheme, |
|
|
silderTheme, |
|
|
layout: PropsLayout, |
|
|
layout: PropsLayout, |
|
|
children, |
|
|
children, |
|
|
location: { pathname }, |
|
|
location: { pathname }, |
|
|
} = this.props; |
|
|
} = this.props; |
|
|
const isTop = PropsLayout === 'topmenu'; |
|
|
const isTop = PropsLayout === 'topmenu'; |
|
|
// const bashRedirect = this.getBashRedirect();
|
|
|
|
|
|
// const myRedirectData = redirectData || [];
|
|
|
|
|
|
const layout = ( |
|
|
const layout = ( |
|
|
<Layout> |
|
|
<Layout> |
|
|
{isTop && !isMobile ? null : ( |
|
|
{isTop && !isMobile ? null : ( |
|
|
@ -174,33 +171,14 @@ class BasicLayout extends React.PureComponent { |
|
|
)} |
|
|
)} |
|
|
<Layout style={this.getLayoutStyle()}> |
|
|
<Layout style={this.getLayoutStyle()}> |
|
|
<Header handleMenuCollapse={this.handleMenuCollapse} logo={logo} {...this.props} /> |
|
|
<Header handleMenuCollapse={this.handleMenuCollapse} logo={logo} {...this.props} /> |
|
|
<Content style={this.getContentStyle()}> |
|
|
<Content style={this.getContentStyle()}>{children}</Content> |
|
|
{children} |
|
|
|
|
|
{/* <Switch> TODO remove |
|
|
|
|
|
{myRedirectData.map(item => ( |
|
|
|
|
|
<Redirect key={item.from} exact from={item.from} to={item.to} /> |
|
|
|
|
|
))} |
|
|
|
|
|
{getRoutes(match.path, routerData).map(item => ( |
|
|
|
|
|
<AuthorizedRoute |
|
|
|
|
|
key={item.key} |
|
|
|
|
|
path={item.path} |
|
|
|
|
|
component={item.component} |
|
|
|
|
|
exact={item.exact} |
|
|
|
|
|
authority={item.authority} |
|
|
|
|
|
redirectPath="/exception/403" |
|
|
|
|
|
/> |
|
|
|
|
|
))} |
|
|
|
|
|
<Redirect exact from="/" to={bashRedirect} /> |
|
|
|
|
|
<Route render={NotFound} /> |
|
|
|
|
|
</Switch> */} |
|
|
|
|
|
</Content> |
|
|
|
|
|
<Footer /> |
|
|
<Footer /> |
|
|
</Layout> |
|
|
</Layout> |
|
|
</Layout> |
|
|
</Layout> |
|
|
); |
|
|
); |
|
|
const getPageTitle = memoizeOne(this.getPageTitle); |
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<DocumentTitle title={getPageTitle(pathname)}> |
|
|
<DocumentTitle title={this.getPageTitle(pathname)}> |
|
|
<ContainerQuery query={query}> |
|
|
<ContainerQuery query={query}> |
|
|
{params => ( |
|
|
{params => ( |
|
|
<Context.Provider value={this.getContext()}> |
|
|
<Context.Provider value={this.getContext()}> |
|
|
|