|
|
@ -20,15 +20,17 @@ import Choicequestion from './component/Choicequestion';
|
|
|
|
import SingleEditor from "./component/SingleEditor";
|
|
|
|
import SingleEditor from "./component/SingleEditor";
|
|
|
|
import ChoquesEditor from "./component/ChoquesEditor"
|
|
|
|
import ChoquesEditor from "./component/ChoquesEditor"
|
|
|
|
import JudquestionEditor from "./component/JudquestionEditor";
|
|
|
|
import JudquestionEditor from "./component/JudquestionEditor";
|
|
|
|
var itembankstop=null;
|
|
|
|
// var itembankstop=null;
|
|
|
|
var singleEditor=null;
|
|
|
|
// var singleEditor=null;
|
|
|
|
var Judquestio=null;
|
|
|
|
// var Judquestio=null;
|
|
|
|
var Choques=null;
|
|
|
|
// var Choques=null;
|
|
|
|
class Questionitem_banks extends Component {
|
|
|
|
class Questionitem_banks extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
|
this.contentMdRef = React.createRef();
|
|
|
|
this.contentMdRef = React.createRef();
|
|
|
|
this.answerMdRef = React.createRef();
|
|
|
|
this.answerMdRef = React.createRef();
|
|
|
|
|
|
|
|
this.Choques= React.createRef();
|
|
|
|
|
|
|
|
this.Judquestio= React.createRef();
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
|
item_type:null
|
|
|
|
item_type:null
|
|
|
|
|
|
|
|
|
|
|
@ -120,7 +122,7 @@ class Questionitem_banks extends Component {
|
|
|
|
if(this.state.item_type==="SINGLE"){
|
|
|
|
if(this.state.item_type==="SINGLE"){
|
|
|
|
if( this.answerMdRef!=null){
|
|
|
|
if( this.answerMdRef!=null){
|
|
|
|
//单选题
|
|
|
|
//单选题
|
|
|
|
console.log(this.answerMdRef.onSave());
|
|
|
|
// console.log(this.answerMdRef.onSave());
|
|
|
|
|
|
|
|
|
|
|
|
if(this.answerMdRef.onSave().length===0){
|
|
|
|
if(this.answerMdRef.onSave().length===0){
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -168,14 +170,95 @@ class Questionitem_banks extends Component {
|
|
|
|
if(this.state.item_type==="MULTIPLE"){
|
|
|
|
if(this.state.item_type==="MULTIPLE"){
|
|
|
|
if(this.Choques!=null){
|
|
|
|
if(this.Choques!=null){
|
|
|
|
//多选题
|
|
|
|
//多选题
|
|
|
|
console.log(this.Choques.onSave());
|
|
|
|
// 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"]
|
|
|
|
|
|
|
|
for(var k=0;k<anserdata[2].length;k++){
|
|
|
|
|
|
|
|
console.log("k");
|
|
|
|
|
|
|
|
console.log(k);
|
|
|
|
|
|
|
|
const choicesdata={
|
|
|
|
|
|
|
|
choice_text:anserdata[2][k],
|
|
|
|
|
|
|
|
is_answer:anserdata[1]-1===k?0:1,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
choices.push(choicesdata);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var data={
|
|
|
|
|
|
|
|
repertoire_id:1,
|
|
|
|
|
|
|
|
sub_repertoire_id:1,
|
|
|
|
|
|
|
|
tag_repertoire_id:[1,3],
|
|
|
|
|
|
|
|
name:anserdata[0],
|
|
|
|
|
|
|
|
item_type:"MULTIPLE",
|
|
|
|
|
|
|
|
difficulty:2,
|
|
|
|
|
|
|
|
analysis:anserdata[3],
|
|
|
|
|
|
|
|
choices:choices,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
axios.post(url, data)
|
|
|
|
|
|
|
|
.then((result) => {
|
|
|
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
|
|
|
this.props.showNotification(`新增多选题成功`);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(this.state.item_type==="JUDGMENT"){
|
|
|
|
if(this.state.item_type==="JUDGMENT"){
|
|
|
|
if( this.Judquestio !=null){
|
|
|
|
if( this.Judquestio !=null){
|
|
|
|
//判断题
|
|
|
|
//判断题
|
|
|
|
console.log(this.Judquestio.onSave());
|
|
|
|
// 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"?0:1,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
choices.push(choicesdata);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const choicesdatas={
|
|
|
|
|
|
|
|
choice_text:"错误",
|
|
|
|
|
|
|
|
is_answer:anserdata[1]==="1"?0:1,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
choices.push(choicesdatas);
|
|
|
|
|
|
|
|
var data={
|
|
|
|
|
|
|
|
repertoire_id:1,
|
|
|
|
|
|
|
|
sub_repertoire_id:1,
|
|
|
|
|
|
|
|
tag_repertoire_id:[1,3],
|
|
|
|
|
|
|
|
name:anserdata[0],
|
|
|
|
|
|
|
|
item_type:"JUDGMENT",
|
|
|
|
|
|
|
|
difficulty:2,
|
|
|
|
|
|
|
|
analysis:anserdata[2],
|
|
|
|
|
|
|
|
choices:choices,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
axios.post(url, data)
|
|
|
|
|
|
|
|
.then((result) => {
|
|
|
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
|
|
|
this.props.showNotification(`新增判断题成功`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|