import React, { Component, useState, useEffect } from 'react';
import { Card, Row, Col, Statistic, Icon } from 'antd';
// import IndexEcharts from './components/indexEcharts';
// import Swiper from './swiper/index';
import router from 'umi/router';
import request from '@/utils/request';
import apis from '@/services/apis';

const Count = props => {
  const [data, setData] = useState([]);


  const [checkData, setCheckData] = useState([]);

  useEffect(() => {
    getIndexEcharts();

  }, []);

  function getIndexEcharts(params) {
    request({
      ...apis.indexEcharts.list,
      params,
    }).then(data => {
      setData(data);
      console.log(data, '11111');
    });
  }

//   function getBuildingReports() {
//     request({ ...apis.system.taBuildingReports }).then(data => {
//       console.log(
//         (data.records || []).map(x => x.reportCode),
//         '22222222222222222',
//       );
//       setCheckData((data.records || []).map(x => x.reportCode));
//     });
//   }

  return (
    <>
      <Row gutter={16} style={{textAlign:'center'}}>
        <Col span={4}>
          <Card>
            <Statistic
              title="总用户"
              value={data.allPersonNum || 0}
              //   valueStyle={{ color: '#3f8600' }}
            />
          </Card>
        </Col>
        <Col span={4}>
          <Card>
            <Statistic
              title="总注册用户"
              value={data.registerPersonNum || 0}
              //   valueStyle={{ color: '#cf1322' }}
            />
          </Card>
        </Col>
        <Col span={4}>
          <Card>
            <Statistic
              title="今日访问次数"
              value={data.todayVisitNum || 0}
              //   valueStyle={{ color: '#3f8600' }}
            />
          </Card>
        </Col>
        <Col span={4}>
          <Card>
            <Statistic
              title="今日新增用户"
              value={data.todayAddPersonNum || 0}
              //   valueStyle={{ color: '#cf1322' }}
            />
          </Card>
        </Col>
        <Col span={4}>
          <Card>
            <Statistic
              title="渠道数量"
              value={data.channelNum || 0}
              //   valueStyle={{ color: '#3f8600' }}
            />
          </Card>
        </Col>
        <Col span={4}>
          <Card>
            <Statistic
              title="经纪人数量"
              value={data.estateAgentNum || 0}
              //   valueStyle={{ color: '#cf1322' }}
            />
          </Card>
        </Col>
      </Row>
    </>
  );
};
export default Count;
