dev_forum
hjm 5 years ago
parent 4db7e1e058
commit 199c603ac9

@ -3,7 +3,6 @@ import { markdownToHTML } from 'educoder'
import './MarkdownToHtml.css'
/**
selector 需要传入唯一的selector作为id不然会引起冲突
delay 如果有公式需要传入delay={true}
*/
class MarkdownToHtml extends Component{
constructor(props){
@ -12,16 +11,7 @@ class MarkdownToHtml extends Component{
}
}
_markdownToHTML = (content, selector) => {
if (this.props.delay == true) {
(function(content, selector) {
// console.log('selector: ', selector)
// setTimeout(() => {
markdownToHTML(content, selector)
// }, 600)
})(content, selector)
} else {
markdownToHTML(content, selector)
}
}
componentDidUpdate = (prevProps) => {
if (this.props.content) {

@ -7,7 +7,7 @@ import '../poll/pollStyle.css'
import '../css/Courses.css'
import moment from 'moment'
import { WordsBtn,markdownToHTML,ActionBtn,getImageUrl } from 'educoder'
import { WordsBtn,markdownToHTML,ActionBtn,getImageUrl, MarkdownToHtml } from 'educoder'
import Modals from '../../modals/Modals'
import CoursesListType from '../coursesPublic/CoursesListType';
@ -537,7 +537,7 @@ class ExerciseReviewAndAnswer extends Component{
/>
<div className="educontent mt10 mb50">
<p className="clearfix mb20">
<WordsBtn style="grey" className="fl" to={current_user.first_category_url}>{courseName}</WordsBtn>
<WordsBtn style="grey" className="fl" to={current_user && current_user.first_category_url}>{courseName}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="fl" to={`/courses/${coursesId}/exercises/${data && data.left_banner_id}`}>{data && data.left_banner_name}</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
@ -712,7 +712,10 @@ class ExerciseReviewAndAnswer extends Component{
</span>
</p>
<li className="break_word mt15 mb15 pl30 pr30">
<p className="standardAnswer markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML(item.question_type == 5 ? item.shixun_name : item.question_title).replace(/▁/g,"▁▁▁")}}></p>
{/* <p className="standardAnswer markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML1(item.question_type == 5 ? item.shixun_name : item.question_title).replace(/▁/g,"▁▁▁")}}></p> */}
<MarkdownToHtml content={(item.question_type == 5 ? item.shixun_name : item.question_title)} selector={'answer_' + key}
className="standardAnswer"
></MarkdownToHtml>
</li>
{
// 选择题和判断题共用
@ -724,6 +727,7 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
></Single>
}
{
@ -736,6 +740,8 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
></Multiple>
}
{
@ -748,6 +754,8 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
changeQuestionStatus={(No,flag)=>this.changeQuestionStatus(No,flag)}
index={key}
></FillEmpty>
}
{
@ -774,6 +782,8 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
id={this.state.Id}
index={key}
></ShixunAnswer>
}

@ -1,5 +1,5 @@
import React, {Component} from "react";
import {WordsBtn,markdownToHTML} from 'educoder';
import {WordsBtn,markdownToHTML, MarkdownToHtml} from 'educoder';
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider,InputNumber, Tag,DatePicker,Radio,Tooltip,Pagination} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
import axios from 'axios';
@ -194,8 +194,10 @@ class Exercisestatisticalresult extends Component {
<span className="CACFF">{item.ques_position+"."}{item.ques_type===0?"单选":item.ques_type===1?"多选":item.ques_type===2?"判断":item.ques_type===3?"填空":item.ques_type===4?"主观":item.ques_type===5?"实训":""}</span>
<div>
{/*Q{item.ques_position}*/}
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(item.ques_title).replace(/▁/g,"▁▁▁")}}></div>
{/* <div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML1(item.ques_title).replace(/▁/g,"▁▁▁")}}></div> */}
<MarkdownToHtml content={item.ques_title} selector={'ques_title_' + key}
className=""
></MarkdownToHtml>
{/*<span className="markdown-body" dangerouslySetInnerHTML={createMarkup(item.ques_title)}></span>*/}
</div>
</div>

@ -87,9 +87,12 @@ class JudgeDisplay extends Component{
return (
<div key={optionIndex} className="fl mr30">
<Radio disabled checked={item.standard_boolean}></Radio>
<span>{item.choice_text}</span>
{/* <span>{item.choice_text}</span> */}
<MarkdownToHtml content={item.choice_text} selector={'judge_' + optionIndex}
className=""
></MarkdownToHtml>
{/* <span style={{ display: 'inline-block'}} className="markdown-body"
dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span> */}
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
</div>)
})}

@ -70,10 +70,10 @@ class MainDisplay extends Component{
<div style={{color: '#05101A'}} className="font-16 mb5 font-bd">参考答案</div>
<MarkdownToHtml content={standard_answer[0]} selector={'answer_' + qNumber}
delay={true} className=""
className=""
></MarkdownToHtml>
{/* <div className="mainQuestionDisplay markdown-body"
dangerouslySetInnerHTML={{__html: markdownToHTML(standard_answer[0])}}
dangerouslySetInnerHTML={{__html: markdownToHTML1(standard_answer[0])}}
>
</div> */}
</React.Fragment>

@ -109,7 +109,7 @@ class NullDisplay extends Component{
<div className="answers">
{ answers.answer_text.map((item, itemIndex) => {
return <MarkdownToHtml
className="answer" key={itemIndex} delay={true}
className="answer" key={itemIndex}
content={item} selector={'null_' + (index + 1) + '' + (itemIndex + 1)}
></MarkdownToHtml>
})}

@ -82,9 +82,9 @@ class QestionDisplayHeader extends Component{
</div>
{ question_title &&
<MarkdownToHtml content={question_title} selector={'qtitle_' + (index + 1)} style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px' }}
delay={true}
></MarkdownToHtml>
// <div className="markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML(question_title)}}
// <div className="markdown-body" dangerouslySetInnerHTML={{__html: markdownToHTML1(question_title)}}
// style={{ display: 'inline-block', width:'100%' , margin: '10px 0px 15px' }}></div>
}
</React.Fragment>

@ -101,10 +101,10 @@ class SingleDisplay extends Component{
<div className="mb10 clearfix" key={optionIndex}>
<Radio disabled className="fl lineh-20" checked={item.standard_boolean}>{prefix}</Radio>
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1) + '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
delay={true}
></MarkdownToHtml>
{/* <span style={{ display: 'inline-block'}} className="markdown-body fl"
dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span> */}
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
</div>)
} else {
@ -112,10 +112,10 @@ class SingleDisplay extends Component{
<div className="mb10 clearfix" key={optionIndex}>
<Checkbox disabled className="fl lineh-20" checked={item.standard_boolean}>{prefix}</Checkbox>
<MarkdownToHtml content={item.choice_text} selector={'single_' + (index + 1)+ '' + (optionIndex + 1)} style={{ float: 'left', display: 'inline-block' }}
delay={true}
></MarkdownToHtml>
{/* <span style={{ display: 'inline-block'}} className="markdown-body fl"
dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span> */}
dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
</div>)
}
})}

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {DMDEditor,markdownToHTML } from 'educoder'
import {DMDEditor,markdownToHTML, MarkdownToHtml } from 'educoder'
import axios from 'axios'
@ -140,7 +140,10 @@ class fillEmpty extends Component{
{
item.answer_text && item.answer_text.map((i,index)=>{
return(
<div className="standardAnswer markdown-body answerStyle mb10" dangerouslySetInnerHTML={{__html: markdownToHTML(i)}}></div>
<MarkdownToHtml content={i} selector={'empty_' + (this.props.index + 1) +(k + 1) + (index + 1)}
className="standardAnswer answerStyle mb10"
></MarkdownToHtml>
// <div className="standardAnswer markdown-body answerStyle mb10" dangerouslySetInnerHTML={{__html: markdownToHTML1(i)}}></div>
)
})
}

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML} from 'educoder'
import {markdownToHTML, MarkdownToHtml} from 'educoder'
import axios from 'axios'
const tagArray = [
@ -51,7 +51,10 @@ class Multiple extends Component{
<p className="clearfix mb15 df">
<Checkbox className="fl lineh-20 " value={item.choice_id}>{prefix}</Checkbox>
{/* <span class="fl lineh-20 mt1"></span> */}
<span style={{display:"inline-block"}} className="markdown-body " dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span>
{/* <span style={{display:"inline-block"}} className="markdown-body " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
<MarkdownToHtml content={item.choice_text} selector={'multiple_' + (this.props.index + 1) + (key + 1)}
className="" style={{display:"inline-block"}}
></MarkdownToHtml>
</p>
)
})

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML} from 'educoder'
import {markdownToHTML, MarkdownToHtml} from 'educoder'
import TPMMDEditor from '../../../../modules/tpm/challengesnew/TPMMDEditor'
import axios from 'axios'
@ -54,7 +54,10 @@ class simpleAnswer extends Component{
<li className="with100">
{
user_exercise_status == 1 ?
<div className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML(questionType.user_answer.length>0 ? questionType.user_answer[0]:"")}}></div>
// <div className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML1(questionType.user_answer.length>0 ? questionType.user_answer[0]:"")}}></div>
<MarkdownToHtml content={questionType.user_answer.length>0 ? questionType.user_answer[0]:""} selector={'simgle_' + (this.props.index + 1)}
className="answerStyle"
></MarkdownToHtml>
:
<div>
<TPMMDEditor ref={this.mdRef} initValue={questionType.user_answer.length > 0 ? questionType.user_answer[0]:''} mdID={'simpleEditor'+questionType.question_id} placeholder="请输入你的答案"
@ -70,7 +73,10 @@ class simpleAnswer extends Component{
exercise.answer_status == 1 || questionType.a_flag ?
<div className="standardAnswer">
<p className="mb10 font-16">参考答案</p>
<li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML(questionType.standard_answer && questionType.standard_answer[0])}}></li>
{/* <li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML1(questionType.standard_answer && questionType.standard_answer[0])}}></li> */}
<MarkdownToHtml content={questionType.standard_answer && questionType.standard_answer[0]} selector={'simgle_standard_' + (this.props.index + 1)}
className="answerStyle"
></MarkdownToHtml>
<p className="mt15"><a className="color-blue font-16" onClick={()=>this.showAndHide(false)}>隐藏参考答案</a></p>
</div>
:
@ -82,7 +88,10 @@ class simpleAnswer extends Component{
isStudent && exercise.answer_open==true && exercise.exercise_status == 3 ?
<div className="bor-top-greyE pt20 mt20 standardAnswer">
<p>参考答案</p>
<li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML(questionType.standard_answer && questionType.standard_answer[0])}}></li>
{/* <li className="markdown-body answerStyle" dangerouslySetInnerHTML={{__html: markdownToHTML1(questionType.standard_answer && questionType.standard_answer[0])}}></li> */}
<MarkdownToHtml content={questionType.standard_answer && questionType.standard_answer[0]} selector={'simgle_standard2_' + (this.props.index + 1)}
className="answerStyle"
></MarkdownToHtml>
</div>:""
}
</div>

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import {Checkbox,Radio, Input} from "antd";
import {markdownToHTML} from 'educoder'
import {markdownToHTML, MarkdownToHtml} from 'educoder'
import axios from 'axios'
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
@ -46,7 +46,10 @@ class single extends Component{
<p className={parseInt(questionType.question_type) == 0 ? "clearfix mb15 df" : "fl mr40"}>
<Radio className="fl lineh-20" value={item.choice_id}>{prefix}</Radio>
{/* <span className="fl lineh-20 mr3 "></span> */}
<span style={{display:"inline-block", 'margin-top': '-1px'}} className="markdown-body fl " dangerouslySetInnerHTML={{__html: markdownToHTML(item.choice_text)}}></span>
{/* <span style={{display:"inline-block", 'margin-top': '-1px'}} className="markdown-body fl " dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}></span> */}
<MarkdownToHtml content={item.choice_text} selector={'single_' + (this.props.index + 1) + (key + 1)}
className="fl" style={{display:"inline-block", 'margin-top': '-1px'}}
></MarkdownToHtml>
</p>
)
})

Loading…
Cancel
Save