diff --git a/public/react/src/common/TextUtil.js b/public/react/src/common/TextUtil.js index 4a3145c19..d39ebb32a 100644 --- a/public/react/src/common/TextUtil.js +++ b/public/react/src/common/TextUtil.js @@ -1,5 +1,5 @@ import { bytesToSize } from 'educoder'; -export function markdownToHTML(oldContent) { +export function markdownToHTML(oldContent, selector) { window.$('#md_div').html('') // markdown to html var markdwonParser = window.editormd.markdownToHTML("md_div", { @@ -12,6 +12,9 @@ export function markdownToHTML(oldContent) { sequenceDiagram: true // 默认不解析 }); const content = window.$('#md_div').html() + if (selector) { + window.$(selector).html(content) + } return content } diff --git a/public/react/src/common/components/markdown/MarkdownToHtml.js b/public/react/src/common/components/markdown/MarkdownToHtml.js index 86e94c62e..266f831ee 100644 --- a/public/react/src/common/components/markdown/MarkdownToHtml.js +++ b/public/react/src/common/components/markdown/MarkdownToHtml.js @@ -6,40 +6,23 @@ class MarkdownToHtml extends Component{ this.state={ } } - // componentDidUpdate = (prevProps) => { - // if (this.props.content) { - // if ( prevProps.content != this.props.content ) { - // if (!this.shixunDescr) { - // this.shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", { - // markdown: this.props.content, - // htmlDecode: "style,script,iframe", // you can filter tags decode - // taskList: true, - // tex: true, // 默认不解析 - // flowChart: true, // 默认不解析 - // sequenceDiagram: true // 默认不解析 - // }); - // } else { - // this.shixunDescr.html(this.props.content) - // } - // } - // } - // } - // componentDidMount () { - // if (!this.shixunDescr) { - // this.shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", { - // markdown: this.props.content, - // htmlDecode: "style,script,iframe", // you can filter tags decode - // taskList: true, - // tex: true, // 默认不解析 - // flowChart: true, // 默认不解析 - // sequenceDiagram: true // 默认不解析 - // }); - // } - // } + componentDidUpdate = (prevProps) => { + if (this.props.content) { + if ( prevProps.content != this.props.content ) { + markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`) + } + } + } + componentDidMount () { + this.props.content && markdownToHTML(this.props.content, `.markdown_to_html_${this.props.selector || ''}`) + + } render(){ return( -
+
) } diff --git a/public/react/src/modules/comment/Comment.css b/public/react/src/modules/comment/Comment.css index 61e8b2f8b..f7b52366d 100644 --- a/public/react/src/modules/comment/Comment.css +++ b/public/react/src/modules/comment/Comment.css @@ -236,6 +236,7 @@ /* line-height: 14px; */ width: 100%; word-wrap: break-word; + margin-bottom: 4px; } .childComment .break_word_comments{ line-height: 22px; diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index 50368d60a..42fea091c 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -168,7 +168,7 @@ class Comments extends Component { }
-

+

@@ -225,7 +225,7 @@ class Comments extends Component {

-
+
@@ -326,7 +326,7 @@ class Comments extends Component { { item.hidden && ((this.props.onlySuperAdminCouldHide && !item.isSuperAdmin) || !this.props.onlySuperAdminCouldHide && item.admin === false && (item.manager === false || item.manager == undefined)) ?

违规评论已被屏蔽!

- :
+ :
}
diff --git a/public/react/src/modules/courses/boards/BoardsListItem.js b/public/react/src/modules/courses/boards/BoardsListItem.js index 089d060a4..c25c541e8 100644 --- a/public/react/src/modules/courses/boards/BoardsListItem.js +++ b/public/react/src/modules/courses/boards/BoardsListItem.js @@ -1,6 +1,7 @@ import React,{ Component } from "react"; import {Tooltip} from 'antd' import moment from 'moment' +import { getUrl } from 'educoder' class BoardsListItem extends Component{ constructor(props){ super(props); @@ -37,11 +38,11 @@ class BoardsListItem extends Component{ } `} { checkBox } - + {/* /images/avatars/User/1?1529221779 */} 1?1529221779
onItemClick(discussMessage)}> @@ -62,7 +63,7 @@ class BoardsListItem extends Component{

- {discussMessage.author.name} + {discussMessage.author.name} { discussMessage.total_replies_count != 0 && {discussMessage.total_replies_count} 回复 } { discussMessage.total_praises_count != 0 && {discussMessage.total_praises_count} 点赞 } diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js index f0bc978ef..1ef880c9f 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.js +++ b/public/react/src/modules/courses/boards/TopicDetail.js @@ -24,7 +24,7 @@ import '../../forums/RightSection.css' import './TopicDetail.css' import '../common/courseMessage.css' import { Pagination, Tooltip } from 'antd' -import { bytesToSize, ConditionToolTip } from 'educoder' +import { bytesToSize, ConditionToolTip, markdownToHTML, MarkdownToHtml } from 'educoder' import SendToCourseModal from '../coursesPublic/modal/SendToCourseModal' import CBreadcrumb from '../common/CBreadcrumb' import { generateComments, generateChildComments, _findById, handleContentBeforeCreateNew, addNewComment @@ -87,15 +87,6 @@ class TopicDetail extends Component { replies_count: response.data.data.total_replies_count }, {...this.state.memo}) }, () => { - setTimeout(()=>{ - var shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", { - htmlDecode: "style,script,iframe", // you can filter tags decode - taskList: true, - tex: true, // 默认不解析 - flowChart: true, // 默认不解析 - sequenceDiagram: true // 默认不解析 - }); - }, 200) }) // const { memo_replies, memo } = response.data; @@ -181,13 +172,13 @@ class TopicDetail extends Component { // md渲染content,等xhr执行完(即memoLoading变化),memo.content更新后初始化md setTimeout(()=>{ - var shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", { - htmlDecode: "style,script,iframe", // you can filter tags decode - taskList: true, - tex: true, // 默认不解析 - flowChart: true, // 默认不解析 - sequenceDiagram: true // 默认不解析 - }); + // var shixunDescr = window.editormd.markdownToHTML("memo_content_editorMd", { + // htmlDecode: "style,script,iframe", // you can filter tags decode + // taskList: true, + // tex: true, // 默认不解析 + // flowChart: true, // 默认不解析 + // sequenceDiagram: true // 默认不解析 + // }); }, 200) } @@ -629,13 +620,8 @@ class TopicDetail extends Component {

-
- -
+
-{/* style={{ paddingTop: '0px'}} */}
{/* ${memo.user_praise ? '' : ''} */} diff --git a/public/react/src/modules/courses/common/courseMessage.css b/public/react/src/modules/courses/common/courseMessage.css index c928162f4..db2381d37 100644 --- a/public/react/src/modules/courses/common/courseMessage.css +++ b/public/react/src/modules/courses/common/courseMessage.css @@ -17,7 +17,7 @@ } /* 子回复按钮 */ .course-message .reply_to_message a.commentsbtn.task-btn-blue { - margin-right: 50px; + /* margin-right: 50px; */ } /* 改边距 */ /* .course-message .commentsDelegateParent { diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js index a45a105fd..7807e7265 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js @@ -205,7 +205,7 @@ class GraduationTasksappraise extends Component{
-
+
{/*
*/} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index 36c2f9d3f..9874b26fa 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -125,7 +125,7 @@ class GraduationTasksedit extends Component{ GraduationTasksedittype=false; // window.location.href="/courses/"+course_id+"/graduation/"+graduationId+"/graduation_tasks/"+category_id+"/questions"; // this.goback() - this.props.history.push("/courses/"+this.props.match.params.coursesId+"/graduation_tasks/"+graduation_id+"/"+this.props.match.params.category_id +"/setting"); + window.location.href="/courses/"+this.props.match.params.coursesId+"/graduation_tasks/"+graduation_id+"/"+this.props.match.params.category_id +"/setting"; } }).catch((error) => { console.log(error) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index 762fe1406..c74f8a1d7 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -140,9 +140,11 @@ class GraduationTaskssettingapp extends Component{ componentDidMount(){ - + let query=this.props.location.search + const type = query.split('?tab='); + let id=parseInt(type[1]) this.getsettings(); - if(this.props.isAdmin()===true){ + if(this.props.isAdmin()===true&&isNaN(id)){ this.editSetting() } } @@ -484,6 +486,31 @@ class GraduationTaskssettingapp extends Component{ let {latepenalty,hascommit,minnums,max_nums,publish_time,end_time,crosscomment,latetime,starttimetype}=this.state; + + if(isNaN(parseInt(this.state.minnum))){ + this.setState({ + numtype:true + }) + this.scrollToAnchor("publishtimestart"); + return + }else{ + this.setState({ + numtype:false + }) + } + if(isNaN(parseInt(this.state.maxnum))){ + this.setState({ + numtype:true + }) + this.scrollToAnchor("publishtimestart"); + return + }else{ + this.setState({ + numtype:false + }) + } + + if(latepenalty===undefined){ this.setState({ latepenaltytype:true, @@ -611,26 +638,7 @@ class GraduationTaskssettingapp extends Component{ return } - if(isNaN(parseInt(this.state.minnum))){ - this.setState({ - numtype:true - }) - return - }else{ - this.setState({ - numtype:false - }) - } - if(isNaN(parseInt(this.state.maxnum))){ - this.setState({ - numtype:true - }) - return - }else{ - this.setState({ - numtype:false - }) - } + @@ -1036,7 +1044,7 @@ class GraduationTaskssettingapp extends Component{ 任务问答 设置 + to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/setting?tab=3"}>设置 {/*导出*/}
+ style={{ padding: '30px',boxSizing:"border-box", display: isInited ? '' : 'none', paddingBottom: '40px' }} >