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( -
+
@@ -225,7 +225,7 @@ class Comments extends Component {
违规评论已被屏蔽!
- : + : } diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index bc79bdada..dd37c441c 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -8,6 +8,7 @@ import {getUrl} from 'educoder'; import moment from 'moment'; import CoursesListType from '../coursesPublic/CoursesListType'; import Showoldfiles from "../coursesPublic/Showoldfiles"; +import Modals from '../../modals/Modals'; class Fileslistitem extends Component{ constructor(props){ @@ -74,7 +75,68 @@ class Fileslistitem extends Component{ Showoldfiles:false, }) } - render(){ + + onDelete = (id) => { + + this.setState({ + Modalstype:true, + Modalstopval:"是否确认删除?", + ModalCancel:this.cancelmodel, + ModalSave:()=>this.savedelete(id), + }) + + } + + cancelmodel=()=>{ + + this.setState({ + Modalstype:false, + Loadtype:false, + Modalstopval:"", + ModalCancel:"", + ModalSave:"", + checkBoxValues:[], + }) + + } + + savedelete=(id)=>{ + + this.setState({ + Modalstype:false, + }) + + + const cid = this.props.match.params.coursesId + const url = `/files/bulk_delete.json`; + axios.delete(url, { data: { + course_id:cid, + ids: [id], + }}) + .then((response) => { + if (response.data.status == 0) { + //Modalstopval:response.data.message, + + this.props.updatafiledfun() + this.setState({ + // Modalstype:true, + // Modalstopval:"删除成功", + ModalsBottomval:"", + // ModalSave:this.cancelmodel, + // Loadtype:true, + checkBoxValues:[], + checkAllValue:false + }) + + this.props.showNotification("删除成功"); + } + }) + .catch(function (error) { + console.log(error); + }); + } + + render(){ const { checkBox, discussMessage, @@ -84,6 +146,16 @@ class Fileslistitem extends Component{ return(+
{discussMessage.course_groups.map((item,key)=>{ return(
+
- {discussMessage.author.name}
+ {discussMessage.author.login}
大小 {discussMessage.filesize}
下载 {discussMessage.downloads_count}
引用 {discussMessage.quotes}
@@ -220,15 +289,31 @@ class Fileslistitem extends Component{
{ discussMessage.publish_time===null?"":discussMessage.is_publish===true?moment(discussMessage.publish_time).fromNow():moment(discussMessage.publish_time).format('YYYY-MM-DD hh:mm')}
+ {this.props.isAdmin ||this.props.current_user.login===discussMessage.author.login?
+
+
+
- 资源描述 :
- {discussMessage.description}
- {this.props.isAdmin ?this.settingList()}>:""}
+ {/**/}
+
+ 资源描述 :{discussMessage.description===null?"暂无描述":discussMessage.description}
+
+ {/*{this.props.isAdmin ?this.settingList()}>:""}*/}
- {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 {
this.onItemClick(item)}
+ className="fl font-16 font-bd mt2 comnonwidth580" style={{cursor: canNotLink ? 'normal' : 'poninter'}}
+ onClick={canNotLink ? () => {} : () => this.onItemClick(item)}
>{item.name}
{/* 只有非课堂成员且作业是私有的情况下才会为true */}
@@ -155,7 +157,7 @@ class CommonWorkItem extends Component{
{title}
- 非成员不能访问
-
-
- {/*{item.name.length>32?*/}
- {/* {item.creator} {item.technical_title}
-
- 请选择分班 请填写完整 描述不能超过最大限制:100个字符 请输入资源描述,最大限制100个字符
+
{/*{item.exercise_name}*/}
{
@@ -132,7 +135,7 @@ class ExerciseListItem extends Component{
{/**/}
{/**/}
+
{item.exercise_status===1?"":{item.exercise_answer} 已答}
{item.exercise_status===1?"":{item.exercise_unanswer} 未答}
{item.unreview_count===null||item.exercise_status===1?"":{item.unreview_count} 未评数 }
@@ -161,23 +164,32 @@ class ExerciseListItem extends Component{
{/*item.exercise_status ==2?"":*/}
{/* 发布于{moment(item.exercise_left_time).fromNow()} */}
{/*}*/}
-
- {/* target="_blank" */}
-
- {memo.subject}
-
-
- { memo.sticky && 置顶 }
-
- { memo.reward &&
-
- {memo.reward}
-
- }
-
- {/* data-tip-down="回复数" {memo.replies_count}
- {memo.praise_count}*/}
- {memo.replies_count ?
-
- {memo.replies_count} 回复
- :''}
-
- {memo.praise_count ?
-
- {memo.praise_count} 赞
- :''}
-
- {memo.viewed_count ?
-
- {this._toTenThousand(memo.viewed_count)} 浏览
- :''}
-
-
+ {/* target="_blank" */}
+
+ {memo.subject}
+
+
+ { memo.sticky && 置顶 }
+
+ { memo.reward &&
+
+ {memo.reward}
+
+ }
+
+ {/* data-tip-down="回复数" {memo.replies_count}
+ {memo.praise_count}*/}
+ {memo.replies_count ?
+
+ {memo.replies_count} 回复
+ :''}
+
+ {memo.praise_count ?
+
+ {memo.praise_count} 赞
+ :''}
+
+ {memo.viewed_count ?
+
+ {this._toTenThousand(memo.viewed_count)} 浏览
+ :''}
+
+
{ChallengesDataList === undefined ? "" :ChallengesDataList.description===null?"":
-
+
+
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/common/titleSearch/TitleSearchSection.js b/public/react/src/modules/courses/common/titleSearch/TitleSearchSection.js
index c6530e855..4cb69a8d7 100644
--- a/public/react/src/modules/courses/common/titleSearch/TitleSearchSection.js
+++ b/public/react/src/modules/courses/common/titleSearch/TitleSearchSection.js
@@ -62,7 +62,7 @@ class Titlesearchsection extends Component{
-
-
-
- */}
+ {/*
*/}
+ {/**/}
+ {/*
*/}
+ {/*
- { user.admin === true &&
- ( memo.sticky === true ?
-
-
+ { user.admin === true &&
+ ( memo.sticky === true ?
+
+