import React, { Component } from "react";
import "../../recrulistcss/recrulistcss.scss";
import LoadingSpin from "../../../../common/LoadingSpin";
import NoneDatas from "../../../courses/signin/component/NoneDatas";

import { Table, Pagination } from "antd";
class Tablereacts extends Component {
  constructor(props) {
    super(props);
    this.state = {
      loading: false,
    };
  }

  render() {
    let {
      columns, //表格数组
      dataSource, //数据
      page, //起始页 改变页
      limit, //总条数
      count, //数组总长度
      loading, // 刷新参数
    } = this.props;

    return (
      <div className="educontent   edu-back-white  ">
        {loading === true ? (
          <div
            style={{
              minHeight: "500px",
            }}
          >
            <LoadingSpin></LoadingSpin>
          </div>
        ) : dataSource && dataSource.length === 0 ? (
          <div
            style={{
              minHeight: "500px",
            }}
          >
            <NoneDatas></NoneDatas>
          </div>
        ) : (
          <Table columns={columns} dataSource={dataSource} pagination={false} />
        )}

        <div className="mb30 clearfix educontent mt40 intermediatecenter">
          {dataSource && dataSource.length > 0 ? (
            <Pagination
              hideOnSinglePage
              showQuickJumper
              current={page}
              onChange={(e) => this.props.paginationonChange(e)}
              pageSize={limit}
              total={count}
              style={{ marginTop: 30, marginBottom: 20 }}
            ></Pagination>
          ) : (
            ""
          )}
        </div>
      </div>
    );
  }
}

export default Tablereacts;
