import {Card,Icon,Popover,Button,AutoComplete,Menu,message} from 'antd'; import {WeaInputSearch,WeaTools,WeaErrorPage} from 'ecCom' import * as mobx from 'mobx' import isEqual from 'lodash/isEqual'; class LinkCardItem extends React.Component{ constructor(props) { super(props); this.state = { width: 0 } } componentDidMount(){ if (!document.getElementsByClassName) { document.getElementsByClassName = function (className, element) { var children = (element || document).getElementsByTagName('*'); var elements = new Array(); for (var i = 0; i < children.length; i++) { var child = children[i]; var classNames = child.className.split(' '); for (var j = 0; j < classNames.length; j++) { if (classNames[j] == className) { elements.push(child); break; } } } return elements; }; } let coms = document.getElementsByClassName('centerItem')[0]; !!coms.offsetWidth && this.setState({width:coms.offsetWidth}); } shouldComponentUpdate(nextProps,nextState) { const prjbean = this.props.prjbean; const prjbeanNext = nextProps.prjbean; let needrender = false; return !isEqual(prjbean, prjbeanNext) || this.props.iscommon !== nextProps.iscommon || this.props.num !== nextProps.num || this.state.width !== nextState.width; } render(){ const {width} = this.state; const {prjbean,iscommon,num,actions,user} = this.props; const {beagenters,belongtoUsers,id,name,isview,typeId} = prjbean; const colorarray = ["#55D2D4","#B37BFA","#FFC62E","#8DCE36","#37B2FF","#FF9537","#FF5E56"]; return (
{iscommon && }
{name}
{!iscommon &&
}
) } //显示项目信息 showPrjInfo(id,typeid){ const {actions} = this.props; actions.addProjectStore.handleShareDialog(true,{viewtype:'showadd',templetid:id,prjtypeid:typeid}); } //新建项目 addProject(id,typeid){ const {actions} = this.props; actions.addProjectStore.handleShareDialog(true,{viewtype:'add',templetid:id,prjtypeid:typeid}); } } export default LinkCardItem