diff --git a/src/common/router.js b/src/common/router.js index aca4ead7d2959c318cfed598a81618d3614fcbb1..1664ee72b9c89287d472cc14d2b126eb6c16d70e 100644 --- a/src/common/router.js +++ b/src/common/router.js @@ -80,7 +80,7 @@ export const getRouterData = (app) => { component: dynamicWrapper(app, ['monitor'], () => import('../routes/Dashboard/Monitor')), }, '/dashboard/workplace': { - component: dynamicWrapper(app, ['project', 'activities', 'chart'], () => import('../routes/Dashboard/Workplace')), + component: dynamicWrapper(app, ['user', 'project', 'activities', 'chart'], () => import('../routes/Dashboard/Workplace')), // hideInBreadcrumb: true, // name: '工作台', // authority: 'admin', diff --git a/src/routes/Dashboard/Workplace.js b/src/routes/Dashboard/Workplace.js index 9159cbf31a229e30657bfa860b3936c24fbba7da..f568182676e5928248dda5a0385af4e41916be2f 100644 --- a/src/routes/Dashboard/Workplace.js +++ b/src/routes/Dashboard/Workplace.js @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; import moment from 'moment'; import { connect } from 'dva'; import { Link } from 'dva/router'; -import { Row, Col, Card, List, Avatar } from 'antd'; +import { Row, Col, Card, List, Avatar, Spin } from 'antd'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import EditableLinkGroup from '../../components/EditableLinkGroup'; @@ -37,49 +37,21 @@ const links = [ }, ]; -const members = [ - { - id: 'members-1', - title: '科学搬砖组', - logo: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png', - link: '', - }, - { - id: 'members-2', - title: '程序员日常', - logo: 'https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png', - link: '', - }, - { - id: 'members-3', - title: '设计天团', - logo: 'https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png', - link: '', - }, - { - id: 'members-4', - title: '中二少女团', - logo: 'https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png', - link: '', - }, - { - id: 'members-5', - title: '骗你学计算机', - logo: 'https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png', - link: '', - }, -]; - -@connect(({ project, activities, chart, loading }) => ({ +@connect(({ user, project, activities, chart, loading }) => ({ + currentUser: user.currentUser, project, activities, chart, + currentUserLoading: loading.effects['user/fetchCurrent'], projectLoading: loading.effects['project/fetchNotice'], activitiesLoading: loading.effects['activities/fetchList'], })) export default class Workplace extends PureComponent { componentDidMount() { const { dispatch } = this.props; + dispatch({ + type: 'user/fetchCurrent', + }); dispatch({ type: 'project/fetchNotice', }); @@ -133,6 +105,8 @@ export default class Workplace extends PureComponent { render() { const { + currentUser, + currentUserLoading, project: { notice }, projectLoading, activitiesLoading, @@ -140,15 +114,22 @@ export default class Workplace extends PureComponent { } = this.props; const pageHeaderContent = ( -