From feca7e315812f70aa8feaaa4d89a172d7d605194 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 11 Dec 2019 15:33:19 +0800 Subject: [PATCH 01/27] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=88=B0trustie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/application_record.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 888c65423..60308f4d8 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -14,6 +14,7 @@ class ApplicationRecord < ActiveRecord::Base end def allow_sync_to_trustie? - Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net' + true + # Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net' end end From 64bea22d70264a11493923ecdff45f28fd9d0c58 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Dec 2019 15:35:46 +0800 Subject: [PATCH 02/27] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E9=9B=86=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 112 +++++++++--------- ...0191211073142_modify_type_for_test_sets.rb | 7 ++ 2 files changed, 66 insertions(+), 53 deletions(-) create mode 100644 db/migrate/20191211073142_modify_type_for_test_sets.rb diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 0b5140743..4528b7b90 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -173,64 +173,70 @@ class ChallengesController < ApplicationController # tab 0:过关任务的更新; 1:评测设置的更新; 2:表示参考答案的更新; def update - ActiveRecord::Base.transaction do - tab = params[:tab].to_i - @challenge.update_attributes(challenge_params) - if tab == 0 && @challenge.st == 0 - @challenge.challenge_tags.delete_all - if params[:challenge_tag].present? - params[:challenge_tag].each do |input| - ChallengeTag.create!(:name => input, :challenge_id => @challenge.id) + begin + ActiveRecord::Base.transaction do + tab = params[:tab].to_i + @challenge.update_attributes(challenge_params) + if tab == 0 && @challenge.st == 0 + @challenge.challenge_tags.delete_all + if params[:challenge_tag].present? + params[:challenge_tag].each do |input| + ChallengeTag.create!(:name => input, :challenge_id => @challenge.id) + end end - end - elsif tab == 1 - path = @challenge.path - exec_path = @challenge.exec_path - test_set = @challenge.test_sets - sets_output = test_set.map(&:output) - sets_input = test_set.map(&:input) - sets_open = test_set.map(&:is_public) - set_score = test_set.map(&:score) - set_match_rule = test_set.map(&:match_rule) - params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0} - params_output = params[:test_set].map{|set| set[:output] } - params_input = params[:test_set].map{|set| set[:input] } - params_score = params[:test_set].map{|set| set[:score]} - params_test_set = params[:test_set].map{|set| set[:match_rule]} - # 测试集变化则需要更新(输入、 输出、 是否隐藏) - if sets_output != params_output || sets_open != params_hidden || sets_input != params_input || - set_score != params_score || params_test_set != set_match_rule - test_set.delete_all unless test_set.blank? - params[:test_set].each_with_index do |set, index| - # last: 末尾匹配, full: 全完匹配 - logger.info("set: #{set}; match_rule : #{set[:match_rule]}") - match_rule = set[:match_rule] == 'last' ? 'last' : 'full' - TestSet.create(:challenge_id => @challenge.id, - :input => "#{set[:input]}", - :output => "#{set[:output]}", - :is_public => params_hidden[index], - :score => set[:score], - :match_rule => "#{match_rule}", - :position => (index + 1)) + elsif tab == 1 + path = @challenge.path + exec_path = @challenge.exec_path + test_set = @challenge.test_sets + sets_output = test_set.map(&:output) + sets_input = test_set.map(&:input) + sets_open = test_set.map(&:is_public) + set_score = test_set.map(&:score) + set_match_rule = test_set.map(&:match_rule) + params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0} + params_output = params[:test_set].map{|set| set[:output] } + params_input = params[:test_set].map{|set| set[:input] } + params_score = params[:test_set].map{|set| set[:score]} + params_test_set = params[:test_set].map{|set| set[:match_rule]} + # 测试集变化则需要更新(输入、 输出、 是否隐藏) + if sets_output != params_output || sets_open != params_hidden || sets_input != params_input || + set_score != params_score || params_test_set != set_match_rule + test_set.delete_all unless test_set.blank? + params[:test_set].each_with_index do |set, index| + # last: 末尾匹配, full: 全完匹配 + logger.info("set: #{set}; match_rule : #{set[:match_rule]}") + match_rule = set[:match_rule] == 'last' ? 'last' : 'full' + TestSet.create(:challenge_id => @challenge.id, + :input => "#{set[:input]}", + :output => "#{set[:output]}", + :is_public => params_hidden[index], + :score => set[:score], + :match_rule => "#{match_rule}", + :position => (index + 1)) + end + @challenge.update_column(:modify_time, Time.now) + # 测试集的 + @shixun.myshixuns.update_all(:system_tip => 0) end - @challenge.update_column(:modify_time, Time.now) - # 测试集的 - @shixun.myshixuns.update_all(:system_tip => 0) - end - if params[:challenge][:show_type].to_i == -1 - @challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil) + if params[:challenge][:show_type].to_i == -1 + @challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil) + end + # 关卡评测执行文件如果被修改,需要修改脚本内容 + script = modify_shixun_script @shixun, @shixun.evaluate_script + @shixun.shixun_info.update_column(:evaluate_script, script) + # TODO: + # if path != params[:challenge][:path] + # shixun_modify_status_without_publish(@shixun, 1) + # end + #Attachment.attach_files(@challenge, params[:attachments]) end - # 关卡评测执行文件如果被修改,需要修改脚本内容 - script = modify_shixun_script @shixun, @shixun.evaluate_script - @shixun.shixun_info.update_column(:evaluate_script, script) - # TODO: - # if path != params[:challenge][:path] - # shixun_modify_status_without_publish(@shixun, 1) - # end - #Attachment.attach_files(@challenge, params[:attachments]) - end + end + rescue => e + logger_error("##update_challenges: ##{e.message}") + tip_exception("更新失败!") end + end # 参考答案的'增,删,改' diff --git a/db/migrate/20191211073142_modify_type_for_test_sets.rb b/db/migrate/20191211073142_modify_type_for_test_sets.rb new file mode 100644 index 000000000..7b5c8dfef --- /dev/null +++ b/db/migrate/20191211073142_modify_type_for_test_sets.rb @@ -0,0 +1,7 @@ +class ModifyTypeForTestSets < ActiveRecord::Migration[5.2] + def change + change_column :test_sets, :input, :longtext + change_column :test_sets, :output, :longtext + + end +end From e8a1045316d17e0fc7031a3f297c59d1c517cbaf Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 11 Dec 2019 16:10:00 +0800 Subject: [PATCH 03/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9sync=5Ftrustie=5Fjob.rb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/sync_trustie_job.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/jobs/sync_trustie_job.rb b/app/jobs/sync_trustie_job.rb index 33df5b529..dec09debc 100644 --- a/app/jobs/sync_trustie_job.rb +++ b/app/jobs/sync_trustie_job.rb @@ -17,10 +17,17 @@ class SyncTrustieJob < ApplicationJob "number": count } uri = URI.parse(url) + # http = Net::HTTP.new(uri.hostname, uri.port) + if api_host http = Net::HTTP.new(uri.hostname, uri.port) - http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'}) - Rails.logger.info("#######_________response__sync__end_____#########") + + if api_host.include?("https://") + http.use_ssl = true + end + + response = http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'}) + Rails.logger.info("#######_________response__sync__end_____#########{response.body}") end end end From 7b304da2da39d187c4292dbe7347aa168431f285 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 11 Dec 2019 16:13:02 +0800 Subject: [PATCH 04/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9application=5Frecord?= =?UTF-8?q?=E9=87=8C=E7=9A=84allow=5Fsync=5Fto=5Ftrusti?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/application_record.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 60308f4d8..888c65423 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -14,7 +14,6 @@ class ApplicationRecord < ActiveRecord::Base end def allow_sync_to_trustie? - true - # Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net' + Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net' end end From 2fa673229794f6b57cdad67955d5415fc0e8e8a7 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 Dec 2019 17:27:42 +0800 Subject: [PATCH 05/27] =?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/TPMIndex.js | 2 +- .../tpm/TPMsettings/Shixuninformation.js | 204 +++++++++++++++++- 2 files changed, 197 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index f80691d56..9c82e987d 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -20,7 +20,7 @@ import TPMRepositoryComponent from './TPMRepositoryComponent'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; -import TPMsettings from './TPMsettings/oldTPMsettings'; +import TPMsettings from './TPMsettings/TPMsettings'; import TPMChallengeComponent from './TPMChallengeContainer'; import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent'; diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index aa874d8fe..cb18f8b7a 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -43,6 +43,7 @@ class Shixuninformation extends Component { NAME_COUNT: 60, shixunmemoMDvalue: "", language: "java", + testscripttiptype:false } } @@ -54,7 +55,145 @@ class Shixuninformation extends Component { }) } + testscripttip=(val)=>{ + if(val===0){ + this.setState({ + testscripttiptype:true + }) + }else if(val===1){ + this.setState({ + testscripttiptype:false + }) + } + } + + post_apply = () => { + this.setState({ + postapplyvisible: true + }) + } + + + sendhideModaly = () => { + this.setState({ + postapplyvisible: false, + }) + if (this.state.file !== undefined) { + // this.deleteAttachment(this.state.file); + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } else { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } + } + + + sendsure_apply = () => { + let {language, runtime, run_method} = this.state; + + if (!language || language === "") { + // this.props.showNotification(`请填写该镜像是基于什么语言`); + this.setState({ + languagewritetype: true + }) + return + } + if (!runtime || runtime === "") { + // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`); + this.setState({ + systemenvironmenttype: true + }) + return; + + } + if (!run_method || run_method === "") { + // this.props.showNotification(`请填写该镜像中测试代码运行方式`); + this.setState({ + testcoderunmodetype: true + }) + return; + } + + var attachment_ids = undefined; + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + + if (attachment_ids === undefined || attachment_ids.length === 0) { + this.setState({ + attachmentidstype: true + }) + return; + } + + var data = { + language: language, + runtime: runtime, + run_method: run_method, + attachment_id: attachment_ids[0], + } + var url = `/shixuns/apply_shixun_mirror.json`; + axios.post(url, data + ).then((response) => { + + try { + if (response.data) { + + if (this.state.file !== undefined) { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } else { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } + notification.open( + { + message: '提示', + description: + '提交成功!', + + } + ) + this.sendhideModaly() + + } + } catch (e) { + + } + + }) + + } + + render() { console.log(this.props.data) const {getFieldDecorator} = this.props.form; @@ -105,6 +244,8 @@ class Shixuninformation extends Component { }, } + + return (
@@ -179,17 +320,26 @@ class Shixuninformation extends Component { })(
- @@ -319,16 +438,9 @@ class Shixuninformation extends Component { rules: [{required: true, message: '请选择主类别'}], })(
- - { - newshixunlist === undefined ? "" : newshixunlist.small_type.map((item, key) => { - return ( + this.props.data === undefined ? "" : this.props.data.shixun.small_type.map((item, key) => { + return( @@ -408,7 +523,7 @@ class Shixuninformation extends Component { style={{"borderBottom": 'none'}} className="chooseDes pr" > - {getFieldDecorator('select', { + {getFieldDecorator('select123', { rules: [{required: true, message: '请选择评测脚本'}], })(
@@ -638,7 +753,7 @@ class Shixuninformation extends Component { {/**/} - +
- +
); diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index 6d5e3fd4f..c09a3cece 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -589,10 +589,10 @@ class Newshixuns extends Component { )}
- {this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" : + {this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
- {`已安装软件:${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`} - {` 说明:添加了${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`} + {`已安装软件:${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`} + {` 说明:添加了${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`}
}
From 7f885da98deb9ebf7e0f21260c855ae4d5b65103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Dec 2019 21:01:22 +0800 Subject: [PATCH 10/27] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tpm/shixunchild/Challenges/Challengesjupyter.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index dc70ee1ca..cf7243bf1 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -125,15 +125,21 @@ class Challengesjupyter extends Component { console.log("propsysl"); console.log(propsysl); let id=this.props.match.params.shixunId; + var jupyter_port=""; + try{ + jupyter_port= parseInt(propsysl.shixunsDetails.jupyter_port); + }catch (e) { + jupyter_port=propsysl.shixunsDetails.jupyter_port; + } const url=`/shixuns/${id}/update_jupyter.json`; const data={ identifier:id, - jupyter_port:propsysl.shixunsDetails.jupyter_port + jupyter_port:jupyter_port, } axios.post(url, data) .then((result) => { - if (result.data.status == 0) { + if (result.data.status === 0) { this.props.showNotification(`应用成功`); } }).catch((error) => { From 20bff9a125120867d5dae2486fafa519a299511f 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 Dec 2019 21:27:16 +0800 Subject: [PATCH 11/27] =?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/page/VNCContainer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/page/VNCContainer.js b/public/react/src/modules/page/VNCContainer.js index 8164f052a..aa4d82e78 100644 --- a/public/react/src/modules/page/VNCContainer.js +++ b/public/react/src/modules/page/VNCContainer.js @@ -38,9 +38,9 @@ class VNCContainer extends Component { } - shouldComponentUpdate () { - return false; - } + // shouldComponentUpdate () { + // return false; + // } getSecondDrawerWidth = () => { return $('#game_right_contents').width() - firstDrawerWidth @@ -337,11 +337,11 @@ class VNCContainer extends Component { width={firstDrawerWidth} closable={false} onClose={this.onBottomDrawerClose} - visible={this.state.bottomDrawer} + visible={this.state.bottomDrawer===undefined?false:this.state.bottomDrawer} className={'codeEvaluateDrawer'} placement="bottom" getContainer={false} - style={{ position: 'absolute', bottom: '25px', zIndex: 1 }} + style={{ position: 'absolute', bottom: '-25px', zIndex: 1 }} afterVisibleChange={(visible) => { if (visible) { const canvas = $('.vncDisply canvas')[0] From 038a25a45e1bf1947ad5383f20d0fcce1200c3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 12 Dec 2019 00:12:03 +0800 Subject: [PATCH 12/27] =?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/TPMIndex.js | 4 ++- .../tpm/TPMsettings/Shixuninformation.js | 2 +- .../src/modules/tpm/newshixuns/Newshixuns.js | 29 ++++--------------- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index e8730defc..2e28d800e 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -20,7 +20,9 @@ import TPMRepositoryComponent from './TPMRepositoryComponent'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; -import TPMsettings from './TPMsettings/oldTPMsettings'; +import TPMsettings from './TPMsettings/TPMsettings'; + +//import TPMsettings from './TPMsettings/oldTPMsettings'; import TPMChallengeComponent from './TPMChallengeContainer'; import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent'; diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index acd73541b..b274b018f 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -593,7 +593,7 @@ class Shixuninformation extends Component {
{this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
- {`已安装软件:${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`} - {` 说明:添加了${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`} + {`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`已安装软件:`+this.state.mainvalues}`} + {`${this.state.subvalues===undefined||this.state.subvalues=== ""?"":this.state.mainvalues===undefined||this.state.mainvalues=== ""?`已安装软件:`+this.state.subvalues:this.state.subvalues}`} + {`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`说明:添加了`+this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues=== ""?"": + this.state.mainvalues===undefined||this.state.mainvalues=== ""?`说明:添加了`+this.state.subvalues:this.state.subvalues}`}
}
@@ -697,27 +699,6 @@ class Newshixuns extends Component { {/**/} - - -
-

新建申请已提交,请等待管理员的审核

-
  • 我们将在1-2个工作日内与您联系 -
  • -
    -
    - 知道啦 -
    -
    -
    From f1e8ef30369b3ab7be16cff1308ca84310e54cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 12 Dec 2019 09:39:03 +0800 Subject: [PATCH 13/27] =?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/TPMIndex.js | 4 +- .../modules/tpm/TPMsettings/Configuration.js | 2 +- .../tpm/TPMsettings/LearningSettings.js | 2 +- .../tpm/TPMsettings/Shixuninformation.js | 635 +++++++++--------- .../modules/tpm/TPMsettings/TPMsettings.js | 19 +- 5 files changed, 329 insertions(+), 333 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 2e28d800e..0fe17be2e 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -20,9 +20,9 @@ import TPMRepositoryComponent from './TPMRepositoryComponent'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; -import TPMsettings from './TPMsettings/TPMsettings'; +//import TPMsettings from './TPMsettings/TPMsettings'; -//import TPMsettings from './TPMsettings/oldTPMsettings'; +import TPMsettings from './TPMsettings/oldTPMsettings'; import TPMChallengeComponent from './TPMChallengeContainer'; import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent'; diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js index 299f4eb64..2089d1939 100644 --- a/public/react/src/modules/tpm/TPMsettings/Configuration.js +++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js @@ -80,7 +80,7 @@ export default class Shixuninformation extends Component { }) } return ( -
    +
    复制: diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js index 393e0659c..9f99ea5a0 100644 --- a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js +++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js @@ -23,7 +23,7 @@ export default class Shixuninformation extends Component { render() { return ( -
    +
    1111
    ); diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index b274b018f..1e6980216 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -62,7 +62,8 @@ class Shixuninformation extends Component { shixunName:this.props.data.shixun.name, trainee:this.props.data.shixun.trainee, choice_main_type:this.props.data.shixun.choice_main_type, - choice_small_type:this.props.data.shixun.choice_small_type + choice_small_type:this.props.data.shixun.choice_small_type, + choice_standard_scripts:this.props.data.shixun.choice_standard_scripts, }) this.props.form.setFieldsValue({ @@ -315,7 +316,7 @@ class Shixuninformation extends Component { let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false; console.log(operateauthority) const {getFieldDecorator} = this.props.form; - const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, postapplytitle, postapplyvisible, shixunmemoMDvalue} = this.state; + const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state; const {shixun_service_configs}=this.props; const uploadProps = { width: 600, @@ -366,139 +367,140 @@ class Shixuninformation extends Component { return (
    -
    - - {getFieldDecorator('name', { - rules: [{ - required: true, message: '请输入选题名称', - }, { - max: 60, message: '请输入名称,最大限制60个字符', - }, { - whitespace: true, message: '请勿输入空格' - }], - })( - - )} - - - - - - - - - {getFieldDecorator('trainee', { - rules: [{required: true, message: '请选择难易度'}], - })( -
    - - -
    - )} - (实训的难易程度) -
    - - -
    - - {getFieldDecorator('selectleft', { - rules: [{required: true, message: '请选择主类别'}], +
    + + + {getFieldDecorator('name', { + rules: [{ + required: true, message: '请输入选题名称', + }, { + max: 60, message: '请输入名称,最大限制60个字符', + }, { + whitespace: true, message: '请勿输入空格' + }], + })( + + )} + + + + + + + + + {getFieldDecorator('trainee', { + rules: [{required: true, message: '请选择难易度'}], })( -
    - - option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 - } + onChange={this.Selectthestudent} + value={this.state.trainee} > - - { - this.props.data === undefined ? "" : this.props.data.shixun.main_type.map((item, key) => { - return ( - - ) - }) - } + + + +
    )} -
    - - + (实训的难易程度) + + + +
    + + {getFieldDecorator('selectleft', { + rules: [{required: true, message: '请选择主类别'}], + })( +
    + - -
    - {getFieldDecorator('selectright', { - rules: [{required: true, message: '请选择小类别'}], - })( -
    - -
    - )} - +
    + )} +
    + + + + +
    + {getFieldDecorator('selectright', { + rules: [{required: true, message: '请选择小类别'}], + })( +
    + +
    + )} +
    已安装软件:hadoop3.1.0、jdk1.8; @@ -508,44 +510,49 @@ class Shixuninformation extends Component {
    -
    -
    +
    +
    -
    -
    - 没有实验环境? - 申请新建 -
    +
    +
    + 没有实验环境? + 申请新建 +
    - - {getFieldDecorator('select123', { - rules: [{required: true, message: '请选择评测脚本'}], - })( -
    - + + {getFieldDecorator('select123', { + rules: [{required: true, message: '请选择评测脚本'}], + })( +
    + +
    + )} + 使用自定义脚本 this.testscripttip(0)}>
    + style={{top: '33px', left: '-15px',width: '450px',zIndex: '10',display: this.state.testscripttiptype===true?'block':"none"}}> : ""} - - -
    -
  • - - -
  • -
    {this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
    -
  • - - -
  • -
    {this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
    -
  • - - - -
  • -
    {this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
    -
  • - -
    - - - 上传附件 - (单个文件50M以内) - - -
    - -
  • -
    - {this.state.attachmentidstype === true ? "请上传附件" : ""} -
    -
  • - this.sendhideModaly()} - >取消 - -
  • -
    -
    - {/**/} -
    + } + : ""} + + +
    +
  • + + +
  • +
    {this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
    +
  • + + +
  • +
    {this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
    +
  • + + + +
  • +
    {this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
    +
  • + +
    + + + 上传附件 + (单个文件50M以内) + + +
    - - -
    -

    新建申请已提交,请等待管理员的审核

    -
  • 我们将在1-2个工作日内与您联系
  • +
    + {this.state.attachmentidstype === true ? "请上传附件" : ""} +
    +
  • + this.sendhideModaly()} + >取消 + +
  • +
    -
    - 知道啦 -
    -
    - - + {/**/} + +
    +
    + ); } } diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index 224339998..c405e3e9f 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -83,9 +83,21 @@ export default class TPMsettings extends Component { render() { return ( -
    -
    +
    +
    - - -
    ); } } From 5977fa4a24947d9678ab363ce832f53904eb8616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 12 Dec 2019 09:40:27 +0800 Subject: [PATCH 14/27] =?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/tpm/TPMChallengeContainer.js | 4 ++-- public/react/src/modules/tpm/TPMDataset.js | 8 ++++--- .../Challenges/Challengesjupyter.js | 23 +++++++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/tpm/TPMChallengeContainer.js b/public/react/src/modules/tpm/TPMChallengeContainer.js index d58a17e55..9fc1f44f4 100644 --- a/public/react/src/modules/tpm/TPMChallengeContainer.js +++ b/public/react/src/modules/tpm/TPMChallengeContainer.js @@ -15,8 +15,8 @@ class TPMChallengeContainer extends Component { render() { const { tpmLoading } = this.props; const user = this.props.current_user; - console.log("TPMChallengeContainerTPMChallengeContainer"); - console.log(this.props); + // console.log("TPMChallengeContainerTPMChallengeContainer"); + // console.log(this.props); return ( diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index d7f14b84e..897fbe221 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -103,8 +103,8 @@ class TPMDataset extends Component { selectedRowKeysdata:mydata, selectedRowKeys: datas, }) - console.log(mydata); - console.log(datas); + // console.log(mydata); + // console.log(datas); } else { @@ -237,6 +237,7 @@ class TPMDataset extends Component { // 附件相关 START handleChange = (info) => { + debugger if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { let {fileList} = this.state; @@ -256,6 +257,7 @@ class TPMDataset extends Component { } onAttachmentRemove = (file) => { + debugger if(!file.percent || file.percent == 100){ confirm({ title: '确定要删除这个附件吗?', @@ -357,7 +359,7 @@ class TPMDataset extends Component { onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file, fileList) => { - + debugger if (this.state.fileList.length >= 1) { return false } diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index cf7243bf1..86e7f2c04 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -60,11 +60,26 @@ class Challengesjupyter extends Component { componentDidMount() { setTimeout(this.ChallengesList(), 1000); + // console.log("componentDidMount"); + // console.log("Challengesjupyter"); + // console.log(this.props); + let id = this.props.match.params.shixunId; + let ChallengesURL = `/jupyters/get_info_with_tpm.json`; + let datas={ + identifier:id, + } + axios.get(ChallengesURL, {params: datas}).then((response) => { + if (response.status === 200) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - console.log("componentDidMount"); - console.log("Challengesjupyter"); - console.log(this.props); - + }else{ + console.log("componentDidMountChallengesjupyter"); + console.log(response.data); + } + } + }).catch((error) => { + console.log(error) + }); From 187925a71ba9dd2fb2038479b3eb08b85b7f186d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 12 Dec 2019 09:46:36 +0800 Subject: [PATCH 15/27] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=88=86=E7=8F=AD?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=88=90=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/export_helper.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 31e1ecf45..12f1ccdae 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -163,9 +163,12 @@ module ExportHelper count_2 = common_homeworks.size count_3 = group_homeworks.size count_4 = tasks.size + + all_user_ids = all_members.pluck(:user_id) + #实训作业 shixun_homeworks.each_with_index do |s,index| - all_student_works = s.score_student_works #该实训题的全部用户回答 + all_student_works = s.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #该实训题的全部用户回答 title_no = index.to_i + 1 student_work_to_xlsx(all_student_works,s) shixun_work_display_name = format_sheet_name (title_no.to_s + "." + s.name).strip.first(30) @@ -175,7 +178,7 @@ module ExportHelper #普通作业 common_homeworks.each_with_index do |c,index| - all_student_works = c.score_student_works #当前用户的对该作业的回答 + all_student_works = c.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答 title_no = count_1 + index.to_i + 1 student_work_to_xlsx(all_student_works,c) @@ -187,7 +190,7 @@ module ExportHelper #分组作业 group_homeworks.each_with_index do |c,index| - all_student_works = c.score_student_works #当前用户的对该作业的回答 + all_student_works = c.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答 title_no = count_1 + count_2 + index.to_i + 1 student_work_to_xlsx(all_student_works,c) work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30) @@ -197,7 +200,7 @@ module ExportHelper #毕设任务 tasks.each_with_index do |c,index| - all_student_works = c.score_graduation_works #当前用户的对该作业的回答 + all_student_works = c.score_graduation_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答 title_no = count_1 + count_2 + count_3 + index.to_i + 1 graduation_work_to_xlsx(all_student_works,c,current_user) work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30) @@ -207,7 +210,7 @@ module ExportHelper #试卷的导出 exercises.each_with_index do |c,index| - all_student_works = c.score_exercise_users #当前用户的对该作业的回答 + all_student_works = c.score_exercise_users.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答 title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1 get_export_users(c,course,all_student_works) work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30) From bd6263f907efa0d919480933d7363a3db2dc7017 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Dec 2019 09:46:38 +0800 Subject: [PATCH 16/27] =?UTF-8?q?jupyter=E5=AE=9E=E8=AE=AD=E5=BC=80?= =?UTF-8?q?=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 9 +- app/controllers/shixuns_controller.rb | 147 +++++-------------- app/views/games/jupyter.json.jbuilder | 5 + app/views/shixuns/jupyter_exec.json.jbuilder | 1 + config/routes.rb | 2 + 5 files changed, 54 insertions(+), 110 deletions(-) create mode 100644 app/views/games/jupyter.json.jbuilder create mode 100644 app/views/shixuns/jupyter_exec.json.jbuilder diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 3f7a451fd..f4a914673 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -1,6 +1,6 @@ class GamesController < ApplicationController before_action :require_login, :check_auth - before_action :find_game + before_action :find_game, except: [:jupyter] before_action :find_shixun, only: [:show, :answer, :rep_content, :choose_build, :game_build, :game_status] before_action :allowed @@ -88,6 +88,13 @@ class GamesController < ApplicationController end end + + def jupyter + # Jupyter没有challenge + @myshixun = Myshixun.find_by_identifier params[:identifier] + @shixun = @myshixun.shixun + end + def reset_vnc_link begin # 删除vnc的pod diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index a3030001c..61c549d9c 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -6,16 +6,17 @@ class ShixunsController < ApplicationController before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list, :discusses, :collaborators, :fork_list, :propaedeutics] - before_action :check_account, only: [:new, :create, :shixun_exec] + before_action :check_account, only: [:new, :create, :shixun_exec, :jupyter_exec] before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, :departments, :apply_shixun_mirror, :get_mirror_script, :download_file, :shixun_list, :batch_send_to_course] before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, - :propaedeutics, :departments, :apply_shixun_mirror, + :propaedeutics, :departments, :apply_shixun_mirror, :jupyter_exec, :get_mirror_script, :download_file, :shixun_list, :batch_send_to_course] - before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file] + before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, + :add_file, :jupyter_exec] before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :shixun_members_added, :change_manager, :collaborators_delete, @@ -684,112 +685,40 @@ class ShixunsController < ApplicationController end end - # def shixun_exec - # if is_shixun_opening? - # tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") - # end - # current_myshixun = @shixun.current_myshixun(current_user.id) - # - # min_challenges = @shixun.challenges.pluck(:id , :st) - # # 因为读写分离有延迟,所以如果是重置来的请求可以先跳过,重置过来的params[:reset]为1 - # if current_myshixun && params[:reset] != "1" - # games = current_myshixun.games - # # 如果TPM和TPI的管卡数不相等或者关卡顺序错了,说明实训被极大的改动,需要重置,实训发布前打过的实训都需要重置 - # if is_shixun_reset?(games, min_challenges, current_myshixun) - # # 这里页面弹框要收到 当前用户myshixun的identifier. - # tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game") - # end - # - # - # if current_myshixun.repo_name.nil? - # g = Gitlab.client - # repo_name = g.project(current_myshixun.gpid).try(:path_with_namespace) - # current_myshixun.update_column(:repo_name, repo_name) - # end - # - # # 如果存在实训,则直接进入实训 - # # 如果实训允许跳关,传参params[:challenge_id]跳入具体的关卡 - # @current_task = - # if params[:challenge_id] - # game = games.where(challenge_id: params[:challenge_id]).take - # if @shixun.task_pass || game.status != 3 - # game - # else - # current_myshixun.current_task(games) - # end - # else - # current_myshixun.current_task(games) - # end - # else - # # 如果未创建关卡一定不能开启实训,否则TPI没法找到当前的关卡 - # if @shixun.challenges_count == 0 - # tip_exception("开启实战前请先创建实训关卡") - # end - # - # # 判断实训是否全为选择题 - # is_choice_type = (min_challenges.size == min_challenges.select{|challenge| challenge.last == 1}.count) - # if !is_choice_type - # commit = GitService.commits(repo_path: @repo_path).try(:first) - # uid_logger("First comit########{commit}") - # tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? - # commit_id = commit["id"] - # end - # - # begin - # ActiveRecord::Base.transaction do - # begin - # myshixun_identifier = generate_identifier Myshixun, 10 - # myshixun_params = {user_id: current_user.id, identifier: myshixun_identifier, - # modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, - # onclick_time: Time.now, commit_id: commit_id} - # @myshixun = @shixun.myshixuns.create!(myshixun_params) - # # 其它创建关卡等操作 - # challenges = @shixun.challenges - # # 之所以增加user_id是为了方便统计查询性能 - # game_attrs = %i[challenge_id myshixun_id status user_id open_time identifier modify_time created_at updated_at] - # Game.bulk_insert(*game_attrs) do |worker| - # base_attr = {myshixun_id: @myshixun.id, user_id: @myshixun.user_id} - # challenges.each_with_index do |challenge, index| - # status = (index == 0 ? 0 : 3) - # game_identifier = generate_identifier(Game, 12) - # worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now, - # identifier: game_identifier, modify_time: challenge.modify_time)) - # end - # end - # @current_task = @myshixun.current_task(@myshixun.games) - # rescue Exception => e - # logger.error("------ActiveRecord::RecordInvalid: #{e.message}") - # raise("ActiveRecord::RecordInvalid") - # end - # end - # # 如果实训是纯选择题,则不需要去fork仓库以及中间层的相关操作了 - # ActiveRecord::Base.transaction do - # unless is_choice_type - # # fork仓库 - # cloud_bridge = edu_setting('cloud_bridge') - # project_fork(@myshixun, @repo_path, current_user.login) - # rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) - # uid_logger("start openGameInstance") - # uri = "#{cloud_bridge}/bridge/game/openGameInstance" - # logger.info("end openGameInstance") - # params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last} - # uid_logger("openGameInstance params is #{params}") - # interface_post uri, params, 83, "实训云平台繁忙(繁忙等级:83)" - # end - # end - # rescue Exception => e - # logger.info("shixun_exec error: #{e.message}") - # if e.message != "ActiveRecord::RecordInvalid" - # logger.error("##########project_fork error #{e.message}") - # @myshixun.destroy! - # end - # raise "实训云平台繁忙(繁忙等级:81)" - # end - # end - # end - - # gameID 及实训ID - # status: 0 , 1 申请过, 2,实训关卡路径未填, 3 实训标签未填, 4 实训未创建关卡 + # jupyter开启挑战 + def jupyter_exec + begin + if is_shixun_opening? + tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") + end + current_myshixun = @shixun.current_myshixun(current_user.id) + if current_myshixun + @myshixun = current_myshixun + else + commit = GitService.commits(repo_path: @repo_path).try(:first) + uid_logger("First comit########{commit}") + tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? + commit_id = commit["id"] + cloud_bridge = edu_setting('cloud_bridge') + myshixun_identifier = generate_identifier Myshixun, 10 + ActiveRecord::Base.transaction do + @myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, + modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, + onclick_time: Time.now, commit_id: commit_id) + # fork仓库 + project_fork(@myshixun, @repo_path, current_user.login) + rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) + uri = "#{cloud_bridge}/bridge/game/openGameInstance" + params = {tpiID: "#{myshixun.id}", tpmGitURL: rep_url, tpiRepoName: myshixun.repo_name.split("/").last} + interface_post uri, params, 83, "实训云平台繁忙(繁忙等级:83)" + end + end + rescue => e + uid_logger_error(e.message) + tip_exception("实训云平台繁忙(繁忙等级:81)") + end + end + def publish @status = 0 @position = [] diff --git a/app/views/games/jupyter.json.jbuilder b/app/views/games/jupyter.json.jbuilder new file mode 100644 index 000000000..0714e9eca --- /dev/null +++ b/app/views/games/jupyter.json.jbuilder @@ -0,0 +1,5 @@ +json.user do + json.partial! 'users/user', user: current_user +end + +json.(@shixun, :id, :identifier, :status, :name) \ No newline at end of file diff --git a/app/views/shixuns/jupyter_exec.json.jbuilder b/app/views/shixuns/jupyter_exec.json.jbuilder new file mode 100644 index 000000000..44e5c979a --- /dev/null +++ b/app/views/shixuns/jupyter_exec.json.jbuilder @@ -0,0 +1 @@ +json.identifier @myshixun.identifier \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index c3498adac..a813109bd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -205,6 +205,7 @@ Rails.application.routes.draw do get :check_test_sets get :unlock_choose_answer get :get_choose_answer + get :jupyter end collection do @@ -264,6 +265,7 @@ Rails.application.routes.draw do post :update_permission_setting post :update_learn_setting get :jupyter_data_sets + get :jupyter_exec end resources :challenges do From 77e3f5b46ac5997f9480e21bce2c76a0dc9fff52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 12 Dec 2019 09:53:45 +0800 Subject: [PATCH 17/27] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Challenges/Challengesjupyter.js | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 86e7f2c04..2eb692f58 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -75,6 +75,16 @@ class Challengesjupyter extends Component { }else{ console.log("componentDidMountChallengesjupyter"); console.log(response.data); + if(response.data.status===0){ + this.setState({ + jupyter_url:response.data.url, + jupyter_port:response.data.port, + }) + + + }else{ + + } } } }).catch((error) => { @@ -142,9 +152,9 @@ class Challengesjupyter extends Component { let id=this.props.match.params.shixunId; var jupyter_port=""; try{ - jupyter_port= parseInt(propsysl.shixunsDetails.jupyter_port); + jupyter_port= parseInt(this.state.jupyter_port); }catch (e) { - jupyter_port=propsysl.shixunsDetails.jupyter_port; + jupyter_port=this.state.jupyter_port; } const url=`/shixuns/${id}/update_jupyter.json`; @@ -242,13 +252,22 @@ class Challengesjupyter extends Component { ` } + { + this.props.jupyter_url === null || this.props.jupyter_url === undefined ? + "" + : +
    +
    +

    任务详情

    +

    示例

    +
    +
    +
    this.modifyjupyter(this.props)}>

    应用到实训

    +
    +
    + } -
    -
    -

    任务详情

    示例

    -
    -
    this.modifyjupyter(this.props)}>

    应用到实训

    -
    */} -
      -
    • - 学习人数 - {shixunsDetails.stu_num} -
    • - {/*
    • */} - {/*经验值*/} - {/*{shixunsDetails.experience}*/} - {/*
    • */} -
    • - 难度级别 - {shixunsDetails.diffcult} - -
    • +

      +
      + {/**/} +
        +
      • + 学习人数 + {shixunsDetails.stu_num} +
      • + {/*
      • */} + {/*经验值*/} + {/*{shixunsDetails.experience}*/} + {/*
      • */} +
      • + 难度级别 + {shixunsDetails.diffcult} + +
      -
      this.showonMouseOver()} onMouseOut={()=>this.hideonMouseOut()}> -
      学员评分
      -
      - -
      -
      this.hideonMouseOut()}> -
      - -
      -
      -
      +
      this.showonMouseOver()} + onMouseOut={() => this.hideonMouseOut()}> +
      学员评分
      +
      + +
      +
      this.hideonMouseOut()}> +
      + +
      +
      +
      {star_infos[0]}分 - 总评分 -
      - {showradios === true ? - - : ""} -
      -
      -
      -
      -
      -
      - {showradios === true ? - - : ""} -
      - - {star_infos[1]}% -
      -
      -
      - {showradios === true ? - - : ""} -
      - - {star_infos[2]}% -
      -
      -
      - {showradios === true ? - - : ""} -
      - - {star_infos[3]}% -
      -
      -
      - {showradios === true ? - - : ""} -
      - - {star_infos[4]}% -
      -
      -
      - {showradios === true ? - - : ""} -
      - - {star_infos[5]}% -
      -
      + className="font-24 color-yellow-ff lineh-20 mb10 ml20">{star_infos[0]}分 + 总评分 +
      + {showradios === true ? + + : ""}
      +
      +
      +
      +
      + {showradios === true ? + + : ""} +
      + + {star_infos[1]}% +
      +
      +
      + {showradios === true ? + + : ""} +
      + + {star_infos[2]}% +
      +
      +
      + {showradios === true ? + + : ""} +
      + + {star_infos[3]}% +
      +
      +
      + {showradios === true ? + + : ""} +
      + + {star_infos[4]}% +
      +
      +
      + {showradios === true ? + + : ""} +
      + + {star_infos[5]}% +
      +
      +
      +
      { - startbtn === false && shixunsDetails.shixun_status != -1 ? - - this.startshixunCombat(this.props.match.params.shixunId)} - className="fr user_default_btn task-btn-orange font-18" - id="shixun_operation" data-remote="true" - > - {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.shixun_status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} - - - : "" + startbtn === false && shixunsDetails.shixun_status != -1 ? + + this.startshixunCombat(this.props.match.params.shixunId)} + className="fr user_default_btn task-btn-orange font-18" + id="shixun_operation" data-remote="true" + > + {shixunsDetails.task_operation === undefined ? "" : shixunsDetails.shixun_status > 1 ? shixunsDetails.task_operation[0] : "模拟实战"} + + + : "" } -
      -

      目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!

      -
      -
      - {/*取消*/} - 知道啦 -
      - {/*

      */} - {/*知道了*/} - {/*

      */} +
      +

      目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!

      +
      +
      + {/*取消*/} + 知道啦 +
      + {/*

      */} + {/*知道了*/} + {/*

      */}
      - +
      -

      实训已经更新了,正在为您重置!

      +

      实训已经更新了,正在为您重置!

      -
      +
      - + { - startbtn === true ? - 开启中 : "" + startbtn === true ? + 开启中 : "" } {/*{*/} @@ -815,172 +903,173 @@ class TPMBanner extends Component { {/*}*/} {shixunsDetails.shixun_status === 0 && this.props.identity < 5 ? - 申请发布 : "" + 申请发布 : "" } - { - publishboxstatus === 0 ?
      -

      - 发布申请已提交,请等待管理员的审核
      -

      -
      : publishboxstatus === 1 ? -
      -

      - 发布申请已提交,请等待管理员的审核
      - • 我们将在1-2个工作日内完成审核 -

      -
      : publishboxstatus === 2 ?
      -

      - 第 - { - evaluation_set_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关评测设置尚未完成,无法申请发布 -

      -
      : publishboxstatus === 3 ? -
      -

      - 每一个关卡至少需要一个技能标签
      - 第 - { - tag_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关尚未设置技能标签,请补充 -

      -
      : -
      -

      - 尚未创建任务的实训,不能申请发布 -

      -
      - } - + { + publishboxstatus === 0 ?
      +

      + 发布申请已提交,请等待管理员的审核
      +

      +
      : publishboxstatus === 1 ? +
      +

      + 发布申请已提交,请等待管理员的审核
      + • 我们将在1-2个工作日内完成审核 +

      +
      : publishboxstatus === 2 ?
      +

      + 第 + { + evaluation_set_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关评测设置尚未完成,无法申请发布 +

      +
      : publishboxstatus === 3 ? +
      +

      + 每一个关卡至少需要一个技能标签
      + 第 + { + tag_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关尚未设置技能标签,请补充 +

      +
      : +
      +

      + 尚未创建任务的实训,不能申请发布 +

      +
      + } +
      {shixunsDetails.shixun_status === 1 && this.props.identity < 5 ? - 撤销发布 : "" + 撤销发布 : "" } { - - - 发送至 - - + + + 发送至 + + } -
      -
      - -
      - 选择的实训将会发送到指定课堂 -
      - -
      - this.SenttotheSearch(value)} - style={{width: '100%'}} - /> -
      - - -
      12?"cdefault ":"cdefault "}> -
      -
        - - { - course_list === undefined ? "" : course_list.map((item, key) => { - return ( - {item.name} - ) - }) - } - -
      -
      -
      - {this.state.Senttothevcaluetype===true?
      请选择你要发送的课堂
      :""} -
      12 ? "block" : "none"}}> - -
      - -
      -
      -
      -
      - 取消 - 确定 -
      + + +
      12 ? "cdefault " : "cdefault "}> +
      +
        + + { + course_list === undefined ? "" : course_list.map((item, key) => { + return ( + {item.name} + ) + }) + } + +
      +
      +
      + {this.state.Senttothevcaluetype === true ?
      请选择你要发送的课堂
      : ""} +
      12 ? "block" : "none"}}> + +
      + +
      +
      +
      +
      + 取消 + 确定 +
      -
      +
      -
      +
      {shixunsDetails.shixun_status === 3 && 已关闭 } - {shixunsDetails.shixun_status === -1 && - 已删除 - } + {shixunsDetails.shixun_status === -1 && + 已删除 + } - {this.props.identity < 8&&shixunsDetails.shixun_status != -1 ?
      - + {this.props.identity < 8 && shixunsDetails.shixun_status != -1 ? +
      + - - {Forkvisibletype===true? + {Forkvisibletype === true ? - : + :
      -

      复制将在后台执行,平台将为你创建
      一个新的同名实训和内容,请问是否继续?

      -
      -
      - 取消 - 确定 -
      +

      复制将在后台执行,平台将为你创建
      一个新的同名实训和内容,请问是否继续?

      +
      +
      + 取消 + 确定 +
      } @@ -1017,40 +1106,41 @@ class TPMBanner extends Component {
      -

      {can_fork}
      请问是否前往进行认证?

      -
      -
      - 取消 - 确定 -
      +

      {can_fork}
      请问是否前往进行认证?

      +
      +
      + 取消 + 确定 +
      {!!shixunsDetails.fork_num && - {shixunsDetails.fork_num} + {shixunsDetails.fork_num} } -
      :""} +
      : ""} + +
      +
      +
      正在等待管理员的审核。在审核通过前,可以随时撤销发布 +
      -
    -
    正在等待管理员的审核。在审核通过前,可以随时撤销发布
    -
    - - ); - } + ); + } } export default TPMBanner; diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index 1e6980216..b72a4e43f 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -64,6 +64,7 @@ class Shixuninformation extends Component { choice_main_type:this.props.data.shixun.choice_main_type, choice_small_type:this.props.data.shixun.choice_small_type, choice_standard_scripts:this.props.data.shixun.choice_standard_scripts, + shixunmemoMDvalue:this.props.data.shixun.evaluate_script, }) this.props.form.setFieldsValue({ @@ -316,7 +317,10 @@ class Shixuninformation extends Component { let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false; console.log(operateauthority) const {getFieldDecorator} = this.props.form; - const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state; + const {languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state; + + console.log("1222") + console.log(choice_standard_scripts) const {shixun_service_configs}=this.props; const uploadProps = { width: 600, @@ -478,6 +482,7 @@ class Shixuninformation extends Component { })(