/*
 * @Author: yuananting
 * @Date: 2021-02-25 09:45:11
 * @LastEditors: yuananting
 * @LastEditTime: 2021-02-25 11:35:10
 * @Description: 助学工具-题库-题目管理主页面
 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
 */
import React, { Component } from "react";
import Breadcrumbs from "@/components/Breadcrumbs";
import { Space } from "antd";
import QuestionManageFilter from "./components/QuestionManageFilter";
import QuestionManageOpt from "./components/QuestionManageOpt";
import QuestionManageList from "./components/QuestionManageList";
import "./QuestionManageIndex.less";

class QuestionManageIndex extends Component {
  constructor(props) {
    super(props);
    this.state = {
      query: {
        current: 1,
        size: 10,
      },
      loading: true,
      dataSource: [], // 题目列表数据
      totalCount: 1, // 题目数据总条数
    };
  }

  componentDidMount() {
    // TODO
    // 接口请求 初始化数据
    this.getQuestionList();
  }

  getQuestionList = (_query = {}) => {
    const query = {
      ...this.state.query,
      ..._query,
    };

    // 更新请求参数
    this.setState({ query });
  };

  render() {
    const { query, dataSource, totalCount } = this.state;

    return (
      <div className="question-manage-index page">
        <Breadcrumbs navList="课程分类" goBack={() => RCHistory.goBack()} />
        <div className="box">
          <Space className="question-basic-info" size={100}>
            <span>题库名称：{"业务培训"}</span>
            <span>题目数量：{100}</span>
          </Space>
          <QuestionManageFilter />
          <QuestionManageOpt />
          <QuestionManageList
            query={query}
            dataSource={dataSource}
            totalCount={totalCount}
            onChange={this.getQuestionList}
          />
        </div>
      </div>
    );
  }
}
export default QuestionManageIndex;
