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 {
+
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">返回
-
- {fileName}{filesize? ` ${filesize}` : ''}
+
diff --git a/public/react/src/modules/forums/RightMyPublish.js b/public/react/src/modules/forums/RightMyPublish.js
index 94a09f7d9..fc101ae30 100644
--- a/public/react/src/modules/forums/RightMyPublish.js
+++ b/public/react/src/modules/forums/RightMyPublish.js
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames'
-import { getImageUrl, toPath } from 'educoder'
+import { getImageUrl, toPath, LinkAfterLogin } from 'educoder'
import match_adImg from '../../images/ad/match_ad.jpg'
const $ = window.$
@@ -58,7 +58,7 @@ class RightMyPublish extends Component {
我的发布
教学案例
-
diff --git a/public/react/src/modules/forums/RecommendShixun.js b/public/react/src/modules/forums/RecommendShixun.js
index af0ca0007..535b027cc 100644
--- a/public/react/src/modules/forums/RecommendShixun.js
+++ b/public/react/src/modules/forums/RecommendShixun.js
@@ -32,7 +32,7 @@ class RecommendShixun extends Component {
{my_memos_count}
diff --git a/public/react/src/modules/forums/shixun/ShiXunPostItem.js b/public/react/src/modules/forums/shixun/ShiXunPostItem.js
index 961e16ff1..765591c6c 100644
--- a/public/react/src/modules/forums/shixun/ShiXunPostItem.js
+++ b/public/react/src/modules/forums/shixun/ShiXunPostItem.js
@@ -44,7 +44,9 @@ class ShiXunPostItem extends Component
{memo.subject}
diff --git a/public/react/src/modules/page/tpiPage.css b/public/react/src/modules/page/tpiPage.css
index 55e75059d..fe71de64f 100644
--- a/public/react/src/modules/page/tpiPage.css
+++ b/public/react/src/modules/page/tpiPage.css
@@ -13,9 +13,11 @@
margin-top: -20px;
margin-left: -17px;
left: 50%;
- top: 50%;
+ top: 50%;
+ /* .editormd-preview 有个 z-index 99 某些情况下,被cm盖住了 */
z-index: 50;
}
+
.b-label>.resize-helper button{
width: 24px;
height: 24px;
@@ -64,6 +66,7 @@
,#game_show_content #tab_con_5 .editormd-preview {
width: 100% !important;
height: 100% !important;
+ z-index: 20;
}
/* tab 样式覆盖 */
diff --git a/public/react/src/modules/paths/PathNew.js b/public/react/src/modules/paths/PathNew.js
index 3acad7eed..04e391732 100644
--- a/public/react/src/modules/paths/PathNew.js
+++ b/public/react/src/modules/paths/PathNew.js
@@ -71,7 +71,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callb
}
});
// 一个页面有多个md时,onload方法只执行了一次
- window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`);
+ // window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`);
return editorName;
}
diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js
index bbb2eb97d..0361b090f 100644
--- a/public/react/src/modules/tpm/TPMIndexHOC.js
+++ b/public/react/src/modules/tpm/TPMIndexHOC.js
@@ -9,6 +9,7 @@ import { getUrl } from 'educoder'
import axios from 'axios';
import './TPMIndex.css'
+import LoginDialog from '../login/LoginDialog';
import Trialapplication from "../login/Trialapplication";
// import "antd/dist/antd.css";
// import '../../css/educoder/edu-common.css'
@@ -74,6 +75,8 @@ export function TPMIndexHOC(WrappedComponent) {
Headertop:undefined,
Footerdown:undefined,
coursedata: {},
+
+ isRender: false
}
}
@@ -286,9 +289,22 @@ export function TPMIndexHOC(WrappedComponent) {
}).catch((error) => {
console.log(error)
})
+ }
+ hideLoginDialog = () => {
+ this.setState({
+ isRender: false
+ })
+ }
+ showLoginDialog = () => {
+ this.setState({
+ isRender: true
+ })
+ }
+ checkIfLogin = () => {
+ return this.state.current_user && this.state.current_user.login != ''
}
render() {
- let{Headertop,Footerdown}=this.state;
+ let{Headertop,Footerdown, isRender}=this.state;
const common = {
isSuperAdmin:this.isSuperAdmin,
isAdminOrCreator:this.isAdminOrCreator,
@@ -299,11 +315,18 @@ export function TPMIndexHOC(WrappedComponent) {
isAdminOrStudent: this.isAdminOrStudent,
isNotMember: this.isNotMember,
isUserid:this.state.coursedata&&this.state.coursedata.userid,
- fetchUser: this.fetchUser
+ fetchUser: this.fetchUser,
+
+ showLoginDialog: this.showLoginDialog,
+ checkIfLogin: this.checkIfLogin,
}
return (