import React, { PureComponent } from 'react'; import moment from 'moment'; import { connect } from 'dva'; import Link from 'umi/link'; import { Row, Col, Card, List, Avatar } from 'antd'; import { Dispatch } from 'redux'; import EditableLinkGroup from './components/EditableLinkGroup'; import PageHeaderWrapper from './components/PageHeaderWrapper'; import Radar from './components/Radar'; import { ModalState } from './model'; import { CurrentUser, Activeties, RadarData, Notice } from './data'; import styles from './style.less'; const links = [ { title: '操作一', href: '', }, { title: '操作二', href: '', }, { title: '操作三', href: '', }, { title: '操作四', href: '', }, { title: '操作五', href: '', }, { title: '操作六', href: '', }, ]; interface BLOCK_NAME_CAMEL_CASEProps { currentUser: CurrentUser; projectNotice: Notice[]; activities: Activeties[]; radarData: RadarData[]; dispatch: Dispatch; currentUserLoading: boolean; projectLoading: boolean; activitiesLoading: boolean; } @connect(({ BLOCK_NAME_CAMEL_CASE: { currentUser, projectNotice, activities, radarData }, loading, }: { BLOCK_NAME_CAMEL_CASE: ModalState, loading: { effects: any }, }) => ({ currentUser, projectNotice, activities, radarData, currentUserLoading: loading.effects['BLOCK_NAME_CAMEL_CASE/fetchUserCurrent'], projectLoading: loading.effects['BLOCK_NAME_CAMEL_CASE/fetchProjectNotice'], activitiesLoading: loading.effects['BLOCK_NAME_CAMEL_CASE/fetchActivitiesList'], })) class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent { componentDidMount() { const { dispatch } = this.props; dispatch({ type: 'BLOCK_NAME_CAMEL_CASE/init', }); } componentWillUnmount() { const { dispatch } = this.props; dispatch({ type: 'BLOCK_NAME_CAMEL_CASE/clear', }); } renderActivities() { const { activities, } = this.props; return activities.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, 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()} )}
))}
{this.renderActivities()}
{}} links={links} linkElement={Link} />
{projectNotice.map(item => ( {item.member} ))}
); } } export default PAGE_NAME_UPPER_CAMEL_CASE;