From 64ccbd24e692568a6b5862e2b3f8855188431c5a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 6 Jan 2020 16:19:30 +0800 Subject: [PATCH 01/24] =?UTF-8?q?tpi=20active=E4=BC=A0=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/jupyters_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb index ecb411b36..81df43759 100644 --- a/app/controllers/jupyters_controller.rb +++ b/app/controllers/jupyters_controller.rb @@ -76,7 +76,7 @@ class JupytersController < ApplicationController def active_with_tpi myshixun = Myshixun.find_by(identifier: params[:identifier]) - jupyter_active_tpm(myshixun) + jupyter_active_tpi(myshixun) render json: {status: 0} end From 5f1c9ee1ad8ac72ab8b5105d36ab111f11737f9c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 6 Jan 2020 16:35:10 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E8=AE=A1=E5=88=92=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/print_date.rake | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/tasks/print_date.rake diff --git a/lib/tasks/print_date.rake b/lib/tasks/print_date.rake new file mode 100644 index 000000000..501cd3750 --- /dev/null +++ b/lib/tasks/print_date.rake @@ -0,0 +1,7 @@ +namespace :print_date do + desc "print date" + + task :print => :environment do + Rails.logger.info("#{Time.now}") + end +end \ No newline at end of file From b5f1caad7cecb4ac1834c979a9c1f8ad412a694c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 6 Jan 2020 16:36:57 +0800 Subject: [PATCH 03/24] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/jupyter/index.js | 2 +- .../src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/jupyter/index.js b/public/react/src/modules/tpm/jupyter/index.js index 6883aa72f..8c07b0bee 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 c1a5f8dea..d53a88327 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -550,7 +550,7 @@ class Challengesjupyter extends Component { {/*this.state.jupytertime*/} - {endtimes===false?"":} + {/*{endtimes===false?"":}*/}

From b30885da7edbdfc2c1b9fc26845eb24fd1559f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 6 Jan 2020 16:52:33 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMBanner.js | 13 +++++++++ public/react/src/modules/tpm/TPMIndex.js | 32 +++++++++++------------ 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index f79301be0..6c57bcff8 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -135,6 +135,13 @@ class TPMBanner extends Component { this.setState({ openknow:true }) + setTimeout(()=>{ + this.openknow() + this.setState({ + openknow:false + }) + }, 10000); + }else{ this.setState({ openknow:false @@ -158,6 +165,12 @@ class TPMBanner extends Component { this.setState({ openshowpublictype: true }) + setTimeout(()=>{ + this.openshowpublic() + this.setState({ + openshowpublictype:false + }) + }, 10000); } else { this.setState({ openshowpublictype: false diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 86d0e9637..5edea264f 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -163,7 +163,7 @@ class TPMIndex extends Component { openknows:false }) let newTPMsettings=this.props.user&&this.props.user.user_id+'newTPMsettings' - storage.setItem(newTPMsettings,true); + storage.setItem(newTPMsettings,false); } @@ -174,7 +174,7 @@ class TPMIndex extends Component { let newTPMsettings=window.localStorage.getItem(getnewTPMsettings) if(newTPMsettings===undefined||newTPMsettings===false||newTPMsettings===null){ this.setState({ - openknows:true + openknows:false }) }else{ this.setState({ @@ -453,20 +453,20 @@ class TPMIndex extends Component { { this.state.is_jupyter===false? 排行榜 :""} - {this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true? - -

更多设置在这里,点击“配置”看一看~
-
- - } - trigger="click" - placement="top" - visible={this.state.openknows} - > - - :""} + {/*{this.state.identity >4||this.state.identity===undefined ? "":this.state.openknows===true?*/} + {/* */} + {/*
更多设置在这里,点击“配置”看一看~
*/} + {/*
*/} + {/* */} + {/* }*/} + {/* trigger="click"*/} + {/* placement="top"*/} + {/* visible={this.state.openknows}*/} + {/* >*/} + {/* */} + {/*
:""}*/} {this.state.identity >4||this.state.identity===undefined ? "": From 9136c9f53500e1ec9255f8929ad042ad969e0a51 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 6 Jan 2020 16:53:12 +0800 Subject: [PATCH 05/24] update quill --- .../src/common/quillForEditor/FillBlot.js | 38 ++++++++++ .../react/src/common/quillForEditor/index.js | 57 +++++++++++++-- .../src/common/quillForEditor/index.scss | 17 +++++ .../modules/developer/newOrEditTask/index.js | 2 +- .../leftpane/editorTab/README.md | 69 +++++++++++++++++++ .../newOrEditTask/leftpane/editorTab/index.js | 4 +- .../modules/developer/split_pane_resizer.scss | 39 +++++++++++ .../modules/developer/studentStudy/index.js | 4 +- 8 files changed, 221 insertions(+), 9 deletions(-) create mode 100644 public/react/src/common/quillForEditor/FillBlot.js create mode 100644 public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/README.md diff --git a/public/react/src/common/quillForEditor/FillBlot.js b/public/react/src/common/quillForEditor/FillBlot.js new file mode 100644 index 000000000..d36f2d4b1 --- /dev/null +++ b/public/react/src/common/quillForEditor/FillBlot.js @@ -0,0 +1,38 @@ +/* + * @Description: 填空 + * @Author: tangjiang + * @Github: + * @Date: 2020-01-06 09:02:29 + * @LastEditors : tangjiang + * @LastEditTime : 2020-01-06 16:04:46 + */ +import Quill from 'quill'; + +let Inline = Quill.import('blots/inline'); + +class FillBlot extends Inline { + static create (value) { + const node = super.cerate(); + node.classList.add('icon icon-bianji2'); + node.setAttribute('data-fill', 'fill'); + node.addEventListener('DOMNodeRemoved', function () { + alert(123); + }, false); + return node; + } + + static value (node) { + return { + dataSet: node.getAttribute('data-fill'), + onDOMNodeRemoved: () => { + alert('123456'); + } + } + } +} + + +FillBlot.blotName = "fill"; +FillBlot.tagName = "span"; + +export default FillBlot; diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js index f3f359a80..326ca21ae 100644 --- a/public/react/src/common/quillForEditor/index.js +++ b/public/react/src/common/quillForEditor/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-18 08:49:30 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-31 15:11:37 + * @LastEditTime : 2020-01-06 16:45:50 */ import './index.scss'; import 'quill/dist/quill.core.css'; // 核心样式 @@ -18,8 +18,11 @@ import deepEqual from './deepEqual.js' import { fetchUploadImage } from '../../services/ojService.js'; import { getImageUrl } from 'educoder' import ImageBlot from './ImageBlot'; +// import Toolbar from 'quill/modules/toolbar'; +import FillBlot from './FillBlot'; const Size = Quill.import('attributors/style/size'); const Font = Quill.import('formats/font'); + // const Color = Quill.import('attributes/style/color'); Size.whitelist = ['12px', '14px', '16px', '18px', '20px', false]; Font.whitelist = ['SimSun', 'SimHei','Microsoft-YaHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif']; @@ -29,6 +32,8 @@ window.katex = katex; Quill.register(ImageBlot); Quill.register(Size); Quill.register(Font, true); +// Quill.register({'modules/toolbar': Toolbar}); +Quill.register(FillBlot); // Quill.register(Color); function QuillForEditor ({ @@ -42,6 +47,7 @@ function QuillForEditor ({ wrapStyle = {}, showUploadImage, onContentChange, + // addFill, // 点击填空成功的回调 // getQuillContent }) { // toolbar 默认值 @@ -62,6 +68,8 @@ function QuillForEditor ({ // quill 实例 const [quill, setQuill] = useState(null); const [selection, setSelection] = useState(null); + const [fillCount, setFillCount] = useState(0); + const [quillCtx, setQuillCtx] = useState({}); // 文本内容变化时 const handleOnChange = content => { @@ -70,18 +78,23 @@ function QuillForEditor ({ }; const renderOptions = options || defaultConfig; + // quill 配置信息 const quillOption = { modules: { toolbar: renderOptions + // toolbar: { + // container: renderOptions + // } }, readOnly, placeholder, - theme: readOnly ? 'bubble' : 'snow' + theme: readOnly ? 'bubble' : 'snow', }; useEffect(() => { + const quillNode = document.createElement('div'); editorRef.current.appendChild(quillNode); const _quill = new Quill(editorRef.current, quillOption); @@ -121,13 +134,20 @@ function QuillForEditor ({ } } }); + + _quill.getModule('toolbar').addHandler('fill', (e) => { + setFillCount(fillCount + 1); + const range = _quill.getSelection(true); + _quill.insertText(range.index, '▁'); + // 点击填空图标时,插入一个下划线 + // 1. 获取编辑器内容 + }); }, []); // 设置值 useEffect(() => { if (!quill) return - // debugger; const previous = quill.getContents() if (value && value.hasOwnProperty('ops')) { @@ -173,7 +193,36 @@ function QuillForEditor ({ let handler; quill.on( 'text-change', - (handler = () => { + (handler = (delta, oldDelta, source) => { + // let del = false; + // let delLen = 1; + // delta.ops.forEach(o => { + // // 存在删除并且只删除一个 + // if (o.delete) { + // del = true; + // } + // }); + // 删除编辑器内容 + // if (del) { + // delLen = delta.ops[0].retain || 1; // 删除数组的长度 + // // 获取删除的内容并判断其它是否有填空内容 + // console.log('原编辑器内容', oldDelta); + // console.log('编辑器内容', quillCtx); + // } + // 获取删除的内容 + // oldDelta + // if (del) { + // const ops = oldDelta.ops; + // const len = ops.length; + // // if (ops[len - 1] && ops[len - 1].insert) { + // // const str = ops[len - 1].insert; + // // const _len = str.length; + // // const _last = str.substr(_len - 1); + // // console.log('删除的一项', _last); + // // } + // } + const _ctx = quill.getContents(); + setQuillCtx(_ctx); handleOnChange(quill.getContents()); // getContents: 检索编辑器内容 }) ); diff --git a/public/react/src/common/quillForEditor/index.scss b/public/react/src/common/quillForEditor/index.scss index 96cd45edd..eca8c4485 100644 --- a/public/react/src/common/quillForEditor/index.scss +++ b/public/react/src/common/quillForEditor/index.scss @@ -110,4 +110,21 @@ content: "微软雅黑"; font-family: "Microsoft YaHei"; } + + // 填空图标 + .ql-snow .ql-fill{ + display: inline-block; + position: relative; + color: #05101A; + // font-size: 18px; + vertical-align: top; + &::before{ + position: absolute; + left: 50%; + top: -1px; + content: '\e709'; + font-family: 'iconfont'; + margin-left: -7px; + } + } } \ No newline at end of file diff --git a/public/react/src/modules/developer/newOrEditTask/index.js b/public/react/src/modules/developer/newOrEditTask/index.js index eb894d1d0..382b91878 100644 --- a/public/react/src/modules/developer/newOrEditTask/index.js +++ b/public/react/src/modules/developer/newOrEditTask/index.js @@ -214,7 +214,7 @@ const NewOrEditTask = (props) => { { renderQuit() }
- +
diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/README.md b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/README.md new file mode 100644 index 000000000..bbec5eb50 --- /dev/null +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/README.md @@ -0,0 +1,69 @@ + +## QuillForEditor 使用 [https://quilljs.com/] + + ### 导入 + + - 目录 src/common/quillForEditor (默认加载当前文件夹下的 index.js 文件) + + ### 参数 + + | 字段 | 描述 | + | ----- | ----- | + | placeholder | 提示信息 | + | readOnly | 只读(只读取模式时,没有 工具栏且内容不可编辑,通过用于展示quill内容) | + | autoFocus | 自动获得焦点 | + | options | 配置参数, 指定工具栏内容 | + | value | 文本编辑器内容 | + | imgAttrs | 指定上传图片的尺寸 | + | style | 指定quill容器样式 | + | wrapStyle | 指定包裹quill容器的样式| + | onContentChange | 当编辑器内容变化时调用此回调函数 | + | showUploadImage | 点击放大上传成功后的图片, 返回上传成功后的图片 url, (评论时点击图片这么大)| + + + + ### 添加工具栏 + + - 默认所有的 + + ``` + const options = [ + 'bold', // 加粗 + 'italic', // 斜体 + 'underline', // 下划线 + {size: ['12px', '14px', '16px', '18px', '20px']}, // 字体大小 + {align: []}, // 对齐方式 + {list: 'ordered'}, // 有序列表 + {list: 'bullet'}, // 无序列表 + {script: 'sub'}, // 下标 x2 + {script: 'super'}, // 上标 平方 (x2) + { 'color': [] }, // 字体颜色 + { 'background': [] }, // 背景色 + {header: [1,2,3,4,5,false]}, // H1,H2 ... + 'blockquote', // 文件左边加一个边框样式 + 'code-block', // 块内容 + 'link', // 链接 + 'image', // 图片 + 'video', // 视频 + 'formula', // 数学公式 + 'clean' // 清除 + ] + ``` + + + ### 使用 + + ```` + import QuillForEditor from 'xxx'; + + + + ```` + diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js index 85c391b2d..f8b92361b 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-20 10:35:40 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-03 19:02:17 + * @LastEditTime : 2020-01-06 16:17:22 */ import './index.scss'; // import 'katex/dist/katex.css'; @@ -277,7 +277,7 @@ class EditTab extends React.Component { const quillConfig = [ { header: 1}, {header: 2}, // {size: ['12px', '14px', '16px', '18px', '20px', false]}, - 'bold', 'italic', 'underline', 'strike', // 切换按钮 + 'bold', 'italic', 'underline', 'strike', // 切换按钮 'blockquote', 'code-block', // 代码块 {align: []}, { 'list': 'ordered' }, { 'list': 'bullet' }, // 列表 { 'script': 'sub'}, { 'script': 'super' }, diff --git a/public/react/src/modules/developer/split_pane_resizer.scss b/public/react/src/modules/developer/split_pane_resizer.scss index 8d4ad171c..2c1101433 100644 --- a/public/react/src/modules/developer/split_pane_resizer.scss +++ b/public/react/src/modules/developer/split_pane_resizer.scss @@ -217,3 +217,42 @@ .Resizer.disabled:hover { border-color: transparent; } + +.outer-split-pane{ + & > .Resizer{ + position: relative; + &::before, + &::after{ + position: absolute; + right: -12px; + top: 50%; + transition: opacity, background .3s; + } + &::before{ + content: ''; + border-radius: 50%; + background: rgba(235,235,235,.3); + width: 24px; + height: 24px; + // font-size: 12px; + } + &::after{ + content: '\e712'; + font-family: 'iconfont'; + transform: scale(.7); + color: #666; + margin-top: -2px; + right: -14px; + opacity: .3; + } + + &:hover{ + &::before{ + background: rgba(235,235,235, 1); + } + &::after{ + opacity: 1; + } + } + } +} diff --git a/public/react/src/modules/developer/studentStudy/index.js b/public/react/src/modules/developer/studentStudy/index.js index 2ef8c4ba9..0c8c7012f 100644 --- a/public/react/src/modules/developer/studentStudy/index.js +++ b/public/react/src/modules/developer/studentStudy/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-11-23 10:53:19 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-27 16:22:47 + * @LastEditTime : 2020-01-06 15:27:34 */ import './index.scss'; import React, { useEffect, useState } from 'react'; @@ -144,7 +144,7 @@ function StudentStudy (props) {
- +
From b594e4b509aa50406744c489af90113b314a2962 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 6 Jan 2020 16:55:52 +0800 Subject: [PATCH 06/24] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixun_work/shixun_work.html.erb | 607 +++++++++--------- lib/tasks/zip_pack.rake | 4 +- 2 files changed, 309 insertions(+), 302 deletions(-) diff --git a/app/templates/shixun_work/shixun_work.html.erb b/app/templates/shixun_work/shixun_work.html.erb index bbc81f373..76a269f3f 100644 --- a/app/templates/shixun_work/shixun_work.html.erb +++ b/app/templates/shixun_work/shixun_work.html.erb @@ -101,85 +101,86 @@
-
-

- 图形统计 -

-
- -
- -
-
-
-
-
+ <% if @work.myshixun.present? %> +
+

+ 图形统计 +

+
-
-
-
-
  • 姓名
  • -
  • 学号
  • -
  • 工作效率
  • +
    + +
    -
    -
  • <%= @user.real_name %>
  • -
  • <%= @user.student_id %>
  • -
  • <%= @myself_eff[1] %>
  • +
    -
    - -
    -
    + +
    +
  • 姓名
  • 学号
  • -
  • 能力
  • +
  • 工作效率
  • -
  • <%= @user.real_name %>
  • +
  • <%= @user.real_name %>
  • <%= @user.student_id %>
  • -
  • <%= @myself_consume[1] %>
  • +
  • <%= @myself_eff[1] %>
  • - +
    -
    -
    -

    - 实训详情 -

    - <%#= ApplicationController.helpers.javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %> - <% @games.each_with_index do |game, index| %> -
    -

    +

    +

    + 实训详情 +

    + <%#= ApplicationController.helpers.javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %> + <% @games.each_with_index do |game, index| %> +
    +

    <% if game.challenge.st == 1 %> @@ -187,43 +188,44 @@ <% end %> - 第<%= index+1 %>关<%= game.challenge.subject %> -

    -
    - <% if game.outputs.present? %> - - - - - - - <% outputs = game.outputs.group("query_index") %> - <% max_query = outputs.map(&:query_index).max %> - <% outputs.reverse.try(:each) do |output| %> - - - - - <% end %> - -
    评测次数评测信息
    <%= max_query == output.query_index ? "最后一次" : "第#{output.query_index}次" %><%= output_detail(game, output) %>
    - <% end %> - <% if game.try(:lastest_code).present? && game.challenge.st == 0 %> -
    -

    - 最近通过的代码 -

    -
    -
  • - -
  • + 第<%= index+1 %>关<%= game.challenge.subject %> +

    +
    + <% if game.outputs.present? %> + + + + + + + <% outputs = game.outputs.group("query_index") %> + <% max_query = outputs.map(&:query_index).max %> + <% outputs.reverse.try(:each) do |output| %> + + + + + <% end %> + +
    评测次数评测信息
    <%= max_query == output.query_index ? "最后一次" : "第#{output.query_index}次" %><%= output_detail(game, output) %>
    + <% end %> + <% if game.try(:lastest_code).present? && game.challenge.st == 0 %> +
    +

    + 最近通过的代码 +

    +
    +
  • + +
  • +
    -
    - <% end %> + <% end %> +
    -
    - <% end %> -
    + <% end %> +
    + <% end %>
    @@ -261,215 +263,220 @@ // 基于准备好的dom,初始化echarts实例 - var effChart = echarts.init(document.getElementById('shixun_skill_chart')); - // 指定图表的配置项和数据 - var option = { - grid: { - left: '3%', - right: '9%', - bottom: '3%', - containLabel: true - }, - tooltip : {}, - xAxis : [ - { - type : 'value', - name: '学生序号', - scale:true, - axisLabel : { - formatter: ' ' - }, - axisTick:{ - show:false - }, - splitLine: { - show: false - } - } - ], - yAxis : [ - { - type : 'value', - name : '工作效率', - scale:true, - axisLabel : { - formatter: '{value} ' - }, - splitLine: { - show: false - } - } - ], - series : [ - { - name:'', - type:'scatter', - data: <%= @echart_data[:efficiency_list] %>, - itemStyle:{ - normal:{color:'#2e65ad'} - }, - markArea: { - silent: true, - itemStyle: { - normal: { - color: 'transparent', - borderWidth: 1, - borderType: 'dashed' - } - } - }, - markPoint : { - data : [ - { - name: 'daiao', - xAxis:<%= @myself_eff[0] %>, - yAxis:<%= @myself_eff[1] %> - } - ], - itemStyle: { - normal:{ - color:'#c23531' - } - } - }, - markLine : { - lineStyle: { - normal: { - type: 'solid', - color:'#c23531' - } + if(document.getElementById('shixun_skill_chart')){ + var effChart = echarts.init(document.getElementById('shixun_skill_chart')); + // 指定图表的配置项和数据 + var option = { + grid: { + left: '3%', + right: '9%', + bottom: '3%', + containLabel: true }, - data : [ - {type : 'average', name: '中位值'} + tooltip : {}, + xAxis : [ + { + type : 'value', + name: '学生序号', + scale:true, + axisLabel : { + formatter: ' ' + }, + axisTick:{ + show:false + }, + splitLine: { + show: false + } + } + ], + yAxis : [ + { + type : 'value', + name : '工作效率', + scale:true, + axisLabel : { + formatter: '{value} ' + }, + splitLine: { + show: false + } + } + ], + series : [ + { + name:'', + type:'scatter', + data: <%= @echart_data[:efficiency_list] %>, + itemStyle:{ + normal:{color:'#2e65ad'} + }, + markArea: { + silent: true, + itemStyle: { + normal: { + color: 'transparent', + borderWidth: 1, + borderType: 'dashed' + } + } + }, + markPoint : { + data : [ + { + name: 'daiao', + xAxis:<%= @myself_eff[0] %>, + yAxis:<%= @myself_eff[1] %> + } + ], + itemStyle: { + normal:{ + color:'#c23531' + } + } + }, + markLine : { + lineStyle: { + normal: { + type: 'solid', + color:'#c23531' + } + }, + data : [ + {type : 'average', name: '中位值'} + ] + } + }, + { + name:'二班', + type:'scatter', + data: [<%= @myself_eff %>], + itemStyle:{ + color:'#c23531' + } + } ] - } - }, - { - name:'二班', - type:'scatter', - data: [<%= @myself_eff %>], - itemStyle:{ - color:'#c23531' - } - } - ] - }; - // 使用刚指定的配置项和数据显示图表 - effChart.setOption(option); - console.debug(<%= @myself_consume %>); - var ablChart = echarts.init(document.getElementById('shixun_overall_ablility_chart')); - var dataBJ = <%= @echart_data[:consume_list] %>; - var schema = [ - {name: 'date', index: 0, text: '日'}, - {name: 'AQIindex', index: 1, text: 'AQI指数'}, - {name: 'PM25', index: 2, text: 'PM2.5'} - ]; + }; + // 使用刚指定的配置项和数据显示图表 + effChart.setOption(option); + console.debug(<%= @myself_consume %>); + } - var itemStyle = { - normal: { - opacity: 0.8, - shadowBlur: 10, - shadowOffsetX: 0, - shadowOffsetY: 0, - shadowColor: 'rgba(0, 0, 0, 0)', - color:'#2e65ad' - } - }; - var itemStyle1 = { - normal: { - opacity: 0.8, - shadowBlur: 10, - shadowOffsetX: 0, - shadowOffsetY: 0, - shadowColor: 'rgba(0, 0, 0, 0)', - color:'#c23531' - } - }; + if(document.getElementById('shixun_skill_chart')) { + var ablChart = echarts.init(document.getElementById('shixun_overall_ablility_chart')); + var dataBJ = <%= @echart_data[:consume_list] %>; + var schema = [ + {name: 'date', index: 0, text: '日'}, + {name: 'AQIindex', index: 1, text: 'AQI指数'}, + {name: 'PM25', index: 2, text: 'PM2.5'} + ]; - var option1 = { - backgroundColor: '#fff', - color: [ - '#dd4444', '#fec42c', '#80F1BE' - ], - grid: { - x: '10%', - x2: 150, - y: '18%', - y2: '10%' - }, - tooltip: {}, - xAxis: { - type: 'value', - name: 'log(实训的总时间)', - nameGap: 16, - nameTextStyle: { - color: '#000', - fontSize: 14 - }, - splitLine: { - show: false - }, - axisLine: { - lineStyle: { - color: '#000' - } - } - }, - yAxis: { - type: 'value', - name: '总分数/评测次数', - nameLocation: 'end', - nameGap: 20, - nameTextStyle: { - color: '#000', - fontSize: 16 - }, - axisLine: { - lineStyle: { - color: '#000' - } - }, - splitLine: { - show: false - } - }, - series: [ - { - name: '能力', - type: 'scatter', - itemStyle: itemStyle, - data: dataBJ, - symbolSize: function (value){ - return Math.round(value[2]); - }, - markPoint : { - data : [ - { - name: 'daiao', - xAxis:<%= @myself_consume[0] %>, - yAxis:<%= @myself_consume[1] %> + var itemStyle = { + normal: { + opacity: 0.8, + shadowBlur: 10, + shadowOffsetX: 0, + shadowOffsetY: 0, + shadowColor: 'rgba(0, 0, 0, 0)', + color:'#2e65ad' } - ], - itemStyle: { - normal:{ - color:'#c23531' + }; + var itemStyle1 = { + normal: { + opacity: 0.8, + shadowBlur: 10, + shadowOffsetX: 0, + shadowOffsetY: 0, + shadowColor: 'rgba(0, 0, 0, 0)', + color:'#c23531' } - } - } - }, - { - name: '能力1', - type: 'scatter', - data:[<%= @myself_consume %>], - itemStyle:itemStyle1, - symbolSize: function (val){ - return Math.round(val[2]); - } - } - ] - }; - // 使用刚指定的配置项和数据显示图表。 - ablChart.setOption(option1); + }; + + var option1 = { + backgroundColor: '#fff', + color: [ + '#dd4444', '#fec42c', '#80F1BE' + ], + grid: { + x: '10%', + x2: 150, + y: '18%', + y2: '10%' + }, + tooltip: {}, + xAxis: { + type: 'value', + name: 'log(实训的总时间)', + nameGap: 16, + nameTextStyle: { + color: '#000', + fontSize: 14 + }, + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#000' + } + } + }, + yAxis: { + type: 'value', + name: '总分数/评测次数', + nameLocation: 'end', + nameGap: 20, + nameTextStyle: { + color: '#000', + fontSize: 16 + }, + axisLine: { + lineStyle: { + color: '#000' + } + }, + splitLine: { + show: false + } + }, + series: [ + { + name: '能力', + type: 'scatter', + itemStyle: itemStyle, + data: dataBJ, + symbolSize: function (value){ + return Math.round(value[2]); + }, + markPoint : { + data : [ + { + name: 'daiao', + xAxis:<%= @myself_consume[0] %>, + yAxis:<%= @myself_consume[1] %> + } + ], + itemStyle: { + normal:{ + color:'#c23531' + } + } + } + }, + { + name: '能力1', + type: 'scatter', + data:[<%= @myself_consume %>], + itemStyle:itemStyle1, + symbolSize: function (val){ + return Math.round(val[2]); + } + } + ] + }; + // 使用刚指定的配置项和数据显示图表。 + ablChart.setOption(option1); + } } diff --git a/lib/tasks/zip_pack.rake b/lib/tasks/zip_pack.rake index 7eb757f08..0452a83e2 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 = "#{Rails.root}/files/archiveZip" + OUTPUT_FOLDER = "/tmp" task :shixun_pack => :environment do @@ -23,7 +23,7 @@ namespace :zip_pack do student_works.find_each.map do |student_work| export = ExportShixunReportService.new(homework, student_work) pdf = export.to_pdf - # pdfs << pdf + pdfs << pdf begin zip.add(export.filename, pdf.path) rescue => ex From 2f87b0040adeee1a4b8df26938a7d814f4606f51 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 6 Jan 2020 16:57:17 +0800 Subject: [PATCH 07/24] move file --- .../leftpane/editorTab => common/quillForEditor}/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename public/react/src/{modules/developer/newOrEditTask/leftpane/editorTab => common/quillForEditor}/README.md (100%) diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/README.md b/public/react/src/common/quillForEditor/README.md similarity index 100% rename from public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/README.md rename to public/react/src/common/quillForEditor/README.md From 9cc7bafe549cd47a53240bd239389ae9f7a640c2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 6 Jan 2020 17:01:43 +0800 Subject: [PATCH 08/24] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/zip_pack.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/zip_pack.rake b/lib/tasks/zip_pack.rake index 0452a83e2..54099a2c0 100644 --- a/lib/tasks/zip_pack.rake +++ b/lib/tasks/zip_pack.rake @@ -19,6 +19,7 @@ namespace :zip_pack do student_works = homework.score_student_works if student_works.size > 0 + pdfs = [] Zip::File.open(zipfile_name, Zip::File::CREATE) do |zip| student_works.find_each.map do |student_work| export = ExportShixunReportService.new(homework, student_work) From 8aa7d7bd725d9e8ca7f042076ac0d3c745db4ca4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 6 Jan 2020 17:10:42 +0800 Subject: [PATCH 09/24] =?UTF-8?q?vnc=20webssh=E5=A4=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 5 ++++- app/controllers/myshixuns_controller.rb | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 938d42c2f..055c656eb 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -962,8 +962,11 @@ class GamesController < ApplicationController shixun = game.myshixun.shixun shixun_tomcat = edu_setting('cloud_bridge') service_host = edu_setting('vnc_url') + tpiGitURL = "#{edu_setting('git_address_domain')}/#{game.myshixun.repo_path}" + uri = "#{shixun_tomcat}/bridge/vnc/getvnc" - params = {tpiID: game.myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"} + params = {tpiID: game.myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}", + tpiGitURL: tpiGitURL} res = uri_post uri, params if res && res['code'].to_i != 0 raise("实训云平台繁忙(繁忙等级:99)") diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 67bec877b..7847d58ed 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -216,10 +216,11 @@ class MyshixunsController < ApplicationController old_time = Time.now.to_i begin shixun_tomcat = edu_setting('tomcat_webssh') + tpiGitURL = "#{edu_setting('git_address_domain')}/#{@myshixun.repo_path}" uri = "#{shixun_tomcat}/bridge/webssh/getConnectInfo" # 由于中间层采用混合云的方式,因为local参数表示在有文件生成的实训是在本地生成,还是在其他云端生成评测文件 local = @myshixun.shixun.challenges.where.not(show_type: -1).count == 0 - params = {tpiID:@myshixun.id, podType:@myshixun.shixun.try(:webssh), local: local, + params = {tpiID:@myshixun.id, podType:@myshixun.shixun.try(:webssh), local: local, tpiGitURL: tpiGitURL, containers:(Base64.urlsafe_encode64(shixun_container_limit @myshixun.shixun))} res = uri_post uri, params if res && res['code'].to_i != 0 From 260c2c2ad93f441108ebe62d0c52fc1973788f0c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 6 Jan 2020 17:11:33 +0800 Subject: [PATCH 10/24] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/zip_pack.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/zip_pack.rake b/lib/tasks/zip_pack.rake index 54099a2c0..6e3140f47 100644 --- a/lib/tasks/zip_pack.rake +++ b/lib/tasks/zip_pack.rake @@ -27,6 +27,7 @@ namespace :zip_pack do pdfs << pdf begin zip.add(export.filename, pdf.path) + puts "out: #{export.filename}" rescue => ex Rails.logger.error(ex.message) From dcbe49265c2c5a9fc75bb60bbdbc3b22d22fd81a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 6 Jan 2020 17:13:03 +0800 Subject: [PATCH 11/24] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/zip_pack.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/zip_pack.rake b/lib/tasks/zip_pack.rake index 6e3140f47..766925571 100644 --- a/lib/tasks/zip_pack.rake +++ b/lib/tasks/zip_pack.rake @@ -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) From 1fba78cd1afdda3a6d3eb9e7c9021dbbda5aab36 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Mon, 6 Jan 2020 17:14:20 +0800 Subject: [PATCH 12/24] update quill readme.md --- .../react/src/common/quillForEditor/README.md | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) 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) + } + } + + + ```` From 2fc0587b8c0df0ed9203cd891a14f9faa3c21f15 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 6 Jan 2020 17:27:06 +0800 Subject: [PATCH 13/24] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=AE=9E=E8=B7=B5?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E8=AE=BF=E9=97=AE=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20200106092135_modify_viewed_count_for_subjects.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/migrate/20200106092135_modify_viewed_count_for_subjects.rb 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 From 972fd5376745d3ea4b7b94f2d42deb77d9eaee0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 6 Jan 2020 17:30:53 +0800 Subject: [PATCH 14/24] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixunHomework/Trainingjobsetting.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 ( From 2092e2a187cf897cfec2a7ffdfdaa1dccde0dc4d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 6 Jan 2020 17:38:55 +0800 Subject: [PATCH 15/24] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/export_shixun_report_service.rb | 4 ++-- lib/tasks/zip_pack.rake | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/export_shixun_report_service.rb b/app/services/export_shixun_report_service.rb index b75f031c0..2339b6d56 100644 --- a/app/services/export_shixun_report_service.rb +++ b/app/services/export_shixun_report_service.rb @@ -33,8 +33,8 @@ class ExportShixunReportService base_css = %w(app/templates/shared/main.css app/templates/shixun_work/shixun_work.css app/templates/shared/codemirror.css) base_css.each { |css| kit.stylesheets << Rails.root.join(css) } - file = Tempfile.new(filename) - kit.to_pdf(file.path) + file_name = "#{Rails.root}/files/archiveZip/#{filename}" + kit.to_pdf(file_name) file end diff --git a/lib/tasks/zip_pack.rake b/lib/tasks/zip_pack.rake index 766925571..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 From d39f9b3519806c6829a86a0a35e08f0c091f8614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 6 Jan 2020 17:39:13 +0800 Subject: [PATCH 16/24] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesBanner.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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} }
    -
    } + {/*
  • */} {/**/} From 4a37db2d735b0cb85ca0dbeca36fdb91dcf2a17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 6 Jan 2020 17:51:09 +0800 Subject: [PATCH 17/24] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/forums/MemoDetailKEEditor.js | 20 +++++++++---------- .../src/modules/forums/MemoDetailMDEditor.js | 14 ++++++------- .../modules/forums/MemoDetailMDEditortwo.js | 14 ++++++------- 3 files changed, 24 insertions(+), 24 deletions(-) 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}) From 405b2236b3fe84968762b028306befa920904747 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 6 Jan 2020 17:56:02 +0800 Subject: [PATCH 18/24] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/export_shixun_report_service.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/services/export_shixun_report_service.rb b/app/services/export_shixun_report_service.rb index 2339b6d56..b75f031c0 100644 --- a/app/services/export_shixun_report_service.rb +++ b/app/services/export_shixun_report_service.rb @@ -33,8 +33,8 @@ class ExportShixunReportService base_css = %w(app/templates/shared/main.css app/templates/shixun_work/shixun_work.css app/templates/shared/codemirror.css) base_css.each { |css| kit.stylesheets << Rails.root.join(css) } - file_name = "#{Rails.root}/files/archiveZip/#{filename}" - kit.to_pdf(file_name) + file = Tempfile.new(filename) + kit.to_pdf(file.path) file end From 6ea0459f35cbb218c0c5769f608294ac777fd1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 6 Jan 2020 18:07:06 +0800 Subject: [PATCH 19/24] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/jupyter/index.js | 2 +- .../Challenges/Challengesjupyter.js | 25 +++++++++++-------- public/react/src/redux/actions/jupyter.js | 3 ++- 3 files changed, 18 insertions(+), 12 deletions(-) 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) } } }) From 365e7a372d9827d9d1e376a8ccd053ab6c88985a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 6 Jan 2020 18:13:46 +0800 Subject: [PATCH 20/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0git=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E4=BA=8C=E8=BF=9B=E5=88=B6=E6=96=87=E4=BB=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/git_service.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/app/services/git_service.rb b/app/services/git_service.rb index 7867d063e..c62e703fb 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -2,6 +2,8 @@ # # 文档在 https://www.showdoc.cc/127895880302646?page_id=1077512172693249 # +require 'faraday' + class GitService class << self @@ -12,6 +14,14 @@ class GitService end end + def make_new_multipar_file(full_file_path) + Faraday::FilePart.new(full_file_path, 'application/octet-stream') + end + + def update_file_binary(params) + post_form('update_file', params) + end + private def root_url @@ -24,6 +34,19 @@ class GitService Rails.logger end + def post_form(action,params) + conn = Faraday.new(root_url) do |f| + f.request:multipart + f.request:url_encoded + f.adapter:net_http + end + + resp = conn.post("/api/#{action}", params) + + body = resp.body + parse_return(body) + end + def post(action, params) uri = URI.parse("#{root_url}/api/#{action}") https = Net::HTTP.new(uri.host, uri.port) @@ -32,6 +55,11 @@ class GitService req.body = params.to_json res = https.request(req) body = res.body + + parse_return(body) + end + + def parse_return(body) logger.info("--uri_exec: .....res is #{body}") content = JSON.parse(body) From 007a18a78117290b1a264b2cd1cdc0fe16fdbc8f Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 6 Jan 2020 18:25:33 +0800 Subject: [PATCH 21/24] . --- app/services/git_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/git_service.rb b/app/services/git_service.rb index c62e703fb..fe54b80e6 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -18,6 +18,9 @@ class GitService Faraday::FilePart.new(full_file_path, 'application/octet-stream') end + #上传二进制文件 + #参数构造形式 + # {a: 'a', file: make_new_multipar_file('1.txt') } def update_file_binary(params) post_form('update_file', params) end From 716a5a4629edb91832ebac5df23ec49862cb59c3 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 6 Jan 2020 18:42:14 +0800 Subject: [PATCH 22/24] =?UTF-8?q?git=20base64=20=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/git_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/git_service.rb b/app/services/git_service.rb index fe54b80e6..361de5530 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -8,7 +8,7 @@ class GitService class << self - ['add_repository', 'fork_repository', 'delete_repository', 'file_tree', 'update_file', 'file_content', 'commits', 'add_tree', 'delete_file'].each do |method| + ['add_repository', 'fork_repository', 'delete_repository', 'file_tree', 'update_file', 'file_content', 'commits', 'add_tree', 'delete_file', 'update_file_base64'].each do |method| define_method method do |params| post(method, params) end From b62914743d3c1706297b24ce76d4cab0b17153b4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 6 Jan 2020 18:48:09 +0800 Subject: [PATCH 23/24] =?UTF-8?q?base64=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/git_helper.rb | 3 ++- app/services/git_service.rb | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb index 0d8604aac..efc073c86 100644 --- a/app/controllers/concerns/git_helper.rb +++ b/app/controllers/concerns/git_helper.rb @@ -41,7 +41,8 @@ module GitHelper # 更新文件代码 # content: 文件内容;message:提交描述 def update_file_content(content, repo_path, path, mail, username, message) - GitService.update_file(repo_path: repo_path, file_path: path, message: message, + content = Base64.encode64(content) + GitService.update_file_base64(repo_path: repo_path, file_path: path, message: message, content: content, author_name: username, author_email: mail) end diff --git a/app/services/git_service.rb b/app/services/git_service.rb index 361de5530..8fad1d43d 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -39,9 +39,9 @@ class GitService def post_form(action,params) conn = Faraday.new(root_url) do |f| - f.request:multipart - f.request:url_encoded - f.adapter:net_http + f.request :multipart + f.request :url_encoded + f.adapter :net_http end resp = conn.post("/api/#{action}", params) From f6288d34bf827b12c5475af73866a49fa9a5cb3c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 6 Jan 2020 18:50:12 +0800 Subject: [PATCH 24/24] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/git_service.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/git_service.rb b/app/services/git_service.rb index 8fad1d43d..eedac2595 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -8,7 +8,8 @@ class GitService class << self - ['add_repository', 'fork_repository', 'delete_repository', 'file_tree', 'update_file', 'file_content', 'commits', 'add_tree', 'delete_file', 'update_file_base64'].each do |method| + ['add_repository', 'fork_repository', 'delete_repository', 'file_tree', 'update_file', 'file_content', 'commits', + 'add_tree', 'delete_file', 'update_file_base64'].each do |method| define_method method do |params| post(method, params) end