diff --git a/db/migrate/20190805010546_modify_ke_contents_for_markdown.rb b/db/migrate/20190805010546_modify_ke_contents_for_markdown.rb index 3b9c56b91..3d993cfb8 100644 --- a/db/migrate/20190805010546_modify_ke_contents_for_markdown.rb +++ b/db/migrate/20190805010546_modify_ke_contents_for_markdown.rb @@ -1,48 +1,48 @@ class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2] include ActionView::Helpers::SanitizeHelper def change - def ke_transform_to_md content - return content if content.blank? - s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) - s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "
").gsub(/$(\n)/, "") - .gsub(/(\n)+/, "
").gsub("\t", " ") - end - - # 课程讨论区 - MessageDetail.find_each do |m| - content = ke_transform_to_md m.content - m.update_column(:content, content) - end - - # 试卷的标题 - ExerciseQuestion.find_each do |eq| - question_title = ke_transform_to_md eq.question_title - eq.update_column(:question_title, question_title) - end - - # 试卷的答案 - ExerciseStandardAnswer.find_each do |esa| - answer_text = ke_transform_to_md esa.answer_text - esa.update_column(:answer_text, answer_text) - end - - # 试卷题库的问题标题 - ExerciseBankQuestion.find_each do |ebq| - question_title = ke_transform_to_md ebq.question_title - ebq.update_column(:question_title, question_title) - end - - # 试卷答案 - ExerciseBankStandardAnswer.find_each do |ebsa| - answer_text = ke_transform_to_md ebsa.answer_text - ebsa.update_column(:answer_text, answer_text) - end - - # 问卷的标题 - PollQuestion.find_each do |pq| - question_title = ke_transform_to_md pq.question_title - pq.update_column(:question_title, question_title) - end + # def ke_transform_to_md content + # return content if content.blank? + # s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) + # s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "
").gsub(/$(\n)/, "") + # .gsub(/(\n)+/, "
").gsub("\t", " ") + # end + # + # # 课程讨论区 + # MessageDetail.find_each do |m| + # content = ke_transform_to_md m.content + # m.update_column(:content, content) + # end + # + # # 试卷的标题 + # ExerciseQuestion.find_each do |eq| + # question_title = ke_transform_to_md eq.question_title + # eq.update_column(:question_title, question_title) + # end + # + # # 试卷的答案 + # ExerciseStandardAnswer.find_each do |esa| + # answer_text = ke_transform_to_md esa.answer_text + # esa.update_column(:answer_text, answer_text) + # end + # + # # 试卷题库的问题标题 + # ExerciseBankQuestion.find_each do |ebq| + # question_title = ke_transform_to_md ebq.question_title + # ebq.update_column(:question_title, question_title) + # end + # + # # 试卷答案 + # ExerciseBankStandardAnswer.find_each do |ebsa| + # answer_text = ke_transform_to_md ebsa.answer_text + # ebsa.update_column(:answer_text, answer_text) + # end + # + # # 问卷的标题 + # PollQuestion.find_each do |pq| + # question_title = ke_transform_to_md pq.question_title + # pq.update_column(:question_title, question_title) + # end end end diff --git a/db/migrate/20190806062209_second_mofidy_ke_contents_for_md.rb b/db/migrate/20190806062209_second_mofidy_ke_contents_for_md.rb index 34e16b6aa..044e6c0dd 100644 --- a/db/migrate/20190806062209_second_mofidy_ke_contents_for_md.rb +++ b/db/migrate/20190806062209_second_mofidy_ke_contents_for_md.rb @@ -1,63 +1,63 @@ class SecondMofidyKeContentsForMd < ActiveRecord::Migration[5.2] include ActionView::Helpers::SanitizeHelper def change - def ke_transform_to_md content - return content if content.blank? - s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) - s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "
").gsub(/$(\n)/, "") - .gsub(/(\n)+/, "
").gsub("\t", " ") - end - - # 作业 - HomeworkCommon.find_each do |hc| - description = ke_transform_to_md hc.description - reference_answer = ke_transform_to_md hc.reference_answer - explanation = ke_transform_to_md hc.explanation - hc.update_attributes(description: description, reference_answer: reference_answer, explanation: explanation) - end - - # 作业题库 - HomeworkBank.find_each do |hb| - description = ke_transform_to_md hb.description - reference_answer = ke_transform_to_md hb.reference_answer - hb.update_attributes(description: description, reference_answer: reference_answer) - end - - # 毕业任务 - GraduationTask.find_each do |gt| - description = ke_transform_to_md gt.description - gt.update_column(:description, description) - end - - # 毕设选题 - GraduationTopic.find_each do |gt| - description = ke_transform_to_md gt.description - gt.update_column(:description, description) - end - - # 毕设作品 - GraduationWork.find_each do |gw| - description = ke_transform_to_md gw.description - gw.update_column(:description, description) - end - - # 毕设任务题库 - GtaskBank.find_each do |gb| - description = ke_transform_to_md gb.description - gb.update_column(:description, description) - end - - # 毕设选题题库 - GtopicBank.find_each do |gb| - description = ke_transform_to_md gb.description - gb.update_column(:description, description) - end - - # 交流问答 - Memo.find_each do |m| - content = ke_transform_to_md m.content - m.update_column(:content, content) - end + # def ke_transform_to_md content + # return content if content.blank? + # s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) + # s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "
").gsub(/$(\n)/, "") + # .gsub(/(\n)+/, "
").gsub("\t", " ") + # end + # + # # 作业 + # HomeworkCommon.find_each do |hc| + # description = ke_transform_to_md hc.description + # reference_answer = ke_transform_to_md hc.reference_answer + # explanation = ke_transform_to_md hc.explanation + # hc.update_attributes(description: description, reference_answer: reference_answer, explanation: explanation) + # end + # + # # 作业题库 + # HomeworkBank.find_each do |hb| + # description = ke_transform_to_md hb.description + # reference_answer = ke_transform_to_md hb.reference_answer + # hb.update_attributes(description: description, reference_answer: reference_answer) + # end + # + # # 毕业任务 + # GraduationTask.find_each do |gt| + # description = ke_transform_to_md gt.description + # gt.update_column(:description, description) + # end + # + # # 毕设选题 + # GraduationTopic.find_each do |gt| + # description = ke_transform_to_md gt.description + # gt.update_column(:description, description) + # end + # + # # 毕设作品 + # GraduationWork.find_each do |gw| + # description = ke_transform_to_md gw.description + # gw.update_column(:description, description) + # end + # + # # 毕设任务题库 + # GtaskBank.find_each do |gb| + # description = ke_transform_to_md gb.description + # gb.update_column(:description, description) + # end + # + # # 毕设选题题库 + # GtopicBank.find_each do |gb| + # description = ke_transform_to_md gb.description + # gb.update_column(:description, description) + # end + # + # # 交流问答 + # Memo.find_each do |m| + # content = ke_transform_to_md m.content + # m.update_column(:content, content) + # end end end diff --git a/db/migrate/20190806063903_third_modify_ke_for_student_work.rb b/db/migrate/20190806063903_third_modify_ke_for_student_work.rb index ba3171279..8c7fb0b29 100644 --- a/db/migrate/20190806063903_third_modify_ke_for_student_work.rb +++ b/db/migrate/20190806063903_third_modify_ke_for_student_work.rb @@ -1,17 +1,17 @@ class ThirdModifyKeForStudentWork < ActiveRecord::Migration[5.2] include ActionView::Helpers::SanitizeHelper def change - def ke_transform_to_md content - return content if content.blank? - s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) - s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "
").gsub(/$(\n)/, "") - .gsub(/(\n)+/, "
").gsub("\t", " ") - end - - # 学生的作品 过滤掉一些描述的ke图片的作品 - StudentWork.where("description is not null and LENGTH(description) < 1000000").find_each do |sw| - description = ke_transform_to_md sw.description - sw.update_column(:description, description) - end + # def ke_transform_to_md content + # return content if content.blank? + # s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) + # s_contents.gsub(/^(\n)/, "").gsub(/(\n)+/, "
").gsub(/$(\n)/, "") + # .gsub(/(\n)+/, "
").gsub("\t", " ") + # end + # + # # 学生的作品 过滤掉一些描述的ke图片的作品 + # StudentWork.where("description is not null and LENGTH(description) < 1000000").find_each do |sw| + # description = ke_transform_to_md sw.description + # sw.update_column(:description, description) + # end end end diff --git a/public/react/src/App.css b/public/react/src/App.css index 7b0455bea..50bccfb60 100644 --- a/public/react/src/App.css +++ b/public/react/src/App.css @@ -58,4 +58,9 @@ html, body { /* resize */ .editormd .CodeMirror { border-right: none !important; +} +.editormd-preview { + border-left: 1px solid rgb(221, 221, 221); + /* 某些情况下,被cm盖住了 */ + z-index: 99; } \ No newline at end of file diff --git a/public/react/src/common/components/LinkAfterLogin.js b/public/react/src/common/components/LinkAfterLogin.js new file mode 100644 index 000000000..d0df08f0a --- /dev/null +++ b/public/react/src/common/components/LinkAfterLogin.js @@ -0,0 +1,23 @@ +import React, { Component } from 'react'; + +// 登录后才能跳转 +class LinkAfterLogin extends Component { + + constructor(props) { + super(props); + } + checkAuth = () => { + if (this.props.checkIfLogin()) { + this.props.history.push(this.props.to) + } else { + this.props.showLoginDialog() + } + } + render() { + return( + {this.props.children} + ) + } +} + +export default LinkAfterLogin; \ No newline at end of file diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 2afbca8d1..2074e495a 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -36,6 +36,7 @@ export { ModalHOC } from './components/ModalHOC' export { SetAppModel } from './components/SetAppModel' +export { default as LinkAfterLogin } from './components/LinkAfterLogin' export { default as Cropper } from './components/Cropper' export { default as ConditionToolTip } from './components/ConditionToolTip' export { default as DragValidator } from './components/DragValidator' diff --git a/public/react/src/modules/comment/CommentContainer.js b/public/react/src/modules/comment/CommentContainer.js index 0e12d0e7d..b02f4094f 100644 --- a/public/react/src/modules/comment/CommentContainer.js +++ b/public/react/src/modules/comment/CommentContainer.js @@ -15,6 +15,7 @@ class CommentContainer extends Component { diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index 380b90bd9..ae246197c 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -58,6 +58,9 @@ const _origin = window.location.origin; comment_count_without_reply currentPage comments + + showRewardButton 是否显示奖励按钮 + showHiddenButton 是否显示隐藏按钮 接口 deleteComment 删除 @@ -360,7 +363,8 @@ class Comments extends Component { :""} - { (this.props.onlySuperAdminCouldHide && item.isSuperAdmin || !this.props.onlySuperAdminCouldHide && item.admin === true) ? + { this.props.showHiddenButton == true + && (this.props.onlySuperAdminCouldHide && item.isSuperAdmin || !this.props.onlySuperAdminCouldHide && item.admin === true) ? this.onCommentBtnClick(item, '', item.hidden ? 'hiddenCancel' : 'hidden') }> diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js index 970cf798a..d60c34461 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.js +++ b/public/react/src/modules/courses/boards/TopicDetail.js @@ -648,7 +648,10 @@ class TopicDetail extends Component {
- {memo.is_md == true ? : + {/* */} + {memo.is_md == true ? + + :
}
diff --git a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js index d146b5ef4..4075eff03 100644 --- a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js +++ b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import { WordsBtn } from 'educoder'; +import { WordsBtn, getTaskUrlById } from 'educoder'; import {Tooltip,message,Modal,Spin} from 'antd'; import {Link} from 'react-router-dom'; import axios from 'axios'; @@ -44,6 +44,11 @@ class Startshixuntask extends Component{ startbtn:false }) }else{ + setTimeout(() => { + this.setState({ + startbtn: false, + }) + }, 1000) if(response.data.status!=401&&response.data.status!=403){ const w=window.open('about:blank'); @@ -156,13 +161,31 @@ class Startshixuntask extends Component{ {/*
知道了*/} {/*

*/} - + + {/* 如果是继续实战和查看实战,实训作业这边,后台会直接返回identity,直接写成a标签 */} {this.props.isStudent? - {this.props.data&&this.props.data.task_operation&&this.props.data.task_operation?startbtn===false?this.taskoperationId( this.props.data&&this.props.data.task_operation[1])}> - {this.props.data&&this.props.data.task_operation[0]} - :"开启中":""} - :"" + {this.props.data&&this.props.data.task_operation&&this.props.data.task_operation?startbtn===false + ? + ((this.props.data && this.props.data.task_operation[1] && this.props.data.task_operation[1].indexOf('/') == -1) ? + + {this.props.data.task_operation[0]} + + : + this.taskoperationId( this.props.data&&this.props.data.task_operation[1])}> + {this.props.data&&this.props.data.task_operation[0]} + ) + :"开启中":""} + + :"" } diff --git a/public/react/src/modules/courses/shixunHomework/CommitSummary.js b/public/react/src/modules/courses/shixunHomework/CommitSummary.js index 728d86f96..69c88eb38 100644 --- a/public/react/src/modules/courses/shixunHomework/CommitSummary.js +++ b/public/react/src/modules/courses/shixunHomework/CommitSummary.js @@ -130,10 +130,11 @@ class CommitSummary extends Component{ height:'20px' }} >
-

+

this.gotohome()}>{data === undefined ? "" :data.course_name===undefined?"": data.course_name} > - {data === undefined ? "" :data.category===undefined?"":data.category.category_name} > 作业详情 @@ -142,7 +143,7 @@ class CommitSummary extends Component{

-

修改总结

+

{this.state.description ? '修改总结' : '提交总结'}

this.gotohome()} className="color-grey-6 fr font-16 ml30 mt10">返回
{/*educontentbox*/} diff --git a/public/react/src/modules/forums/MemoDetail.js b/public/react/src/modules/forums/MemoDetail.js index 8441a8ac9..e08f321a4 100644 --- a/public/react/src/modules/forums/MemoDetail.js +++ b/public/react/src/modules/forums/MemoDetail.js @@ -189,11 +189,17 @@ class MemoDetail extends Component { let filesize = item.filesize attachments.push( -

- - {fileName}{filesize? ` ${filesize}` : ''} +

+ + -

+ 30 ? fileName : ''} + className="mr12 color9B9B overflowHidden1" length="58" style={{maxWidth: '480px'}}> + {fileName} + + {filesize} + +
) }) return attachments; @@ -693,7 +699,7 @@ class MemoDetail extends Component {
{/* overflowHidden1 */} - {memo.subject + memo.subject} + {memo.subject} { memo.sticky && 置顶} @@ -768,6 +774,7 @@ class MemoDetail extends Component {
{ !memo.is_md ?
: +