import React, { Component } from "react";
import TPMMDEditor from "../../../modules/tpm/challengesnew/TPMMDEditor";
import "./../questioncss/questioncom.css";
import "../questioncss/font.css";

//题库的试卷  简答题
class SubquestionEditor extends Component {
  state = {
    question_title: this.props.question_title || "",
    standard_answers: this.props.standard_answers || "",
    question_analysis: this.props.question_analysis || "",
  };
  componentDidMount() {
    if (this.props.getanswerMdRef) {
      this.props.getanswerMdRef(this);
    }
  }
  onContentChange = (label, value) => {
    this.setState({
      [label]: value,
    });
  };
  onSave = () => {
    return this.state;
  };
  render() {
    let { question_title, standard_answers, question_analysis } = this.state;
    return (
      <div className="padding20-30  signleEditor">
        <p className="mb10 clearfix">
          <span className="xingcolor font-16 fl mr4">*</span>
          <span className="xingtigan  fl">题干：</span>
        </p>

        <TPMMDEditor
          initValue={question_title}
          mdID="subjective-question-title"
          onChange={(value) => this.onContentChange("question_title", value)}
          height={155}
          placeholder="请您输入题干"
        />
        <div className="mt10">
          <p className="mb10 clearfix">
            <span className="xingcolor font-16 fl mr4">*</span>
            <span className="xingtigan  fl">参考答案：</span>
          </p>

          <TPMMDEditor
            initValue={standard_answers}
            height={166}
            mdID="subjective-question-answer"
            onChange={(value) =>
              this.onContentChange("standard_answers", value)
            }
            placeholder="请您输入参考答案"
          />
        </div>

        <div>
          <div className="mt10">
            <p className="mb10 clearfix">
              <span className="xingcolor font-16 fl mr4"></span>
              <span className="xingtigan  fl">题目解析：</span>
            </p>

            <TPMMDEditor
              initValue={question_analysis}
              height={166}
              mdID="subjective-question-analysis"
              onChange={(value) =>
                this.onContentChange("question_analysis", value)
              }
              placeholder="请您输入题目解析"
            />
          </div>
        </div>
      </div>
    );
  }
}
export default SubquestionEditor;
