From 199c603ac93553454da7269b77a2c3d5f901905b Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Mon, 29 Jul 2019 09:38:49 +0800
Subject: [PATCH] md
---
.../components/markdown/MarkdownToHtml.js | 14 ++------------
.../courses/exercise/ExerciseReviewAndAnswer.js | 16 +++++++++++++---
.../exercise/Exercisestatisticalresult.js | 8 +++++---
.../courses/exercise/new/JudgeDisplay.js | 7 +++++--
.../modules/courses/exercise/new/MainDisplay.js | 4 ++--
.../modules/courses/exercise/new/NullDisplay.js | 2 +-
.../exercise/new/QestionDisplayHeader.js | 4 ++--
.../courses/exercise/new/SingleDisplay.js | 8 ++++----
.../courses/exercise/question/fillEmpty.js | 7 +++++--
.../courses/exercise/question/multiple.js | 7 +++++--
.../courses/exercise/question/simpleAnswer.js | 17 +++++++++++++----
.../modules/courses/exercise/question/single.js | 7 +++++--
12 files changed, 62 insertions(+), 39 deletions(-)
diff --git a/public/react/src/common/components/markdown/MarkdownToHtml.js b/public/react/src/common/components/markdown/MarkdownToHtml.js
index c7d15cf64..63733165e 100644
--- a/public/react/src/common/components/markdown/MarkdownToHtml.js
+++ b/public/react/src/common/components/markdown/MarkdownToHtml.js
@@ -3,7 +3,6 @@ import { markdownToHTML } from 'educoder'
import './MarkdownToHtml.css'
/**
selector 需要传入唯一的selector作为id,不然会引起冲突
- delay 如果有公式,需要传入delay={true}
*/
class MarkdownToHtml extends Component{
constructor(props){
@@ -11,17 +10,8 @@ class MarkdownToHtml extends Component{
this.state={
}
}
- _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)
- }
+ _markdownToHTML = (content, selector) => {
+ markdownToHTML(content, selector)
}
componentDidUpdate = (prevProps) => {
if (this.props.content) {
diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
index cd3355082..778829d72 100644
--- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
+++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js
@@ -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{
/>
- {courseName}
+ {courseName}
>
{data && data.left_banner_name}
>
@@ -712,7 +712,10 @@ class ExerciseReviewAndAnswer extends Component{
-
+ {/* */}
+
{
// 选择题和判断题共用
@@ -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}
>
}
{
@@ -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}
+
>
}
{
@@ -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}
+
>
}
{
@@ -774,6 +782,8 @@ class ExerciseReviewAndAnswer extends Component{
questionType={item}
user_exercise_status={user_exercise_status}
id={this.state.Id}
+ index={key}
+
>
}
diff --git a/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js b/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js
index 6e7b52715..1771d87b3 100644
--- a/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js
+++ b/public/react/src/modules/courses/exercise/Exercisestatisticalresult.js
@@ -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 {
{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?"实训":""}题
{/*Q{item.ques_position}:*/}
-
-
+ {/*
*/}
+
{/*
*/}
diff --git a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
index 7beaa50e5..0f8930a8a 100644
--- a/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/JudgeDisplay.js
@@ -87,9 +87,12 @@ class JudgeDisplay extends Component{
return (
- {item.choice_text}
+ {/* {item.choice_text} */}
+
{/* */}
+ dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}> */}
)
})}
diff --git a/public/react/src/modules/courses/exercise/new/MainDisplay.js b/public/react/src/modules/courses/exercise/new/MainDisplay.js
index 0581865d7..44a795374 100644
--- a/public/react/src/modules/courses/exercise/new/MainDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/MainDisplay.js
@@ -70,10 +70,10 @@ class MainDisplay extends Component{
参考答案:
{/*
*/}
diff --git a/public/react/src/modules/courses/exercise/new/NullDisplay.js b/public/react/src/modules/courses/exercise/new/NullDisplay.js
index eade97474..079b1194f 100644
--- a/public/react/src/modules/courses/exercise/new/NullDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/NullDisplay.js
@@ -109,7 +109,7 @@ class NullDisplay extends Component{
{ answers.answer_text.map((item, itemIndex) => {
return
})}
diff --git a/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js b/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js
index 7b82b14b6..c90d87dac 100644
--- a/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js
+++ b/public/react/src/modules/courses/exercise/new/QestionDisplayHeader.js
@@ -82,9 +82,9 @@ class QestionDisplayHeader extends Component{
{ question_title &&
- //
}
diff --git a/public/react/src/modules/courses/exercise/new/SingleDisplay.js b/public/react/src/modules/courses/exercise/new/SingleDisplay.js
index cbb6da827..bce4dc4c1 100644
--- a/public/react/src/modules/courses/exercise/new/SingleDisplay.js
+++ b/public/react/src/modules/courses/exercise/new/SingleDisplay.js
@@ -101,10 +101,10 @@ class SingleDisplay extends Component{
{prefix}
{/* */}
+ dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}> */}
)
} else {
@@ -112,10 +112,10 @@ class SingleDisplay extends Component{
{prefix}
{/* */}
+ dangerouslySetInnerHTML={{__html: markdownToHTML1(item.choice_text)}}> */}
)
}
})}
diff --git a/public/react/src/modules/courses/exercise/question/fillEmpty.js b/public/react/src/modules/courses/exercise/question/fillEmpty.js
index 79bc164d8..5179432a2 100644
--- a/public/react/src/modules/courses/exercise/question/fillEmpty.js
+++ b/public/react/src/modules/courses/exercise/question/fillEmpty.js
@@ -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(
-
+
+ //
)
})
}
diff --git a/public/react/src/modules/courses/exercise/question/multiple.js b/public/react/src/modules/courses/exercise/question/multiple.js
index 3ef3d960f..7e96f8550 100644
--- a/public/react/src/modules/courses/exercise/question/multiple.js
+++ b/public/react/src/modules/courses/exercise/question/multiple.js
@@ -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{
{prefix}
{/* */}
-
+ {/* */}
+
)
})
diff --git a/public/react/src/modules/courses/exercise/question/simpleAnswer.js b/public/react/src/modules/courses/exercise/question/simpleAnswer.js
index 240f775c2..527044968 100644
--- a/public/react/src/modules/courses/exercise/question/simpleAnswer.js
+++ b/public/react/src/modules/courses/exercise/question/simpleAnswer.js
@@ -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{
{
user_exercise_status == 1 ?
- 0 ? questionType.user_answer[0]:"")}}>
+ // 0 ? questionType.user_answer[0]:"")}}>
+ 0 ? questionType.user_answer[0]:""} selector={'simgle_' + (this.props.index + 1)}
+ className="answerStyle"
+ >
:
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 ?
:
@@ -82,7 +88,10 @@ class simpleAnswer extends Component{
isStudent && exercise.answer_open==true && exercise.exercise_status == 3 ?
:""
}
diff --git a/public/react/src/modules/courses/exercise/question/single.js b/public/react/src/modules/courses/exercise/question/single.js
index 4ff4bf12b..510c28b48 100644
--- a/public/react/src/modules/courses/exercise/question/single.js
+++ b/public/react/src/modules/courses/exercise/question/single.js
@@ -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{
{prefix}
{/* */}
-
+ {/* */}
+
)
})