Commit 931e27fb authored by ζ„šι“'s avatar ζ„šι“

add acount center

parent dc5b0f67
...@@ -76,6 +76,32 @@ export default { ...@@ -76,6 +76,32 @@ export default {
{ path: '/exception/403', component: './Exception/403' }, { path: '/exception/403', component: './Exception/403' },
{ path: '/exception/404', component: './Exception/404' }, { path: '/exception/404', component: './Exception/404' },
{ path: '/exception/500', component: './Exception/500' }, { path: '/exception/500', component: './Exception/500' },
// acount
{
path: '/acount/center',
component: './Account/Center/Center',
routes: [
{ path: '/acount/center', redirect: '/acount/center/articles' },
{ path: '/acount/center/articles', component: './Account/Center/Articles' },
{ path: '/acount/center/applications', component: './Account/Center/Applications' },
{ path: '/acount/center/projects', component: './Account/Center/Projects' },
],
},
{
path: '/acount/settings',
component: './Account/Settings/Info',
routes: [
{ path: '/acount/settings', redirect: '/acount/settings/base' },
{ path: '/acount/center/base', component: './Account/Settings/BaseView' },
{ path: '/acount/center/security', component: './Account/Settings/SecurityView' },
{ path: '/acount/center/binding', component: './Account/Settings/BindingView' },
{
path: '/acount/center/notification',
component: './Account/Settings/NotificationView',
},
],
},
], ],
}, },
], ],
...@@ -135,46 +161,3 @@ export default { ...@@ -135,46 +161,3 @@ export default {
}, },
}, },
}; };
// [
// {
// "path": "/Dashboard",
// "exact": true,
// "redirect": "/Dashboard/Analysis"
// },
// {
// "path": "/Forms",
// "exact": true,
// "redirect": "/Forms/BasicForm"
// },
// {
// "path": "/Forms/StepForm",
// "exact": true,
// "redirect": "/Forms/StepForm/Step1"
// },
// {
// "path": "/List",
// "exact": true,
// "redirect": "/List/TableList"
// },
// {
// "path": "/List/Search",
// "exact": true,
// "redirect": "/List/Search/Articles"
// },
// {
// "path": "/Profile",
// "exact": true,
// "redirect": "/Profile/BasicProfile"
// },
// {
// "path": "/Result",
// "exact": true,
// "redirect": "/Result/Success"
// },
// {
// "path": "/Exception",
// "exact": true,
// "redirect": "/Exception/403"
// }
// ]
import React from 'react'; import React, { PureComponent } from 'react';
import { List, Card, Icon, Dropdown, Menu, Avatar, Tooltip } from 'antd'; import { List, Card, Icon, Dropdown, Menu, Avatar, Tooltip } from 'antd';
import numeral from 'numeral'; import numeral from 'numeral';
import { connect } from 'dva';
import { formatWan } from '../../../utils/utils'; import { formatWan } from '../../../utils/utils';
import stylesApplications from '../../List/Search/Applications.less'; import stylesApplications from '../../List/Applications.less';
export default props => { @connect(({ list }) => ({
const { list } = props; list,
}))
export default class Center extends PureComponent {
render() {
const {
list: { list },
} = this.props;
const itemMenu = ( const itemMenu = (
<Menu> <Menu>
<Menu.Item> <Menu.Item>
...@@ -75,4 +82,5 @@ export default props => { ...@@ -75,4 +82,5 @@ export default props => {
)} )}
/> />
); );
}; }
}
import React from 'react'; import React, { PureComponent } from 'react';
import { List, Icon, Avatar, Tag } from 'antd'; import { List, Icon, Avatar, Tag } from 'antd';
import moment from 'moment'; import moment from 'moment';
import stylesArticles from '../../List/Search/Articles.less'; import { connect } from 'dva';
import stylesArticles from '../../List/Articles.less';
import styles from './Articles.less'; import styles from './Articles.less';
export default props => { @connect(({ list }) => ({
const { list } = props; list,
}))
export default class Center extends PureComponent {
render() {
const {
list: { list },
} = this.props;
const IconText = ({ type, text }) => ( const IconText = ({ type, text }) => (
<span> <span>
<Icon type={type} style={{ marginRight: 8 }} /> <Icon type={type} style={{ marginRight: 8 }} />
...@@ -57,4 +64,5 @@ export default props => { ...@@ -57,4 +64,5 @@ export default props => {
)} )}
/> />
); );
}; }
}
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { connect } from 'dva'; import { connect } from 'dva';
import { Link, routerRedux, Route, Switch, Redirect } from 'dva/router'; import { Link, routerRedux } from 'dva/router';
import { Card, Row, Col, Icon, Avatar, Tag, Divider, Spin, Input } from 'antd'; import { Card, Row, Col, Icon, Avatar, Tag, Divider, Spin, Input } from 'antd';
import { getRoutes } from '../../../utils/utils';
import GridContent from '../../layouts/GridContent'; import GridContent from '../../layouts/GridContent';
import styles from './Center.less'; import styles from './Center.less';
@connect(({ list, loading, user, project }) => ({ @connect(({ loading, user, project }) => ({
list,
listLoading: loading.effects['list/fetch'], listLoading: loading.effects['list/fetch'],
currentUser: user.currentUser, currentUser: user.currentUser,
currentUserLoading: loading.effects['user/fetchCurrent'], currentUserLoading: loading.effects['user/fetchCurrent'],
...@@ -83,17 +81,15 @@ export default class Center extends PureComponent { ...@@ -83,17 +81,15 @@ export default class Center extends PureComponent {
render() { render() {
const { newTags, inputVisible, inputValue } = this.state; const { newTags, inputVisible, inputValue } = this.state;
const { const {
list: { list },
listLoading, listLoading,
currentUser, currentUser,
currentUserLoading, currentUserLoading,
project: { notice }, project: { notice },
projectLoading, projectLoading,
match, match,
routerData,
location, location,
children,
} = this.props; } = this.props;
const routes = getRoutes(match.path, routerData);
const operationTabList = [ const operationTabList = [
{ {
...@@ -207,18 +203,7 @@ export default class Center extends PureComponent { ...@@ -207,18 +203,7 @@ export default class Center extends PureComponent {
onTabChange={this.onTabChange} onTabChange={this.onTabChange}
loading={listLoading} loading={listLoading}
> >
<Switch> {children}
{routes.map(item => (
<Route
key={item.key}
path={item.path}
render={props => <item.component {...props} list={list} />}
exact={item.exact}
/>
))}
<Redirect exact from="/account/center" to="/account/center/articles" />
<Redirect to="/exception/404" />
</Switch>
</Card> </Card>
</Col> </Col>
</Row> </Row>
......
import React from 'react'; import React, { PureComponent } from 'react';
import { List, Card } from 'antd'; import { List, Card } from 'antd';
import moment from 'moment'; import moment from 'moment';
import { connect } from 'dva';
import AvatarList from '../../../components/AvatarList'; import AvatarList from '../../../components/AvatarList';
import stylesProjects from '../../List/Search/Projects.less'; import stylesProjects from '../../List/Projects.less';
export default props => { @connect(({ list }) => ({
const { list } = props; list,
}))
export default class Center extends PureComponent {
render() {
const {
list: { list },
} = this.props;
return ( return (
<List <List
className={stylesProjects.coverCardList} className={stylesProjects.coverCardList}
...@@ -39,4 +46,5 @@ export default props => { ...@@ -39,4 +46,5 @@ export default props => {
)} )}
/> />
); );
}; }
}
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'dva'; import { connect } from 'dva';
import { Route, routerRedux, Switch, Redirect } from 'dva/router'; import { routerRedux } from 'dva/router';
import { Menu } from 'antd'; import { Menu } from 'antd';
import styles from './Info.less'; import styles from './Info.less';
import { getRoutes } from '../../../utils/utils';
import GridContent from '../../layouts/GridContent'; import GridContent from '../../layouts/GridContent';
const { Item } = Menu; const { Item } = Menu;
...@@ -86,7 +85,7 @@ export default class Info extends Component { ...@@ -86,7 +85,7 @@ export default class Info extends Component {
}; };
render() { render() {
const { match, routerData, currentUser } = this.props; const { children, currentUser } = this.props;
if (!currentUser.userid) { if (!currentUser.userid) {
return ''; return '';
} }
...@@ -106,18 +105,7 @@ export default class Info extends Component { ...@@ -106,18 +105,7 @@ export default class Info extends Component {
</div> </div>
<div className={styles.right}> <div className={styles.right}>
<div className={styles.title}>{this.getRightTitle()}</div> <div className={styles.title}>{this.getRightTitle()}</div>
<Switch> {children}
{getRoutes(match.path, routerData).map(item => (
<Route
key={item.key}
path={item.path}
render={props => <item.component {...props} currentUser={currentUser} />}
exact={item.exact}
/>
))}
<Redirect exact from="/account/settings" to="/account/settings/base" />
<Redirect to="/exception/404" />
</Switch>
</div> </div>
</div> </div>
</GridContent> </GridContent>
......
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