From 64b5984a140662b0b40e8abda965533f7446dbcc Mon Sep 17 00:00:00 2001 From: xiaohu <448627663@qq.com> Date: Sat, 7 Jul 2018 15:50:33 +0800 Subject: [PATCH] add user layout --- src/components/Authorized/AuthorizedRoute.js | 1 + src/layouts/UserLayout.js | 29 +++++++++++--------- src/pages/User/Login.js | 2 +- src/pages/User/Register.js | 4 +-- src/pages/User/_layout.js | 15 ++++++++++ 5 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 src/pages/User/_layout.js diff --git a/src/components/Authorized/AuthorizedRoute.js b/src/components/Authorized/AuthorizedRoute.js index 60b45dc9..7534fabc 100644 --- a/src/components/Authorized/AuthorizedRoute.js +++ b/src/components/Authorized/AuthorizedRoute.js @@ -4,6 +4,7 @@ import Authorized from './Authorized'; class AuthorizedRoute extends React.Component { render() { + // TODO: umi只会返回render和rest const { component: Component, render, authority, redirectPath, ...rest } = this.props; return ( 2018 蚂蚁金服体验技术部出品 ); - -function getLoginPathWithRedirectPath() { - const params = getPageQuery(); - const { redirect } = params; - return getQueryPath('/user/login', { - redirect, - }); -} +// TODO:remove +// function getLoginPathWithRedirectPath() { +// const params = getPageQuery(); +// const { redirect } = params; +// return getQueryPath('/user/login', { +// redirect, +// }); +// } class UserLayout extends React.PureComponent { getPageTitle() { @@ -51,7 +53,7 @@ class UserLayout extends React.PureComponent { } render() { - const { routerData, match } = this.props; + const { children } = this.props; return (
@@ -65,7 +67,8 @@ class UserLayout extends React.PureComponent {
Ant Design 是西湖区最具影响力的 Web 设计规范
- + {children} + {/* {getRoutes(match.path, routerData).map(item => ( ))} - + */} diff --git a/src/pages/User/Login.js b/src/pages/User/Login.js index 2fc3e9d5..25caea1a 100644 --- a/src/pages/User/Login.js +++ b/src/pages/User/Login.js @@ -112,7 +112,7 @@ export default class LoginPage extends Component { - + 注册账户 diff --git a/src/pages/User/Register.js b/src/pages/User/Register.js index 6f608952..10273314 100644 --- a/src/pages/User/Register.js +++ b/src/pages/User/Register.js @@ -40,7 +40,7 @@ export default class Register extends Component { if (register.status === 'ok') { dispatch( routerRedux.push({ - pathname: '/user/register-result', + pathname: '/User/RegisterResult', state: { account, }, @@ -279,7 +279,7 @@ export default class Register extends Component { > 注册 - + 使用已有账户登录 diff --git a/src/pages/User/_layout.js b/src/pages/User/_layout.js new file mode 100644 index 00000000..ab782db6 --- /dev/null +++ b/src/pages/User/_layout.js @@ -0,0 +1,15 @@ +import React from 'react'; +import { getRouterData } from 'common/router'; +import { getMenuData } from 'common/menu'; +import UserLayout from '../../layouts/UserLayout'; + +export default props => { + const { children, location } = props; + const routerData = getRouterData({}); + const menuData = getMenuData({}); + return ( + + {children} + + ); +}; -- GitLab