diff --git a/config/config.js b/config/config.js index e86ac61d2474842cb2e0bab0b1581f171088564f..d54d27e9548cce5e4e4e98d6690d9dd1820c73de 100644 --- a/config/config.js +++ b/config/config.js @@ -76,6 +76,32 @@ export default { { path: '/exception/403', component: './Exception/403' }, { path: '/exception/404', component: './Exception/404' }, { 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 { }, }, }; - -// [ -// { -// "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" -// } -// ] diff --git a/src/pages/Account/Center/Applications.js b/src/pages/Account/Center/Applications.js index 865c1ef79ed7db7bd561e10e27584a38c0eef08d..729cdd42cb0f81fd1ec4e14d5368125259e82d74 100644 --- a/src/pages/Account/Center/Applications.js +++ b/src/pages/Account/Center/Applications.js @@ -1,78 +1,86 @@ -import React from 'react'; +import React, { PureComponent } from 'react'; import { List, Card, Icon, Dropdown, Menu, Avatar, Tooltip } from 'antd'; import numeral from 'numeral'; +import { connect } from 'dva'; import { formatWan } from '../../../utils/utils'; -import stylesApplications from '../../List/Search/Applications.less'; +import stylesApplications from '../../List/Applications.less'; -export default props => { - const { list } = props; - const itemMenu = ( - - - - 1st menu item - - - - - 2nd menu item - - - - - 3d menu item - - - - ); - const CardInfo = ({ activeUser, newUser }) => ( -
-
-

活跃用户

-

{activeUser}

+@connect(({ list }) => ({ + list, +})) +export default class Center extends PureComponent { + render() { + const { + list: { list }, + } = this.props; + const itemMenu = ( + + + + 1st menu item + + + + + 2nd menu item + + + + + 3d menu item + + + + ); + const CardInfo = ({ activeUser, newUser }) => ( +
+
+

活跃用户

+

{activeUser}

+
+
+

新增用户

+

{newUser}

+
-
-

新增用户

-

{newUser}

-
-
- ); - return ( - ( - - - - , - - - , - - - , - - - , - ]} - > - } title={item.title} /> -
- -
-
-
- )} - /> - ); -}; + ); + return ( + ( + + + + , + + + , + + + , + + + , + ]} + > + } title={item.title} /> +
+ +
+
+
+ )} + /> + ); + } +} diff --git a/src/pages/Account/Center/Articles.js b/src/pages/Account/Center/Articles.js index fbea8b7b928355eb3e6ad4f9491acee996e385cf..610b36c9cef23e284e75fd1c0fb90fa92b8e2d97 100644 --- a/src/pages/Account/Center/Articles.js +++ b/src/pages/Account/Center/Articles.js @@ -1,60 +1,68 @@ -import React from 'react'; +import React, { PureComponent } from 'react'; import { List, Icon, Avatar, Tag } from 'antd'; 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'; -export default props => { - const { list } = props; - const IconText = ({ type, text }) => ( - - - {text} - - ); - const ListContent = ({ data: { content, updatedAt, avatar, owner, href } }) => ( -
-
{content}
-
- - {owner} 发布在 {href} - {moment(updatedAt).format('YYYY-MM-DD HH:mm')} +@connect(({ list }) => ({ + list, +})) +export default class Center extends PureComponent { + render() { + const { + list: { list }, + } = this.props; + const IconText = ({ type, text }) => ( + + + {text} + + ); + const ListContent = ({ data: { content, updatedAt, avatar, owner, href } }) => ( +
+
{content}
+
+ + {owner} 发布在 {href} + {moment(updatedAt).format('YYYY-MM-DD HH:mm')} +
-
- ); - return ( - ( - , - , - , - ]} - > - - {item.title} - - } - description={ - - Ant Design - 设计语言 - 蚂蚁金服 - - } - /> - - - )} - /> - ); -}; + ); + return ( + ( + , + , + , + ]} + > + + {item.title} + + } + description={ + + Ant Design + 设计语言 + 蚂蚁金服 + + } + /> + + + )} + /> + ); + } +} diff --git a/src/pages/Account/Center/Center.js b/src/pages/Account/Center/Center.js index 66a1a03eb70fc14dd7d9036d3553e7d1deec5edf..6e579524b7de85c58ea03217635e7463480fcf2a 100644 --- a/src/pages/Account/Center/Center.js +++ b/src/pages/Account/Center/Center.js @@ -1,13 +1,11 @@ import React, { PureComponent } from 'react'; 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 { getRoutes } from '../../../utils/utils'; import GridContent from '../../layouts/GridContent'; import styles from './Center.less'; -@connect(({ list, loading, user, project }) => ({ - list, +@connect(({ loading, user, project }) => ({ listLoading: loading.effects['list/fetch'], currentUser: user.currentUser, currentUserLoading: loading.effects['user/fetchCurrent'], @@ -83,17 +81,15 @@ export default class Center extends PureComponent { render() { const { newTags, inputVisible, inputValue } = this.state; const { - list: { list }, listLoading, currentUser, currentUserLoading, project: { notice }, projectLoading, match, - routerData, location, + children, } = this.props; - const routes = getRoutes(match.path, routerData); const operationTabList = [ { @@ -207,18 +203,7 @@ export default class Center extends PureComponent { onTabChange={this.onTabChange} loading={listLoading} > - - {routes.map(item => ( - } - exact={item.exact} - /> - ))} - - - + {children} diff --git a/src/pages/Account/Center/Projects.js b/src/pages/Account/Center/Projects.js index a50ac327cd8275a65f14ac109e4ae3448fb98996..42ce97742da939f1d9f7bcfac8bfbea60c7d48c6 100644 --- a/src/pages/Account/Center/Projects.js +++ b/src/pages/Account/Center/Projects.js @@ -1,42 +1,50 @@ -import React from 'react'; +import React, { PureComponent } from 'react'; import { List, Card } from 'antd'; import moment from 'moment'; +import { connect } from 'dva'; import AvatarList from '../../../components/AvatarList'; -import stylesProjects from '../../List/Search/Projects.less'; +import stylesProjects from '../../List/Projects.less'; -export default props => { - const { list } = props; - return ( - ( - - } - > - {item.title}} description={item.subDescription} /> -
- {moment(item.updatedAt).fromNow()} -
- - {item.members.map(member => ( - - ))} - +@connect(({ list }) => ({ + list, +})) +export default class Center extends PureComponent { + render() { + const { + list: { list }, + } = this.props; + return ( + ( + + } + > + {item.title}} description={item.subDescription} /> +
+ {moment(item.updatedAt).fromNow()} +
+ + {item.members.map(member => ( + + ))} + +
-
- - - )} - /> - ); -}; + + + )} + /> + ); + } +} diff --git a/src/pages/Account/Settings/Info.js b/src/pages/Account/Settings/Info.js index 516fe0f5f49d1afe0284af68a0e5d03af8d3d96a..e59666242db53b0861353f782450bfbb46885840 100644 --- a/src/pages/Account/Settings/Info.js +++ b/src/pages/Account/Settings/Info.js @@ -1,9 +1,8 @@ import React, { Component } from 'react'; import { connect } from 'dva'; -import { Route, routerRedux, Switch, Redirect } from 'dva/router'; +import { routerRedux } from 'dva/router'; import { Menu } from 'antd'; import styles from './Info.less'; -import { getRoutes } from '../../../utils/utils'; import GridContent from '../../layouts/GridContent'; const { Item } = Menu; @@ -86,7 +85,7 @@ export default class Info extends Component { }; render() { - const { match, routerData, currentUser } = this.props; + const { children, currentUser } = this.props; if (!currentUser.userid) { return ''; } @@ -106,18 +105,7 @@ export default class Info extends Component {
{this.getRightTitle()}
- - {getRoutes(match.path, routerData).map(item => ( - } - exact={item.exact} - /> - ))} - - - + {children}