|
|
|
@ -69,14 +69,16 @@ class NullEditor extends Component{
|
|
|
|
|
// const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1);
|
|
|
|
|
let answerArray = []
|
|
|
|
|
if(!question_title) {
|
|
|
|
|
this.props.showNotification('请先输入题目题干'); return;
|
|
|
|
|
this.refs['titleEditor'].showError()
|
|
|
|
|
this.props.showNotification('题目:不能为空'); return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const intScore = parseFloat(question_score)
|
|
|
|
|
if(!question_score || intScore == NaN) {
|
|
|
|
|
this.props.showNotification('分值不能为空'); return;
|
|
|
|
|
this.props.showNotification('分值:不能为空'); return;
|
|
|
|
|
} else {
|
|
|
|
|
if (intScore == 0) {
|
|
|
|
|
this.props.showNotification('分值必须大于0'); return;
|
|
|
|
|
this.props.showNotification('分值:必须大于0'); return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let isEmpty = false;
|
|
|
|
@ -88,7 +90,9 @@ class NullEditor extends Component{
|
|
|
|
|
answers.forEach((item, itemIndex) => {
|
|
|
|
|
answerArray[index].answer_text.push(item)
|
|
|
|
|
if(!item) {
|
|
|
|
|
this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`);
|
|
|
|
|
this.refs[`nullChildEditor${index}`].showError(itemIndex)
|
|
|
|
|
// this.props.showNotification(`请先输入第${index+1}个填空的第${itemIndex+1}参考答案。`);
|
|
|
|
|
this.props.showNotification(`答案:不能为空`);
|
|
|
|
|
isEmpty = true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -97,7 +101,9 @@ class NullEditor extends Component{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(!question_title) {
|
|
|
|
|
this.props.showNotification('请先输入题目题干'); return;
|
|
|
|
|
this.refs['titleEditor'].showError()
|
|
|
|
|
this.props.showNotification('题目:不能为空'); return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -294,13 +300,16 @@ class NullEditor extends Component{
|
|
|
|
|
<NullMDEditor {...this.props} mdID={`question_${question_id}`} placeholder="请您输入题目" height={155} watch={false}
|
|
|
|
|
initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
|
|
|
|
|
onPlaceholderChange={this.onPlaceholderChange} showNullButton={exerciseIsPublish ? false : true}
|
|
|
|
|
ref="titleEditor"
|
|
|
|
|
></NullMDEditor>
|
|
|
|
|
|
|
|
|
|
<div className="clearfix">
|
|
|
|
|
{
|
|
|
|
|
standard_answers.map((answers, index) => {
|
|
|
|
|
|
|
|
|
|
return <NullChildEditor {...this.props}
|
|
|
|
|
return <NullChildEditor
|
|
|
|
|
ref={`nullChildEditor${index}`}
|
|
|
|
|
{...this.props}
|
|
|
|
|
toMDMode={this.toMDMode}
|
|
|
|
|
answers={answers}
|
|
|
|
|
index={index}
|
|
|
|
|