From d67306c0b2a92b66368dd7014c61aa535d422e36 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 11 Sep 2019 14:35:28 +0800
Subject: [PATCH 01/12] =?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/controllers/shixuns_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 5f69f1b91..e4f0ad641 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -128,7 +128,7 @@ class ShixunsController < ApplicationController
page = params[:page] || 1
limit = params[:limit] || 10
- offset = (page.to_i - 1) * limit
+ offset = (page.to_i - 1) * (limit.to_i)
order = params[:order] || "desc"
## 搜索关键字创建者、实训名称、院校名称
keyword = params[:search]
From 4b1f4c7845876eb022f7481a9bb4bb334a7f553e Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 11 Sep 2019 14:48:23 +0800
Subject: [PATCH 02/12] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/shixuns_controller.rb | 2 +-
app/views/homework_commons/works_list.json.jbuilder | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index e4f0ad641..7ba2c65fc 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -131,7 +131,7 @@ class ShixunsController < ApplicationController
offset = (page.to_i - 1) * (limit.to_i)
order = params[:order] || "desc"
## 搜索关键字创建者、实训名称、院校名称
- keyword = params[:search]
+ keyword = params[:search].blank? ? "*" : params[:search]
@shixuns = Shixun.search keyword, where: {id: @shixuns.pluck(:id)}, order: {"myshixuns_count" => order}, limit: limit, offset: offset
@total_count = @shixuns.total_count
diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder
index 08c269670..e626cae13 100644
--- a/app/views/homework_commons/works_list.json.jbuilder
+++ b/app/views/homework_commons/works_list.json.jbuilder
@@ -40,6 +40,7 @@ elsif @user_course_identity == Course::STUDENT
json.efficiency work_score_format(@work.efficiency, true, @score_open)
json.eff_score work_score_format(@work.eff_score, true, @score_open)
json.complete_count @work.myshixun.try(:passed_count)
+ # json.redo_work student_redo_work(@work)
else
json.(@work, :id, :work_status, :update_time, :ultimate_score)
From 254f9cc569a15a6eb1f254f96155609be7615050 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 11 Sep 2019 15:07:56 +0800
Subject: [PATCH 03/12] =?UTF-8?q?=E9=87=8D=E7=BD=AEvnc?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/games_controller.rb | 84 ++++++++++++++++++++---------
config/routes.rb | 1 +
2 files changed, 61 insertions(+), 24 deletions(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index b35f2996f..a77b72708 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -61,29 +61,7 @@ class GamesController < ApplicationController
tomcat_url: edu_setting('cloud_tomcat_php'), is_teacher: is_teacher,
myshixun_manager: myshixun_manager, git_url: (@shixun.vnc ? repo_url(@myshixun.repo_path) : "")}
if @shixun.vnc
- begin
- shixun_tomcat = edu_setting('cloud_bridge')
- service_host = edu_setting('vnc_url')
- uri = "#{shixun_tomcat}/bridge/vnc/getvnc"
- params = {tpiID: @myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(@shixun))}"}
- res = uri_post uri, params
- logger.info("###############---- ")
- if res && res['code'].to_i != 0
- raise("实训云平台繁忙(繁忙等级:99)")
- end
-
- if request.subdomain == "pre-newweb"
- # 无域名版本
- @vnc_url = "http://#{service_host}:#{res['port']}/vnc_lite.html?password=headless"
- else
- # 有域名版本
- @vnc_url = "https://#{res['port']}.#{service_host}/vnc_lite.html?password=headless"
- end
-
- @vnc_evaluate = @shixun.vnc_evaluate
- rescue Exception => e
- Rails.logger.error(e.message)
- end
+ get_vnc_link(@game)
end
# 区分选择题和编程题,st:0编程题;
@@ -110,6 +88,21 @@ class GamesController < ApplicationController
end
end
+ def reset_vnc_link
+ begin
+ # 删除vnc的pod
+ delete_vnc(@game)
+ # 重新连接
+ get_vnc_link(@game)
+
+ render :json => {status: 1, message: "重置VNC成功", data: {vnc_url: @vnc_url, vnc_evaluate: @vnc_evaluate}}
+ rescue Exception => e
+ logger.error("############'#{e.message}'")
+ tip_exception("实训云平台繁忙")
+ end
+
+ end
+
# 查看效果
# todo : 这块代码有很大的改进空间
# todo : 中文排序问题
@@ -880,7 +873,7 @@ class GamesController < ApplicationController
choose.challenge_questions.each do |question|
position = question.position
option_name = question.option_name
- challenge_question << {:positon => position, :option_name => option_name}
+ challenge_question <<{:positon => position, :option_name => option_name}
end
# actual_output为空表示暂时没有评测答题,不允许查看
actual_output = output.try(:actual_output).try(:strip)
@@ -941,4 +934,47 @@ class GamesController < ApplicationController
game.myshixun.update_column(:updated_at, Time.now)
end
+ # vnc连接
+ def get_vnc_link game
+ begin
+ shixun = game.myshixun.shixun
+ shixun_tomcat = edu_setting('cloud_bridge')
+ service_host = edu_setting('vnc_url')
+ uri = "#{shixun_tomcat}/bridge/vnc/getvnc"
+ params = {tpiID: game.myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
+ res = uri_post uri, params
+ if res && res['code'].to_i != 0
+ raise("实训云平台繁忙(繁忙等级:99)")
+ end
+ @vnc_url =
+ if request.subdomain == "pre-newweb"
+ # 无域名版本
+ "http://#{service_host}:#{res['port']}/vnc_lite.html?password=headless"
+ else
+ # 有域名版本
+ "https://#{res['port']}.#{service_host}/vnc_lite.html?password=headless"
+ end
+ @vnc_evaluate = shixun.vnc_evaluate
+ rescue Exception => e
+ Rails.logger.error(e.message)
+ end
+ end
+
+ # 删除pod
+ def delete_vnc game
+ myshixun_id = game.myshixun_id
+ digest = game.identifier + edu_setting('bridge_secret_key')
+ digest_key = Digest::SHA1.hexdigest("#{digest}")
+ begin
+ shixun_tomcat = edu_setting('cloud_bridge')
+ uri = "#{shixun_tomcat}/bridge/vnc/delete"
+ Rails.logger.info("#{current_user} => cloese_webssh digest is #{digest}")
+ params = {:tpiID => myshixun_id, :digestKey => digest_key, :identifier => game.identifier}
+ res = uri_post uri, params
+ if res && res['code'].to_i != 0
+ raise("实训云平台繁忙(繁忙等级:110)")
+ end
+ end
+ end
+
end
diff --git a/config/routes.rb b/config/routes.rb
index 0d6e108ad..15a91b910 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -161,6 +161,7 @@ Rails.application.routes.draw do
get :picture_display
get :sync_codes
get :close_webssh
+ get :reset_vnc_link
get :get_answer_info
get :unlock_answer
get :check_test_sets
From 8f61078aad8e287bd5cd0ae50e3a1916e7f7b1b8 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 11 Sep 2019 15:08:37 +0800
Subject: [PATCH 04/12] 1
---
app/controllers/games_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index a77b72708..f5dcdd037 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -968,7 +968,7 @@ class GamesController < ApplicationController
begin
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/vnc/delete"
- Rails.logger.info("#{current_user} => cloese_webssh digest is #{digest}")
+ Rails.logger.info("#{current_user} => cloese_vnc digest is #{digest}")
params = {:tpiID => myshixun_id, :digestKey => digest_key, :identifier => game.identifier}
res = uri_post uri, params
if res && res['code'].to_i != 0
From cad878c6da8544549279db5a4dc77a14a62e87f6 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 11 Sep 2019 15:31:20 +0800
Subject: [PATCH 05/12] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E7=9A=84=E9=87=8D=E5=81=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_commons_controller.rb | 2 +-
app/helpers/homework_commons_helper.rb | 5 +++++
app/views/homework_commons/works_list.json.jbuilder | 4 ++--
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb
index 3b395bab2..06ee8feee 100644
--- a/app/controllers/homework_commons_controller.rb
+++ b/app/controllers/homework_commons_controller.rb
@@ -113,7 +113,7 @@ class HomeworkCommonsController < ApplicationController
if @user_course_identity == Course::STUDENT
@work = @homework.user_work(current_user.id)
# 学生访问列表时计算个人成绩
- if @homework.homework_type == "practice"
+ if @homework.homework_type == "practice" && !@homework.end_or_late
myshixun = Myshixun.find_by(shixun_id: @shixun.id, user_id: current_user.id)
if @work && myshixun
challenge_settings = @homework.homework_challenge_settings
diff --git a/app/helpers/homework_commons_helper.rb b/app/helpers/homework_commons_helper.rb
index a3ed43405..e10917664 100644
--- a/app/helpers/homework_commons_helper.rb
+++ b/app/helpers/homework_commons_helper.rb
@@ -237,4 +237,9 @@ module HomeworkCommonsHelper
def anon_comments user, work_id
StudentWorksScore.where(student_work_id: work_id, reviewer_role: 3, user_id: user.id)
end
+
+ def student_redo_work work, homework
+ publish_time = homework.homework_group_setting(work.user_id)&.publish_time
+ work.myshixun && publish_time && work.myshixun.games.where("status = 2 and answer_open = 1 and end_time <= '#{publish_time}'").count > 0
+ end
end
diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder
index e626cae13..fe05866e6 100644
--- a/app/views/homework_commons/works_list.json.jbuilder
+++ b/app/views/homework_commons/works_list.json.jbuilder
@@ -31,7 +31,7 @@ elsif @user_course_identity == Course::STUDENT
json.left_time left_time @homework, @current_user.id
if @homework.homework_type == "practice"
- json.(@work, :id, :work_status, :update_time, :ultimate_score)
+ json.(@work, :id, :work_status, :update_time, :ultimate_score, :myshixun_id)
json.calculation_time @work.calculation_time
json.late_penalty @work.late_penalty if @homework.allow_late
json.cost_time @work.myshixun.try(:total_spend_time)
@@ -40,7 +40,7 @@ elsif @user_course_identity == Course::STUDENT
json.efficiency work_score_format(@work.efficiency, true, @score_open)
json.eff_score work_score_format(@work.eff_score, true, @score_open)
json.complete_count @work.myshixun.try(:passed_count)
- # json.redo_work student_redo_work(@work)
+ json.redo_work @homework.end_or_late ? false : student_redo_work(@work, @homework)
else
json.(@work, :id, :work_status, :update_time, :ultimate_score)
From 9279722fc439927bf886ba1c6fb86492acb3aa4f Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 11 Sep 2019 15:32:19 +0800
Subject: [PATCH 06/12] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E5=AD=A6=E4=B9=A0?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/courses/online_learning.json.jbuilder | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/views/courses/online_learning.json.jbuilder b/app/views/courses/online_learning.json.jbuilder
index 057ec61cf..b48cd9e23 100644
--- a/app/views/courses/online_learning.json.jbuilder
+++ b/app/views/courses/online_learning.json.jbuilder
@@ -5,6 +5,7 @@ end
# json.description @subject&.description
json.start_learning @start_learning
+json.subject_id @subject.id
json.learned @start_learning ? @course.my_subject_progress : 0
From 14b7c28d1dd47dc883d1a0159afe274d5ac9a0a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 11 Sep 2019 15:36:01 +0800
Subject: [PATCH 07/12] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=81=AB=E7=8B=90?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/tpm/TPMsettings/TPMsettings.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
index a46654fe6..f78d62637 100644
--- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
+++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js
@@ -2355,10 +2355,10 @@ export default class TPMsettings extends Component {
return(
-
+
{item.name}
{/*this.Deselectlittle(item.mirror_repository_id)}>*/}
-
+
From 0088445c40a3a7549aee4ffe825a3edea89d9f00 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 11 Sep 2019 15:37:43 +0800
Subject: [PATCH 08/12] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88vnc=E5=BC=80?=
=?UTF-8?q?=E6=94=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/games_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index f5dcdd037..b9da12ab0 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -947,7 +947,7 @@ class GamesController < ApplicationController
raise("实训云平台繁忙(繁忙等级:99)")
end
@vnc_url =
- if request.subdomain == "pre-newweb"
+ if request.subdomain == "pre-newweb" || request.subdomain == "test-newweb"
# 无域名版本
"http://#{service_host}:#{res['port']}/vnc_lite.html?password=headless"
else
From f2b036b65956380772604ab506205f731f8a5ef8 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 11 Sep 2019 15:44:09 +0800
Subject: [PATCH 09/12] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/shixuns_controller.rb | 2 +-
app/views/shixuns/settings.json.jbuilder | 1 +
.../20190911074019_add_code_edit_permission_for_shixun.rb | 6 ++++++
3 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 db/migrate/20190911074019_add_code_edit_permission_for_shixun.rb
diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb
index 7ba2c65fc..82bc9ce84 100644
--- a/app/controllers/shixuns_controller.rb
+++ b/app/controllers/shixuns_controller.rb
@@ -978,7 +978,7 @@ private
raise("实训名称不能为空") if params[:shixun][:name].blank?
params.require(:shixun).permit(:name, :trainee, :webssh, :can_copy, :use_scope, :vnc, :test_set_permission,
:task_pass, :multi_webssh, :opening_time, :mirror_script_id, :code_hidden,
- :hide_code, :forbid_copy, :vnc_evaluate)
+ :hide_code, :forbid_copy, :vnc_evaluate, :code_edit_permission)
end
def shixun_info_params
diff --git a/app/views/shixuns/settings.json.jbuilder b/app/views/shixuns/settings.json.jbuilder
index c9142dab0..3441a0a06 100644
--- a/app/views/shixuns/settings.json.jbuilder
+++ b/app/views/shixuns/settings.json.jbuilder
@@ -30,6 +30,7 @@ json.shixun do
json.scope_partment @shixun.schools.map(&:name) # 公开范围
json.opening_time @shixun.opening_time
json.forbid_copy @shixun.forbid_copy
+ json.code_edit_permission @shixun.code_edit_permission # tpi学员是否有编辑所有代码的权限
# 私密仓库
json.is_secret_repository @shixun.shixun_secret_repository.present?
diff --git a/db/migrate/20190911074019_add_code_edit_permission_for_shixun.rb b/db/migrate/20190911074019_add_code_edit_permission_for_shixun.rb
new file mode 100644
index 000000000..801713e0e
--- /dev/null
+++ b/db/migrate/20190911074019_add_code_edit_permission_for_shixun.rb
@@ -0,0 +1,6 @@
+class AddCodeEditPermissionForShixun < ActiveRecord::Migration[5.2]
+ def change
+
+ add_column :shixuns, :code_edit_permission, :boolean, default: false
+ end
+end
From d2fcd7208a4deb78bfd4220b1c9068679d7a3b33 Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 11 Sep 2019 15:48:42 +0800
Subject: [PATCH 10/12] =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 2 +-
app/controllers/myshixuns_controller.rb | 3 ++-
app/helpers/homework_commons_helper.rb | 2 +-
app/views/homework_commons/works_list.json.jbuilder | 5 +++--
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 2ce52d405..1b7101199 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -247,7 +247,7 @@ class ApplicationController < ActionController::Base
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
if !User.current.logged? && Rails.env.development?
- User.current = User.find 1
+ User.current = User.find 8686
end
diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb
index 8c11e88c5..fc5db713f 100644
--- a/app/controllers/myshixuns_controller.rb
+++ b/app/controllers/myshixuns_controller.rb
@@ -25,7 +25,8 @@ class MyshixunsController < ApplicationController
begin
@shixun = Shixun.select(:id, :identifier, :challenges_count).find(@myshixun.shixun_id)
@myshixun.destroy!
- StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0)
+ StudentWork.where(:myshixun_id => @myshixun.id).update_all(myshixun_id: 0, work_status: 0, work_score: nil,
+ final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: 0)
rescue Exception => e
logger.error("######reset_my_game_failed:#{e.message}")
raise("ActiveRecord::RecordInvalid")
diff --git a/app/helpers/homework_commons_helper.rb b/app/helpers/homework_commons_helper.rb
index e10917664..3e9ad2eaa 100644
--- a/app/helpers/homework_commons_helper.rb
+++ b/app/helpers/homework_commons_helper.rb
@@ -240,6 +240,6 @@ module HomeworkCommonsHelper
def student_redo_work work, homework
publish_time = homework.homework_group_setting(work.user_id)&.publish_time
- work.myshixun && publish_time && work.myshixun.games.where("status = 2 and answer_open = 1 and end_time <= '#{publish_time}'").count > 0
+ work.myshixun && publish_time && work.myshixun.games.where("status = 2 and answer_open = 1 and end_time <= '#{publish_time}'").count > 0 ? true : false
end
end
diff --git a/app/views/homework_commons/works_list.json.jbuilder b/app/views/homework_commons/works_list.json.jbuilder
index fe05866e6..09a7cbcc5 100644
--- a/app/views/homework_commons/works_list.json.jbuilder
+++ b/app/views/homework_commons/works_list.json.jbuilder
@@ -31,7 +31,7 @@ elsif @user_course_identity == Course::STUDENT
json.left_time left_time @homework, @current_user.id
if @homework.homework_type == "practice"
- json.(@work, :id, :work_status, :update_time, :ultimate_score, :myshixun_id)
+ json.(@work, :id, :work_status, :update_time, :ultimate_score)
json.calculation_time @work.calculation_time
json.late_penalty @work.late_penalty if @homework.allow_late
json.cost_time @work.myshixun.try(:total_spend_time)
@@ -40,7 +40,8 @@ elsif @user_course_identity == Course::STUDENT
json.efficiency work_score_format(@work.efficiency, true, @score_open)
json.eff_score work_score_format(@work.eff_score, true, @score_open)
json.complete_count @work.myshixun.try(:passed_count)
- json.redo_work @homework.end_or_late ? false : student_redo_work(@work, @homework)
+ json.redo_work (@homework.end_or_late ? false : student_redo_work(@work, @homework))
+ json.myshixun_identifier @work.myshixun&.identifier
else
json.(@work, :id, :work_status, :update_time, :ultimate_score)
From 665358570e001d8a1ab732c0cbebeed8e6b83796 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Wed, 11 Sep 2019 15:57:46 +0800
Subject: [PATCH 11/12] =?UTF-8?q?vnc=20=E9=87=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/context/TPIContextProvider.js | 5 +-
.../courses/common/CNotificationHOC.js | 10 ++-
public/react/src/modules/modals/Modals.js | 1 +
public/react/src/modules/page/Index.js | 2 +
public/react/src/modules/page/VNCContainer.js | 71 ++++++++++++++++++-
public/react/src/modules/page/VNCDisplay.js | 1 +
6 files changed, 85 insertions(+), 5 deletions(-)
diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js
index 3fbdb6ed1..df738ef98 100644
--- a/public/react/src/context/TPIContextProvider.js
+++ b/public/react/src/context/TPIContextProvider.js
@@ -32,7 +32,7 @@ import _ from 'lodash'
import TPIContext from './TPIContext'
import { EDU_ADMIN, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CERTIFICATION_TEACHER
- , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL, EDU_BUSINESS} from 'educoder'
+ , EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL, EDU_BUSINESS, CNotificationHOC } from 'educoder'
import { MuiThemeProvider, createMuiTheme, withStyles } from 'material-ui/styles';
import MUIDialogStyleUtil from '../modules/page/component/MUIDialogStyleUtil'
@@ -877,6 +877,7 @@ pop_box_new(htmlvalue, 480, 182);
return (
{
@@ -146,7 +146,15 @@ export function CNotificationHOC(options = {}) {
return (
+
return(
{
this.setState({ bottomDrawer: true })
}
+ onResetVNC = () => {
+ // 桌面系统将恢复到初始状态,您在系统中创建的数据可能会丢失
+ // 请确保您的数据已保存(如:版本库代码已推送到服务器)
+ // 是否确认重置?
+ this.props.confirm({
+ content:
+
桌面系统将恢复到初始状态,您在系统中创建的数据可能会丢失
+
请确保您的数据已保存(如:版本库代码已推送到服务器)
+
是否确认重置?
+
,
+ onOk: () => {
+ const url = `/tasks/${this.props.game.identifier}/reset_vnc_link.json`
+ axios.get(url, {
+ }).then((response) => {
+ if (response.data.data && response.data.data.vnc_url) {
+ // reset
+ this.setState({
+ displayKey: this.state.displayKey + 1,
+ vnc_url: response.data.data.vnc_url
+ })
+ } else {
+ }
+ // this.setState({ isEditablePath, currentPath: path });
+
+ }).catch(error =>{
+ console.log(error)
+ this.setState({ readingCodeLoading: false });
+ this.props.showSnackbar(`服务端异常,请联系管理员!`);
+ })
+
+ console.log('doooo')
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ })
+ }
/*
selectedKeys={fileTreeSelectedKeys}
@@ -191,6 +229,30 @@ class VNCContainer extends Component {
.codeInDrawer .ant-spin-nested-loading > div > .ant-spin .ant-spin-text {
text-shadow: none;
}
+
+ .resetVNC {
+ top: 30px;
+ writing-mode: initial;
+ left: calc(100% - 120px);
+ background-image: none;
+ width: auto;
+ background: #081516;
+ height: 30px;
+ padding: 0 6px;
+ border-radius: 4px;
+ }
+ .resetVNC .text {
+ top: 0px;
+ writing-mode: initial;
+ left: unset;
+ }
+ .resetVNC .text span {
+ vertical-align: middle;
+ margin-left: 2px;
+ }
+ .float_button:hover .text {
+ color: #4CACFF;
+ }
`}
网址克隆
@@ -207,9 +269,14 @@ class VNCContainer extends Component {
>
- {/*
*/}
+
+
+ 重置桌面系统
+
Date: Wed, 11 Sep 2019 15:59:35 +0800
Subject: [PATCH 12/12] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E7=9A=84=E6=89=80=E5=B1=9E=E8=AF=BE=E7=A8=8B=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 2 +-
app/helpers/application_helper.rb | 5 -----
app/models/shixun.rb | 5 +++++
app/views/shixuns/_right.json.jbuilder | 12 ++++++------
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 1b7101199..2ce52d405 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -247,7 +247,7 @@ class ApplicationController < ActionController::Base
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
if !User.current.logged? && Rails.env.development?
- User.current = User.find 8686
+ User.current = User.find 1
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 44169dc59..d889de36d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -56,11 +56,6 @@ module ApplicationHelper
end
- # 相关推荐
- def relation_path(shixun)
- shixun.subjects.where(hidden: 0).limit(2)
- end
-
# shixun开启挑战对应的行为名及url
def task_operation_url current_myshixun, shixun
if current_myshixun.blank?
diff --git a/app/models/shixun.rb b/app/models/shixun.rb
index 83d97f822..4912ea15a 100644
--- a/app/models/shixun.rb
+++ b/app/models/shixun.rb
@@ -280,6 +280,11 @@ class Shixun < ApplicationRecord
self.mirror_name.include?('JavaWeb') || self.mirror_name.include?('PHP') && self.mirror_name.include?('Mysql') || self.mirror_name.include?('Web')
end
+ # 所属实践课程
+ def relation_path
+ subjects.where(hidden: 0).uniq
+ end
+
private
def send_tiding
diff --git a/app/views/shixuns/_right.json.jbuilder b/app/views/shixuns/_right.json.jbuilder
index 694b672fb..e6f839aa5 100644
--- a/app/views/shixuns/_right.json.jbuilder
+++ b/app/views/shixuns/_right.json.jbuilder
@@ -3,14 +3,14 @@ json.creator do
json.partial! 'users/user', locals: { user: shixun.owner }
end
-# 推荐实训
-json.recommands do
- json.partial! 'shap_shixun', locals: { shixuns: recommend_shixun(shixun) }
-end
-
# 相关路径
json.paths do
- json.partial! 'subjects/subject', locals: {subjects: relation_path(shixun)}
+ json.partial! 'subjects/subject', locals: {subjects: shixun.relation_path}
+end
+
+# 推荐实训
+json.recommands do
+ json.partial! 'shap_shixun', locals: { shixuns: shixun.relation_path.size > 0 ? recommend_shixun(shixun) : [] }
end
# 技能标签