/** * Created by cherry on 2018/10/25. */ import React from 'react'; import { connect } from 'dva'; import TweenOne from 'rc-tween-one'; import Children from 'rc-tween-one/lib/plugin/ChildrenPlugin'; import styles from './TrafficDataDisplay.less'; import { NumberAnimate } from '../../common/NumberAnimate'; import TrafficExponentPop from '@/components/monitor/TrafficData/TrafficDataPop/TrafficExponentPop'; import TrafficExPonentChart from '@/components/monitor/TrafficData/TrafficDataPop/TrafficExPonentChart'; import TopIndex from "./TopIndex"; TweenOne.plugins.push(Children); class TrafficExponent extends React.Component { constructor(props) { super(props); this.state = { current: 0, }; this.doRefreshData = this.doRefreshData.bind(this); } componentDidMount() { const { IsSettingScene } = this.props; if (!IsSettingScene) { this.doRefreshData(); } } componentWillUnmount() { if (this.refreshTimeout) { clearTimeout(this.refreshTimeout); } } doRefreshData() { const { dispatch } = this.props; dispatch({ type: 'trafficdata/getTrafficExponentAndCompare' }).then(data => { if (data && data.result) { this.setState(preState => ({ current: preState.current + 1, })); } }); this.refreshTimeout = setTimeout(this.doRefreshData, 1 * 60 * 1000); } openPop = () => { const { dispatch } = this.props; const popProps = { left: '30vw', top: '20vh', }; dispatch({ type: 'global/openPopWindow', payload: { popWindow: { name: 'trafficExponentPop', props: popProps, component: TrafficExponentPop, }, }, }); }; openChartPop = () => { const { dispatch } = this.props; const popProps = { left: '30vw', top: '20vh', }; dispatch({ type: 'global/openPopWindow', payload: { popWindow: { name: 'jtzsPop', props: popProps, component: TrafficExPonentChart, }, }, }) } render() { const { trafficdata, basefont, componentName } = this.props; const { current } = this.state; const { trafficExponent } = trafficdata; const { colorTheme } = this.props.global const getTrendImg = trend => { if (trend === -1) { return ; } if (trend === 1) { return ; } return ''; }; return (
{ colorTheme === 'lightblue' ? :
{/* 青岛现场演示功能,演示代码需要打开以下注释 */}
{componentName}
0   
上周同期   {trafficExponent.oldvalue}  
{/*
*/} {/* 周同比   */} {/* { trafficExponent.percent === '-' ? '-' : `${trafficExponent.percent}%` }   */} {/* { getTrendImg(trafficExponent.trend) } */} {/*
*/}
}
); } } function mapStateToProps({ trafficdata, global, loading }) { return { trafficdata, global }; } export default connect(mapStateToProps)(TrafficExponent);