/*
 * @Author: yuananting
 * @Date: 2021-03-27 14:55:14
 * @LastEditors: yuananting
 * @LastEditTime: 2021-03-31 19:14:46
 * @Description: 助学工具-试卷主页面
 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
 */
import React, { Component } from "react";
import "./ExaminationPaperIndex.less";
import CourseCategorySiderTree from "../components/CourseCategorySiderTree";
import ExaminationPaperContent from "./components/ExaminationPaperContent";

class ExaminationPaperIndex extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  getCategoryIdFromSider = (selectedCategoryId) => {
    if (selectedCategoryId && selectedCategoryId.length > 0) {
      this.setState({ selectedCategoryId: selectedCategoryId[0] });
    }
  };

  updatedSiderTreeFromList = (currentTotal, updatedCategoryId) => {
    this.setState({ currentTotal, updatedCategoryId });
  };

  render() {
    return (
      <div className="examination-paper-index page">
        <div className="content-header">试卷</div>
        <div className="box content-body">
          <div
            style={{ borderRight: "0.5px solid #EEEEEE", paddingRight: "4px" }}
          >
            <div className="sider">
              <CourseCategorySiderTree
                fromModule="PAPER_INDEX"
                getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)}
                currentTotal={this.state.currentTotal}
                updatedCategoryId={this.state.updatedCategoryId}
              />
            </div>
          </div>
          <div className="content">
            <ExaminationPaperContent
              updatedSiderTree={this.updatedSiderTreeFromList.bind(this)}
              selectedCategoryId={this.state.selectedCategoryId}
            />
          </div>
        </div>
      </div>
    );
  }
}

export default ExaminationPaperIndex;
