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/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
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
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/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/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
diff --git a/lib/tasks/zip_pack.rake b/lib/tasks/zip_pack.rake
index 0452a83e2..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
@@ -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)
@@ -26,6 +27,7 @@ namespace :zip_pack do
pdfs << pdf
begin
zip.add(export.filename, pdf.path)
+ puts "out: #{export.filename}_#{pdf.path}"
rescue => ex
Rails.logger.error(ex.message)
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/README.md b/public/react/src/common/quillForEditor/README.md
new file mode 100644
index 000000000..0369164c7
--- /dev/null
+++ b/public/react/src/common/quillForEditor/README.md
@@ -0,0 +1,94 @@
+
+## QuillForEditor 使用 [https://quilljs.com/]
+
+ ### 导入
+
+ - 目录 src/common/quillForEditor (默认加载当前文件夹下的 index.js 文件)
+
+ ### 参数
+
+ | 字段 | 描述 |
+ | ----- | ----- |
+ | placeholder | 提示信息 |
+ | readOnly | 只读(只读取模式时,没有 工具栏且内容不可编辑,通常用于展示quill内容) |
+ | autoFocus | 自动获得焦点 |
+ | options | 配置参数, 指定工具栏内容 |
+ | value | 文本编辑器内容 |
+ | imgAttrs | 指定上传图片的尺寸 |
+ | style | 指定quill容器样式 |
+ | wrapStyle | 指定包裹quill容器的样式|
+ | onContentChange | 当编辑器内容变化时调用此回调函数(注: 此时返回的内容为对象,提交到后台时需要格式成 JSON 字符串: JSON.stringify(xx)) |
+ | 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';
+
+ // 指定需要显示的工具栏信息, 不指定加载全部
+ 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)
+ }
+ }
+
+
+