|  |  | @ -8,8 +8,9 @@ import { | 
			
		
	
		
		
			
				
					
					|  |  |  | 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 {getUrl, ActionBtn, DMDEditor, ConditionToolTip} from 'educoder'; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import QuillForEditor from "../../../../common/quillForEditor"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | const { TextArea } = Input; |  |  |  | const { TextArea } = Input; | 
			
		
	
		
		
			
				
					
					|  |  |  | const confirm = Modal.confirm; |  |  |  | const confirm = Modal.confirm; | 
			
		
	
		
		
			
				
					
					|  |  |  | const $ = window.$ |  |  |  | const $ = window.$ | 
			
		
	
	
		
		
			
				
					|  |  | @ -47,6 +48,9 @@ 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_default_title: '' | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   addOption = () => { |  |  |  |   addOption = () => { | 
			
		
	
	
		
		
			
				
					|  |  | @ -205,8 +209,33 @@ class SingleEditor extends Component{ | 
			
		
	
		
		
			
				
					
					|  |  |  |   toShowMode = () => { |  |  |  |   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编辑器内容变化时调用此接口
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   handleCtxChange = (ctx) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     console.log('编辑器内容', ctx); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     // 保存编辑器内容
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     this.setState({ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       quill_question_title: JSON.stringify(ctx) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   render() { |  |  |  |   render() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     let { question_title, question_score, question_type, question_choices, standard_answers } = this.state; |  |  |  |     let { question_title, question_score, question_type, question_choices, standard_answers, choice_editor, quill_default_title } = this.state; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     let { question_id, index, exerciseIsPublish, |  |  |  |     let { question_id, index, exerciseIsPublish, | 
			
		
	
		
		
			
				
					
					|  |  |  |       // question_title,
 |  |  |  |       // question_title,
 | 
			
		
	
		
		
			
				
					
					|  |  |  |       // question_type,
 |  |  |  |       // question_type,
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -245,18 +274,51 @@ class SingleEditor extends Component{ | 
			
		
	
		
		
			
				
					
					|  |  |  |                 max-width: 1056px; |  |  |  |                 max-width: 1056px; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 word-break:break-all; |  |  |  |                 word-break:break-all; | 
			
		
	
		
		
			
				
					
					|  |  |  |               } |  |  |  |               } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               .editor_area{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 display: inline-block; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 float: right; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 // line-height: 30px;
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 // height: 30px;
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               .editor_txt{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 margin-right: 10px; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 font-size: 12px; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 color: #999; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               .radio_style{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 display: inline-block; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 vertical: center; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |               } | 
			
		
	
		
		
			
				
					
					|  |  |  |             `}</style>
 |  |  |  |             `}</style>
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             <p className="mb10 clearfix"> |  |  |  |             <p className="mb10 clearfix"> | 
			
		
	
		
		
			
				
					
					|  |  |  |               {/* {!question_id ? '新建' : '编辑'} */} |  |  |  |               {/* {!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> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 {/* <Switch checkedChildren="MD" unCheckedChildren="Quill"></Switch> */} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 {/* <div className="editor_area"> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   <span className="editor_txt">切换编辑器:</span> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   <Radio.Group style={{ float: 'right' }} value={choice_editor} onChange={this.handleChangeEditor}> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     <Radio className="radio_style" value={'md'}>MD</Radio> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     <Radio className="radio_style" value={'quill'}>Quill</Radio> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   </Radio.Group> | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 </div> */} | 
			
		
	
		
		
			
				
					
					|  |  |  |             </p> |  |  |  |             </p> | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             <TPMMDEditor mdID={qNumber} placeholder="请您输入题目" height={155} className="mb20" |  |  |  |             {choice_editor === 'md' | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |               initValue={question_title} onChange={(val) => this.setState({ question_title: val})} |  |  |  |               ? <TPMMDEditor mdID={qNumber} placeholder="请您输入题目" height={155} className="mb20" | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |               ref="titleEditor" |  |  |  |                   initValue={question_title} onChange={(val) => this.setState({ question_title: val})} | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                   ref="titleEditor" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ></TPMMDEditor> | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             ></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) => { |  |  |  |           {question_choices.map( (item, index) => { | 
			
		
	
		
		
			
				
					
					|  |  |  |               const bg = standard_answers[index] ? 'check-option-bg' : '' |  |  |  |               const bg = standard_answers[index] ? 'check-option-bg' : '' | 
			
		
	
	
		
		
			
				
					|  |  | 
 |