Commit e89dadee authored by 愚道's avatar 愚道

finish login and register page

parent da4bd116
...@@ -24,6 +24,19 @@ export default { ...@@ -24,6 +24,19 @@ export default {
// 路由配置 // 路由配置
routes: [ 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: '/', path: '/',
component: './layouts/LoadingPage', component: './layouts/LoadingPage',
...@@ -102,8 +115,6 @@ export default { ...@@ -102,8 +115,6 @@ export default {
}, },
], ],
}, },
// user
], ],
}, },
], ],
......
...@@ -40,7 +40,7 @@ export default class Register extends Component { ...@@ -40,7 +40,7 @@ export default class Register extends Component {
if (register.status === 'ok') { if (register.status === 'ok') {
dispatch( dispatch(
routerRedux.push({ routerRedux.push({
pathname: '/User/RegisterResult', pathname: '/user/register-result',
state: { state: {
account, account,
}, },
......
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 (
<UserLayout routerData={routerData} menuData={menuData} location={location} {...props}>
{children}
</UserLayout>
);
};
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
import DocumentTitle from 'react-document-title'; // import DocumentTitle from 'react-document-title';
import { Icon } from 'antd'; import { Icon } from 'antd';
import GlobalFooter from '../components/GlobalFooter'; import GlobalFooter from '../../components/GlobalFooter';
import styles from './UserLayout.less'; import styles from './UserLayout.less';
import logo from '../assets/logo.svg'; import logo from '../../assets/logo.svg';
// TODO:remove // TODO:remove
// import { getRoutes, getPageQuery, getQueryPath } from '../utils/utils'; // import { getRoutes, getPageQuery, getQueryPath } from '../utils/utils';
...@@ -42,33 +42,34 @@ const copyright = ( ...@@ -42,33 +42,34 @@ const copyright = (
// } // }
class UserLayout extends React.PureComponent { class UserLayout extends React.PureComponent {
getPageTitle() { // TODO title
const { routerData, location } = this.props; // getPageTitle() {
const { pathname } = location; // const { routerData, location } = this.props;
let title = 'Ant Design Pro'; // const { pathname } = location;
if (routerData[pathname] && routerData[pathname].name) { // let title = 'Ant Design Pro';
title = `${routerData[pathname].name} - Ant Design Pro`; // if (routerData[pathname] && routerData[pathname].name) {
} // title = `${routerData[pathname].name} - Ant Design Pro`;
return title; // }
} // return title;
// }
render() { render() {
const { children } = this.props; const { children } = this.props;
return ( return (
<DocumentTitle title={this.getPageTitle()}> // TODO <DocumentTitle title={this.getPageTitle()}>
<div className={styles.container}> <div className={styles.container}>
<div className={styles.content}> <div className={styles.content}>
<div className={styles.top}> <div className={styles.top}>
<div className={styles.header}> <div className={styles.header}>
<Link to="/"> <Link to="/">
<img alt="logo" className={styles.logo} src={logo} /> <img alt="logo" className={styles.logo} src={logo} />
<span className={styles.title}>Ant Design</span> <span className={styles.title}>Ant Design</span>
</Link> </Link>
</div>
<div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
</div> </div>
{children} <div className={styles.desc}>Ant Design 是西湖区最具影响力的 Web 设计规范</div>
{/* <Switch> </div>
{children}
{/* <Switch>
{getRoutes(match.path, routerData).map(item => ( {getRoutes(match.path, routerData).map(item => (
<Route <Route
key={item.key} key={item.key}
...@@ -79,10 +80,10 @@ class UserLayout extends React.PureComponent { ...@@ -79,10 +80,10 @@ class UserLayout extends React.PureComponent {
))} ))}
<Redirect from="/user" to={getLoginPathWithRedirectPath()} /> <Redirect from="/user" to={getLoginPathWithRedirectPath()} />
</Switch> */} </Switch> */}
</div>
<GlobalFooter links={links} copyright={copyright} />
</div> </div>
</DocumentTitle> <GlobalFooter links={links} copyright={copyright} />
</div>
// </DocumentTitle>
); );
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment