|
|
@ -1,28 +1,19 @@
|
|
|
|
import React,{ Component } from "react";
|
|
|
|
import React, { Component } from "react";
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
import { InputNumber, Tooltip } from 'antd';
|
|
|
|
Form, Input, InputNumber, Switch, Radio,
|
|
|
|
|
|
|
|
Slider, Button, Upload, Icon, Rate, Checkbox, message,
|
|
|
|
|
|
|
|
Row, Col, Select, Modal, Tooltip
|
|
|
|
|
|
|
|
} from 'antd';
|
|
|
|
|
|
|
|
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
|
|
|
|
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
|
|
|
|
import axios from 'axios'
|
|
|
|
import axios from 'axios'
|
|
|
|
import update from 'immutability-helper'
|
|
|
|
import update from 'immutability-helper'
|
|
|
|
import {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder';
|
|
|
|
import { ActionBtn, DMDEditor, ConditionToolTip } from 'educoder';
|
|
|
|
import QuillForEditor from "../../../../common/quillForEditor";
|
|
|
|
import QuillForEditor from "../../../../common/quillForEditor";
|
|
|
|
|
|
|
|
|
|
|
|
const { TextArea } = Input;
|
|
|
|
|
|
|
|
const confirm = Modal.confirm;
|
|
|
|
|
|
|
|
const $ = window.$
|
|
|
|
|
|
|
|
const { Option } = Select;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const tagArray = [
|
|
|
|
const tagArray = [
|
|
|
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
|
|
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
|
|
|
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
|
|
|
|
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
|
|
|
|
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
|
|
|
|
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
|
|
|
|
]
|
|
|
|
]
|
|
|
|
class SingleEditor extends Component{
|
|
|
|
class SingleEditor extends Component {
|
|
|
|
constructor(props){
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
super(props);
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
choice_id: 32076
|
|
|
|
choice_id: 32076
|
|
|
@ -30,7 +21,7 @@ class SingleEditor extends Component{
|
|
|
|
choice_text: "1"
|
|
|
|
choice_text: "1"
|
|
|
|
standard_boolean: true
|
|
|
|
standard_boolean: true
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const {question_choices} = this.props;
|
|
|
|
const { question_choices } = this.props;
|
|
|
|
let _standard_answers = undefined;
|
|
|
|
let _standard_answers = undefined;
|
|
|
|
let _question_choices = undefined;
|
|
|
|
let _question_choices = undefined;
|
|
|
|
if (question_choices) {
|
|
|
|
if (question_choices) {
|
|
|
@ -48,7 +39,6 @@ class SingleEditor extends Component{
|
|
|
|
question_title: this.props.question_title || '',
|
|
|
|
question_title: this.props.question_title || '',
|
|
|
|
question_type: this.props.question_type || 0,
|
|
|
|
question_type: this.props.question_type || 0,
|
|
|
|
question_score: this.props.question_score || this.props.init_question_score,
|
|
|
|
question_score: this.props.question_score || this.props.init_question_score,
|
|
|
|
choice_editor: 'md',
|
|
|
|
|
|
|
|
quill_question_title: '',
|
|
|
|
quill_question_title: '',
|
|
|
|
quill_default_title: ''
|
|
|
|
quill_default_title: ''
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -60,25 +50,25 @@ class SingleEditor extends Component{
|
|
|
|
this.setState({ question_choices, standard_answers })
|
|
|
|
this.setState({ question_choices, standard_answers })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
deleteOption = (index) => {
|
|
|
|
deleteOption = (index) => {
|
|
|
|
let {question_choices}=this.state;
|
|
|
|
let { question_choices } = this.state;
|
|
|
|
if(question_choices[index]===""){
|
|
|
|
if (question_choices[index] === "") {
|
|
|
|
// repeat code
|
|
|
|
// repeat code
|
|
|
|
this.toMDMode(null)
|
|
|
|
this.toMDMode(null)
|
|
|
|
this.setState(
|
|
|
|
this.setState(
|
|
|
|
(prevState) => ({
|
|
|
|
(prevState) => ({
|
|
|
|
question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}),
|
|
|
|
question_choices: update(prevState.question_choices, { $splice: [[index, 1]] }),
|
|
|
|
standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]})
|
|
|
|
standard_answers: update(prevState.standard_answers, { $splice: [[index, 1]] })
|
|
|
|
})
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
this.props.confirm({
|
|
|
|
this.props.confirm({
|
|
|
|
content: `确认要删除这个选项吗?`,
|
|
|
|
content: `确认要删除这个选项吗?`,
|
|
|
|
onOk: () => {
|
|
|
|
onOk: () => {
|
|
|
|
this.toMDMode(null)
|
|
|
|
this.toMDMode(null)
|
|
|
|
this.setState(
|
|
|
|
this.setState(
|
|
|
|
(prevState) => ({
|
|
|
|
(prevState) => ({
|
|
|
|
question_choices : update(prevState.question_choices, {$splice: [[index, 1]]}),
|
|
|
|
question_choices: update(prevState.question_choices, { $splice: [[index, 1]] }),
|
|
|
|
standard_answers : update(prevState.standard_answers, {$splice: [[index, 1]]})
|
|
|
|
standard_answers: update(prevState.standard_answers, { $splice: [[index, 1]] })
|
|
|
|
})
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -86,11 +76,11 @@ class SingleEditor extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onSave = () => {
|
|
|
|
onSave = () => {
|
|
|
|
const {question_title, question_score, question_type, question_choices, standard_answers } = this.state;
|
|
|
|
const { question_title, question_score, question_choices, standard_answers } = this.state;
|
|
|
|
const { question_id_to_insert_after, question_id } = this.props
|
|
|
|
const { question_id_to_insert_after, question_id } = this.props
|
|
|
|
// TODO check
|
|
|
|
// TODO check
|
|
|
|
const answerArray = standard_answers.map((item, index) => { return item == true ? index+1 : -1 }).filter(item => item != -1);
|
|
|
|
const answerArray = standard_answers.map((item, index) => { return item == true ? index + 1 : -1 }).filter(item => item != -1);
|
|
|
|
if(!question_title) {
|
|
|
|
if (!question_title) {
|
|
|
|
this.refs['titleEditor'].showError()
|
|
|
|
this.refs['titleEditor'].showError()
|
|
|
|
this.props.showNotification('题目:不能为空'); return;
|
|
|
|
this.props.showNotification('题目:不能为空'); return;
|
|
|
|
|
|
|
|
|
|
|
@ -100,18 +90,18 @@ class SingleEditor extends Component{
|
|
|
|
const intScore = parseFloat(question_score)
|
|
|
|
const intScore = parseFloat(question_score)
|
|
|
|
if (intScore == 0) {
|
|
|
|
if (intScore == 0) {
|
|
|
|
this.props.showNotification('分值:必须大于0'); return;
|
|
|
|
this.props.showNotification('分值:必须大于0'); return;
|
|
|
|
} else if(!question_score || intScore == NaN) {
|
|
|
|
} else if (!question_score || intScore == NaN) {
|
|
|
|
this.props.showNotification('分值:不能为空'); return;
|
|
|
|
this.props.showNotification('分值:不能为空'); return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!answerArray || answerArray.length == 0) {
|
|
|
|
if (!answerArray || answerArray.length == 0) {
|
|
|
|
this.props.showNotification('请先点击选择本选择题的正确选项'); return;
|
|
|
|
this.props.showNotification('请先点击选择本选择题的正确选项'); return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!question_title) {
|
|
|
|
if (!question_title) {
|
|
|
|
this.refs['titleEditor'].showError()
|
|
|
|
this.refs['titleEditor'].showError()
|
|
|
|
this.props.showNotification('题目:不能为空'); return;
|
|
|
|
this.props.showNotification('题目:不能为空'); return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(let i = 0; i < question_choices.length; i++) {
|
|
|
|
for (let i = 0; i < question_choices.length; i++) {
|
|
|
|
if (!question_choices[i]) {
|
|
|
|
if (!question_choices[i]) {
|
|
|
|
this.refs[`optionEditor${i}`].showError()
|
|
|
|
this.refs[`optionEditor${i}`].showError()
|
|
|
|
this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`); return;
|
|
|
|
this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`); return;
|
|
|
@ -138,14 +128,14 @@ class SingleEditor extends Component{
|
|
|
|
}).then((response) => {
|
|
|
|
}).then((response) => {
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
if (response.data.status == 0) {
|
|
|
|
this.props.addSuccess()
|
|
|
|
this.props.addSuccess()
|
|
|
|
}else if(response.data.status == 3){
|
|
|
|
} else if (response.data.status == 3) {
|
|
|
|
// 已发布试卷编辑保存
|
|
|
|
// 已发布试卷编辑保存
|
|
|
|
this.props.changeScore(question_id,answerArray);
|
|
|
|
this.props.changeScore(question_id, answerArray);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
.catch(function (error) {
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const url = this.props.getAddQuestionUrl();
|
|
|
|
const url = this.props.getAddQuestionUrl();
|
|
|
|
|
|
|
|
|
|
|
@ -174,13 +164,7 @@ class SingleEditor extends Component{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount = () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
onOptionClick = (index) => {
|
|
|
|
onOptionClick = (index) => {
|
|
|
|
// if (this.props.exerciseIsPublish) {
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
let standard_answers = this.state.standard_answers.slice(0)
|
|
|
|
let standard_answers = this.state.standard_answers.slice(0)
|
|
|
|
standard_answers[index] = !standard_answers[index]
|
|
|
|
standard_answers[index] = !standard_answers[index]
|
|
|
|
this.setState({ standard_answers })
|
|
|
|
this.setState({ standard_answers })
|
|
|
@ -206,24 +190,6 @@ class SingleEditor extends Component{
|
|
|
|
this.mdReactObject = that;
|
|
|
|
this.mdReactObject = that;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
toShowMode = () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 切换编辑器
|
|
|
|
|
|
|
|
handleChangeEditor = (e) => {
|
|
|
|
|
|
|
|
const {quill_question_title} = this.state;
|
|
|
|
|
|
|
|
const value = e.target.value
|
|
|
|
|
|
|
|
if (value === 'quill') {
|
|
|
|
|
|
|
|
const _val = quill_question_title ? JSON.parse(quill_question_title) : '';
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
quill_default_title: _val
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
choice_editor: value
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// quill编辑器内容变化时调用此接口
|
|
|
|
// quill编辑器内容变化时调用此接口
|
|
|
|
handleCtxChange = (ctx) => {
|
|
|
|
handleCtxChange = (ctx) => {
|
|
|
@ -235,37 +201,19 @@ class SingleEditor extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let { question_title, question_score, question_type, question_choices, standard_answers, choice_editor, quill_default_title } = this.state;
|
|
|
|
let { question_title, question_score, question_choices, standard_answers, quill_default_title } = this.state;
|
|
|
|
let { question_id, index, exerciseIsPublish,
|
|
|
|
let { index, exerciseIsPublish, is_md } = this.props;
|
|
|
|
// question_title,
|
|
|
|
|
|
|
|
// question_type,
|
|
|
|
|
|
|
|
// question_score,
|
|
|
|
|
|
|
|
isNew } = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const { getFieldDecorator } = this.props.form;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isAdmin = this.props.isAdmin()
|
|
|
|
|
|
|
|
const courseId=this.props.match.params.coursesId;
|
|
|
|
|
|
|
|
const isEdit = !!this.props.question_id
|
|
|
|
|
|
|
|
const qNumber = `question_${index}`;
|
|
|
|
const qNumber = `question_${index}`;
|
|
|
|
// TODO show模式 isNew为false isEdit为false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// [true, false, true] -> [0, 2]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
|
|
|
|
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
|
|
|
|
console.log("xuanzheshijuan");
|
|
|
|
|
|
|
|
console.log(answerTagArray);
|
|
|
|
|
|
|
|
console.log(!exerciseIsPublish);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
return (
|
|
|
|
<div className="padding20-30 bor-bottom-greyE signleEditor" id={qNumber}>
|
|
|
|
<div className="padding20-30 bor-bottom-greyE signleEditor" id={qNumber}>
|
|
|
|
<style>{`
|
|
|
|
<style>{`
|
|
|
|
.optionMdEditor {
|
|
|
|
.optionMdEditor {
|
|
|
|
flex:1
|
|
|
|
flex:1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.optionRow {
|
|
|
|
.optionRow {
|
|
|
|
margin:0px!important;
|
|
|
|
margin:0px!important;
|
|
|
|
/* margin-bottom: 20px!important; */
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.signleEditor .content_editorMd_show{
|
|
|
|
.signleEditor .content_editorMd_show{
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
@ -277,8 +225,6 @@ class SingleEditor extends Component{
|
|
|
|
.editor_area{
|
|
|
|
.editor_area{
|
|
|
|
display: inline-block;
|
|
|
|
display: inline-block;
|
|
|
|
float: right;
|
|
|
|
float: right;
|
|
|
|
// line-height: 30px;
|
|
|
|
|
|
|
|
// height: 30px;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.editor_txt{
|
|
|
|
.editor_txt{
|
|
|
|
margin-right: 10px;
|
|
|
|
margin-right: 10px;
|
|
|
@ -290,103 +236,90 @@ class SingleEditor extends Component{
|
|
|
|
vertical: center;
|
|
|
|
vertical: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`}</style>
|
|
|
|
`}</style>
|
|
|
|
<p className="mb10 clearfix">
|
|
|
|
<p className="mb10 clearfix">
|
|
|
|
{/* {!question_id ? '新建' : '编辑'} */}
|
|
|
|
<span className="color-blue font-16 mr20 fl">选择题</span>
|
|
|
|
<span className="color-blue font-16 mr20 fl">选择题</span>
|
|
|
|
<span className="color-grey-9 font-12 fl">(客观题,由系统自动评分,请设置标准答案)</span>
|
|
|
|
<span className="color-grey-9 font-12 fl">(客观题,由系统自动评分,请设置标准答案)</span>
|
|
|
|
</p>
|
|
|
|
{/* <Switch checkedChildren="MD" unCheckedChildren="Quill"></Switch> */}
|
|
|
|
|
|
|
|
{/* <div className="editor_area">
|
|
|
|
{is_md ? <TPMMDEditor mdID={qNumber} placeholder="请您输入题目" height={155} className="mb20"
|
|
|
|
<span className="editor_txt">切换编辑器:</span>
|
|
|
|
initValue={question_title} onChange={(val) => this.setState({ question_title: val })}
|
|
|
|
<Radio.Group style={{ float: 'right' }} value={choice_editor} onChange={this.handleChangeEditor}>
|
|
|
|
ref="titleEditor"
|
|
|
|
<Radio className="radio_style" value={'md'}>MD</Radio>
|
|
|
|
></TPMMDEditor>
|
|
|
|
<Radio className="radio_style" value={'quill'}>Quill</Radio>
|
|
|
|
|
|
|
|
</Radio.Group>
|
|
|
|
: <QuillForEditor
|
|
|
|
</div> */}
|
|
|
|
wrapStyle={{ marginBottom: '35px' }}
|
|
|
|
</p>
|
|
|
|
style={{ height: '109px' }}
|
|
|
|
|
|
|
|
options={['code', 'image', 'formula']}
|
|
|
|
{choice_editor === 'md'
|
|
|
|
placeholder="请您输入题目"
|
|
|
|
? <TPMMDEditor mdID={qNumber} placeholder="请您输入题目" height={155} className="mb20"
|
|
|
|
value={quill_default_title}
|
|
|
|
initValue={question_title} onChange={(val) => this.setState({ question_title: val})}
|
|
|
|
onContentChange={this.handleCtxChange}
|
|
|
|
ref="titleEditor"
|
|
|
|
></QuillForEditor>
|
|
|
|
></TPMMDEditor>
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
: <QuillForEditor
|
|
|
|
|
|
|
|
wrapStyle={{ marginBottom: '35px' }}
|
|
|
|
|
|
|
|
style={{ height: '109px' }}
|
|
|
|
|
|
|
|
options={['code', 'image', 'formula']}
|
|
|
|
|
|
|
|
placeholder="请您输入题目"
|
|
|
|
|
|
|
|
value={quill_default_title}
|
|
|
|
|
|
|
|
onContentChange={this.handleCtxChange}
|
|
|
|
|
|
|
|
></QuillForEditor>
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{question_choices.map( (item, index) => {
|
|
|
|
|
|
|
|
const bg = standard_answers[index] ? 'check-option-bg' : ''
|
|
|
|
|
|
|
|
return <div className="df optionRow " >
|
|
|
|
|
|
|
|
{/* 点击设置答案 */}
|
|
|
|
|
|
|
|
{/* TODO 加了tooltip后,会丢失掉span的class */}
|
|
|
|
|
|
|
|
{/* <Tooltip title={standard_answers[index] ? '点击取消标准答案设置' : '点击设置为标准答案'}> */}
|
|
|
|
|
|
|
|
<span class={`option-item fr mr10 color-grey select-choice ${bg} `}
|
|
|
|
|
|
|
|
name="option_span" onClick={() => this.onOptionClick(index)} style={{flex: '0 0 38px'}}>
|
|
|
|
|
|
|
|
<ConditionToolTip title={standard_answers[index] ? '点击取消标准答案设置' : '点击设置为标准答案'} placement="left" condition={true}>
|
|
|
|
|
|
|
|
<div style={{width: '100%', height: '100%'}}>{tagArray[index]}</div>
|
|
|
|
|
|
|
|
</ConditionToolTip>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
{/* </Tooltip> */}
|
|
|
|
|
|
|
|
<div style={{ flex: '0 0 1038px'}}>
|
|
|
|
|
|
|
|
<DMDEditor
|
|
|
|
|
|
|
|
ref={`optionEditor${index}`}
|
|
|
|
|
|
|
|
toMDMode={this.toMDMode} toShowMode={this.toShowMode}
|
|
|
|
|
|
|
|
height={166} className={'optionMdEditor'} noStorage={true}
|
|
|
|
|
|
|
|
mdID={qNumber + index} placeholder="" onChange={(value) => this.onOptionContentChange(value, index)}
|
|
|
|
|
|
|
|
initValue={item}
|
|
|
|
|
|
|
|
></DMDEditor>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{exerciseIsPublish || index===0?
|
|
|
|
|
|
|
|
<i className=" font-18 ml15 mr20"></i>
|
|
|
|
|
|
|
|
:<Tooltip title="删除">
|
|
|
|
|
|
|
|
<i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml15" onClick={() => this.deleteOption(index)}></i>
|
|
|
|
|
|
|
|
</Tooltip> }
|
|
|
|
|
|
|
|
{ !exerciseIsPublish && <Tooltip title={`新增参考答案`}>
|
|
|
|
|
|
|
|
<i className="color-green font-16 iconfont icon-roundaddfill ml6"
|
|
|
|
|
|
|
|
onClick={() => this.addOption()}
|
|
|
|
|
|
|
|
style={{float: 'right', visibility: index == question_choices.length - 1 ? '' : 'hidden', marginTop: '2px'}}
|
|
|
|
|
|
|
|
></i>
|
|
|
|
|
|
|
|
</Tooltip>}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
}) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mb20">
|
|
|
|
{question_choices.map((item, index) => {
|
|
|
|
<span
|
|
|
|
const bg = standard_answers[index] ? 'check-option-bg' : ''
|
|
|
|
style={{color: '#FF6800'}}>{'温馨提示:点击选项输入框可设置答案;选中的选项即为正确答案,选择多个答案即为多选题'}</span>
|
|
|
|
return <div className="df optionRow " >
|
|
|
|
{ answerTagArray && !!answerTagArray.length ?
|
|
|
|
{/* 点击设置答案 */}
|
|
|
|
<React.Fragment>
|
|
|
|
<span class={`option-item fr mr10 color-grey select-choice ${bg} `}
|
|
|
|
<span className="fr color-orange">{answerTagArray.join(' ')}</span>
|
|
|
|
name="option_span" onClick={() => this.onOptionClick(index)} style={{ flex: '0 0 38px' }}>
|
|
|
|
<span className="fr">标准答案:</span>
|
|
|
|
<ConditionToolTip title={standard_answers[index] ? '点击取消标准答案设置' : '点击设置为标准答案'} placement="left" condition={true}>
|
|
|
|
</React.Fragment>
|
|
|
|
<div style={{ width: '100%', height: '100%' }}>{tagArray[index]}</div>
|
|
|
|
:
|
|
|
|
</ConditionToolTip>
|
|
|
|
""
|
|
|
|
</span>
|
|
|
|
}
|
|
|
|
<div style={{ flex: '0 0 1038px' }}>
|
|
|
|
|
|
|
|
<DMDEditor
|
|
|
|
|
|
|
|
ref={`optionEditor${index}`}
|
|
|
|
|
|
|
|
toMDMode={this.toMDMode} toShowMode={this.toShowMode}
|
|
|
|
|
|
|
|
height={166} className={'optionMdEditor'} noStorage={true}
|
|
|
|
|
|
|
|
mdID={qNumber + index} placeholder="" onChange={(value) => this.onOptionContentChange(value, index)}
|
|
|
|
|
|
|
|
initValue={item}
|
|
|
|
|
|
|
|
></DMDEditor>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{exerciseIsPublish || index === 0 ?
|
|
|
|
|
|
|
|
<i className=" font-18 ml15 mr20"></i>
|
|
|
|
|
|
|
|
: <Tooltip title="删除">
|
|
|
|
|
|
|
|
<i className="iconfont icon-htmal5icon19 font-18 color-grey-c ml15" onClick={() => this.deleteOption(index)}></i>
|
|
|
|
|
|
|
|
</Tooltip>}
|
|
|
|
|
|
|
|
{!exerciseIsPublish && <Tooltip title={`新增参考答案`}>
|
|
|
|
|
|
|
|
<i className="color-green font-16 iconfont icon-roundaddfill ml6"
|
|
|
|
|
|
|
|
onClick={() => this.addOption()}
|
|
|
|
|
|
|
|
style={{ float: 'right', visibility: index == question_choices.length - 1 ? '' : 'hidden', marginTop: '2px' }}
|
|
|
|
|
|
|
|
></i>
|
|
|
|
|
|
|
|
</Tooltip>}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
})}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div className="mb20">
|
|
|
|
|
|
|
|
<span
|
|
|
|
|
|
|
|
style={{ color: '#FF6800' }}>{'温馨提示:点击选项输入框可设置答案;选中的选项即为正确答案,选择多个答案即为多选题'}</span>
|
|
|
|
|
|
|
|
{answerTagArray && !!answerTagArray.length ?
|
|
|
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
|
|
|
<span className="fr color-orange">{answerTagArray.join(' ')}</span>
|
|
|
|
|
|
|
|
<span className="fr">标准答案:</span>
|
|
|
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
|
|
|
:
|
|
|
|
|
|
|
|
""
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
分值:
|
|
|
|
分值:
|
|
|
|
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
|
|
|
|
<InputNumber step={0.1} precision={1} min={0} max={100} style={{ width: 100 }} value={question_score} onChange={this.on_question_score_change}
|
|
|
|
disabled={exerciseIsPublish}
|
|
|
|
disabled={exerciseIsPublish}
|
|
|
|
></InputNumber> 分
|
|
|
|
></InputNumber> 分
|
|
|
|
|
|
|
|
|
|
|
|
<span className="fr">
|
|
|
|
<span className="fr">
|
|
|
|
<ActionBtn style="greyBack" className="middle mr20" onClick={this.onCancel}
|
|
|
|
<ActionBtn style="greyBack" className="middle mr20" onClick={this.onCancel}
|
|
|
|
>取消</ActionBtn>
|
|
|
|
>取消</ActionBtn>
|
|
|
|
<ActionBtn style="blue" className="middle" onClick={this.onSave}>保存</ActionBtn>
|
|
|
|
<ActionBtn style="blue" className="middle" onClick={this.onSave}>保存</ActionBtn>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// RouteHOC()
|
|
|
|
// RouteHOC()
|
|
|
|
export default (SingleEditor);
|
|
|
|
export default (SingleEditor);
|
|
|
|