You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/public/react/src/modules/tpm/challengesnew/TPMquestion.js

1759 lines
78 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import React, {Component} from 'react';
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Tooltip} from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import axios from 'axios';
import { getImageUrl, toPath } from 'educoder';
import './css/TPMchallengesnew.css';
import {getUrl} from 'educoder';
import TPMeditorMD from './editorMD';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
const Option = Select.Option;
const RadioGroup = Radio.Group;
var letterArr = [];
for (var i = 65, j = 0; i < 91; i++, j++) {
letterArr[j] = String.fromCharCode(i);
}
// 恢复数据
function md_rec_data(k,mdu,id, editor){
if(window.sessionStorage.getItem(k+mdu) !== null){
editor.setValue(window.sessionStorage.getItem(k+mdu));
md_clear_data(k,mdu,id);
}
}
// 保存数据
function md_add_data(k,mdu,d){
window.sessionStorage.setItem(k+mdu,d);
}
// 清空保存的数据
function md_clear_data(k,mdu,id){
window.sessionStorage.removeItem(k+mdu);
var id1 = "#e_tip_"+id;
var id2 = "#e_tips_"+id;
if(k == 'content'){
$(id2).html("");
}else{
$(id1).html("");
}
}
function md_elocalStorage(editor,mdu,id){
if (window.sessionStorage){
var oc = window.sessionStorage.getItem('content'+mdu);
if(oc !== null ){
// console.log("#e_tips_"+id)
$("#e_tips_"+id).data('editor', editor);
var h = '您上次有已保存的数据,是否<a style="cursor: pointer;" class="link-color-blue" onclick="md_rec_data(\'content\',\''+ mdu + '\',\'' + id + '\')">恢复</a> ? / <a style="cursor: pointer;" class="link-color-blue" onclick="md_clear_data(\'content\',\''+ mdu + '\',\'' + id + '\')">不恢复</a>';
$("#e_tips_"+id).html(h);
}
setInterval(function() {
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
if(editor.getValue().trim() != ""){
md_add_data("content",mdu,editor.getValue());
var id1 = "#e_tip_"+id;
var id2 = "#e_tips_"+id;
$(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
$(id2).html("");
}
},10000);
}else{
$("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
}
}
function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) {
var editorName = window.editormd(id, {
width: width,
height: high,
path: path, // "/editormd/lib/"
markdown : initValue,
syncScrolling: "single",
tex: true,
tocm: true,
emoji: true,
taskList: true,
codeFold: true,
searchReplace: true,
htmlDecode: "style,script,iframe",
sequenceDiagram: true,
autoFocus: false,
placeholder: placeholder,
toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
},
toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6,
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: imageUrl,//url
onload: function () {
// this.previewing();
$("#" + id + " [type=\"latex\"]").bind("click", function () {
editorName.cm.replaceSelection("```latex");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("```");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line - 1, 0);
});
$("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$");
var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");
$("[type=\"latex\"]").attr("title", "多行公式");
callback && callback()
}
});
return editorName;
}
export default class TPMquestion extends Component {
constructor(props) {
super(props)
this.state = {
choice_url: undefined,
practice_url: undefined,
go_back_url: undefined,
position: undefined,
task_pass_default: undefined,
submit_url: undefined,
questionInputvalue:undefined,
questionaddsum:0,
questionaddarray:[],
questionaddtype:true,
activetype:"",
questionlists:[{str:"A",val:"",type:false},{str:"B",val:"",type:false},{str:"C",val:"",type:false},{str:"D",val:"",type:false}],
answeshixunsGroup: 1,
answeoptions:[10,20],
answeonshixunsmark:10,
shixunssanswerkillvalue:"",
shixunsskillanswerlist:[],
challenge_id:"",
challenge_choose_id:undefined,
questionlistss:[],
newcnttype:false,
newquestioMDvaluetype:false,
challenge_tagtype:false,
editquestionaddtype:false,
mancheckpointId:undefined,
power:false,
questionInputvaluetype:false,
questioMD:"",
standard_answer:"",
subject:"",
newquestioMDvaluetypes:false,
questionInputvaluetypes:false,
prev_challenge:undefined,
next_challenge:undefined,
newcnttypesum:1,
marktype:false,
answer:"",
sumittype:false
}
}
questioMD=(initValue, id)=> {
this.contentChanged = false;
const placeholder = "请输入选择题的过关任务内容";
// amp;
// 编辑时要传memoId
// const imageUrl = `/upload_with_markdown?container_id=&container_type=Memo`;
const imageUrl = `/api/attachments.json`;
// 创建editorMd
let questio_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,() => {
setTimeout(() => {
questio_editormd.resize()
questio_editormd.cm && questio_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
questio_editormd.setValue(initValue)
}
questio_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
md_elocalStorage(questio_editormd, `MemoQuestion_${id}`, `${id}Question`);
this.questio_editormd = questio_editormd;
window.questio_editormd = questio_editormd;
}
newanswerMD=(initValue, id)=> {
this.contentChanged = false;
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
// 创建editorMd
let newanswerMD_editormd = create_editorMD(id, '100%', 400, "请输入各个选项的具体解析或其他相关信息", imageUrl, initValue,() => {
setTimeout(() => {
newanswerMD_editormd.resize()
newanswerMD_editormd.cm && newanswerMD_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
newanswerMD_editormd.setValue(initValue)
}
newanswerMD_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
md_elocalStorage(newanswerMD_editormd, `MemoQuestion_${id}`, `${id}Question`);
this.newanswerMD_editormd = newanswerMD_editormd;
window.newanswerMD_editormd = newanswerMD_editormd;
}
newquestioMD=(initValue, id)=>{
this.contentChanged = false;
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
// 创建editorMd
let newquestioMD_editormd = create_editorMD(id, '100%', 400, "请输入选择题的题干内容", imageUrl, initValue,() => {
setTimeout(() => {
newquestioMD_editormd.resize()
newquestioMD_editormd.cm && newquestioMD_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
newquestioMD_editormd.setValue(initValue)
}
newquestioMD_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
md_elocalStorage(newquestioMD_editormd, `MemoQuestion_${id}`, `${id}Question`);
this.newquestioMD_editormd = newquestioMD_editormd;
window.newquestioMD_editormd = newquestioMD_editormd;
}
editanswerMD=(initValue, id)=> {
this.contentChanged = false;
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
// 创建editorMd
const neweditanswer_editormd =create_editorMD(id, '100%', 400, "请输入选择题的题干内容", imageUrl, initValue,()=> {
setTimeout(() => {
neweditanswer_editormd.resize()
neweditanswer_editormd.cm && neweditanswer_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
neweditanswer_editormd.setValue(initValue)
}
neweditanswer_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
md_elocalStorage(neweditanswer_editormd, `MemoQuestion_${id}`, `${id}Question`);
this.neweditanswer_editormd = neweditanswer_editormd;
window.neweditanswer_editormd = neweditanswer_editormd;
}
editanswersMD=(initValue, id)=> {
this.contentChanged = false;
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
// 创建editorMd
const editanswersMD_editormd = create_editorMD(id, '100%', 400, "请输入各个选项的具体解析或其他相关信息", imageUrl, initValue,() => {
setTimeout(() => {
editanswersMD_editormd.resize()
editanswersMD_editormd.cm && editanswersMD_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
editanswersMD_editormd.setValue(initValue)
}
editanswersMD_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
md_elocalStorage(editanswersMD_editormd, `MemoQuestion_${id}`, `${id}Question`);
this.editanswersMD_editormd = editanswersMD_editormd;
window.editanswersMD_editormd = editanswersMD_editormd;
}
//_______________________________________________________________________________
questionInputvalue=(e)=>{
this.setState({
questionInputvalue: e.target.value
})
}
componentDidMount() {
if(this.props.status===2){
}
let id = this.props.match.params.shixunId;
let checkpointId=this.props.match.params.checkpointId;
this.setState({
mancheckpointId:id,
})
let newchoice_url= "/shixuns/"+id+"/challenges/newquestion";
let newpractice_url= "/shixuns/"+id+"/challenges/new";
let newgo_back_url="/shixuns/"+id+"/challenges";
if(this.props.match.params.choose_id===undefined){
if(checkpointId===undefined){
//新建模式
let nurl = "/shixuns/" + id + "/challenges/new.json"
axios.get(nurl).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else {
this.setState({
choice_url: newchoice_url,
practice_url: newpractice_url,
go_back_url: newgo_back_url,
position: response.data.position,
task_pass_default: response.data.task_pass_default,
submit_url: response.data.submit_url,
power:true,
activetype:"first",
})
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
this.questioMD("", "questioMD");
this.setState({
questioMD:""
})
} else {
this.questioMD("", "questioMD");
// this.create_mackdown(response.data.task_pass_default, "questioMD","")
this.setState({
questioMD:response.data.task_pass_default
})
}
this.shixunsautoHeight()
}
}).catch((error) => {
console.log(error)
});
}else{
//编辑模式
let url = "/shixuns/"+ id +"/challenges/"+checkpointId+"/edit.json?st=1"
axios.get(url).then((response) => {
// if(choose_idlist!=undefined){
//
// for(var i=0; i<choose_idlist.length;i++){
// questionaddarrays.push({sum:i+1,chooseid:choose_idlist[i]});
// }
// }
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else {
let newprev_challenge=response.data.prev_challenge;
let next_challenge=response.data.next_challenge;
if (newprev_challenge != undefined) {
if(newprev_challenge.st===0){
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
}else{
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
}
}
if (next_challenge != undefined) {
if(next_challenge.st===0){
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint";
}else{
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion";
}
}
this.setState({
questionaddtype:false,
newquestionaddtype:false,
activetype:"first",
prev_challenge:newprev_challenge,
next_challenge:next_challenge,
questionInputvalue:response.data.subject,
questionaddarray:response.data.chooses,
challenge_id:response.data.id,
mancheckpointId:checkpointId,
position: response.data.position,
choice_url: newchoice_url,
practice_url: newpractice_url,
go_back_url: newgo_back_url,
power:response.data.power,
questioMD:response.data.task_pass,
answer:response.data.answer
})
this.questioMD(response.data.task_pass, "questioMD");
if(response.data.chooses.length===0){
this.questionadd()
}
// this.create_mackdown(response.data.task_pass, "questioMD","","questio_editormd")
this.shixunsautoHeight()
}
}).catch((error) => {
console.log(error)
});
}
}else{
$('html').animate({
scrollTop:10
}, 500);
let{challenge_id} =this.state;
let id = this.props.match.params.shixunId;
let url = "/shixuns/"+ id +"/challenges/"+checkpointId+"/edit.json?st=1"
axios.get(url).then((response) => {
// if(choose_idlist!=undefined){
//
// for(var i=0; i<choose_idlist.length;i++){
// questionaddarrays.push({sum:i+1,chooseid:choose_idlist[i]});
// }
// }
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else {
let newprev_challenge=response.data.prev_challenge;
let next_challenge=response.data.next_challenge;
if (newprev_challenge != undefined) {
if(newprev_challenge.st===0){
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
}else{
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
}
}
if (next_challenge != undefined) {
if(next_challenge.st===0){
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint";
}else{
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion";
}
}
this.setState({
questionaddtype:false,
newquestionaddtype:false,
prev_challenge:newprev_challenge,
next_challenge:next_challenge,
questionInputvalue:response.data.subject,
questionaddarray:response.data.chooses,
challenge_id:response.data.id,
mancheckpointId:checkpointId,
position: response.data.position,
choice_url: newchoice_url,
practice_url: newpractice_url,
go_back_url: newgo_back_url,
power:response.data.power,
questioMD:response.data.task_pass,
})
this.questioMD(response.data.task_pass, "questioMD");
if(response.data.chooses.length===0){
this.questionadd()
}
// this.create_mackdown(response.data.task_pass, "questioMD","","questio_editormd")
this.shixunsautoHeight()
}
}).catch((error) => {
console.log(error)
});
let zrl ='/shixuns/'+this.props.match.params.shixunId+'/challenges/'+this.props.match.params.checkpointId+'/edit_choose_question.json?choose_id='+this.props.match.params.choose_id;
axios.get(zrl).then((response) => {
if(response.status===200){
let choose_contents=response.data.choose_contents;
let newchoose_contentslist=[]
for(var i=0; i<choose_contents.length; i++){
let a=choose_contents[i];
newchoose_contentslist.push({str:letterArr[a.position],val:a.option_name,type:a.right_key})
}
this.setState({
activetype:this.props.match.params.choose_id,
editquestionaddtype:true,
questionaddtype:false,
newquestionaddtype:false,
editlist:response.data,
questionlists:newchoose_contentslist,
answeshixunsGroup:response.data.difficult,
answeonshixunsmark:response.data.score,
shixunsskillanswerlist:response.data.tags,
challenge_choose_id:this.props.match.params.choose_id,
standard_answer:response.data.standard_answer,
subject:response.data.subject,
answer:response.data.answer
})
this.editanswerMD(response.data.subject, "neweditanswer")
this.editanswersMD(response.data.answer, "editanswers")
this.shixunsautoHeight()
}
}).catch((error) => {
});
}
}
clickquestionsumit=()=>{
this.setState({
sumittype:true
})
let checkpointId=this.props.match.params.checkpointId;
if(this.props.status===2&&checkpointId===undefined){
this.props.showSnackbar("该实训已经发布不能新建")
this.setState({
sumittype:false
})
return
}
let {questionInputvalue} =this.state;
const exercise_editormdvalue = this.questio_editormd.getValue();
let id = this.props.match.params.shixunId;
if(questionInputvalue===undefined||questionInputvalue===null||questionInputvalue===""){
this.setState({
questionInputvaluetype:true
})
$('html').animate({
scrollTop: 10
}, 1000);
this.setState({
sumittype:false
})
return
}
if(exercise_editormdvalue===null ||exercise_editormdvalue===""){
this.setState({
questionInputvaluetypes:true
})
$('html').animate({
scrollTop: 500
}, 1000);
this.setState({
sumittype:false
})
return
}
if(checkpointId===undefined){
let url = "/shixuns/" + id + "/challenges.json";
axios.post(url, {
identifier:id,
subject: questionInputvalue,
task_pass: exercise_editormdvalue,
st: 1
}).then((response) => {
this.props.showSnackbar(response.data.messages);
// if(response.data.status===1){
//
// this.setState({
// questionaddtype:false,
// challenge_id:response.data.challenge_id
// })
//
// this.questionadd()
// }
window.location.href = '/shixuns/'+id+'/challenges/'+response.data.challenge_id+'/editquestion';
}).catch((error) => {
console.log(error)
});
}else{
let url ="/shixuns/"+id+"/challenges/"+checkpointId+".json";
axios.put(url, {
tab:0,
subject: questionInputvalue,
task_pass: exercise_editormdvalue,
}).then((response) => {
if(response.data.status===1){
this.setState({
questionaddtype:false,
challenge_id:response.data.challenge_id
})
}
$('html').animate({
scrollTop: 10
}, 200);
this.props.showSnackbar(response.data.messages);
window.location.href = '/shixuns/'+id+'/challenges/'+response.data.challenge_id+'/editquestion';
}).catch((error) => {
console.log(error)
});
}
}
questionall=()=>{
let {task_pass_default}=this.state;
this.setState({
activetype:"first",
newquestionaddtype:false,
editquestionaddtype:false
})
this.questioMD(task_pass_default, "questioMD");
}
questionadd=()=>{
$('html').animate({
scrollTop: 10
}, 200);
let{questionaddarray}=this.state;
let questionaddsums=questionaddarray.length;
if(questionaddarray.length-1>9){
return
}
let questionaddarrays=questionaddarray;
questionaddarrays.push({type:0,choose_id:0});
this.setState({
activetype:0,
questionaddarray:questionaddarrays,
questionaddtype:true,
newquestionaddtype:true,
editquestionaddtype:false,
questionlists:[{str:"A",val:"",type:false},{str:"B",val:"",type:false},{str:"C",val:"",type:false},{str:"D",val:"",type:false}],
answeshixunsGroup: 1,
answeoptions:[10,20],
answeonshixunsmark:10,
shixunssanswerkillvalue:"",
shixunsskillanswerlist:[]
})
this.newanswerMD("","challenge_choose_answer")
this.newquestioMD("","newquestioMDs")
// this.create_mackdown("", "newquestioMDs","请输入选择题的题干内容","newanswerMD_editormd")
// this.create_mackdown("", "challenge_choose_answer","请输入各个选项的具体解析或其他相关信息","newquestioMD_editormd")
this.shixunsautoHeight()
}
editquestionlists=(newquestionlists)=>{
let newlist=newquestionlists;
let list=[]
for(var i=0; i<newlist.length; i++){
if(newlist[i].type===true){
list.push(newlist[i].str)
}
}
this.setState({
questionlists:newquestionlists,
questionlistss:list
})
}
addquestionlists=()=>{
let{questionlists} = this.state;
let newquestionlists=questionlists;
let newli={str:letterArr[questionlists.length],val:"",type:false};
newquestionlists.push(newli);
this.editquestionlists(newquestionlists);
}
delquestionlists=(key)=>{
let{questionlists} = this.state;
let newquestionlists=questionlists;
newquestionlists.splice(key,1);
for(var i=0; i<newquestionlists.length; i++){
newquestionlists[i].str=letterArr[i];
}
this.editquestionlists(newquestionlists);
}
selquestionlists=(key)=>{
let{questionlists} = this.state;
let newquestionlists=questionlists;
if(newquestionlists[key].type===true){
newquestionlists[key].type=false;
}else if(newquestionlists[key].type===false){
newquestionlists[key].type=true;
}
this.editquestionlists(newquestionlists);
}
onshixunGroupanswe=(e)=> {
let optionsum;
let onshixunsmark;
if(e.target.value===1){
optionsum=[10,20];
onshixunsmark=10;
}else if(e.target.value===2){
optionsum=[30,40,50,60];
onshixunsmark=30;
}else if(e.target.value===3){
optionsum=[70,80,90,100]
onshixunsmark=70;
}
this.setState({
answeshixunsGroup: e.target.value,
answeoptions:optionsum,
answeonshixunsmark:onshixunsmark
})
}
shixunssanswerkill = (e) => {
this.setState({
shixunssanswerkillvalue: e.target.value
})
}
clickshixunsanswerskill = () => {
let {shixunssanswerkillvalue, shixunsskillanswerlist} = this.state;
if (shixunssanswerkillvalue === "") {
return
} else if (shixunssanswerkillvalue === undefined) {
return
}
if(shixunssanswerkillvalue == "" || shixunssanswerkillvalue == undefined || shixunssanswerkillvalue == null || (shixunssanswerkillvalue.length>0 && shixunssanswerkillvalue.trim().length == 0)){
message.error("输入为空,不能保存!");
return
}
let list = shixunsskillanswerlist;
list.push(shixunssanswerkillvalue);
this.setState({
shixunsskillanswerlist: list,
shixunssanswerkillvalue: ""
})
}
delshixunssnswerllist=(key)=>{
let {shixunsskillanswerlist} = this.state;
let newshixunsskillanswerlist = shixunsskillanswerlist;
newshixunsskillanswerlist.splice(key, 1);
this.setState({
shixunsskillanswerlist: newshixunsskillanswerlist
})
}
onInputoquestionption=(e,key)=>{
$.fn.autoHeight = function(){
function autoHeight(elem){
elem.style.height = 'auto';
elem.style.maxHeight = '140px';
elem.scrollTop = 0; //防抖动
elem.style.height = elem.scrollHeight + 'px';
}
this.each(function(){
autoHeight(this);
$(this).on('keyup', function(){
autoHeight(this);
});
});
}
$("#"+e.target.id).autoHeight();
let {questionlists}=this.state;
let newquestionlists=questionlists;
newquestionlists[key].val=e.target.value;
this.editquestionlists(newquestionlists);
}
onshixunsansweSelect=(value)=>{
this.setState({
answeonshixunsmark: value
})
}
answer_subit=(sumtype,challenge_choose_id)=>{
let {challenge_id,questionlists,shixunsskillanswerlist,answeonshixunsmark,answeshixunsGroup,questionaddarray} =this.state;
if(challenge_id===undefined){
message.error("关卡id为空");
return
}
let newquestionlists=questionlists;
let newlist="";
let newtype=[];
let newcnt=[];
let list=0;
for(var i=0; i<newquestionlists.length; i++){
if(newquestionlists[i].type===true){
newlist=newlist+newquestionlists[i].str;
}else{
list=list+1
}
newtype.push(newquestionlists[i].type)
newcnt.push(newquestionlists[i].val)
}
if(list===newquestionlists.length){
this.setState({
newcnttype:true,
newcnttypesum:0
})
message.error("没有选择答案");
$('html').animate({
scrollTop:700
}, 1000);
return
}
for(var z=0; z<newcnt.length; z++){
if(newcnt.length===0){
this.setState({
newcnttype:true,
newcnttypesum:1
})
message.error("新增选项为空");
$('html').animate({
scrollTop:700
}, 1000);
return
}
if(newcnt[z]===" "||newcnt[z]===""){
this.setState({
newcnttype:true,
newcnttypesum:1
})
message.error("新增选项为空");
$('html').animate({
scrollTop:700
}, 1000);
return
}
}
if(shixunsskillanswerlist.length===0){
this.setState({
challenge_tagtype:true,
})
message.error("技能标签为空");
return
}else{
this.setState({
challenge_tagtype:false,
})
}
for(var l=0; l<shixunsskillanswerlist.length; l++){
if(shixunsskillanswerlist[l]===""){
this.setState({
challenge_tagtype:true,
})
message.error("技能标签为空");
return
}else{
this.setState({
challenge_tagtype:false,
})
}
}
let id = this.props.match.params.shixunId;
let url;
if(sumtype==="edit"){
let newquestioMDvalue = this.neweditanswer_editormd.getValue();
if(newquestioMDvalue===""||newquestioMDvalue==="请输入选择题的题干内容"){
this.setState({
newquestioMDvaluetype:true,
})
$('html').animate({
scrollTop:100
}, 200);
message.error("题干为空");
return
}
let newnewanswerMDvalue = this.editanswersMD_editormd.getValue();
console.log(newnewanswerMDvalue)
if(newnewanswerMDvalue===""||newnewanswerMDvalue===" "){
newnewanswerMDvalue=newlist
}
// if(newnewanswerMDvalue===""||newnewanswerMDvalue==="请输入选择题的题干内容"){
// this.setState({
// newquestioMDvaluetypes:true,
// })
// $('html').animate({
// scrollTop:1300
// }, 200);
// this.props.showSnackbar("参考答案为空");
// return
// }
url="/shixuns/" + id + "/challenges/" + challenge_id + "/update_choose_question.json?choose_id="+challenge_choose_id;
axios.post(url, {
challenge_choose: {subject: newquestioMDvalue, answer: newnewanswerMDvalue, standard_answer:newlist, score: answeonshixunsmark, difficult: answeshixunsGroup},
challenge_tag: shixunsskillanswerlist,
question: {cnt: newcnt},
choice: {answer: newtype}
}).then((response) => {
// $('html').animate({
// scrollTop: 10
// }, 200);
message.success("修改成功");
this.setState({
questionaddtype:false,
newquestioMDvaluetype:false,
newquestioMDvaluetypes:false,
})
setTimeout(window.location.href="/shixuns/"+this.props.match.params.shixunId+"/challenges/"+this.props.match.params.checkpointId+"/editquestion"+"/"+response.data.challenge_choose_id,1000)
// this.gochooseid()
}).catch((error) => {
console.log(error)
});
}else{
let newquestioMDvalue = this.newquestioMD_editormd.getValue();
if(newquestioMDvalue===""||newquestioMDvalue==="请输入选择题的题干内容"){
this.setState({
newquestioMDvaluetype:true,
})
$('html').animate({
scrollTop:100
}, 200);
message.error("题干为空");
return
}
let newnewanswerMDvalue = this.newanswerMD_editormd.getValue();
//
// if(newnewanswerMDvalue===""||newnewanswerMDvalue==="请输入选择题的题干内容"){
// this.setState({
// newquestioMDvaluetypes:true,
// })
//
// $('html').animate({
// scrollTop:1300
// }, 200);
// this.props.showSnackbar("参考答案为空");
// return
// }
if(newnewanswerMDvalue===""||newnewanswerMDvalue===" "){
newnewanswerMDvalue=newlist
}
url="/shixuns/" + id + "/challenges/" + challenge_id + "/create_choose_question.json";
axios.post(url, {
challenge_choose: {subject: newquestioMDvalue, answer: newnewanswerMDvalue, standard_answer:newlist , score: answeonshixunsmark, difficult: answeshixunsGroup},
challenge_tag: shixunsskillanswerlist,
question: {cnt: newcnt},
choice: {answer: newtype}
}).then((response) => {
let questionaddsums=questionaddarray.length;
let questionaddarrays=questionaddarray;
questionaddarrays[questionaddsums-1].choose_id=response.data.challenge_choose_id;
if(newlist.length===1){
questionaddarrays[questionaddsums-1].type=1;
}else if(newlist.length>1){
questionaddarrays[questionaddsums-1].type=2;
}
this.setState({
challenge_choose_id:response.data.challenge_choose_id,
questionaddtype:false,
editquestionaddtype:false,
newquestioMDvaluetype:false,
newquestioMDvaluetypes:false,
questionaddarray:questionaddarrays
})
// $('html').animate({
// scrollTop: 10
// }, 200);
message.success("新建成功");
// this.getanswer_subitlist()
this.gochooseid("/shixuns/"+this.props.match.params.shixunId+"/challenges/"+this.props.match.params.checkpointId+"/editquestion"+"/"+response.data.challenge_choose_id)
}).catch((error) => {
console.log(error)
});
}
}
// getanswer_subitlist=()=>{
// let{challenge_choose_id,challenge_id,questionaddarray} =this.state
// let id = this.props.match.params.shixunId;
// let url ='/shixuns/'+id+'/challenges/'+challenge_id+'/edit_choose_question.json?choose_id='+challenge_choose_id;
// axios.get(url).then((response) => {
// if(response.status===200){
// this.create_mackdown(response.data.subject, "neweditanswer","","neweditanswer_editormd")
// this.create_mackdown(response.data.standard_answer, "editanswers","","editanswersMD_editormd")
// let choose_contents=response.data.choose_contents;
// let newchoose_contentslist=[]
// for(var i=0; i<choose_contents.length; i++){
// let a=choose_contents[i];
// newchoose_contentslist.push({str:letterArr[a.position],val:a.option_name,type:a.right_key})
// }
// this.setState({
// activetype:challenge_choose_id,
// editquestionaddtype:true,
// questionaddtype:false,
// newquestionaddtype:false,
// editlist:response.data,
// questionlists:newchoose_contentslist,
// answeshixunsGroup:response.data.difficult,
// answeonshixunsmark:response.data.score,
// shixunsskillanswerlist:response.data.tags,
// challenge_choose_id:challenge_choose_id
// })
// }
// }).catch((error) => {
// });
// }
questionlist=(key,challenge_choose_id,type)=>{
$('html').animate({
scrollTop:10
}, 500);
let{challenge_id} =this.state;
if(challenge_choose_id===""||type===0){
this.newanswerMD("","neweditanswer")
this.editanswersMD("","editanswers")
this.setState({
activetype:challenge_choose_id,
editquestionaddtype:true,
questionaddtype:true,
newquestionaddtype:false,
questionlists:[{str:"A",val:"",type:false},{str:"B",val:"",type:false},{str:"C",val:"",type:false},{str:"D",val:"",type:false}],
answeshixunsGroup: 1,
answeoptions:[10,20],
answeonshixunsmark:10,
shixunssanswerkillvalue:"",
shixunsskillanswerlist:[]
})
// this.create_mackdown("", "newquestioMDs","请输入选择题的题干内容","newanswerMD_editormd")
// this.create_mackdown("", "challenge_choose_answer","请输入各个选项的具体解析或其他相关信息","newquestioMD_editormd")
}else{
let id = this.props.match.params.shixunId;
let url ='/shixuns/'+id+'/challenges/'+challenge_id+'/edit_choose_question.json?choose_id='+challenge_choose_id;
axios.get(url).then((response) => {
if(response.status===200){
let choose_contents=response.data.choose_contents;
let newchoose_contentslist=[]
for(var i=0; i<choose_contents.length; i++){
let a=choose_contents[i];
newchoose_contentslist.push({str:letterArr[a.position],val:a.option_name,type:a.right_key})
}
this.setState({
activetype:challenge_choose_id,
editquestionaddtype:true,
questionaddtype:false,
newquestionaddtype:false,
editlist:response.data,
questionlists:newchoose_contentslist,
answeshixunsGroup:response.data.difficult,
answeonshixunsmark:response.data.score,
shixunsskillanswerlist:response.data.tags,
challenge_choose_id:challenge_choose_id,
standard_answer:response.data.standard_answer,
subject:response.data.subject,
answer:response.data.answer
})
this.editanswerMD(response.data.subject, "neweditanswer")
this.editanswersMD(response.data.answer, "editanswers")
this.shixunsautoHeight()
}
}).catch((error) => {
});
}
}
shixunsautoHeight=()=>{
$.fn.autoHeight = function(){
function autoHeight(elem){
elem.style.height = 'auto';
elem.style.maxHeight = '140px';
elem.scrollTop = 0; //防抖动
if(elem.scrollHeight===0){
elem.style.height = 62 + 'px';
}else{
// if(elem.style.height>140){
//
// }
elem.style.height = elem.scrollHeight + 'px';
}
}
this.each(function(){
autoHeight(this);
$(this).on('keyup', function(){
autoHeight(this);
});
});
}
$('textarea[autoHeight]').autoHeight();
}
gochooseid=(url)=>{
window.location.href =url
}
onshixunsmarks=()=> {
this.setState({
marktype:true
})
}
onshixunsmarkss=()=> {
this.setState({
marktype:false
})
}
render() {
let {choice_url,
practice_url,
go_back_url,
position,
questionInputvalue,
challenge_tagtype,
questionInputvaluetype,
answeshixunsGroup,
answeoptions,
answeonshixunsmark,
shixunssanswerkillvalue,
questionlistss,power,
questionaddarray,
questionaddtype,
activetype,
newquestionaddtype,
newquestioMDvaluetype,
editquestionaddtype,
questionlists,
shixunsskillanswerlist,
newcnttype,
challenge_choose_id,
mancheckpointId,
challenge_id,
questioMD,
standard_answer,
subject,
newquestioMDvaluetypes,
questionInputvaluetypes,
prev_challenge,
next_challenge,
newcnttypesum,
marktype,
answer,
sumittype
} = this.state;
let options;
options = answeoptions.map((d, k) => {
return (
<Option key={d} id={k}>{d}</Option>
)
})
console.log(answer)
return (
<React.Fragment>
<div className="educontent mt30 mb30">
<div className="padding10-20 mb10 edu-back-white clearfix">
<span className="fl ring-blue mr10 mt7" style={{lineHeight:"15px"}}>
<img src={getImageUrl("images/educoder/icon/choose.svg")} data-tip-down="实训任务"/>
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-15 mt3">返回</Link>
{ prev_challenge===undefined?"":
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{ next_challenge===undefined?"":
<a href={next_challenge}className="fr color-blue mr15 mt4">下一关</a>
}
<a href={practice_url === undefined ? "" : practice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}}
data-tip-down="新增代码编辑类型的任务">+&nbsp;实践类型</a>
<a href={choice_url === undefined ? "" : choice_url} className="fr color-blue mr15 mt4"
style={{display:this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}}
data-tip-down="新增选择题类型的任务">+&nbsp;选择题类型</a>
</div>
<div className="challenge_nav clearfix edu-back-white question_nav">
<li onClick={this.questionall} className={activetype==="first"?"click_active active":""}>
<a>本关任务</a>
</li>
{
questionaddarray.length===0?"":questionaddarray.map((item,key)=>{
return(
<li key={key}
className={parseInt(activetype)===item.choose_id?"click_active active":""}
onClick={parseInt(activetype)===item.choose_id?()=>this.questionlist(key,item.choose_id,item.type):""}
>
{
item.choose_id!=0?
<Popconfirm title="切换前请确认当前选择题已提交,否则不会保存你当前所有输入!" okText="确定" cancelText="取消" onConfirm={()=>this.gochooseid("/shixuns/"+this.props.match.params.shixunId+"/challenges/"+this.props.match.params.checkpointId+"/editquestion"+"/"+item.choose_id)}>
<a>{key+1}.{item.type===2?"多选题":item.type===1?"单选题":'选择题'}</a>
</Popconfirm>:<a>{key+1}.{item.type===2?"":item.type===1?"":''}</a>
}
</li>
)
})
}
<li onClick={this.questionadd}
style={{display:questionaddtype===true||this.props.status===2?"none":"block"}}>
<Tooltip placement="bottom" title={"新增选择题"}>
<a className="add_choose_type" style={{width:'50px'}}>+</a>
</Tooltip>
</li>
</div>
<div style={{display:activetype==="first"?"block":"none"}}>
<div className="edu-back-white mb10 clearfix">
<div className="padding40-20">
<p className="color-grey-6 font-16 mb30">任务名称</p>
<div className="df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20">
<input type="text"
className={questionInputvaluetype===true?"input-100-45 greyInpus wind100":"input-100-45 greyInput "}
maxLength="50"
name="challenge[subject]"
value={questionInputvalue}
placeholder="请输入任务名称(此信息将提前展示给学员),例:计算学生的课程成绩绩点"
onInput={this.questionInputvalue}
/>
</div>
<div style={{width: '57px'}}>
<span className={questionInputvaluetype===true?"color-orange mt8 fl":"color-orange mt8 fl none"} id="new_shixun_name"><i className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
</div>
</div>
<div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">过关任务</p>
<div className="df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20">
<div className="padding10-20 edu-back-greyf5 radius4" id="questioMD">
<textarea style={{display: 'none'}} id="questioadd" name="content"> </textarea>
<div className="CodeMirror cm-s-defualt">
</div>
</div>
{/*<TPMeditorMD*/}
{/*id={"questioMD"}*/}
{/*value={questioMD}*/}
{/*/>*/}
</div>
<div>
<span className={questionInputvaluetypes===true?"color-orange mt8 fl":"color-orange mt8 fl none"} id="new_shixun_pass"><i
className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
<p id="e_tip_questioMDQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
<p id="e_tips_questioMDQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
</div>
<div className="clearfix mt30" style={{display:this.props.identity>4||this.props.identity===undefined||power===false?"none":"block"}}>
<a className="defalutSubmitbtn fl mr20" onClick={sumittype===true?"":this.clickquestionsumit}>提交</a>
<a href={go_back_url}
className="defalutCancelbtn fl">取消</a>
</div>
</div>
{/*新建*/}
{newquestionaddtype===true?<div>
<div className="edu-back-white mb10 clearfix">
<div className="padding40-20">
<p className="color-grey-6 font-16 mb30">题干</p>
<div className="df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20">
<div className="padding10-20 edu-back-greyf5 radius4" id="newquestioMDs">
{/*<textarea style={{display: 'none'}} id="newquestioMDadds" name="content"> </textarea>*/}
{/*<div className="CodeMirror cm-s-defualt">*/}
{/*</div>*/}
{/*<textarea placeholder="markdown语言">#Editor.md</textarea>*/}
</div>
</div>
<div style={{width: '57px'}} style={{display:newquestioMDvaluetype===true?"block":"none"}}>
<span className="color-orange mt8 fl" id="choose_name"
style={{display: 'inline'}}><i className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
<p id="e_tip_newquestioMDsQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
<p id="e_tips_newquestioMDsQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
<div id="shixun_form" className="mt10">
{
questionlists===undefined||questionlists.length===0?"":questionlists.map((item,key)=>{
return(
<li className="clearfix pr mb20 df questionli" key={key}>
<label className="fl"><span
className={item.type===true?"option-item fr mr10 color-grey select-choice check-option-bg":"option-item fr mr10 color-grey select-choice"}
onClick={()=>this.selquestionlists(key)}
name="option_span"
data-tip-down="点击设置答案"
>{item.str}</span></label>
<textarea className="input-flex-40 fl candiate_answer"
name="question[cnt][]"
placeholder="请输入选项内容"
value={item.val}
autoHeight="true"
id={"question"+key}
onInput={(e)=>this.onInputoquestionption(e,key)}
style={{resize: 'none', height: '62px'}}></textarea>
<a className="position-delete option_icon_remove" onClick={()=>this.delquestionlists(key)}>
<Tooltip placement="bottom" title={"删除"}>
<i className="fa fa-times-circle color-grey-c font-16 fl"></i>
</Tooltip>
</a>
</li>
)
})
}
<p className="clearfix ml40">
<a onClick={this.addquestionlists}
className="fl edu-default-btn edu-greyline-btn mb20 option_icon_add">新增选项</a>
<span className="color-orange mt8 fr mr20" style={{display:newcnttype===true?"block":"none"}}id="chooce_error">
<i className="fa fa-exclamation-circle mr3"></i>
{newcnttypesum===0?"请选择答案":"选项内容不能为空"}
</span>
</p>
<li className="clearfix color-grey-9 ">
<label className="fl ml40">温馨提示点击选项标题可以直接设置答案选择多个答案即为多选题</label>
<label className="fr mr20">标准答案
<span id="current-option" className="color-orange">{questionlistss===undefined?"请点击正确选项":questionlistss.length===0? <span>{standard_answer}</span>:questionlistss.map((item,key)=>{
return(
<span key={key}>{item}</span>
)
})}</span>
</label>
</li>
</div>
</div>
</div>
<div className={"edu-back-white mb10 clearfix"}>
<div className={"padding40-20"}>
<p className="color-grey-6 font-16 mb30">参考答案</p>
<div className={"df"}>
<div className="padding10-20 edu-back-greyf5 radius4" id="challenge_choose_answer">
{/*<textarea style={{display: 'none'}} id="newquestioMDadda" name="content"> </textarea>*/}
{/*<div className="CodeMirror cm-s-defualt">*/}
{/*</div>*/}
</div>
<div className={"choose_names"} style={{display:newquestioMDvaluetypes===true?"block":"none"}}>
<span className="color-orange mt8 fl" id="choose_name"
style={{display: 'inline'}}><i className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
<p id="e_tip_challenge_choose_answerQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
<p id="e_tips_challenge_choose_answerQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
</div>
</div>
<div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">难度系数</p>
<div className="clearfix mb40">
<RadioGroup value={answeshixunsGroup} className="fl mr40"
onChange={this.onshixunGroupanswe}
>
<Radio value={1}>简单</Radio>
<Radio value={2}>中等</Radio>
<Radio value={3}>困难</Radio>
</RadioGroup>
</div>
<p className="color-grey-6 font-16 mb30">奖励经验值</p>
<div className="clearfix"
// onMouseLeave={this.onshixunsmarkss}
>
<span className="fl mr30 color-orange pt10">*</span>
<style>
{`
.ant-select-dropdown{
top:2295px !important;
}
`}
</style>
<Select style={{width: 120}} className="winput-240-40 fl"
id="challenge_score"
onChange={this.onshixunsansweSelect}
// onMouseEnter={this.onshixunsmarks}
// open={marktype}
value={answeonshixunsmark}
>
{options}
</Select>
<p className="fl color-grey-9 font-12 ml20">
如果学员答题错误则不能得到相应的经验值<br/>
如果学员成功得到经验值那么将同时获得等值的金币奖励+10经验值+10金币
</p>
<span className="color-orange mt7 fl ml20 none" id="ex_value_notice"><i
className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
<div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">技能标签</p>
<div className="clearfix df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1">
<Input type="text"
className="winput-240-40 fl mr20"
id="input_task_tag"
placeholder="添加标签"
onInput={this.shixunssanswerkill}
value={shixunssanswerkillvalue}
onPressEnter={this.clickshixunsanswerskill}
onBlur={this.clickshixunsanswerskill}
/>
{/*<a className="white-btn orange-btn fl mt1 use_scope-btn ml20 mt5 mr20"*/}
{/*onClick={this.clickshixunsanswerskill}>+ 添加</a>*/}
<div className="ml15 color-grey-9 mt5">学员答题正确将获得技能否则不能获得技能
<span className=" color-orange ml20" style={{display:challenge_tagtype===true?"inline-block":"none"}} id="stage_name_notice">
<i className="fa fa-exclamation-circle mr3"></i>
</span>
</div>
<div className="mt20 clearfix" id="task_tag_content">
{
shixunsskillanswerlist.length === 0 ? "" : shixunsskillanswerlist.map((itme, key) => {
return (
<li className="task_tag_span" key={key}><span>{itme}</span>
<a onClick={() => this.delshixunssnswerllist(key)}>×</a>
</li>
)
})
}
</div>
</div>
</div>
</div>
<div className="clearfix mt30" style={{display:this.props.identity>4||this.props.identity===undefined||power===false?"none":"block"}}>
<a className="defalutSubmitbtn fl mr20"
onClick={this.answer_subit}>提交</a>
<a href={go_back_url}
className="defalutCancelbtn fl">取消</a>
</div>
</div>:""}
{/*修改*/}
{editquestionaddtype===true?<div>
<div className="edu-back-white mb10 clearfix">
<div className="padding40-20">
<p className="color-grey-6 font-16 mb30">题干</p>
<div className="df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20">
<div className="padding10-20 edu-back-greyf5 radius4" id="neweditanswer">
<textarea style={{display: 'none'}} id="newquestioMDadd" name="content"> </textarea>
<div className="CodeMirror cm-s-defualt">
</div>
</div>
</div>
<div style={{width: '57px'}} style={{display:newquestioMDvaluetype===true?"block":"none"}}>
<span className="color-orange mt8 fl" id="choose_name"
style={{display: 'inline'}}><i className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
<p id="e_tip_neweditanswerQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
<p id="e_tips_neweditanswerQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
<div id="shixun_form" className="mt10">
{
questionlists===undefined||questionlists.length===0?"":questionlists.map((item,key)=>{
return(
<li className="clearfix pr mb20 df questionli" key={key}>
<label className="fl"><span
className={item.type===true?"option-item fr mr10 color-grey select-choice check-option-bg":"option-item fr mr10 color-grey select-choice"}
onClick={()=>this.selquestionlists(key)}
name="option_span"
data-tip-down="点击设置答案"
>{item.str}</span></label>
<textarea className="input-flex-40 fl candiate_answer"
name="question[cnt][]"
placeholder="请输入选项内容"
value={item.val}
autoHeight="true"
id={"question"+key}
onInput={(e)=>this.onInputoquestionption(e,key)}
style={{resize: 'none', height: '62px'}}></textarea>
<a className="position-delete option_icon_remove" onClick={()=>this.delquestionlists(key)}>
<i className="fa fa-times-circle color-grey-c font-16 fl"></i>
</a>
</li>
)
})
}
<p className="clearfix ml40">
<a onClick={this.addquestionlists}
className="fl edu-default-btn edu-greyline-btn mb20 option_icon_add">新增选项</a>
<span className="color-orange mt8 fr mr20" style={{display:newcnttype===true?"block":"none"}}id="chooce_error">
<i className="fa fa-exclamation-circle mr3"></i>
{newcnttypesum===0?"请选择答案":"选项内容不能为空"}
</span>
</p>
<li className="clearfix color-grey-9 ">
<label className="fl ml40">温馨提示点击选项标题可以直接设置答案选择多个答案即为多选题</label>
<label className="fr mr20">标准答案
<span d="current-option" className="color-orange">{questionlistss===undefined?"请点击正确选项":questionlistss.length===0? <span>{standard_answer}</span>:questionlistss.map((item,key)=>{
return(
<span key={key}>{item}</span>
)
})}</span>
</label>
</li>
</div>
</div>
</div>
<div className={"edu-back-white mb10 clearfix"}>
<div className={"padding40-20"}>
<p className="color-grey-6 font-16 mb30">参考答案</p>
<div className={"df mr20"}>
<div className="padding10-20 edu-back-greyf5 radius4" id="editanswers">
{/*<textarea style={{display: 'none'}} id="newquestioMDaddb" name="content"> </textarea>*/}
{/*<div className="CodeMirror cm-s-defualt">*/}
{/*</div>*/}
</div>
<div className={"choose_names"} style={{display:newquestioMDvaluetypes===true?"block":"none"}}>
<span className="color-orange mt8 fl" id="choose_name"
style={{display: 'inline'}}><i className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
<p id="e_tip_editanswersQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
<p id="e_tips_editanswersQuestion" className="edu-txt-right color-grey-cd font-12 pdr20"></p>
</div>
</div>
<div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">难度系数</p>
<div className="clearfix mb40">
<RadioGroup value={answeshixunsGroup} className="fl mr40"
disabled={this.props.status===2?true:false}
onChange={this.props.status===2?"":this.onshixunGroupanswe}>
<Radio value={1}>简单</Radio>
<Radio value={2}>中等</Radio>
<Radio value={3}>困难</Radio>
</RadioGroup>
</div>
<p className="color-grey-6 font-16 mb30">奖励经验值</p>
<div className="clearfix"
// onMouseLeave={this.onshixunsmarkss}
>
<span className="fl mr30 color-orange pt10">*</span>
<style>
{`
.ant-select-dropdown{
top:2295px !important;
}
`}
</style>
<Select style={{width: 120}} className="winput-240-40 fl"
id="challenge_score"
disabled={this.props.status===2?true:false}
onChange={this.props.status===2?"":this.onshixunsansweSelect}
// onMouseEnter={this.onshixunsmarks}
value={answeonshixunsmark}
// open={marktype}
>
{options}
</Select>
<p className="fl color-grey-9 font-12 ml20">
如果学员答题错误则不能得到相应的经验值<br/>
如果学员成功得到经验值那么将同时获得等值的金币奖励+10经验值+10金币
</p>
<span className="color-orange mt7 fl ml20 none" id="ex_value_notice"><i
className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
<div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">技能标签</p>
<div className="clearfix df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1">
<Input type="text"
className="winput-240-40 fl mr20"
id="input_task_tag"
placeholder="添加标签"
onInput={this.shixunssanswerkill}
value={shixunssanswerkillvalue}
onPressEnter={this.clickshixunsanswerskill}
onBlur={this.clickshixunsanswerskill}
/>
{/*<a className="white-btn orange-btn fl mt1 use_scope-btn ml20 mt5 mr20"*/}
{/*onClick={this.clickshixunsanswerskill}>+ 添加</a>*/}
<div className="ml15 color-grey-9 mt5">学员答题正确将获得技能否则不能获得技能
<span className=" color-orange ml20" style={{display:challenge_tagtype===true?"inline-block":"none"}} id="stage_name_notice">
<i className="fa fa-exclamation-circle mr3"></i>
</span>
</div>
<div className="mt20 clearfix" id="task_tag_content">
{
shixunsskillanswerlist.length === 0 ? "" : shixunsskillanswerlist.map((itme, key) => {
return (
<li className="task_tag_span" key={key}><span>{itme}</span>
<a onClick={() => this.delshixunssnswerllist(key)}>×</a>
</li>
)
})
}
</div>
</div>
</div>
</div>
<div className="clearfix mt30" style={{display:this.props.identity>4||this.props.identity===undefined||power===false?"none":"block"}}>
<a className="defalutSubmitbtn fl mr20"
onClick={()=>this.answer_subit("edit",challenge_choose_id)}>提交</a>
<a href={go_back_url}
className="defalutCancelbtn fl">取消</a>
</div>
</div>
:""}
</div>
</React.Fragment>
)
}
}