import React,{ Component } from "react"; import { Form, Input, InputNumber, Switch, Radio, Slider, Button, Upload, Icon, Rate, Checkbox, message, Row, Col, Select, Modal, Tooltip } from 'antd'; import axios from 'axios' import {getUrl, ActionBtn, markdownToHTML} from 'educoder'; import SingleDisplay from './new/SingleDisplay' import JudgeDisplay from './new/JudgeDisplay' import NullDisplay from './new/NullDisplay' import MainDisplay from './new/MainDisplay' import ShixunDisplay from './new/ShixunDisplay' import './new/common.css' const { TextArea } = Input; const confirm = Modal.confirm; const $ = window.$ const { Option } = Select; const tagArray = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] class ExerciseDisplay extends Component{ constructor(props){ super(props); this.state = { exercise_questions: [], exercise_group_id:[], page:1, limit:10, searchtext:"", order: "end_at", } } _getRequestParams() { const { order, exercise_group_id,searchtext, page ,limit} = this.state return { page, search:searchtext, order, limit: limit, group_id:exercise_group_id, } } componentDidMount = () => { const Id = this.props.match.params.Id if (Id) { const url = `/${this.props.urlPath || 'exercises'}/${Id}.json` axios.get(url) .then((response) => { if (response.data.exercise) { response.data.exercise.exercise_description = response.data.exercise.exercise_description || response.data.exercise.description response.data.exercise.exercise_name = response.data.exercise.exercise_name || response.data.exercise.name response.data.exercise.exercise_status = response.data.exercise.exercise_status == undefined ? 1 : response.data.exercise.exercise_status this.setState({...response.data}) this.props.detailFetchCallback && this.props.detailFetchCallback(response); } }) .catch(function (error) { console.log(error); }); } try { this.props.triggerRef(this); }catch (e) { } } _getRequestParams() { const { order, exercise_group_id,searchtext, page ,limit} = this.state return { page, search:searchtext, order, limit: limit, group_id:exercise_group_id, } } render() { // let { question_title, question_score, question_type, question_choices, standard_answer, // question_id, question_number, index, displayCount, // multi_count // } = this.props; const { exercise_questions,exercise,exercise_types} = this.state; // // const { getFieldDecorator } = this.props.form; // const isAdmin = this.props.isAdmin() // const courseId=this.props.match.params.coursesId; // const isEdit = this.isEdit // const qNumber = `question_${index}`; // let length = 5; // const qName = qNameArray[question_type] const commonHandler = {} return(
{ exercise_types && exercise_types.q_singles > 0 && 单选题 {exercise_types.q_singles} 题,共 {exercise_types && exercise_types.q_singles_scores} 分 } { exercise_types && exercise_types.q_doubles > 0 && 多选题 {exercise_types.q_doubles} 题,共 {exercise_types && exercise_types.q_doubles_scores} 分 } { exercise_types && exercise_types.q_judges > 0 && 判断题 {exercise_types.q_judges} 题,共 {exercise_types && exercise_types.q_judges_scores} 分 } { exercise_types && exercise_types.q_nulls > 0 && 填空题 {exercise_types.q_nulls} 题,共 {exercise_types && exercise_types.q_nulls_scores} 分 } { exercise_types && exercise_types.q_mains > 0 && 简答题 {exercise_types.q_mains} 题,共 {exercise_types && exercise_types.q_mains_scores} 分 } { exercise_types && exercise_types.q_shixuns > 0 && 实训题 {exercise_types.q_shixuns} 题,共 {exercise_types && exercise_types.q_shixuns_scores} 分 } 共 {exercise_types &&exercise_types.q_scores} 分 合计 {exercise_types &&exercise_types.q_counts} 题: