*/}
+ {/*
*/}
+ {/* fenye*/}
+ {
+ items_count&&items_count>10?
+
+ :
+
+
+ }
+
+
+ {/*抽屉效果*/}
+
+
+
this.onClose()}
+ visible={visible}
+ mask={false}
+ closable={true}
+ >
+
+ {Datacount && Datacount > 0 ?
+
+
+
+
+ {
+ single_questions_count === 0 ?
+ ""
+ :
this.showQuestionModals("SINGLE")} >
+
单选题{'('}{single_questions_count}{')'}
+
+
+ }
+ {
+ multiple_questions_count === 0 ?
+ ""
+ :
+
this.showQuestionModals("MULTIPLE")}>
+
多选题{'('}{multiple_questions_count}{')'}
+
+
+ }
+ {
+ judgement_questions_count === 0 ?
+ ""
+ :
+
this.showQuestionModals("JUDGMENT")}>
+
判断题{'('}{judgement_questions_count}{')'}
+
+
+ }
+ {
+ completion_questions_count === 0 ?
+ ""
+ :
+
this.showQuestionModals("COMPLETION")}>
+
填空题{'('}{completion_questions_count}{')'}
+
+
+ }
+ {
+ subjective_questions_count === 0 ?
+ ""
+ :
+
this.showQuestionModals("SUBJECTIVE")}>
+
简答题{'('}{subjective_questions_count}{')'}
+
+
+ }
+ {
+ practical_questions_count === 0 ?
+ ""
+ :
+
+
实训题{'('}{practical_questions_count}{')'}
+
+
+ }
+ {
+ program_questions_count === 0 ?
+ ""
+ :
+
this.showQuestionModals("PROGRAM")}>
+
编程题{'('}{program_questions_count}{')'}
+
+
+ }
+
+
+
+ :
+
+
+
+ }
+
+
+
+
+
+
+ )
+
+ }
+
+
+}
+
+export default SnackbarHOC()(TPMIndexHOC(Question));
+
diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js
new file mode 100644
index 000000000..2db01242f
--- /dev/null
+++ b/public/react/src/modules/question/Questionitem_banks.js
@@ -0,0 +1,584 @@
+import React, {Component} from "react";
+import {Link, NavLink} from 'react-router-dom';
+import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder';
+import axios from 'axios';
+import {
+ notification,
+ Spin,
+ Table,
+ Pagination,
+ Drawer,
+ Input,
+ Button,
+ Breadcrumb
+} from "antd";
+import {TPMIndexHOC} from "../tpm/TPMIndexHOC";
+import Itembankstop from "./component/Itembankstop";
+import NoneData from './component/NoneData';
+import './questioncss/questioncom.css';
+import '../tpm/newshixuns/css/Newshixuns.css';
+import Choicequestion from './component/Choicequestion';
+import SingleEditor from "./component/SingleEditor";
+import ChoquesEditor from "./component/ChoquesEditor"
+import JudquestionEditor from "./component/JudquestionEditor";
+import Bottomsubmit from "../../modules/modals/Bottomsubmit";
+// var itembankstop=null;
+// var singleEditor=null;
+// var Judquestio=null;
+// var Choques=null;
+class Questionitem_banks extends Component {
+ constructor(props) {
+ super(props);
+ this.contentMdRef = React.createRef();
+ this.answerMdRef = React.createRef();
+ this.Choques = React.createRef();
+ this.Judquestio = React.createRef();
+ this.state = {
+ item_type: null,
+ item_banksedit: [],
+ myquestion_choicesco: [],
+ disciplinesdata: [],
+ knowledgepoints: [],
+ disciplmy:[]
+ }
+
+ }
+
+ //初始化
+ componentDidMount() {
+ // let {defaultActiveKey}= this.state;
+ // var data={
+ // public:defaultActiveKey
+ // };
+ // this.getdata(data);
+ //
+ // let url=`/users/get_navigation_info.json`;
+ // axios.get(url, {
+ //
+ // }).then((response) => {
+ // // //////console.log("开始请求/get_navigation_info.json");
+ // // //////console.log(response);
+ // if(response!=undefined){
+ // if(response.status===200){
+ // this.setState({
+ // Headertop:response.data.top,
+ // Footerdown:response.data.down
+ // })
+ // }
+ // }
+ // });
+ const params = this.props && this.props.match && this.props.match.params;
+ if (JSON.stringify(params) === "{}") {
+ //新增
+ } else {
+ //编辑
+
+ const url = `/item_banks/${this.props.match.params.id}/edit.json`;
+ axios.get((url)).then((response) => {
+ if (response === null || response === undefined) {
+
+ return
+ }
+ if (response.data.status === 403 || response.data.status === 401 || response.data.status === 500) {
+
+ } else {
+
+ }
+ //////console.log("item_banks");
+ //console.log("Questionitem_banks");
+ //console.log(response.data);
+
+ this.setState({
+ item_banksedit: response.data,
+ })
+ }).catch((error) => {
+ //////console.log(error)
+
+ });
+
+ }
+
+
+ let urls = `/disciplines.json`;
+ axios.get(urls, {
+ params: {
+ source: "question"
+ }
+ }).then((response) => {
+ if (response) {
+ this.setState({
+ disciplinesdata: response.data.disciplines,
+ })
+ if (response.data) {
+ if (response.data.disciplines) {
+
+ const didata = response.data.disciplines;
+
+ for (var i = 0; i < didata.length; i++) {
+ const childern=[];
+ //方向
+ const fxdidata = didata[i].sub_disciplines;
+
+
+ for (var j = 0; j < fxdidata.length; j++) {
+ //课程
+ const zsddata = fxdidata[j].tag_disciplines;
+ childern.push(
+ {
+ value: fxdidata[j].id,
+ label: fxdidata[j].name,
+ }
+ )
+ for (var k = 0; k < zsddata.length; k++) {
+ //知识点
+ this.state.knowledgepoints.push(zsddata[k]);
+
+
+ }
+ }
+
+ const datakec={
+ value: didata[i].id,
+ label: didata[i].name,
+ children: childern,
+ }
+ this.state.disciplmy.push(datakec);
+ }
+
+ this.setState({
+ knowledgepoints: this.state.knowledgepoints,
+ disciplmy:this.state.disciplmy,
+ })
+
+
+ }
+
+ }
+
+ }
+ });
+
+ }
+
+
+ getdata = (data) => {
+ // const url=`/item_banks.json`;
+ // axios.get((url),{params:data}).then((response) => {
+ // if(response===null||response===undefined){
+ //
+ // return
+ // }
+ // if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
+ //
+ // }else{
+ //
+ // }
+ // //////console.log("item_banks");
+ // //////console.log(response);
+ // }).catch((error) => {
+ // //////console.log(error)
+ //
+ // });
+ }
+
+ getcontentMdRef = (Ref) => {
+ this.contentMdRef = Ref;
+ }
+ getanswerMdRef = (Ref) => {
+ this.answerMdRef = Ref;
+ }
+
+ getJudquestio = (Ref) => {
+ this.Judquestio = Ref;
+ }
+
+ getChoquesEditor = (Ref) => {
+ this.Choques = Ref;
+ }
+ //跳转道描点的地方
+ scrollToAnchor = (anchorName) => {
+ try {
+ if (anchorName) {
+ // 找到锚点
+ let anchorElement = document.getElementById(anchorName);
+ // 如果对应id的锚点存在,就跳转到锚点
+ if (anchorElement) {
+ anchorElement.scrollIntoView();
+ }
+ }
+ } catch (e) {
+
+ }
+
+ }
+ preservation = () => {
+ //////console.log("preservation");
+ // //////console.log(this.contentMdRef);
+ // //////console.log(this.answerMdRef);
+ //////console.log("preservation222");
+ //////console.log(this.contentMdRef.Getdatas());
+ //////console.log("preservation3333");
+ //////console.log(this.answerMdRef.onSave());
+ const params = this.props && this.props.match && this.props.match.params;
+ var url = "";
+ var boolnew = true;
+ if (JSON.stringify(params) === "{}") {
+ // "新增"
+ url = "/item_banks.json";
+ boolnew = true;
+ } else {
+ url = `/item_banks/${params.id}.json`;
+ boolnew = false;
+ // "编辑"
+ }
+
+ if (this.contentMdRef.Getdatas().length === 0) {
+ this.scrollToAnchor("Itembankstopid");
+ return;
+ }
+
+
+ console.log("preservation");
+ console.log(this.contentMdRef.Getdatas());
+ var Getdatasdata=this.contentMdRef.Getdatas();
+ if (this.state.item_type === null) {
+
+
+ return
+ }
+ if (this.state.item_type === "SINGLE") {
+ if (this.answerMdRef != null) {
+ //单选题
+ // //console.log(this.answerMdRef.onSave());
+
+ if (this.answerMdRef.onSave().length === 0) {
+ return;
+ }
+ var anserdata = this.answerMdRef.onSave();
+ const choices = [];
+ // 1: [3]
+ // 2: (4) ["1", "2", "3", "4"]
+ for (var k = 0; k < anserdata[2].length; k++) {
+ const choicesdata = {
+ choice_text: anserdata[2][k],
+ is_answer: anserdata[1][0] === (k + 1) ? 1 : 0,
+ }
+ choices.push(choicesdata);
+ }
+
+
+ // repertoire_id:1,
+ // sub_repertoire_id:1,
+ // tag_repertoire_id:[1,3],
+ var myrbkc=[];
+ var Getdatasdatas=Getdatasdata[2].rbzsd;
+ for(let myda of Getdatasdatas) {
+ myrbkc.push(myda.id);
+ }
+ var data = {
+ discipline_id: Getdatasdata[3].rbkc[0],
+ sub_discipline_id: Getdatasdata[3].rbkc[1],
+ tag_discipline_id: myrbkc,
+ name: anserdata[0],
+ item_type: Getdatasdata[1].rbtx,
+ difficulty:Getdatasdata[0].rbnd,
+ analysis: anserdata[3],
+ choices: choices,
+
+ };
+
+ if (boolnew === true) {
+
+ axios.post(url, data)
+ .then((result) => {
+ if (result.data.status == 0) {
+ this.props.showNotification(`新增单选题成功`);
+ this.props.history.replace('/question');
+
+ }
+ }).catch((error) => {
+ //console.log(error);
+ })
+ } else {
+ axios.put(url, data)
+ .then((result) => {
+ if (result.data.status == 0) {
+ this.props.showNotification(`编辑单选题成功`);
+ this.props.history.replace('/question');
+
+
+ }
+ }).catch((error) => {
+ //console.log(error);
+ })
+ }
+
+
+ }
+
+
+ }
+ if (this.state.item_type === "MULTIPLE") {
+ if (this.Choques != null) {
+ //多选题
+ // //console.log(this.Choques.onSave());
+ if (this.Choques.onSave().length === 0) {
+ return;
+ }
+ var anserdata = this.Choques.onSave();
+ const choices = [];
+ // 1: [3]
+ // 2: (4) ["1", "2", "3", "4"]
+ //console.log("MULTIPLE");
+ //console.log(anserdata);
+ for (var k = 0; k < anserdata[2].length; k++) {
+
+ var bool = false
+ for (var y = 0; y < anserdata[1].length; y++) {
+ if (anserdata[1][y] === (k + 1)) {
+ bool = true
+ }
+ }
+
+ const choicesdata = {
+ choice_text: anserdata[2][k],
+ is_answer: bool === true ? 1 : 0,
+ }
+ choices.push(choicesdata);
+ }
+
+
+ var myrbkc=[];
+ var Getdatasdatas=Getdatasdata[2].rbzsd;
+ for(let myda of Getdatasdatas) {
+ myrbkc.push(myda.id);
+ }
+ var data = {
+ discipline_id: Getdatasdata[3].rbkc[0],
+ sub_discipline_id: Getdatasdata[3].rbkc[1],
+ tag_discipline_id: myrbkc,
+ name: anserdata[0],
+ item_type: Getdatasdata[1].rbtx,
+ difficulty:Getdatasdata[0].rbnd,
+ analysis: anserdata[3],
+ choices: choices,
+
+ };
+
+
+ if (boolnew === true) {
+ axios.post(url, data)
+ .then((result) => {
+ if (result.data.status == 0) {
+ this.props.showNotification(`新增多选题成功`);
+ this.props.history.replace('/question');
+
+
+ }
+ }).catch((error) => {
+ //console.log(error);
+ })
+
+ } else {
+ axios.put(url, data)
+ .then((result) => {
+ if (result.data.status == 0) {
+ this.props.showNotification(`编辑多选题成功`);
+ this.props.history.replace('/question');
+
+
+ }
+ }).catch((error) => {
+ //console.log(error);
+ })
+ }
+
+
+ }
+
+ }
+ if (this.state.item_type === "JUDGMENT") {
+ if (this.Judquestio != null) {
+ //判断题
+ // //console.log(this.Judquestio.onSave());
+ if (this.Judquestio.onSave().length === 0) {
+ return;
+ }
+ var anserdata = this.Judquestio.onSave();
+ const choices = [];
+ const choicesdata = {
+ choice_text: "正确",
+ is_answer: anserdata[1] === "0" ? 1 : 0,
+ }
+ choices.push(choicesdata);
+
+ const choicesdatas = {
+ choice_text: "错误",
+ is_answer: anserdata[1] === "1" ? 1 : 0,
+ }
+ choices.push(choicesdatas);
+ var myrbkc=[];
+ var Getdatasdatas=Getdatasdata[2].rbzsd;
+ for(let myda of Getdatasdatas) {
+ myrbkc.push(myda.id);
+ }
+ var data = {
+ discipline_id: Getdatasdata[3].rbkc[0],
+ sub_discipline_id: Getdatasdata[3].rbkc[1],
+ tag_discipline_id: myrbkc,
+ name: anserdata[0],
+ item_type: Getdatasdata[1].rbtx,
+ difficulty:Getdatasdata[0].rbnd,
+ analysis: anserdata[2],
+ choices: choices,
+
+ };
+ if (boolnew === true) {
+ axios.post(url, data)
+ .then((result) => {
+ if (result.data.status == 0) {
+ this.props.showNotification(`新增判断题成功`);
+ this.props.history.replace('/question');
+
+ }
+ }).catch((error) => {
+ //console.log(error);
+ })
+
+ } else {
+ axios.put(url, data)
+ .then((result) => {
+ if (result.data.status == 0) {
+ this.props.showNotification(`编辑判断题成功`);
+ this.props.history.replace('/question');
+
+ }
+ }).catch((error) => {
+ //console.log(error);
+ })
+ }
+
+
+ }
+
+ }
+ if (this.state.item_type === "PROGRAM") {
+ //编程题 跳转到 oj 中创建
+
+
+ }
+
+
+ }
+
+
+ setitem_type = (item_type) => {
+ this.setState({
+ item_type: item_type
+ })
+
+ }
+
+ render() {
+ let {page, limit, count, Headertop, visible, placement, modalsType, item_type} = this.state;
+ const params = this.props && this.props.match && this.props.match.params;
+ // //console.log(params);
+ return (
+
+
+
+
+
+
+
+ 试题库
+ {JSON.stringify(params) === "{}" ? "新增" : "编辑"}试题
+
+
+
+ {/*题目头部操作*/}
+
this.getcontentMdRef(ref)}
+ setitem_type={(item) => this.setitem_type(item)}
+ >
+
+
+ {
+ item_type && item_type === "SINGLE" ?
+
+
+ this.getanswerMdRef(ref)}
+ >
+
+
+
+ : item_type && item_type === "MULTIPLE" ?
+
+ this.getChoquesEditor(ref)}
+ >
+
+
+
+
+ : item_type && item_type === "JUDGMENT" ?
+
+
+ this.getJudquestio(ref)}
+ >
+
+
+
+
+
+ : item_type && item_type === "PROGRAM" ?
+ ""
+ : ""
+ }
+
+
+
+
+
+
+ {
+ item_type === null ?
+ ""
+ :
+
this.preservation()} url={item_type === "PROGRAM" ?'/problems':'/question'}>
+ }
+
+ )
+
+ }
+
+
+}
+
+export default SnackbarHOC()(TPMIndexHOC(Questionitem_banks));
+
+
diff --git a/public/react/src/modules/question/component/Choicequestion.js b/public/react/src/modules/question/component/Choicequestion.js
new file mode 100644
index 000000000..dbba533b4
--- /dev/null
+++ b/public/react/src/modules/question/component/Choicequestion.js
@@ -0,0 +1,51 @@
+import React, {Component} from "react";
+import {Link, NavLink} from 'react-router-dom';
+import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder';
+import axios from 'axios';
+import {
+ notification,
+ Spin,
+ Table,
+ Pagination,
+ Radio,
+ Checkbox,
+ Form,
+ Input,
+ Select,
+ Cascader,
+ Col, Row, InputNumber, DatePicker, AutoComplete,Button,Tag
+} from "antd";
+import './../questioncss/questioncom.css';
+import SingleEditor from './../component/SingleEditor';
+class Choicequestion extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ page:1,
+ Knowpoints:[]
+ }
+ }
+ //初始化
+ componentDidMount(){
+
+ }
+
+ render() {
+ let {page}=this.state;
+ const { getFieldDecorator } = this.props.form;
+
+ return (
+
+
+
+
+
+ )
+
+ }
+
+
+
+}
+const Choicequestions = Form.create({ name: 'Choicequestions' })(Choicequestion);
+export default Choicequestions;
diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js
new file mode 100644
index 000000000..28ef8e8a5
--- /dev/null
+++ b/public/react/src/modules/question/component/ChoquesEditor.js
@@ -0,0 +1,384 @@
+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 TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor';
+import axios from 'axios'
+import update from 'immutability-helper'
+import './../questioncss/questioncom.css';
+import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder';
+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 ChoquesEditor extends Component{
+ constructor(props){
+ super(props);
+ /**
+ choice_id: 32076
+ choice_position: 1
+ choice_text: "1"
+ standard_boolean: true
+ */
+ const {question_choices} = this.props;
+ let _standard_answers = undefined;
+ let _question_choices = undefined;
+ if (question_choices) {
+ _standard_answers = []
+ _question_choices = []
+
+ question_choices.forEach((item, index) => {
+ _standard_answers.push(item.standard_boolean)
+ _question_choices.push(item.choice_text)
+ })
+ }
+ const choicescomy=[];
+ try {
+ if(this.props.item_banksedit){
+ if(this.props.item_banksedit.choices){
+
+ this.props.item_banksedit.choices.forEach((item, index) => {
+ choicescomy.push({
+ choice_text:item.choice_text,
+ standard_boolean:item.is_answer,
+ })
+ })
+
+ _standard_answers = []
+ _question_choices = []
+ choicescomy.forEach((item, index) => {
+ _standard_answers.push(item.standard_boolean)
+ _question_choices.push(item.choice_text)
+ })
+ }
+
+ }
+ }catch (e) {
+
+ }
+ this.state = {
+ question_choices: _question_choices || ['', '', '', ''],
+ standard_answers: _standard_answers || [false, false, false, false],
+ question_title: this.props.question_title || '',
+ question_type: this.props.question_type || 0,
+ question_score: this.props.question_score || this.props.init_question_score,
+ question_titles:this.props.question_titles||'',
+ }
+ }
+ addOption = () => {
+
+ const { question_choices, standard_answers } = this.state;
+ // ////console.log("addOption");
+ // ////console.log(question_choices);
+ // ////console.log(standard_answers);
+
+
+ question_choices.push('')
+ standard_answers.push(false)
+ this.setState({ question_choices, standard_answers })
+ }
+ deleteOption = (index) => {
+ let {question_choices}=this.state;
+
+ // ////console.log("deleteOption");
+ // ////console.log(question_choices);
+
+ if(question_choices[index]===""){
+ // repeat code
+ this.toMDMode(null)
+ this.setState(
+ (prevState) => ({
+ question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}),
+ standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]})
+ })
+ )
+ }else{
+ // this.props.confirm({
+ // content: `确认要删除这个选项吗?`,
+ // onOk: () => {
+
+ this.toMDMode(null)
+ this.setState(
+ (prevState) => ({
+ question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}),
+ standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]})
+ })
+ )
+
+ // }
+ // })
+ }
+ }
+ onSave = () => {
+ var editordata=[];
+ const {question_title, question_score, question_type,question_titles, question_choices, standard_answers } = this.state;
+ const { question_id_to_insert_after, question_id } = this.props
+ // TODO check
+ const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1);
+ if(!question_title) {
+ this.refs['titleEditor'].showError()
+ this.props.showNotification('请您输入题干');
+ return editordata;
+ }
+ if(!answerArray || answerArray.length == 0) {
+ this.props.showNotification('请先点击选择本选择题的正确选项');
+ return editordata;
+ }
+
+ if(!answerArray || answerArray.length < 2) {
+ this.props.showNotification('多选题最小正确选项为2个');
+ return editordata;
+ }
+
+ for(let i = 0; i < question_choices.length; i++) {
+ if (!question_choices[i]) {
+ this.refs[`optionEditor${i}`].showError()
+ this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`);
+ return editordata;
+ }
+ }
+
+ if(!question_titles) {
+ this.refs['titleEditor2'].showError()
+ this.props.showNotification('请您输入题目解析');
+ return editordata;
+ }
+ /**
+ {
+ "question_title":"同学朋友间常用的沟通工具是什么?",
+ "question_type":1,
+ "question_score":5,
+ "question_choices":["a答案","b答案","c答案","d答案"],
+ "standard_answers":[1]
+ }*/
+ editordata=[question_title,answerArray,question_choices,question_titles];
+ // question_title,
+ // question_type: answerArray.length > 1 ? 1 : 0,
+ // question_score,
+ // question_choices,
+ // standard_answers: answerArray,
+ // insert_id: question_id_to_insert_after || undefined
+ return editordata;
+ }
+ onCancel = () => {
+ this.props.onEditorCancel()
+ }
+
+
+
+ componentDidMount = () => {
+ try {
+ this.props.getanswerMdRef(this);
+ }catch (e) {
+
+ }
+ try {
+ this.setState({
+ item_banksedit:this.props.item_banksedit,
+ question_title:this.props.item_banksedit.name,
+ question_titles:this.props.item_banksedit.analysis,
+ mychoicess:this.props.item_banksedit.choices,
+
+ })
+
+
+ }catch (e) {
+
+ }
+ }
+ componentDidUpdate(prevProps) {
+ //console.log("componentDidUpdate");
+ // //console.log(prevProps);
+ // //console.log(this.props.item_banksedit);
+
+ if(prevProps.item_banksedit !== this.props.item_banksedit) {
+ this.setState({
+ item_banksedit: this.props.item_banksedit,
+ question_title: this.props.item_banksedit.name,
+ question_titles: this.props.item_banksedit.analysis,
+ mychoicess: this.props.item_banksedit.choices,
+
+ })
+ }
+ }
+ onOptionClick = (index) => {
+ let standard_answers = this.state.standard_answers.slice(0)
+ standard_answers[index] = !standard_answers[index]
+ this.setState({ standard_answers })
+ }
+ onOptionContentChange = (value, index) => {
+ if (index >= this.state.question_choices.length) {
+ // TODO 新建,然后删除CD选项,再输入题干,会调用到这里,且index是3
+ return;
+ }
+ let question_choices = this.state.question_choices.slice(0);
+ question_choices[index] = value;
+ this.setState({ question_choices })
+ }
+ on_question_score_change = (e) => {
+ this.setState({ question_score: e })
+ }
+ toMDMode = (that) => {
+ if (this.mdReactObject) {
+ let mdReactObject = this.mdReactObject;
+ this.mdReactObject = null
+ mdReactObject.toShowMode()
+ }
+ this.mdReactObject = that;
+
+ }
+ toShowMode = () => {
+
+ }
+ render() {
+ let { question_title, question_score, question_type, question_choices, standard_answers,question_titles} = this.state;
+ let { question_id, index, exerciseIsPublish,
+ // question_title,
+ // question_type,
+ // question_score,
+ isNew } = this.props;
+
+ // const { getFieldDecorator } = this.props.form;
+
+ // const isAdmin = this.props.isAdmin()
+ // const courseId=this.props.match.params.coursesId;
+ // const isEdit = !!this.props.question_id
+ const qNumber = `question_`;
+ // TODO show模式 isNew为false isEdit为false
+
+ // [true, false, true] -> [0, 2]
+
+ const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
+ // ////console.log("xuanzheshijuan");
+ // ////console.log(answerTagArray);
+ // ////console.log(!exerciseIsPublish);
+
+ return(
+
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 题干:
+
+
+
this.setState({ question_title: val})}
+ ref="titleEditor"
+
+ >
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 答案选项:点击答案可设置正确答案
+
+
+ {question_choices.map( (item, index) => {
+ const bg = standard_answers[index] ? 'check-option-bg' : ''
+ return
+ {/* 点击设置答案 */}
+ {/* TODO 加了tooltip后,会丢失掉span的class */}
+ {/*
*/}
+ this.onOptionClick(index)} style={{flex: '0 0 38px'}}>
+
+ {tagArray[index]}
+
+
+ {/* */}
+
+ this.onOptionContentChange(value, index)}
+ initValue={item}
+ >
+
+ {exerciseIsPublish || index<=2?
+
+ :
+ this.deleteOption(index)}>
+ }
+ { !exerciseIsPublish && index<7 &&
+ this.addOption()}
+ style={{float: 'right', visibility: index == question_choices.length - 1 ? '' : 'hidden', marginTop: '2px'}}
+ >
+ }
+
+
+ }) }
+
+
+
+
+
+
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 题目解析:
+
+
+
this.setState({ question_titles: val})}
+ ref="titleEditor2"
+
+ >
+
+
+
+
+
+ )
+ }
+}
+// RouteHOC()
+export default (ChoquesEditor);
diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js
new file mode 100644
index 000000000..59347d36c
--- /dev/null
+++ b/public/react/src/modules/question/component/Contentpart.js
@@ -0,0 +1,237 @@
+import React, {Component} from "react";
+import {Link, NavLink} from 'react-router-dom';
+import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder';
+import axios from 'axios';
+import {
+ notification,
+ Spin,
+ Table,
+ Pagination,
+ Tabs,
+ Input,
+ Popover
+} from "antd";
+import './../questioncss/questioncom.css';
+import NoneDatas from '../component/NoneDatas';
+import LoadingSpin from '../../../common/LoadingSpin';
+import Contentquestionbank from "./Contentquestionbank";
+import Listjihe from "./Listjihe";
+const { TabPane } = Tabs;
+const Search = Input.Search;
+class Contentpart extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ page:1,
+
+ }
+ }
+ //初始化
+ componentDidMount(){
+
+
+ }
+
+
+
+ render() {
+ let {page}=this.state;
+ let {defaultActiveKey}=this.props;
+ const content = (
+
+
this.props.setitem_types("SINGLE")}>单选题
+
+
this.props.setitem_types("MULTIPLE")}>多选题
+
+
this.props.setitem_types("JUDGMENT")}>判断题
+
+
this.props.setitem_types("PROGRAM")}>编程题
+
+
+
+ );
+ const contents = (
+
+
this.props.setdifficulty(1)}>简单
+
+
this.props.setdifficulty(2)}>适中
+
+
this.props.setdifficulty(3)}>困难
+
+
+ );
+
+ const buttonWidth = 70;
+ //console.log("Contentpart");
+ //console.log(this.props);
+ return (
+
+
+
+
+
this.props.callback(e)}>
+
+
+
+
+
+
+
+
+
+ {
+ defaultActiveKey===0||defaultActiveKey==="0"?
+
+
+
+ :""
+ }
+
this.props.handleVisibleChange(true)}>
+
+
+
+
+
+
this.props.handleVisibleChanges(true)}>
+
+
+
this.props.setdatafunsval(e)}
+ onSearch={ (value)=>this.props.setdatafuns(value)} />
+
+
+
+
+ {/*内容*/}
+ {
+ this.props.Contentdata.items === undefined ||this.props.Contentdata.items === null||this.props.Contentdata.items.length===0 ?
+
+ :
+
+ {
+ defaultActiveKey===1||defaultActiveKey==="1"?
+ this.props.selectallquestionsonthispage()}>
+ :""
+ }
+ {
+ defaultActiveKey===0||defaultActiveKey==="0"?
+ this.props.selectallquestionsonthispage()}>
+ :""
+ }
+
+ }
+
+
+ {/*列表集合*/}
+
+ {
+ this.props.booljupyterurls===true?
+
+ :
+ this.props.Contentdata.items === undefined ||this.props.Contentdata.items === null||this.props.Contentdata.items.length===0?
+
+
+
+ : this.props.Contentdata.items.map((object, index) => {
+ return (
+ this.props.getitem_basketss(id)}
+ getitem_baskets={(e)=>this.props.getitem_baskets(e)}
+ showmodels={(e)=>this.props.showmodels(e)}
+ showmodelysl={(e)=>this.props.showmodelysl(e)}>
+
+
+ )
+ })}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+
+ }
+
+
+
+}
+export default Contentpart
diff --git a/public/react/src/modules/question/component/Contentquestionbank.js b/public/react/src/modules/question/component/Contentquestionbank.js
new file mode 100644
index 000000000..00776eedd
--- /dev/null
+++ b/public/react/src/modules/question/component/Contentquestionbank.js
@@ -0,0 +1,70 @@
+import React, {Component} from "react";
+import {Link, NavLink} from 'react-router-dom';
+import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder';
+import axios from 'axios';
+import {
+ notification,
+ Spin,
+ Table,
+ Pagination,
+ Radio,
+ Checkbox
+} from "antd";
+import './../questioncss/questioncom.css';
+class Contentquestionbank extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ page:1,
+ }
+ }
+ //初始化
+ componentDidMount(){
+ ////console.log("componentDidMount");
+ ////console.log(this.state);
+ ////console.log(this.props);
+ // let homeworkid = this.props.match.params.homeworkid;
+ // let url = "/homework_commons/" + homeworkid + "/end_groups.json";
+ // axios.get(url).then((response) => {
+ // if (response.status === 200) {
+ // this.setState({})
+ // }
+ // }).catch((error) => {
+ // ////console.log(error)
+ // });
+
+ }
+ onChange=(e)=> {
+ ////console.log(`checked = ${e.target.checked}`);
+ }
+
+ render() {
+ let {page}=this.state;
+
+ return (
+
+
+
+
+
+
this.props.selectallquestionsonthispage()}>
+
选用本页全部试题
+
+
+ 共{this.props.items_count?this.props.items_count:0}个试题
+
+
+
+
+
+
+
+
+ )
+
+ }
+
+
+
+}
+export default Contentquestionbank ;
diff --git a/public/react/src/modules/question/component/Headplugselection.js b/public/react/src/modules/question/component/Headplugselection.js
new file mode 100644
index 000000000..142a316cb
--- /dev/null
+++ b/public/react/src/modules/question/component/Headplugselection.js
@@ -0,0 +1,277 @@
+import React, {Component} from "react";
+import {Link, NavLink} from 'react-router-dom';
+import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl} from 'educoder';
+import axios from 'axios';
+import {
+ notification,
+ Spin,
+ Table,
+ Pagination,
+} from "antd";
+import './../questioncss/questioncom.css';
+class Headplugselection extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ page:1,
+ titlestting:"全部",
+ titlesttingid:null,
+ titlesttings:null,
+ titlesttingss:null,
+
+ }
+ }
+ //初始化
+ componentDidMount(){
+
+ }
+//
+// setdiscipline_id={(e)=>this.setdiscipline_id(e)}
+// setsub_discipline_id={(e)=>this.setsub_discipline_id(e)}
+// settag_discipline_id={(e)=>this.settag_discipline_id(e)}
+ settitlestting=(name,id)=>{
+ //如果全部其他的选项重置
+ this.setState({
+ titlestting:name,
+ titlesttingid:id,
+ titlesttings:null,
+ titlesttingsid:null,
+ titlesttingss:null,
+ titlesttingssid:null
+ })
+ if(name==="全部"){
+ this.props.setdiscipline_id(null);
+
+ }else{
+ this.props.setdiscipline_id(id);
+ }
+
+
+
+ }
+
+ settitlesttings=(name,id)=>{
+ //课程选项
+ this.setState({
+ titlesttings:name,
+ titlesttingsid:id,
+ titlesttingss:null,
+ })
+ this.props.setsub_discipline_id(id);
+ }
+
+ settitlesttingss=(name,id)=>{
+ //知识点
+ if(this.state.titlesttings===null){
+ this.props.showNotification('请先选择课程');
+ return
+
+ }
+ this.setState({
+ titlesttingss:name,
+ titlesttingssid:id
+ })
+ this.props.settag_discipline_id(id);
+
+
+ }
+ render() {
+ let {page,titlestting,titlesttings,titlesttingss}=this.state;
+ // console.log("Headplugselection");
+ // console.log(this.props.disciplinesdata);
+ // disciplinesdatakc:kc,
+ // disciplinesdatazsd:zsd,
+ var kc=0;
+ var zsd=0;
+
+ if(this.props.disciplinesdata){
+ const didata = this.props.disciplinesdata;
+ for (var i = 0; i < didata.length; i++) {
+ //方向
+ const fxdidata = didata[i].sub_disciplines;
+
+ if(titlestting===didata[i].name){
+ for (var j = 0; j < fxdidata.length; j++) {
+ kc=kc+1;
+
+ //课程
+ const zsddata = fxdidata[j].tag_disciplines;
+ for (var k = 0; k < zsddata.length; k++) {
+ //知识点
+ zsd=zsd+1;
+ }
+ }
+ }else if(titlestting==="全部"){
+ kc=kc+1;
+ zsd=zsd+1;
+ }else{
+
+ }
+
+
+ }
+ }
+ return (
+
+
+
+
+ {/*课程*/}
+
+
+ 方向:
+
+
+
this.settitlestting("全部",null)}>
+ 全部
+
+ {this.props.disciplinesdata&&this.props.disciplinesdata.map((object, index) => {
+ return (
+
this.settitlestting(object.name,object.id)}>
+ {object.name}
+
+ )
+ })}
+
+
+
+ {/*课程*/}
+ {
+ kc===0?
+ ""
+ :
+
+
+ 课程:
+
+
+
+ {this.props.disciplinesdata&&this.props.disciplinesdata.map((objectn, index) => {
+ return (
+ titlestting==="全部"?
+ objectn.sub_disciplines&&objectn.sub_disciplines.map((object, indexs) => {
+ return (
+
this.settitlesttings(object.name,object.id)}>
+ {object.name}
+
+ )
+ })
+ :
+ objectn.name===titlestting?
+ objectn.sub_disciplines&&objectn.sub_disciplines.map((object, indexs) => {
+ return (
+
this.settitlesttings(object.name,object.id)}>
+ {object.name}
+
+ )
+ })
+ : ""
+ )
+ })}
+
+
+
+
+
+ }
+ {/*知识点*/}
+ {
+ zsd===0?
+ ""
+ :
+
+ 知识点:
+
+
+
+
+
+ {this.props.disciplinesdata&&this.props.disciplinesdata.map((objecta, index) => {
+ return (
+ titlestting==="全部"&&titlesttings===null?
+ objecta.sub_disciplines&&objecta.sub_disciplines.map((objectb, indexs) => {
+ return (
+ objectb.tag_disciplines&&objectb.tag_disciplines.map((object, indexss) => {
+ return (
+
this.settitlesttingss(object.name)}>
+ {object.name}
+
+ )
+ })
+ )
+ })
+ :titlestting==="全部"&&titlesttings!==null?
+ objecta.sub_disciplines&&objecta.sub_disciplines.map((objectb, indexs) => {
+ return (
+ titlesttings===objectb.name?
+ objectb.tag_disciplines&&objectb.tag_disciplines.map((object, indexss) => {
+ return (
+
this.settitlesttingss(object.name)}>
+ {object.name}
+
+ )
+ }):""
+ )
+ })
+ : titlestting!=="全部"&&titlesttings!==null?
+ titlestting===objecta.name?
+ objecta.sub_disciplines&&objecta.sub_disciplines.map((objectb, indexs) => {
+ return (
+ titlesttings===objectb.name?
+ objectb.tag_disciplines&&objectb.tag_disciplines.map((object, indexss) => {
+ return (
+
this.settitlesttingss(object.name)}>
+ {object.name}
+
+ )
+ }):""
+ )
+ })
+ :""
+ : titlestting!=="全部"&&titlesttings===null?
+ titlestting===objecta.name?
+ objecta.sub_disciplines&&objecta.sub_disciplines.map((objectb, indexs) => {
+ return (
+ objectb.tag_disciplines&&objectb.tag_disciplines.map((object, indexss) => {
+ return (
+
this.settitlesttingss(object.name)}>
+ {object.name}
+
+ )
+ })
+ )
+ })
+ :""
+ :""
+ )
+ })}
+
+
+
+
+
+ }
+
+
+
+
+ )
+
+ }
+
+
+
+}
+export default Headplugselection ;
diff --git a/public/react/src/modules/question/component/Itembankstop.js b/public/react/src/modules/question/component/Itembankstop.js
new file mode 100644
index 000000000..6480ec82b
--- /dev/null
+++ b/public/react/src/modules/question/component/Itembankstop.js
@@ -0,0 +1,604 @@
+import React, {Component} from "react";
+import {Link, NavLink} from 'react-router-dom';
+import {WordsBtn, ActionBtn, SnackbarHOC, getImageUrl} from 'educoder';
+import axios from 'axios';
+import {
+ notification,
+ Spin,
+ Table,
+ Pagination,
+ Radio,
+ Checkbox,
+ Form,
+ Input,
+ Select,
+ Cascader,
+ Col, Row, InputNumber, DatePicker, AutoComplete, Button, Tag
+} from "antd";
+import './../questioncss/questioncom.css';
+
+const InputGroup = Input.Group;
+const {Option} = Select;
+const options = [
+ {
+ value: '方向',
+ label: '方向',
+ children: [
+ {
+ value: '课程',
+ label: '课程',
+ },
+ ],
+ },
+ {
+ value: 'jiangsu',
+ label: 'Jiangsu',
+ children: [
+ {
+ value: 'nanjing',
+ label: 'Nanjing',
+ },
+ ],
+ },
+];
+
+class Itembankstop extends Component {
+ constructor(props) {
+ super(props);
+ this.contentMdRef = React.createRef()
+ this.state = {
+ page: 1,
+ Knowpoints: [],
+ rbtx: undefined,
+ rbkc: undefined,
+ knowledgepoints: [],
+ options: [],
+ }
+ }
+
+ //初始化
+ componentDidMount() {
+ try {
+ this.props.getcontentMdRef(this);
+ } catch (e) {
+
+ }
+ this.setState({
+ options: this.props.disciplmy
+ })
+ // knowledgepoints:this.props.knowledgepoints,
+
+ ////console.log("componentDidMount");
+ ////console.log(this.state);
+ ////console.log(this.props);
+ // let homeworkid = this.props.match.params.homeworkid;
+ // let url = "/homework_commons/" + homeworkid + "/end_groups.json";
+ // axios.get(url).then((response) => {
+ // if (response.status === 200) {
+ // this.setState({})
+ // }
+ // }).catch((error) => {
+ // ////console.log(error)
+ // });()
+ // 题型
+
+
+ }
+
+ componentDidUpdate(prevProps) {
+
+ if (prevProps.item_banksedit !== this.props.item_banksedit) {
+ if (this.props.item_banksedit.item_type) {
+ this.handleFormtixing(this.props.item_banksedit.item_type);
+ }
+ if (this.props.item_banksedit.difficulty) {
+ this.handleFormLayoutChange(this.props.item_banksedit.difficulty);
+ }
+ if (this.props.item_banksedit.tag_disciplines) {
+ this.handletag_disciplinesChange(this.props.item_banksedit.tag_disciplines);
+ }
+
+ if (this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline) {
+ this.handdisciplinesChange(this.props.item_banksedit.discipline,this.props.item_banksedit.sub_discipline);
+ }
+ }
+ if (prevProps.disciplmy !== this.props.disciplmy) {
+ this.setState({
+ options: this.props.disciplmy
+ })
+ }
+
+ }
+ handdisciplinesChange =(name,title)=>{
+ this.setState({
+ rbkc:[name.id,title.id]
+ })
+ this.props.form.setFieldsValue({
+ rbkc: [name.id,title.id],
+ });
+
+ if(this.props.item_banksedit.tag_disciplines.length===0){
+ const didata = this.props.disciplinesdata;
+ const knowledgepointsdata = [];
+
+ for (var i = 0; i < didata.length; i++) {
+ //方向
+ if (name.id === didata[i].id) {
+ const fxdidata = didata[i].sub_disciplines;
+ for (var j = 0; j < fxdidata.length; j++) {
+ //课程
+ if (title.id === fxdidata[j].id) {
+ const zsddata = fxdidata[j].tag_disciplines;
+ for (var k = 0; k < zsddata.length; k++) {
+ //知识点
+ knowledgepointsdata.push(zsddata[k]);
+
+
+ }
+
+ }
+
+ }
+ }
+
+
+ }
+
+ this.setState({
+ Knowpoints: [],
+ knowledgepoints: knowledgepointsdata,
+ })
+
+ }
+
+
+
+
+
+
+
+
+
+
+ }
+ handletag_disciplinesChange = (data) => {
+ try {
+ var sju=data[data.length-1].name;
+ this.setState({
+ rbzsd:sju,
+ Knowpoints:data,
+ })
+ this.props.form.setFieldsValue({
+ rbzsd: sju,
+ });
+ }catch (e) {
+
+ }
+ }
+ onChange = (e) => {
+
+ }
+ Getdatas = () => {
+ return this.handleSubmits();
+ }
+ handleSubmits = () => {
+ var data = [];
+ this.props.form.validateFields((err, values) => {
+ data = []
+ if (!err) {
+ // ////console.log("获取的form 数据");
+ // ////console.log(values);
+ data.push({
+ rbnd: parseInt(values.rbnd)
+ })
+ data.push({
+ rbtx: values.rbtx
+ })
+ data.push({
+ rbzsd: this.state.Knowpoints
+ })
+ data.push({
+ rbkc: values.rbkc
+ })
+
+ }
+ });
+
+ return data;
+
+ }
+ handleSubmit = (e) => {
+ e.preventDefault();
+ this.props.form.validateFields((err, values) => {
+ if (!err) {
+ ////console.log("获取的form 数据");
+ ////console.log(values);
+
+ }
+
+
+ });
+ }
+
+ handleFormLayoutChange = (value) => {
+ //难度塞选
+ ////console.log("难度塞选");
+ ////console.log(value);
+ this.props.form.setFieldsValue({
+ rbnd: value + "",
+ });
+ this.setState({
+ rbnd: value + "",
+ })
+
+ }
+ handleFormkechen = (value) => {
+ //课程
+ ////console.log("课程");
+ ////console.log(value);
+ var valuename = undefined;
+ this.props.form.setFieldsValue({
+ rbzsd: value,
+ });
+
+ var arr = this.state.knowledgepoints;
+ for (let data of arr) {
+ if (data.id === value) {
+ this.state.Knowpoints.push(data);
+ valuename = data.name;
+ }
+ }
+
+ var tmp = JSON.parse(JSON.stringify(this.state.knowledgepoints));
+ for (var i = 0; i < tmp.length; i++) {
+ if (tmp[i].id === value) {
+ this.state.knowledgepoints.splice(i, 1);
+ }
+ }
+
+ this.setState({
+ rbzsd: valuename,
+ Knowpoints: this.state.Knowpoints,
+ knowledgepoints: this.state.knowledgepoints,
+ })
+
+ }
+
+ handleFormzhishidian = (value) => {
+ console.log("handleFormzhishidian 课程");
+ console.log(value);
+
+ //课程
+ this.props.form.setFieldsValue({
+ rbkc: value,
+ });
+ this.setState({
+ rbkc:value,
+ })
+ // console.log("handleFormzhishidian");
+ // console.log(this.props.disciplinesdata);
+
+ const didata = this.props.disciplinesdata;
+ const knowledgepointsdata = [];
+
+ for (var i = 0; i < didata.length; i++) {
+ //方向
+ if (value[0] === didata[i].id) {
+ const fxdidata = didata[i].sub_disciplines;
+ for (var j = 0; j < fxdidata.length; j++) {
+ //课程
+ if (value[1] === fxdidata[j].id) {
+ const zsddata = fxdidata[j].tag_disciplines;
+ for (var k = 0; k < zsddata.length; k++) {
+ //知识点
+ knowledgepointsdata.push(zsddata[k]);
+
+
+ }
+
+ }
+
+ }
+ }
+
+
+ }
+
+ this.setState({
+ Knowpoints: [],
+ knowledgepoints: knowledgepointsdata,
+ })
+
+ this.props.form.setFieldsValue({
+ rbzsd: undefined,
+ });
+ this.setState({
+ rbzsd: undefined,
+ })
+ }
+
+ handleFormtixing = (value) => {
+ //题型
+ //console.log("题型");
+ //console.log(value);
+ this.setState({
+ rbtx: value + "",
+ })
+ this.props.form.setFieldsValue({
+ rbtx: value + "",
+ });
+ this.props.setitem_type(value);
+ }
+ preventDefault = (e) => {
+ e.preventDefault();
+ ////console.log('Clicked! But prevent default.');
+ }
+ deletesobject = (item, index) => {
+ var arr = this.state.Knowpoints;
+ for (let data of arr) {
+ if (data.id === item.id) {
+ this.state.knowledgepoints.push(data);
+ }
+ }
+
+
+ var tmp = JSON.parse(JSON.stringify(this.state.Knowpoints));
+ for (var i = 0; i < tmp.length; i++) {
+ if (i >= index) {
+ var pos = this.state.Knowpoints.indexOf(tmp[i]);
+ this.state.Knowpoints.splice(pos, 1);
+ }
+ }
+
+ this.props.form.setFieldsValue({
+ rbzsd: this.state.Knowpoints,
+ });
+
+
+ this.setState({
+ Knowpoints: this.state.Knowpoints,
+ })
+
+ if (this.state.Knowpoints.length === 0) {
+ this.setState({
+ rbzsd: undefined,
+ })
+ } else if (this.state.Knowpoints.length > 0) {
+ try {
+ const myknowda = this.state.Knowpoints;
+ this.setState({
+ rbzsd: myknowda[this.state.Knowpoints.length - 1].name,
+ })
+ } catch (e) {
+
+ }
+
+ }
+
+ }
+
+
+ render() {
+ let {page, options} = this.state;
+ const {getFieldDecorator} = this.props.form;
+ //console.log("renderrenderrender");
+ //console.log(this.props.item_banksedit);
+ //console.log("renderrenderrendersssss");
+ //console.log(this.state.rbtx);
+ return (
+
+
+
+
+
+
+ {getFieldDecorator("rbkc",
+ {
+ rules: [{required: true, message: '请选择课程'}],
+ }
+ )(
+
+
+
+
+
+
+ {/*
*/}
+
+ {/* {this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {*/}
+ {/* return (*/}
+ {/*
*/}
+ {/*
{object}
*/}
+ {/*
this.deletesobject(object,index)}>*/}
+ {/*
*/}
+ {/* )*/}
+ {/* })}*/}
+
+ {/*
*/}
+
+ )}
+
+
+ {getFieldDecorator("rbzsd"
+ )(
+
+
+
+
+
+
+ {this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
+ return (
+
+
{object.name}
+
this.deletesobject(object, index)}>
+
+ )
+ })}
+
+
+
+ )}
+
+
+
+ {getFieldDecorator("rbtx",
+ {
+ rules: [{required: true, message: '请选择题型'}],
+ }
+ )(
+
+
+
+ )}
+
+
+
+
+
+
+ {getFieldDecorator('rbnd',
+ {
+ rules: [{required: true, message: '请选择难度'}],
+ }
+ )(
+
+ 简单
+ 适中
+ 困难
+ ,
+ )}
+
+
+ {/*
*/}
+ {/* */}
+ {/**/}
+
+
+
+
+ )
+
+ }
+
+
+}
+
+const Itembankstops = Form.create({name: 'Itembankstops'})(Itembankstop);
+export default Itembankstops;
diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js
new file mode 100644
index 000000000..ff491125c
--- /dev/null
+++ b/public/react/src/modules/question/component/JudquestionEditor.js
@@ -0,0 +1,402 @@
+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 TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor';
+import axios from 'axios'
+import update from 'immutability-helper'
+import './../questioncss/questioncom.css';
+import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder';
+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 JudquestionEditor extends Component{
+ constructor(props){
+ super(props);
+ /**
+ choice_id: 32076
+ choice_position: 1
+ choice_text: "1"
+ standard_boolean: true
+ */
+ const {question_choices} = this.props;
+ let _standard_answers = undefined;
+ let _question_choices = undefined;
+ if (question_choices) {
+ _standard_answers = []
+ _question_choices = []
+
+ question_choices.forEach((item, index) => {
+ _standard_answers.push(item.standard_boolean)
+ _question_choices.push(item.choice_text)
+ })
+ }
+ this.state = {
+ question_choices: _question_choices || ['', '', '', ''],
+ standard_answers: _standard_answers || [false, false, false, false],
+ question_title: this.props.question_title || '',
+ question_type: this.props.question_type || 0,
+ question_score: this.props.question_score || this.props.init_question_score,
+ question_titles:this.props.question_titles||'',
+ zqda:null,
+ item_banksedit:[],
+ mychoicess:[],
+ }
+ }
+ addOption = () => {
+
+ const { question_choices, standard_answers } = this.state;
+ // //////console.log("addOption");
+ // //////console.log(question_choices);
+ // //////console.log(standard_answers);
+
+
+ question_choices.push('')
+ standard_answers.push(false)
+ this.setState({ question_choices, standard_answers })
+ }
+ deleteOption = (index) => {
+ let {question_choices}=this.state;
+
+ // //////console.log("deleteOption");
+ // //////console.log(question_choices);
+
+ if(question_choices[index]===""){
+ // repeat code
+ this.toMDMode(null)
+ this.setState(
+ (prevState) => ({
+ question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}),
+ standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]})
+ })
+ )
+ }else{
+ this.props.confirm({
+ content: `确认要删除这个选项吗?`,
+ onOk: () => {
+ this.toMDMode(null)
+ this.setState(
+ (prevState) => ({
+ question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}),
+ standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]})
+ })
+ )
+ }
+ })
+ }
+ }
+ onSave = () => {
+ var editordata=[];
+ const {question_title, question_score, question_type,question_titles, zqda,question_choices, standard_answers } = this.state;
+ const { question_id_to_insert_after, question_id } = this.props
+ // TODO check
+ const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1);
+ if(!question_title) {
+ this.refs['titleEditor'].showError()
+ this.props.showNotification('请您输入题干');
+ return editordata;
+ }
+
+ if(zqda===null) {
+ this.props.showNotification('请先点击选择本选择题的正确选项');
+ return editordata;
+ }
+
+
+
+
+ if(!question_titles) {
+ this.refs['titleEditor2'].showError()
+ this.props.showNotification('请您输入题目解析');
+ return editordata;
+ }
+ /**
+ {
+ "question_title":"同学朋友间常用的沟通工具是什么?",
+ "question_type":1,
+ "question_score":5,
+ "question_choices":["a答案","b答案","c答案","d答案"],
+ "standard_answers":[1]
+ }*/
+
+
+ editordata=[question_title,zqda,question_titles];
+ // question_title,
+ // question_type: answerArray.length > 1 ? 1 : 0,
+ // question_score,
+ // question_choices,
+ // standard_answers: answerArray,
+ // insert_id: question_id_to_insert_after || undefined
+ return editordata;
+ }
+ onCancel = () => {
+ this.props.onEditorCancel()
+ }
+
+
+
+ componentDidMount = () => {
+ try {
+ this.props.getanswerMdRef(this);
+ }catch (e) {
+
+ }
+ try {
+ this.setState({
+ item_banksedit:this.props.item_banksedit,
+ question_title:this.props.item_banksedit.name,
+ question_titles:this.props.item_banksedit.analysis,
+ mychoicess:this.props.item_banksedit.choices,
+
+ })
+ if(this.props.item_banksedit){
+ if(this.props.item_banksedit.choices){
+ for(var ik=0;ik
{
+
+ let standard_answers = this.state.standard_answers.slice(0);
+ // //////console.log("onOptionClick");
+ // //////console.log(standard_answers);
+ // //////console.log(standard_answers[index]);
+ // //////console.log(!standard_answers[index]);
+ for (var i=0;i {
+ if (index >= this.state.question_choices.length) {
+ // TODO 新建,然后删除CD选项,再输入题干,会调用到这里,且index是3
+ return;
+ }
+ let question_choices = this.state.question_choices.slice(0);
+ question_choices[index] = value;
+ this.setState({ question_choices })
+ }
+ on_question_score_change = (e) => {
+ this.setState({ question_score: e })
+ }
+ toMDMode = (that) => {
+ if (this.mdReactObject) {
+ let mdReactObject = this.mdReactObject;
+ this.mdReactObject = null
+ mdReactObject.toShowMode()
+ }
+ this.mdReactObject = that;
+
+ }
+ toShowMode = () => {
+
+ }
+
+
+ handleFormLayoutChange=(e)=>{
+ //////console.log("难度塞选");
+ //////console.log(value);
+ this.setState({
+ zqda:e.target.value,
+
+ })
+
+ }
+ render() {
+ let { question_title, question_score, question_type, question_choices, standard_answers,question_titles} = this.state;
+ let { question_id, index, exerciseIsPublish,
+ // question_title,
+ // question_type,
+ // question_score,
+ isNew } = this.props;
+
+ // const { getFieldDecorator } = this.props.form;
+
+ // const isAdmin = this.props.isAdmin()
+ // const courseId=this.props.match.params.coursesId;
+ // const isEdit = !!this.props.question_id
+ const qNumber = `question_`;
+ // TODO show模式 isNew为false isEdit为false
+
+ // [true, false, true] -> [0, 2]
+
+ const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
+ // //////console.log("xuanzheshijuan");
+ // //////console.log(answerTagArray);
+ // //////console.log(!exerciseIsPublish);
+ const params= this.props&&this.props.match&&this.props.match.params;
+ return(
+
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 题干:
+
+
+
this.setState({ question_title: val})}
+ ref="titleEditor"
+
+ >
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 答案选项:点击答案可设置正确答案
+
+
+
+
+
+ 正确
+ 错误
+
+
+
+
+
+
+
+
+
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 题目解析:
+
+
+
this.setState({ question_titles: val})}
+ ref="titleEditor2"
+
+ >
+
+
+
+
+
+ )
+ }
+}
+// RouteHOC()
+export default (JudquestionEditor);
diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js
new file mode 100644
index 000000000..c8c518f8c
--- /dev/null
+++ b/public/react/src/modules/question/component/Listjihe.js
@@ -0,0 +1,179 @@
+import React, {Component} from "react";
+import {Link, NavLink} from 'react-router-dom';
+import {WordsBtn, ActionBtn,SnackbarHOC,getImageUrl,markdownToHTML} from 'educoder';
+import axios from 'axios';
+import {
+ notification,
+ Spin,
+ Table,
+ Pagination,
+ Radio
+} from "antd";
+import './../questioncss/questioncom.css';
+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 Listjihe extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ page:1,
+ name:"单选题",
+ nd:"简单",
+ chakanjiexibool:false,
+ }
+ }
+ //初始化
+ componentDidMount(){
+
+
+ }
+
+ chakanjiexibool=()=>{
+ if(this.state.chakanjiexibool===true){
+ this.setState({
+ chakanjiexibool:false
+ })
+ }else{
+ this.setState({
+ chakanjiexibool:true
+ })
+ }
+
+ }
+ //选用
+ Selectingpracticaltraining=(id)=>{
+ let data={
+ item_ids:[id]
+ }
+ this.props.getitem_baskets(data);
+ }
+ //撤销
+ Selectingpracticaltrainings=(id)=>{
+
+ this.props.getitem_basketss(id);
+ }
+
+
+
+
+
+ render() {
+ let {page,name,nd,chakanjiexibool}=this.state;
+ let {defaultActiveKey,items}=this.props;
+
+ ////console.log("Listjihe");
+ ////console.log(this.props);
+ return (
+
+ {/*顶部*/}
+
+
+
+
+
难度:{items.difficulty===1?"简单":items.difficulty===2?"适中":items.difficulty===3?"困难":""}
+
题型:{items.item_type==="SINGLE"?"单选题":items.item_type==="MULTIPLE"?"多选题":items.item_type==="JUDGMENT"?"判断题":items.item_type==="PROGRAM"?"编程题":""}
+
+
+ {/*内容*/}
+
+
+
+ {
+ items.item_type==="JUDGMENT"?
+ items === undefined ||items === null? "" : items.choices.map((object, index) => {
+ return (
+
+
+ {object.choice_text}
+
+
+ )
+ })
+ :
+ items === undefined ||items === null? "" : items.choices.map((object, index) => {
+ return (
+
+ {tagArray[index]}
+
+
+ )
+ })
+ }
+
+
+
+
+ {/*更新时间*/}
+
+
+
更新时间:{items.update_time}
+ {
+ this.props.defaultActiveKey==="0"||this.props.defaultActiveKey===0?
+ ""
+ :
+
创建者:{items.author.name}
+ }
+
+
+ {
+ items.choosed===true?
+
this.Selectingpracticaltrainings(items.id)}>
+
+ 撤销
+ :
+
this.Selectingpracticaltraining(items.id)}>
+
+ 选用
+ }
+ {
+ defaultActiveKey===0||defaultActiveKey==="0"?
+
+
this.props.showmodelysl(items.id)}>
+
+ 删除
+
+
+
+
+ 编辑
+
+
+
this.props.showmodels(items.id)}>
+
+ 公开
+
+
+ :""
+ }
+
this.chakanjiexibool()}>
+
+ 查看解析
+
+
+
+
+ {
+ chakanjiexibool===true?
:""
+ }
+
+
+
+ )
+
+ }
+
+}
+export default Listjihe;
diff --git a/public/react/src/modules/question/component/NoneData.js b/public/react/src/modules/question/component/NoneData.js
new file mode 100644
index 000000000..123b7524e
--- /dev/null
+++ b/public/react/src/modules/question/component/NoneData.js
@@ -0,0 +1,37 @@
+import React, { Component } from 'react';
+import { getImageUrl , getUrl } from 'educoder';
+
+class NoneData extends Component{
+ constructor(props) {
+ super(props)
+ }
+ render(){
+ const { style } = this.props;
+ return(
+
+
+
}/)
+
暂无相关数据
+
请选择试题进行组卷
+
+ )
+ }
+}
+export default NoneData;
diff --git a/public/react/src/modules/question/component/NoneDatas.js b/public/react/src/modules/question/component/NoneDatas.js
new file mode 100644
index 000000000..c36cc29d1
--- /dev/null
+++ b/public/react/src/modules/question/component/NoneDatas.js
@@ -0,0 +1,36 @@
+import React, { Component } from 'react';
+import { getImageUrl , getUrl } from 'educoder';
+
+class NoneDatas extends Component{
+ constructor(props) {
+ super(props)
+ }
+ render(){
+ const { style } = this.props;
+ return(
+
+
+
}/)
+
暂无相关数据
+
+ )
+ }
+}
+export default NoneDatas;
diff --git a/public/react/src/modules/question/component/QuestionModal.js b/public/react/src/modules/question/component/QuestionModal.js
new file mode 100644
index 000000000..de7614f37
--- /dev/null
+++ b/public/react/src/modules/question/component/QuestionModal.js
@@ -0,0 +1,43 @@
+import React, { Component } from 'react';
+import {getImageUrl} from 'educoder';
+import { Modal} from 'antd';
+import axios from 'axios';
+import './../questioncss/questioncom.css'
+//立即申请试用
+class QuestionModal extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state={
+
+ }
+ }
+
+
+ render() {
+
+ return(
+
+
+
+ )
+ }
+}
+
+export default QuestionModal;
diff --git a/public/react/src/modules/question/component/QuestionModals.js b/public/react/src/modules/question/component/QuestionModals.js
new file mode 100644
index 000000000..ba10d3f35
--- /dev/null
+++ b/public/react/src/modules/question/component/QuestionModals.js
@@ -0,0 +1,66 @@
+import React, { Component } from 'react';
+import {getImageUrl} from 'educoder';
+import { Modal} from 'antd';
+import axios from 'axios';
+import './../questioncss/questioncom.css'
+//立即申请试用
+class QuestionModals extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state={
+
+ }
+ }
+
+
+ render() {
+
+ return(
+
+
+
是否删除试题栏中{
+
+ this.props.titilesms&&this.props.titilesms==="SINGLE"?
+ "单选题"
+ :
+ this.props.titilesms&&this.props.titilesms==="MULTIPLE"?
+ "多选题"
+ :
+ this.props.titilesms&&this.props.titilesms==="JUDGMENT"?
+ "判断题"
+ :
+ this.props.titilesms&&this.props.titilesms==="COMPLETION"?
+ "填空题"
+ :
+ this.props.titilesms&&this.props.titilesms==="SUBJECTIVE"?
+ "简答题"
+ :
+ this.props.titilesms&&this.props.titilesms==="PROGRAM"?
+ "编程题"
+ :
+ this.props.titilesms&&this.props.titilesms==="PRACTICAL"?
+ "实训题"
+ :""
+
+ }
+
+
+
+ )
+ }
+}
+
+export default QuestionModals;
diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js
new file mode 100644
index 000000000..6762626f7
--- /dev/null
+++ b/public/react/src/modules/question/component/SingleEditor.js
@@ -0,0 +1,395 @@
+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 TPMMDEditor from '../../../modules/tpm/challengesnew/TPMMDEditor';
+import axios from 'axios'
+import update from 'immutability-helper'
+import './../questioncss/questioncom.css';
+import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder';
+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 SingleEditor extends Component{
+ constructor(props){
+ super(props);
+ /**
+ choice_id: 32076
+ choice_position: 1
+ choice_text: "1"
+ standard_boolean: true
+ */
+
+ const {question_choices} = this.props;
+ let _standard_answers = undefined;
+ let _question_choices = undefined;
+ if (question_choices) {
+ _standard_answers = []
+ _question_choices = []
+
+ question_choices.forEach((item, index) => {
+ _standard_answers.push(item.standard_boolean)
+ _question_choices.push(item.choice_text)
+ })
+ }
+
+ const choicescomy=[];
+ try {
+ if(this.props.item_banksedit){
+ if(this.props.item_banksedit.choices){
+
+ this.props.item_banksedit.choices.forEach((item, index) => {
+ //console.log("SingleEditor");
+ //console.log(item);
+ choicescomy.push({
+ choice_text:item.choice_text,
+ standard_boolean:item.is_answer,
+ })
+ })
+
+ _standard_answers = []
+ _question_choices = []
+ choicescomy.forEach((item, index) => {
+ _standard_answers.push(item.standard_boolean)
+ _question_choices.push(item.choice_text)
+ })
+ }
+
+ }
+ }catch (e) {
+
+ }
+ this.state = {
+ question_choices: _question_choices || ['', '', '', ''],
+ standard_answers: _standard_answers || [false, false, false, false],
+ question_title: this.props.question_title || '',
+ question_type: this.props.question_type || 0,
+ question_score: this.props.question_score || this.props.init_question_score,
+ question_titles:this.props.question_titles||'',
+ item_banksedit:[],
+ }
+ }
+ addOption = () => {
+
+ const { question_choices, standard_answers } = this.state;
+ // ////console.log("addOption");
+ // ////console.log(question_choices);
+ // ////console.log(standard_answers);
+
+
+ question_choices.push('')
+ standard_answers.push(false)
+ this.setState({ question_choices, standard_answers })
+ }
+ deleteOption = (index) => {
+ let {question_choices}=this.state;
+
+ // ////console.log("deleteOption");
+ // ////console.log(question_choices);
+
+ if(question_choices[index]===""){
+ // repeat code
+ this.toMDMode(null)
+ this.setState(
+ (prevState) => ({
+ question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}),
+ standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]})
+ })
+ )
+ }else{
+ this.toMDMode(null)
+ this.setState(
+ (prevState) => ({
+ question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}),
+ standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]})
+ })
+ )
+ }
+ }
+ onSave = () => {
+ var editordata=[];
+ const {question_title, question_score, question_type,question_titles, question_choices, standard_answers } = this.state;
+ const { question_id_to_insert_after, question_id } = this.props
+ // TODO check
+ const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1);
+ if(!question_title) {
+ this.refs['titleEditor'].showError()
+ this.props.showNotification('请您输入题干');
+ return editordata;
+ }
+
+ if(!answerArray || answerArray.length == 0) {
+ this.props.showNotification('请先点击选择本选择题的正确选项');
+ return editordata;
+ }
+
+
+ for(let i = 0; i < question_choices.length; i++) {
+ if (!question_choices[i]) {
+ this.refs[`optionEditor${i}`].showError()
+ this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`);
+ return editordata;
+ }
+ }
+
+ if(!question_titles) {
+ this.refs['titleEditor2'].showError()
+ this.props.showNotification('请您输入题目解析');
+ return editordata;
+ }
+ /**
+ {
+ "question_title":"同学朋友间常用的沟通工具是什么?",
+ "question_type":1,
+ "question_score":5,
+ "question_choices":["a答案","b答案","c答案","d答案"],
+ "standard_answers":[1]
+ }*/
+ editordata=[question_title,answerArray,question_choices,question_titles];
+ // question_title,
+ // question_type: answerArray.length > 1 ? 1 : 0,
+ // question_score,
+ // question_choices,
+ // standard_answers: answerArray,
+ // insert_id: question_id_to_insert_after || undefined
+ return editordata;
+ }
+ onCancel = () => {
+ this.props.onEditorCancel()
+ }
+
+
+
+ componentDidMount = () => {
+ try {
+ this.props.getanswerMdRef(this);
+ }catch (e) {
+
+ }
+
+
+ try {
+ this.setState({
+ item_banksedit:this.props.item_banksedit,
+ question_title:this.props.item_banksedit.name,
+ question_titles:this.props.item_banksedit.analysis,
+ mychoicess:this.props.item_banksedit.choices,
+
+ })
+
+
+ }catch (e) {
+
+ }
+
+ }
+ componentDidUpdate(prevProps) {
+ //console.log("componentDidUpdate");
+ // //console.log(prevProps);
+ // //console.log(this.props.item_banksedit);
+
+ if(prevProps.item_banksedit !== this.props.item_banksedit) {
+ this.setState({
+ item_banksedit: this.props.item_banksedit,
+ question_title: this.props.item_banksedit.name,
+ question_titles: this.props.item_banksedit.analysis,
+ mychoicess: this.props.item_banksedit.choices,
+
+ })
+ }
+ }
+ onOptionClick = (index) => {
+
+ let standard_answers = this.state.standard_answers.slice(0);
+ // ////console.log("onOptionClick");
+ // ////console.log(standard_answers);
+ // ////console.log(standard_answers[index]);
+ // ////console.log(!standard_answers[index]);
+ for (var i=0;i {
+ if (index >= this.state.question_choices.length) {
+ // TODO 新建,然后删除CD选项,再输入题干,会调用到这里,且index是3
+ return;
+ }
+ let question_choices = this.state.question_choices.slice(0);
+ question_choices[index] = value;
+ this.setState({ question_choices })
+ }
+ on_question_score_change = (e) => {
+ this.setState({ question_score: e })
+ }
+ toMDMode = (that) => {
+ if (this.mdReactObject) {
+ let mdReactObject = this.mdReactObject;
+ this.mdReactObject = null
+ mdReactObject.toShowMode()
+ }
+ this.mdReactObject = that;
+
+ }
+ toShowMode = () => {
+
+ }
+ render() {
+ let { question_title, question_score, question_type, question_choices, standard_answers,question_titles} = this.state;
+ let { question_id, index, exerciseIsPublish,
+ // question_title,
+ // question_type,
+ // question_score,
+ isNew } = this.props;
+
+ // const { getFieldDecorator } = this.props.form;
+
+ // const isAdmin = this.props.isAdmin()
+ // const courseId=this.props.match.params.coursesId;
+ // const isEdit = !!this.props.question_id
+ const qNumber = `question_`;
+ // TODO show模式 isNew为false isEdit为false
+
+ // [true, false, true] -> [0, 2]
+
+ const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
+ // ////console.log("xuanzheshijuan");
+ // ////console.log(answerTagArray);
+ // ////console.log(!exerciseIsPublish);
+
+ return(
+
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 题干:
+
+
+
this.setState({ question_title: val})}
+ ref="titleEditor"
+
+ >
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 答案选项:点击答案可设置正确答案
+
+
+ {question_choices.map( (item, index) => {
+ const bg = standard_answers[index] ? 'check-option-bg' : ''
+ return
+ {/* 点击设置答案 */}
+ {/* TODO 加了tooltip后,会丢失掉span的class */}
+ {/*
*/}
+ this.onOptionClick(index)} style={{flex: '0 0 38px'}}>
+
+ {tagArray[index]}
+
+
+ {/* */}
+
+ this.onOptionContentChange(value, index)}
+ initValue={item}
+ >
+
+ {exerciseIsPublish || index<=1?
+
+ :
+ this.deleteOption(index)}>
+ }
+ { !exerciseIsPublish && index<7 &&
+ this.addOption()}
+ style={{float: 'right', visibility: index == question_choices.length - 1 ? '' : 'hidden', marginTop: '2px'}}
+ >
+ }
+
+
+ }) }
+
+
+
+
+
+
+
+
+ {/* {!question_id ? '新建' : '编辑'} */}
+ *
+ 题目解析:
+
+
+
this.setState({ question_titles: val})}
+ ref="titleEditor2"
+
+ >
+
+
+
+
+
+ )
+ }
+}
+// RouteHOC()
+export default (SingleEditor);
diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css
new file mode 100644
index 000000000..89d6b2b98
--- /dev/null
+++ b/public/react/src/modules/question/questioncss/questioncom.css
@@ -0,0 +1,611 @@
+.w1200{
+ width:1062px;
+ height:177px;
+ background:rgba(255,255,255,1);
+ box-shadow:0px 6px 8px 0px rgba(0,0,0,0.03);
+ border-radius:2px;
+}
+
+.w1200dbl{
+ width:1062px;
+ min-height:60px;
+ background:rgba(255,255,255,1);
+ box-shadow:0px 6px 8px 0px rgba(0,0,0,0.03);
+ border-radius:2px;
+}
+.w1200fpx{
+ width:1200px;
+ background:rgba(255,255,255,1);
+ box-shadow:0px 6px 8px 0px rgba(0,0,0,0.03);
+ border-radius:2px;
+}
+.w1200mss{
+ width:1200px;
+}
+.w1200ms{
+ width:1062px;
+}
+.w1200s{
+ width:1062px;
+ background:rgba(255,255,255,1);
+ box-shadow:0px 6px 8px 0px rgba(0,0,0,0.03);
+ border-radius:2px;
+}
+.h177{
+ height: 177px;
+}
+/* 中间居中 */
+.intermediatecenter{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
+/* 简单居中 */
+.intermediatecenterysls{
+ display: flex;
+ align-items: center;
+}
+.spacearound{
+ display: flex;
+ justify-content: space-around;
+
+}
+.spacebetween{
+ display: flex;
+ justify-content: space-between;
+}
+/* 头顶部居中 */
+.topcenter{
+ display: -webkit-flex;
+ flex-direction: column;
+ align-items: center;
+
+}
+
+
+/* x轴正方向排序 */
+/* 一 二 三 四 五 六 七 八 */
+.sortinxdirection{
+ display: flex;
+ flex-direction:row;
+}
+/* x轴反方向排序 */
+/* 八 七 六 五 四 三 二 一 */
+.xaxisreverseorder{
+ display: flex;
+ flex-direction:row-reverse;
+}
+/* 垂直布局 正方向*/
+/* 一
+ 二
+ 三
+ 四
+ 五
+ 六
+ 七
+ 八 */
+.verticallayout{
+ display: flex;
+ flex-direction:column;
+}
+/* 垂直布局 反方向*/
+.reversedirection{
+ display: flex;
+ flex-direction:column-reverse;
+}
+.w100{
+ width: 100px;
+}
+.mt21{
+ margin-top: 21px;
+}
+.mt23{
+ margin-top: 23px;
+}
+.mt19{
+ margin-top: 19px;
+}
+.mt15{
+ margin-top: 10px;
+}
+.h40{
+ height: 40px;
+}
+
+.tophom{
+ padding-top: 33px;
+ padding-bottom: 40px;
+ padding-left: 26px;
+ padding-right: 26px;
+}
+.tophoms{
+ padding-top: 15px;
+ padding-left: 26px;
+ padding-right: 26px;
+}
+.borderwd{
+ border: 1px solid #000000;
+}
+.borderwds{
+ width: 1020px !important;
+ background: #FFFFFF;
+ border: 1px solid #DDDDDD;
+ margin-left: 20px;
+ min-height:150px;
+}
+.borderwds283{
+ width: 1020px !important;
+ min-height:283px;
+ background:#F9F9F9;
+ border:1px solid #DDDDDD;
+ margin-left: 20px;
+}
+.w64{
+ width: 64px;
+}
+.w70{
+ width: 70px !important;
+}
+
+.tophomsembold{
+ height:21px;
+ font-size:16px;
+ color:#333333;
+ line-height:21px;
+}
+
+.tophomsembolds{
+ width:42px;
+ height:19px;
+ font-size:14px;
+ font-family:MicrosoftYaHeiSemibold;
+ color:rgba(51,51,51,1);
+ line-height:31px;
+}
+/*Contentpart*/
+.contentparttit{
+ padding-top: 10px;
+ padding-left: 20px;
+ padding-right: 20px;
+}
+
+.subjecttit{
+ width:28px;
+ height:19px;
+ font-size:14px;
+ color:rgba(51,51,51,1);
+ line-height: 42px;
+ cursor:pointer;
+
+}
+.ml55{
+ margin-right: 55px;
+
+}
+
+.lg{
+ line-height: 42px;
+}
+.ml7{
+ margin-left: 7px;
+}
+
+.icondowncolor{
+ color:#9E9E9E;
+
+}
+.icondowncolorss{
+ color: #9E9E9E;
+ position: absolute;
+ top: -20px;
+ right: -16px;
+}
+
+.questiontype{
+ width: 100%;
+ font-size: 12px;
+ color: #333333;
+ line-height: 17px;
+ text-align: center;
+ padding: 11px;
+ cursor:pointer;
+
+}
+.questiontypes{
+ width:37px;
+ height:17px;
+ font-size:12px;
+ color:rgba(51,51,51,1);
+ line-height:17px;
+ cursor:pointer;
+
+}
+.questiontypeheng{
+ width:100%;
+ height:1px;
+ background: #EEEEEE;
+}
+.questiontype:hover{
+ color: #4CACFF;
+}
+.questiontype:active{
+ color: #4CACFF;
+}
+
+.w100s{
+ width:100%;
+}
+.stestcen{
+ text-align: center;
+}
+.w70s{
+ width:70%;
+}
+.w30s{
+ width:70%;
+}
+.w50s{
+ width: 50%;
+}
+.testpaper{
+ font-size:12px;
+ color:#888888;
+ line-height:28px;
+ text-align: center;
+}
+
+.setequesbank{
+ font-size:14px;
+ color:#333333;
+ line-height:28px;
+}
+
+.Contentquestionbankstyle{
+ padding-left: 20px;
+ padding-right: 20px;
+}
+
+.pd20{
+ padding-top: 20px;
+ padding-bottom: 20px;
+ padding-left: 30px;
+ padding-right: 30px;
+}
+
+/*listjihe*/
+.listjihetixing{
+ color: #888888;
+ font-size: 12px;
+ line-height: 17px;
+}
+
+.listjihetixings{
+ color: #333333;
+ font-size: 12px;
+ line-height: 17px;
+}
+.listjihetixingstit{
+ color: #333333;
+ font-size: 14px;
+ line-height: 17px;
+
+}
+.listjihetixingstits{
+ color: #333333;
+ font-size: 14px;
+ line-height:19px;
+ margin-top: 19px;
+}
+
+.updatetimes{
+ color: #BBBBBB;
+ font-size: 12px;
+}
+.mt22{
+ margin-top: 22px;
+}
+.viewparsings{
+ color:#4CACFF;
+ font-size:12px;
+ line-height: 30px;
+}
+
+.selection{
+ width:88px;
+ height:30px;
+ background:#33BD8C;
+ border-radius:4px;
+ text-align: center;
+ line-height: 30px;
+ color: #FFFFFF;
+}
+.selectionss{
+ width:88px;
+ height:30px;
+ background:#eeeeee;
+ border-radius:4px;
+ text-align: center;
+ line-height: 30px;
+ color: #FFFFFF;
+}
+.lh30{
+ line-height: 30px;
+
+
+}
+
+.analysis{
+ height:19px;
+ font-size:14px;
+ color:#333333;
+ line-height:19px;
+}
+
+.testfondex{
+ color: #808080;
+ font-size: 14px;
+}
+.pb20{
+ padding-bottom: 20px;
+}
+.icontianjiadaohangcolor{
+ color: #FFFFFF;
+}
+
+.icontianjiadaohangcolors{
+ color: #4CACFF;
+}
+.xiaoshou{
+ cursor:pointer
+}
+.mt40{
+ margin-top: 40px;
+}
+.mt42{
+ margin-top: 42px;
+}
+.drawerbutton{
+ width:88px;
+ height:30px;
+ background:#4CACFF;
+ border-radius:4px;
+ font-size:14px;
+ color:#ffffff;
+ line-height:30px;
+ text-align: center;
+}
+.icondrawercolor{
+ color: #979797;
+}
+
+.mt25{
+ margin-top: 25px;
+}
+.mb26{
+ margin-bottom: 26px;
+}
+.drawernonedatadiv{
+ height: 100%;
+}
+
+.font-17{
+ font-size: 17px;
+}
+.ml30{
+ margin-right: 30px;
+}
+.mr25{
+ margin-right: 25px;
+}
+.newbutoon{
+ width:88px;
+ height:42px;
+ background:#33BD8C;
+ line-height: 42px;
+ border-radius:4px;
+
+}
+
+.newbutoontes{
+ width:100%;
+ height:42px;
+ font-size:14px;
+ color:#ffffff;
+ line-height:42px;
+ text-align: center;
+}
+.educouddiv {
+ display: flex;
+ flex-direction: column;
+}
+
+.tabeltext-alignleftysl{
+ font-size:14px;
+ color:#000000;
+ line-height:19px;
+
+}
+.tabeltext-alignleftysltwo{
+ font-size:14px;
+ color:#848282;
+ line-height:19px;
+
+}
+
+.publictask-btn{
+ width:80px;
+ height:34px;
+ background:#CCCCCC;
+ border-radius:4px;
+ color: #ffffff;
+
+}
+.publictask-btns{
+ width:80px;
+ height:34px;
+ background:#4CACFF;
+ border-radius:4px;
+ color: #ffffff;
+}
+.w80{
+ width: 80px;
+}
+
+.titiles{
+ color: #333333;
+ font-size: 16px;
+}
+
+.h12{
+ height: 12px;
+ min-height: 12px;
+}
+
+.mt19{
+ margin-top: 19px;
+}
+.mytags{
+ width:106px;
+ height:32px;
+ border-radius:2px;
+ border:1px solid #DDDDDD;
+ margin-left: 20px;
+}
+.lh32{
+ line-height: 32px;
+}
+
+.h20{
+ height: 20px;
+ min-height: 20px;
+ line-height: 20px;
+}
+.xingcolor{
+ color: rgba(224, 64, 64, 1);
+}
+.xingtigan{
+ font-size:14px;
+ color:rgba(51, 51, 51, 1);
+}
+.mr4{
+ margin-right: 4px;
+}
+
+.xingtigans{
+ width:100%;
+ font-size:14px;
+ color:rgba(136,136,136,1);
+}
+
+.bottomdivs{
+ width:100%;
+ height:55px;
+ background:rgba(255,255,255,1);
+ box-shadow:0px -2px 7px 0px rgba(1,6,22,0.04);
+}
+.mt50{
+ margin-top: 50px;
+}
+
+.divquxiao{
+ width:88px;
+ height:32px;
+ background:rgba(255,255,255,1);
+ border-radius:4px;
+ border:1px solid rgba(204,204,204,1);
+}
+.divquxiaotest{
+ width:100%;
+ height:32px;
+ font-size:12px;
+ color:rgba(136,136,136,1);
+ line-height:32px;
+ text-align: center;
+}
+.divbaocuntests{
+ width:100%;
+ height:32px;
+ font-size:12px;
+ color:#ffffff;
+ line-height:32px;
+ text-align: center;
+}
+.divbaocun{
+ width:88px;
+ height:32px;
+ background:rgba(76,172,255,1);
+ border-radius:4px;
+}
+.sortzhenque{
+ width:49px;
+ height:33px;
+ border-radius:2px;
+ border:1px solid rgba(221,221,221,1);
+}
+
+.sortzhenquetest{
+ width:100%;
+ height:33px;
+ font-size:14px;
+ color:rgba(51,51,51,1);
+ line-height:33px;
+
+}
+
+.sortquxiao{
+
+ width:49px;
+ height:33px;
+ border-radius:2px;
+ border:1px solid rgba(221,221,221,1);
+}
+.sortquxiaotest{
+ width:100%;
+ height:33px;
+ font-size:14px;
+ color:rgba(51,51,51,1);
+ line-height:33px;
+}
+
+.ml45{
+ margin-left: 45px;
+}
+
+.programcss{
+ height: 251px;
+ min-height: 100%;
+}
+
+.titlesttingcss{
+ min-width: 100px;
+ height:32px;
+ line-height: 32px;
+ background:rgba(76,172,255,1);
+ border-radius:16px;
+ text-align: center;
+ color: #fff;
+}
+.titlesttingcssmy{
+ min-width: 100px;
+ height:32px;
+ line-height: 32px;
+ font-size:14px;
+ color:rgba(51,51,51,1);
+ text-align: center;
+}
+.minleng40{
+ min-height: 40px;
+}
+
+.w60{
+ width: 60px !important;
+}
+
+.h30{
+ min-height: 30px !important;
+}
+
+.minheight{
+ min-height: 500px !important;
+}
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index ac5213ec1..d9f9fe53b 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -13,7 +13,7 @@ import { getImageUrl, toPath ,trigger,broadcastChannelPostMessage} from 'educode
import axios from 'axios';
-import { Modal,Checkbox ,Radio,Input,message,notification } from 'antd';
+import { Modal,Checkbox ,Radio,Input,message,notification,Popover} from 'antd';
import Addcourses from '../courses/coursesPublic/Addcourses';
@@ -69,6 +69,7 @@ class NewHeader extends Component {
headtypesonClickbool:false,
headtypess:"/",
mygetHelmetapi2: null,
+ visiblemyss:false,
}
console.log("176")
// console.log(props);
@@ -705,6 +706,15 @@ submittojoinclass=(value)=>{
document.head.appendChild(link);
}
+
+ handleVisibleChanges = (boll) => {
+ this.setState({
+ visiblemyss: boll,
+ })
+
+ }
+
+
getAppdata=()=>{
let url = "/setting.json";
axios.get(url).then((response) => {
@@ -874,7 +884,17 @@ submittojoinclass=(value)=>{
})
}
-
+ const contents = (
+
+ );
return (