|
|
|
@ -33,7 +33,9 @@ class Questionitem_banks extends Component {
|
|
|
|
|
this.Judquestio= React.createRef();
|
|
|
|
|
this.state = {
|
|
|
|
|
item_type:null,
|
|
|
|
|
item_banksedit:[]
|
|
|
|
|
item_banksedit:[],
|
|
|
|
|
myquestion_choicesco:[],
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -80,8 +82,29 @@ class Questionitem_banks extends Component {
|
|
|
|
|
////console.log("item_banks");
|
|
|
|
|
console.log("Questionitem_banks");
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
var choicescomy=[];
|
|
|
|
|
try {
|
|
|
|
|
if(this.props.item_banksedit){
|
|
|
|
|
if(this.props.item_banksedit.choices){
|
|
|
|
|
for(var p=0;p<this.props.item_banksedit.choices.length;p++){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.props.item_banksedit.choices.forEach((item, index) => {
|
|
|
|
|
choicescomy.push({
|
|
|
|
|
choice_text:item.choice_text,
|
|
|
|
|
standard_boolean:item.is_answer,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
item_banksedit:response.data,
|
|
|
|
|
myquestion_choicesco:choicescomy,
|
|
|
|
|
})
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
////console.log(error)
|
|
|
|
@ -124,7 +147,6 @@ class Questionitem_banks extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getJudquestio=(Ref)=>{
|
|
|
|
|
debugger
|
|
|
|
|
this.Judquestio=Ref;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -139,7 +161,20 @@ class Questionitem_banks extends Component {
|
|
|
|
|
////console.log(this.contentMdRef.Getdatas());
|
|
|
|
|
////console.log("preservation3333");
|
|
|
|
|
////console.log(this.answerMdRef.onSave());
|
|
|
|
|
var url="/item_banks.json";
|
|
|
|
|
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 !=null){
|
|
|
|
|
console.log(this.contentMdRef.Getdatas());
|
|
|
|
|
}
|
|
|
|
@ -185,7 +220,9 @@ class Questionitem_banks extends Component {
|
|
|
|
|
analysis:anserdata[3],
|
|
|
|
|
choices:choices,
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
if(boolnew===true){
|
|
|
|
|
|
|
|
|
|
axios.post(url, data)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
@ -195,6 +232,18 @@ class Questionitem_banks extends Component {
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
axios.put(url, data)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
this.props.showNotification(`编辑单选题成功`);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -230,6 +279,7 @@ class Questionitem_banks extends Component {
|
|
|
|
|
analysis:anserdata[3],
|
|
|
|
|
choices:choices,
|
|
|
|
|
}
|
|
|
|
|
if(boolnew===true) {
|
|
|
|
|
axios.post(url, data)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
@ -240,6 +290,19 @@ class Questionitem_banks extends Component {
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
axios.put(url, data)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
this.props.showNotification(`编辑多选题成功`);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -278,6 +341,8 @@ class Questionitem_banks extends Component {
|
|
|
|
|
analysis:anserdata[2],
|
|
|
|
|
choices:choices,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(boolnew===true) {
|
|
|
|
|
axios.post(url, data)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
@ -287,6 +352,18 @@ class Questionitem_banks extends Component {
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
axios.put(url, data)
|
|
|
|
|
.then((result) => {
|
|
|
|
|
if (result.data.status == 0) {
|
|
|
|
|
this.props.showNotification(`编辑判断题成功`);
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -363,6 +440,7 @@ class Questionitem_banks extends Component {
|
|
|
|
|
<SingleEditor
|
|
|
|
|
{...this.state}
|
|
|
|
|
{...this.props}
|
|
|
|
|
question_choices={this.state.myquestion_choicesco}
|
|
|
|
|
getanswerMdRef={(ref)=>this.getanswerMdRef(ref)}
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
@ -385,6 +463,7 @@ class Questionitem_banks extends Component {
|
|
|
|
|
<JudquestionEditor
|
|
|
|
|
{...this.state}
|
|
|
|
|
{...this.props}
|
|
|
|
|
item_banksedit={this.state.item_banksedit}
|
|
|
|
|
getanswerMdRef={(ref)=>this.getJudquestio(ref)}
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|