|
|
@ -16,11 +16,13 @@ class single extends Component{
|
|
|
|
changeItem=(e)=>{
|
|
|
|
changeItem=(e)=>{
|
|
|
|
let choiceId=e.target.value;
|
|
|
|
let choiceId=e.target.value;
|
|
|
|
let question_id=this.props.questionType.question_id;
|
|
|
|
let question_id=this.props.questionType.question_id;
|
|
|
|
|
|
|
|
let {index}=this.props;
|
|
|
|
let url=`/exercise_questions/${question_id}/exercise_answers.json`;
|
|
|
|
let url=`/exercise_questions/${question_id}/exercise_answers.json`;
|
|
|
|
axios.post((url),{
|
|
|
|
axios.post((url),{
|
|
|
|
exercise_choice_id:choiceId
|
|
|
|
exercise_choice_id:choiceId
|
|
|
|
}).then((result)=>{
|
|
|
|
}).then((result)=>{
|
|
|
|
if(result){
|
|
|
|
if(result){
|
|
|
|
|
|
|
|
this.props.changeOption && this.props.changeOption(index,[choiceId]);
|
|
|
|
this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,1);
|
|
|
|
this.props.changeQuestionStatus && this.props.changeQuestionStatus(parseInt(this.props.questionType.q_position)-1,1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((error)=>{
|
|
|
|
}).catch((error)=>{
|
|
|
@ -38,12 +40,12 @@ class single extends Component{
|
|
|
|
let isJudge = questionType.question_type == 2
|
|
|
|
let isJudge = questionType.question_type == 2
|
|
|
|
return(
|
|
|
|
return(
|
|
|
|
<div className="pl30 pr30 singleDisplay">
|
|
|
|
<div className="pl30 pr30 singleDisplay">
|
|
|
|
<Radio.Group disabled={ user_exercise_status == 1 ? true : false } defaultValue={questionType.user_answer[0]} onChange={this.changeItem}>
|
|
|
|
<Radio.Group disabled={ user_exercise_status == 1 ? true : false } value={questionType.user_answer[0]} onChange={this.changeItem}>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
questionType.question_choices && questionType.question_choices.map((item,key)=>{
|
|
|
|
questionType.question_choices && questionType.question_choices.map((item,key)=>{
|
|
|
|
let prefix = isJudge ? undefined : `${tagArray[key]}.`
|
|
|
|
let prefix = isJudge ? undefined : `${tagArray[key]}.`
|
|
|
|
return(
|
|
|
|
return(
|
|
|
|
<p className={parseInt(questionType.question_type) == 0 ? "clearfix mb15 df" : "fl mr40"}>
|
|
|
|
<p className={parseInt(questionType.question_type) == 0 ? "clearfix mb15 df" : "fl mr40 df"}>
|
|
|
|
<Radio className="fl lineh-20" value={item.choice_id}>{prefix}</Radio>
|
|
|
|
<Radio className="fl lineh-20" value={item.choice_id}>{prefix}</Radio>
|
|
|
|
{/* <span className="fl lineh-20 mr3 "></span> */}
|
|
|
|
{/* <span className="fl lineh-20 mr3 "></span> */}
|
|
|
|
{/* <span style={{display:"inline-block", 'margin-top': '-1px'}} className="markdown-body fl " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
|
|
|
|
{/* <span style={{display:"inline-block", 'margin-top': '-1px'}} className="markdown-body fl " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
|
|
|
|