调整题库

yslnewtiku
杨树林 5 years ago
parent a00922f4e7
commit b46aef7e98

@ -192,15 +192,31 @@ class Question extends Component {
}
handleVisibleChange=(boll)=>{
this.setState({
visiblemys:boll,
})
if(this.state.visiblemyss===true){
this.setState({
visiblemys:boll,
visiblemyss:false,
})
}else{
this.setState({
visiblemys:boll,
})
}
}
handleVisibleChanges=(boll)=>{
this.setState({
visiblemyss:boll,
})
if(this.state.visiblemys===true){
this.setState({
visiblemyss:boll,
visiblemys:false,
})
}else{
this.setState({
visiblemyss:boll,
})
}
}
setdatafunsval=(e)=>{

@ -20,15 +20,17 @@ import Choicequestion from './component/Choicequestion';
import SingleEditor from "./component/SingleEditor";
import ChoquesEditor from "./component/ChoquesEditor"
import JudquestionEditor from "./component/JudquestionEditor";
var itembankstop=null;
var singleEditor=null;
var Judquestio=null;
var Choques=null;
// 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
@ -120,7 +122,7 @@ class Questionitem_banks extends Component {
if(this.state.item_type==="SINGLE"){
if( this.answerMdRef!=null){
//单选题
console.log(this.answerMdRef.onSave());
// console.log(this.answerMdRef.onSave());
if(this.answerMdRef.onSave().length===0){
return;
@ -168,14 +170,95 @@ class Questionitem_banks extends Component {
if(this.state.item_type==="MULTIPLE"){
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.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);
})
}
}

@ -105,12 +105,15 @@ class ChoquesEditor extends Component{
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]) {

@ -60,7 +60,7 @@ class Listjihe extends Component {
</div>
<div className="w30s xaxisreverseorder">
<p className="listjihetixing">难度<span className="listjihetixings">{items.difficulty===1?"简单":items.difficulty===2?"适中":items.difficulty===3?"困难":""}</span></p>
<p className="mr30 listjihetixing">题型<span className="listjihetixings">{items.item_type==="SINGLE"?"单选题":""}</span></p>
<p className="mr30 listjihetixing">题型<span className="listjihetixings">{items.item_type==="SINGLE"?"单选题":items.item_type==="MULTIPLE"?"多选题":items.item_type==="JUDGMENT"?"判断题":items.item_type==="PROGRAM"?"编程题":""}</span></p>
</div>
</div>
{/*内容*/}

Loading…
Cancel
Save