issues25489
杨树林 5 years ago
parent 15f02ce89e
commit 4031798e88

@ -43,7 +43,7 @@ class CompetitionCommon extends Component{
// })
// }
// }).catch((error) => {
// console.log(error)
// //console.log(error)
// })
}
}
@ -51,8 +51,8 @@ class CompetitionCommon extends Component{
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
console.log("componentDidUpdatess");
console.log(this.props.user);
//console.log("componentDidUpdatess");
//console.log(this.props.user);
if (this.props.user && this.props.user.login != "") {
const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((zul)).then((result) => {
@ -64,7 +64,7 @@ class CompetitionCommon extends Component{
}
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
}
@ -103,7 +103,7 @@ class CompetitionCommon extends Component{
}
}
}).catch((error) => {
console.log(error)
//console.log(error)
})
//this.props.user 有可能为空
@ -119,7 +119,7 @@ class CompetitionCommon extends Component{
}
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
@ -161,7 +161,7 @@ class CompetitionCommon extends Component{
}
}).catch((error) => {
console.log(error)
//console.log(error)
})
}
}
@ -192,7 +192,7 @@ class CompetitionCommon extends Component{
}
}).catch((error) => {
console.log(error)
//console.log(error)
})
}else{
if (module_url.substring(0, 7) == 'http://' || module_url.substring(0, 8) == 'https://') {
@ -309,7 +309,7 @@ class CompetitionCommon extends Component{
})
}
}).catch((error) => {
console.log(error)
//console.log(error)
})
}

@ -16,8 +16,8 @@ const $ = window.$
const { Option } = Select;
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
class SingleEditor extends Component{
@ -92,13 +92,13 @@ class SingleEditor extends Component{
}
const intScore = parseFloat(question_score)
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
} else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return;
}
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项'); return;
}
@ -119,9 +119,9 @@ class SingleEditor extends Component{
"question_type":1,
"question_score":5,
"question_choices":["a答案","b答案","c答案","d答案"],
"standard_answers":[1]
"standard_answers":[1]
}*/
const Id = this.props.match.params.Id
const Id = this.props.match.params.Id
if (question_id) {
const editUrl = this.props.getEditQuestionUrl(question_id);
axios.put(editUrl, {
@ -144,7 +144,7 @@ class SingleEditor extends Component{
});
} else {
const url = this.props.getAddQuestionUrl();
axios.post(url, {
exercise_bank_id: Id,
question_title,
@ -162,16 +162,16 @@ class SingleEditor extends Component{
.catch(function (error) {
console.log(error);
});
}
}
}
onCancel = () => {
this.props.onEditorCancel()
}
componentDidMount = () => {
}
onOptionClick = (index) => {
// if (this.props.exerciseIsPublish) {
@ -186,7 +186,7 @@ class SingleEditor extends Component{
// TODO 新建然后删除CD选项再输入题干会调用到这里且index是3
return;
}
let question_choices = this.state.question_choices.slice(0);
let question_choices = this.state.question_choices.slice(0);
question_choices[index] = value;
this.setState({ question_choices })
}
@ -200,19 +200,19 @@ class SingleEditor extends Component{
mdReactObject.toShowMode()
}
this.mdReactObject = that;
}
toShowMode = () => {
}
render() {
let { question_title, question_score, question_type, question_choices, standard_answers } = this.state;
let { question_id, index, exerciseIsPublish,
// question_title,
// question_type,
// question_title,
// question_type,
// question_score,
isNew } = this.props;
// const { getFieldDecorator } = this.props.form;
const isAdmin = this.props.isAdmin()
@ -221,8 +221,8 @@ class SingleEditor extends Component{
const qNumber = `question_${index}`;
// TODO show模式 isNew为false isEdit为false
// [true, false, true] -> [0, 2]
// [true, false, true] -> [0, 2]
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
return(
<div className="padding20-30 bor-bottom-greyE signleEditor" id={qNumber}>
@ -253,8 +253,8 @@ class SingleEditor extends Component{
ref="titleEditor"
></TPMMDEditor>
{question_choices.map( (item, index) => {
{question_choices.map( (item, index) => {
const bg = standard_answers[index] ? 'check-option-bg' : ''
return <div className="df optionRow " >
{/* 点击设置答案 */}
@ -268,7 +268,7 @@ class SingleEditor extends Component{
</span>
{/* </Tooltip> */}
<div style={{ flex: '0 0 1038px'}}>
<DMDEditor
<DMDEditor
ref={`optionEditor${index}`}
toMDMode={this.toMDMode} toShowMode={this.toShowMode}
height={166} className={'optionMdEditor'} noStorage={true}
@ -293,15 +293,16 @@ class SingleEditor extends Component{
<div className="mb20">
{/* {!exerciseIsPublish && <ActionBtn style="grey" className="middle mr20" onClick={this.addOption}>新增选项</ActionBtn>} */}
<span style={{color: '#FF6800'}}>{!exerciseIsPublish ? '温馨提示:点击选项标题,可以直接设置答案;选择多个答案即为多选题' : ' '}</span>
<span
style={{color: '#FF6800'}}>{!exerciseIsPublish ? '温馨提示:点击选项输入框可设置答案;选中的选项即为正确答案,选择多个答案即为多选题' : ' '}</span>
{ answerTagArray && !!answerTagArray.length ?
<React.Fragment>
<span className="fr color-orange">{answerTagArray.join(' ')}</span>
<span className="fr">标准答案</span>
</React.Fragment>
:
<span className="fr color-orange">请点击正确选项</span>
:
<span className="fl color-orange">温馨提示点击选项输入框可设置答案选中的选项即为正确答案选择多个答案即为多选题</span>
}
</div>
@ -310,18 +311,18 @@ class SingleEditor extends Component{
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
disabled={exerciseIsPublish}
></InputNumber>&nbsp;
<span className="fr">
<ActionBtn style="greyBack" className="middle mr20" onClick={this.onCancel}
>取消</ActionBtn>
<ActionBtn style="blue" className="middle" onClick={this.onSave}>保存</ActionBtn>
</span>
</div>
</div>
)
}
}
// RouteHOC()
export default (SingleEditor);
export default (SingleEditor);

Loading…
Cancel
Save