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 { Radar } from 'components/Charts'; import EditableLinkGroup from 'components/EditableLinkGroup'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import styles from './Workplace.less'; const links = [ { title: '操作一', href: '', }, { title: '操作二', href: '', }, { title: '操作三', href: '', }, { title: '操作四', href: '', }, { title: '操作五', href: '', }, { title: '操作六', href: '', }, ]; @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', }); dispatch({ type: 'activities/fetchList', }); dispatch({ type: 'chart/fetch', }); } componentWillUnmount() { const { dispatch } = this.props; dispatch({ type: 'chart/clear', }); } renderActivities() { const { activities: { list }, } = this.props; return list.map(item => { const events = item.template.split(/@\{([^{}]*)\}/gi).map(key => { if (item[key]) { return ( {item[key].name} ); } return key; }); return ( } title={ {item.user.name}   {events} } description={ {moment(item.updatedAt).fromNow()} } /> ); }); } render() { const { currentUser, currentUserLoading, project: { notice }, projectLoading, activitiesLoading, chart: { radarData }, } = this.props; const pageHeaderContent = currentUser && Object.keys(currentUser).length ? (
早安,{currentUser.name},祝你开心每一天!
{currentUser.title} | {currentUser.group}
) : null; const extraContent = (

项目数

56

团队内排名

8 / 24

项目访问

2,223

); return ( 全部项目} loading={projectLoading} bodyStyle={{ padding: 0 }} > {notice.map(item => ( {item.title} } description={item.description} />
{item.member || ''} {item.updatedAt && ( {moment(item.updatedAt).fromNow()} )}
))}
{this.renderActivities()}
{}} links={links} linkElement={Link} />
{notice.map(item => ( {item.member} ))}
); } }