From e89dadee920575c901b45489b7766982fd096092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E9=81=93?= Date: Wed, 11 Jul 2018 13:47:13 +0800 Subject: [PATCH] finish login and register page --- config/config.js | 15 +++++++-- src/pages/User/Register.js | 2 +- src/pages/User/_layout.js | 15 --------- src/pages/layouts/UserLayout.js | 57 +++++++++++++++++---------------- 4 files changed, 43 insertions(+), 46 deletions(-) delete mode 100644 src/pages/User/_layout.js diff --git a/config/config.js b/config/config.js index 294f39cd..b5e9a89d 100644 --- a/config/config.js +++ b/config/config.js @@ -24,6 +24,19 @@ export default { // 路由配置 routes: [ + // user + { + path: '/user', + component: './layouts/UserLayout', + routes: [ + { path: '/user', redirect: '/user/login' }, + { path: '/user/login', component: '/User/Login' }, + { path: '/user/register', component: './User/Register' }, + { path: '/user/register-result', component: './User/RegisterResult' }, + ], + }, + + // app { path: '/', component: './layouts/LoadingPage', @@ -102,8 +115,6 @@ export default { }, ], }, - - // user ], }, ], diff --git a/src/pages/User/Register.js b/src/pages/User/Register.js index 10273314..50ab5bf0 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/RegisterResult', + pathname: '/user/register-result', state: { account, }, diff --git a/src/pages/User/_layout.js b/src/pages/User/_layout.js deleted file mode 100644 index 978c8a11..00000000 --- a/src/pages/User/_layout.js +++ /dev/null @@ -1,15 +0,0 @@ -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} - - ); -}; diff --git a/src/pages/layouts/UserLayout.js b/src/pages/layouts/UserLayout.js index 7fff90e2..034cbf84 100644 --- a/src/pages/layouts/UserLayout.js +++ b/src/pages/layouts/UserLayout.js @@ -1,10 +1,10 @@ import React, { Fragment } from 'react'; import { Link } from 'dva/router'; -import DocumentTitle from 'react-document-title'; +// import DocumentTitle from 'react-document-title'; import { Icon } from 'antd'; -import GlobalFooter from '../components/GlobalFooter'; +import GlobalFooter from '../../components/GlobalFooter'; import styles from './UserLayout.less'; -import logo from '../assets/logo.svg'; +import logo from '../../assets/logo.svg'; // TODO:remove // import { getRoutes, getPageQuery, getQueryPath } from '../utils/utils'; @@ -42,33 +42,34 @@ const copyright = ( // } class UserLayout extends React.PureComponent { - 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; - } + // 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; + // } render() { const { children } = this.props; return ( - -
-
-
-
- - logo - Ant Design - -
-
Ant Design 是西湖区最具影响力的 Web 设计规范
+ // TODO +
+
+
+
+ + logo + Ant Design +
- {children} - {/* +
Ant Design 是西湖区最具影响力的 Web 设计规范
+
+ {children} + {/* {getRoutes(match.path, routerData).map(item => ( */} -
-
-
+ +
+ // ); } } -- GitLab