import { Avatar, Card, Col, List, Row } from 'antd'; import React, { PureComponent } from 'react'; import { Dispatch } from 'redux'; import Link from 'umi/link'; import { PageHeaderWrapper } from '@ant-design/pro-layout'; import { connect } from 'dva'; import moment from 'moment'; import Radar from './components/Radar'; import { ModalState } from './model'; import EditableLinkGroup from './components/EditableLinkGroup'; import styles from './style.less'; import { ActivitiesType, CurrentUser, NoticeType, RadarDataType } from './data.d'; const links = [ { title: '操作一', href: '', }, { title: '操作二', href: '', }, { title: '操作三', href: '', }, { title: '操作四', href: '', }, { title: '操作五', href: '', }, { title: '操作六', href: '', }, ]; interface dashboardWorkplaceProps { currentUser: CurrentUser; projectNotice: NoticeType[]; activities: ActivitiesType[]; radarData: RadarDataType[]; dispatch: Dispatch; currentUserLoading: boolean; projectLoading: boolean; activitiesLoading: boolean; } @connect( ({ dashboardWorkplace: { currentUser, projectNotice, activities, radarData }, loading, }: { dashboardWorkplace: ModalState; loading: { effects: any }; }) => ({ currentUser, projectNotice, activities, radarData, currentUserLoading: loading.effects['dashboardWorkplace/fetchUserCurrent'], projectLoading: loading.effects['dashboardWorkplace/fetchProjectNotice'], activitiesLoading: loading.effects['dashboardWorkplace/fetchActivitiesList'], }), ) class Workplace extends PureComponent { componentDidMount() { const { dispatch } = this.props; dispatch({ type: 'dashboardWorkplace/init', }); } componentWillUnmount() { const { dispatch } = this.props; dispatch({ type: 'dashboardWorkplace/clear', }); } renderActivities = (item: ActivitiesType) => { 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, activities, projectNotice, projectLoading, activitiesLoading, 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 }} > {projectNotice.map(item => ( {item.title} } description={item.description} />
{item.member || ''} {item.updatedAt && ( {moment(item.updatedAt).fromNow()} )}
))}
loading={activitiesLoading} renderItem={item => this.renderActivities(item)} dataSource={activities} className={styles.activitiesList} size="large" /> {}} links={links} linkElement={Link} />
{projectNotice.map(item => ( {item.member} ))}
); } } export default Workplace;