diff --git a/db/migrate/20200106092135_modify_viewed_count_for_subjects.rb b/db/migrate/20200106092135_modify_viewed_count_for_subjects.rb
new file mode 100644
index 000000000..ecef2df69
--- /dev/null
+++ b/db/migrate/20200106092135_modify_viewed_count_for_subjects.rb
@@ -0,0 +1,10 @@
+class ModifyViewedCountForSubjects < ActiveRecord::Migration[5.2]
+ def change
+
+ subjects = Subject.where(status: 2).includes(:shixuns)
+ subjects.find_each do |subject|
+ subject.update_attribute(:visits, subject.visits + subject.shixuns.pluck(:myshixuns_count).sum)
+ end
+
+ end
+end
diff --git a/lib/tasks/zip_pack.rake b/lib/tasks/zip_pack.rake
index 6e3140f47..c1a080e36 100644
--- a/lib/tasks/zip_pack.rake
+++ b/lib/tasks/zip_pack.rake
@@ -1,7 +1,7 @@
# 执行示例 bundle exec rake zip_pack:shixun_pack args=123,2323
namespace :zip_pack do
desc "手工打包作品"
- OUTPUT_FOLDER = "/tmp"
+ OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip"
task :shixun_pack => :environment do
@@ -27,7 +27,7 @@ namespace :zip_pack do
pdfs << pdf
begin
zip.add(export.filename, pdf.path)
- puts "out: #{export.filename}"
+ puts "out: #{export.filename}_#{pdf.path}"
rescue => ex
Rails.logger.error(ex.message)
diff --git a/public/react/src/common/quillForEditor/README.md b/public/react/src/common/quillForEditor/README.md
index bbec5eb50..0369164c7 100644
--- a/public/react/src/common/quillForEditor/README.md
+++ b/public/react/src/common/quillForEditor/README.md
@@ -4,7 +4,7 @@
* @Github:
* @Date: 2020-01-06 16:20:03
* @LastEditors : tangjiang
- * @LastEditTime : 2020-01-06 16:46:44
+ * @LastEditTime : 2020-01-06 17:13:19
-->
## QuillForEditor 使用 [https://quilljs.com/]
@@ -17,14 +17,14 @@
| 字段 | 描述 |
| ----- | ----- |
| placeholder | 提示信息 |
- | readOnly | 只读(只读取模式时,没有 工具栏且内容不可编辑,通过用于展示quill内容) |
+ | readOnly | 只读(只读取模式时,没有 工具栏且内容不可编辑,通常用于展示quill内容) |
| autoFocus | 自动获得焦点 |
| options | 配置参数, 指定工具栏内容 |
| value | 文本编辑器内容 |
| imgAttrs | 指定上传图片的尺寸 |
| style | 指定quill容器样式 |
| wrapStyle | 指定包裹quill容器的样式|
- | onContentChange | 当编辑器内容变化时调用此回调函数 |
+ | onContentChange | 当编辑器内容变化时调用此回调函数(注: 此时返回的内容为对象,提交到后台时需要格式成 JSON 字符串: JSON.stringify(xx)) |
| showUploadImage | 点击放大上传成功后的图片, 返回上传成功后的图片 url, (评论时点击图片这么大)|
@@ -63,7 +63,32 @@
````
import QuillForEditor from 'xxx';
-
+ // 指定需要显示的工具栏信息, 不指定加载全部
+ const options = [
+
+ ];
+
+ /**
+ * @description 获取编辑器返回的内容
+ * @params [Object] value 编辑器内容
+ */
+ const handleCtxChange = (value) => {
+ // 编辑器内容非空判断
+ const _text = quill.getText();
+ const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
+ if (!reg.test(_text)) {
+ // 处理编辑器内容为空
+ } else {
+ // 提交到后台的内容需要处理一下;
+ value = JSON.stringify(value)
+ }
+ }
+
+
+
````
diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js
index 3727b88a2..65fa4e9da 100644
--- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js
+++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js
@@ -734,21 +734,20 @@ background:rgba(204,204,204,0.2) !important;
}
`}
- { excellent===true&&this.props.isAdminOrStudent()===false?"":
-
-
- trigger.parentNode} visible={coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false}
+
+
+ trigger.parentNode} visible={excellent === true && this.props.isAdminOrStudent() === false ?false:coursedata.teacher_applies_count===undefined?false:coursedata.teacher_applies_count>0?true:false}
placement="topLeft"
title={
{coursedata.teacher_applies_count===undefined?"":coursedata.teacher_applies_count>0?
您有{coursedata.teacher_applies_count}条新的加入申请
- this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>
+ this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers?tab=2")}>
待审批
:""}
}>
- this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
+ this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
教师
{coursedata.teacher_count}
@@ -756,8 +755,8 @@ background:rgba(204,204,204,0.2) !important;
this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}
+ className={excellent === true && this.props.isAdminOrStudent() === false ?"":excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?"pointer":"":"pointer"}
+ onClick={excellent === true && this.props.isAdminOrStudent() === false ?"":excellent===true&&coursedata.course_end === true?this.props.isAdminOrTeacher()===true?()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students"):"":()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}
>
学生 {coursedata.student_count}
@@ -766,7 +765,7 @@ background:rgba(204,204,204,0.2) !important;
学分 {coursedata.credit}
}
- }
+
{/**/}
{/**/}
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index 2ce9c0e53..5fd2abdee 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -157,9 +157,9 @@ class Trainingjobsetting extends Component {
this.props.triggerRef(this);
- if (this.props.isAdmin() === false) {
- this.cancelEdit()
- }
+ // if (this.props.isAdmin() === false) {
+ // this.cancelEdit()
+ // }
}
// componentWillReceiveProps(nextProps) {
@@ -383,6 +383,10 @@ class Trainingjobsetting extends Component {
}
let max = latedeductiontwos + len;
let maxs = max.toFixed(1);
+
+ // console.log(1)
+ // console.log(maxs)
+
this.setState({
CalculateMax: maxs,
})
@@ -1212,7 +1216,8 @@ class Trainingjobsetting extends Component {
}
//总比分
Totalscorecalculation = (value) => {
- debugger
+ // console.log(2)
+ // console.log(value)
this.setState({
CalculateMax: value,
})
@@ -2168,6 +2173,9 @@ class Trainingjobsetting extends Component {
})
this.refs.targetElementTrainingjobsetting.scrollIntoView();
this.getTrainingjobsetting(false);
+
+ // console.log(3)
+ // console.log(this.state.total_scoretwo)
this.setState({
CalculateMax:this.state.total_scoretwo,
})
@@ -2311,7 +2319,7 @@ class Trainingjobsetting extends Component {
// console.log(this.props.isAdmin())
// console.log(this.state.code_review===false)
// console.log("引入的分值");
- // console.log(this.state.work_efficiencys);
+ // console.log(this.state.CalculateMax);
return (
diff --git a/public/react/src/modules/forums/MemoDetailKEEditor.js b/public/react/src/modules/forums/MemoDetailKEEditor.js
index 9061d557c..64806c19e 100644
--- a/public/react/src/modules/forums/MemoDetailKEEditor.js
+++ b/public/react/src/modules/forums/MemoDetailKEEditor.js
@@ -25,16 +25,16 @@ class MemoDetailKEEditor extends Component {
showEditor() {
- $("html, body").animate({ scrollTop: $('#commentInput').offset().top - 100 }, 1000, () => {
- if (this.keEditor) {
- const FF = !(window.mozInnerScreenX == null);
- if (FF) {
- this.keEditor.focus()
- } else {
- this.keEditor.edit.win.document.body.focus()
- }
- }
- });
+ // $("html, body").animate({ scrollTop: $('#commentInput').offset().top - 100 }, 1000, () => {
+ // if (this.keEditor) {
+ // const FF = !(window.mozInnerScreenX == null);
+ // if (FF) {
+ // this.keEditor.focus()
+ // } else {
+ // this.keEditor.edit.win.document.body.focus()
+ // }
+ // }
+ // });
}
render() {
diff --git a/public/react/src/modules/forums/MemoDetailMDEditor.js b/public/react/src/modules/forums/MemoDetailMDEditor.js
index 57a48fe91..fb89f5bca 100644
--- a/public/react/src/modules/forums/MemoDetailMDEditor.js
+++ b/public/react/src/modules/forums/MemoDetailMDEditor.js
@@ -108,13 +108,13 @@ class MemoDetailMDEditor extends Component {
}
showEditor() {
- $("html, body").animate({ scrollTop: $('.commentInput:visible').offset().top - 100 }, 1000, () => {
- if (this.commentMDEditor) {
- this.commentMDEditor.cm.focus()
- } else {
- this.onMockInputClick()
- }
- });
+ // $("html, body").animate({ scrollTop: $('.commentInput:visible').offset().top - 100 }, 1000, () => {
+ // if (this.commentMDEditor) {
+ // this.commentMDEditor.cm.focus()
+ // } else {
+ // this.onMockInputClick()
+ // }
+ // });
}
close = () => {
this.setState({isInited: false})
diff --git a/public/react/src/modules/forums/MemoDetailMDEditortwo.js b/public/react/src/modules/forums/MemoDetailMDEditortwo.js
index eafc1451f..257294452 100644
--- a/public/react/src/modules/forums/MemoDetailMDEditortwo.js
+++ b/public/react/src/modules/forums/MemoDetailMDEditortwo.js
@@ -96,13 +96,13 @@ class MemoDetailMDEditortwo extends Component {
}
showEditor() {
- $("html, body").animate({ scrollTop: $('#commentInput').offset().top - 100 }, 1000, () => {
- if (this.commentMDEditor) {
- this.commentMDEditor.cm.focus()
- } else {
- $('#commentInput input')[0].click()
- }
- });
+ // $("html, body").animate({ scrollTop: $('#commentInput').offset().top - 100 }, 1000, () => {
+ // if (this.commentMDEditor) {
+ // this.commentMDEditor.cm.focus()
+ // } else {
+ // $('#commentInput input')[0].click()
+ // }
+ // });
}
onMockInputClick = () => {
this.setState({isInited: true})
diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js
index 8c07b0bee..6883aa72f 100644
--- a/public/react/src/modules/tpm/jupyter/index.js
+++ b/public/react/src/modules/tpm/jupyter/index.js
@@ -367,7 +367,7 @@ function JupyterTPI (props) {
- {/*{endjupytertime===false?"":}*/}
+ {endjupytertime===false?"":}
diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
index d53a88327..3f2aa68a9 100644
--- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
+++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
@@ -107,7 +107,7 @@ class Challengesjupyter extends Component {
}
- gettimeinfo_with_tpm=(datas)=>{
+ gettimeinfo_with_tpm=(datas,type)=>{
let timeinfo_with_tpm=`/jupyters/timeinfo_with_tpm.json`
axios.get(timeinfo_with_tpm, {params: datas}).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
@@ -128,6 +128,9 @@ class Challengesjupyter extends Component {
endtimes:endsms===0?Date.now()+1000:Date.now() +endsms
})
},500);
+ if(type===true){
+ this.props.showNotification('延长成功!');
+ }
}
}else{
@@ -461,19 +464,21 @@ class Challengesjupyter extends Component {
onendhandleClickResetTpi=(id)=>{
-
+ let datas={
+ identifier:id,
+ }
const url = `/jupyters/active_with_tpm.json`;
axios.get(url,{params:{
identifier:id
}}).then((response) => {
if(response.data.status===0){
- this.props.showNotification('延长成功!');
- setTimeout(()=>{
- this.setState({
- jupytertime:Date.now() + 900 * 1000,
- endtimes:Date.now() + 300 * 1000
- })
- },500);
+ this.gettimeinfo_with_tpm(datas,true)
+ // setTimeout(()=>{
+ // this.setState({
+ // jupytertime:Date.now() + 900 * 1000,
+ // endtimes:Date.now() + 300 * 1000
+ // })
+ // },500);
}
});
}
@@ -550,7 +555,7 @@ class Challengesjupyter extends Component {
{/*this.state.jupytertime*/}
- {/*{endtimes===false?"":}*/}
+ {endtimes===false?"":}
diff --git a/public/react/src/redux/actions/jupyter.js b/public/react/src/redux/actions/jupyter.js
index 1a3654c3f..c4a723b3c 100644
--- a/public/react/src/redux/actions/jupyter.js
+++ b/public/react/src/redux/actions/jupyter.js
@@ -160,7 +160,8 @@ export const active_with_tpi = (identifier, msg) => {
if (status === 0) {
message.success(msg);
// dispatch(addjypertime(Date.now() + 900 * 1000,false))
- setTimeout(()=>{dispatch(addjypertime(Date.now() + 900 * 1000, Date.now() + 300 * 1000))},800);
+ // setTimeout(()=>{dispatch(addjypertime(Date.now() + 900 * 1000, Date.now() + 300 * 1000))},800);
+ timeinfo_with_tpi(identifier,dispatch)
}
}
})