From feca7e315812f70aa8feaaa4d89a172d7d605194 Mon Sep 17 00:00:00 2001 From: SylorHuang <sylor_huang@126.com> Date: Wed, 11 Dec 2019 15:33:19 +0800 Subject: [PATCH 01/14] =?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/14] =?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 <sylor_huang@126.com> Date: Wed, 11 Dec 2019 16:10:00 +0800 Subject: [PATCH 03/14] =?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 <sylor_huang@126.com> Date: Wed, 11 Dec 2019 16:13:02 +0800 Subject: [PATCH 04/14] =?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 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 05/14] =?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 187925a71ba9dd2fb2038479b3eb08b85b7f186d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 12 Dec 2019 09:46:36 +0800 Subject: [PATCH 06/14] =?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 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 07/14] =?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 { ` } </style> + { + this.props.jupyter_url === null || this.props.jupyter_url === undefined ? + "" + : + <div className="sortinxdirection mt60"> + <div className="renwuxiangssi sortinxdirection"> + <div><p className="renwuxiangqdiv">任务详情</p></div> + <div><p className="renwuxiangqdivtest ml24">示例</p></div> + </div> + <div className="renwuxiangssit xaxisreverseorder"> + <div className="challenbaocun" onClick={() => this.modifyjupyter(this.props)}><p + className="challenbaocuntest">应用到实训</p></div> + </div> + </div> + } - <div className="sortinxdirection mt60"> - <div className="renwuxiangssi sortinxdirection"> - <div><p className="renwuxiangqdiv">任务详情</p></div> <div><p className="renwuxiangqdivtest ml24">示例</p></div> - </div> - <div className="renwuxiangssit xaxisreverseorder"><div className="challenbaocun" onClick={()=>this.modifyjupyter(this.props)}><p className="challenbaocuntest">应用到实训</p></div></div> - </div> <style> { ` @@ -275,18 +294,13 @@ class Challengesjupyter extends Component { <div className="pb47"> { - this.props.shixunsDetails===null || this.props.shixunsDetails===undefined||JSON.stringify(this.props.shixunsDetails)==="{}"? + this.props.jupyter_url===null || this.props.jupyter_url===undefined? "" : - ( - this.props&&this.props.shixunsDetails&&this.props.shixunsDetails.jupyter_url? - <iframe src={this.props.shixunsDetails.jupyter_url} + <iframe src={this.props.jupyter_url} sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame" name="framename" width="100%" height="700" frameBorder="0" ></iframe> - :"" - ) - } </div> </div> From 7b84e17ede891c28b88b28a77e12f07241aaf32c 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:56:37 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/tpm/shixunchild/Challenges/Challengesjupyter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 2eb692f58..bf2550a62 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -147,8 +147,8 @@ class Challengesjupyter extends Component { }; modifyjupyter=(propsysl)=>{ - console.log("propsysl"); - console.log(propsysl); + // console.log("propsysl"); + // console.log(propsysl); let id=this.props.match.params.shixunId; var jupyter_port=""; try{ @@ -157,7 +157,7 @@ class Challengesjupyter extends Component { jupyter_port=this.state.jupyter_port; } - const url=`/shixuns/${id}/update_jupyter.json`; + const url=`/jupyters/save_with_tpm.json`; const data={ identifier:id, jupyter_port:jupyter_port, From e5dd56c435dc1055559aaee6cb94d63fb30946fe 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 10:03:07 +0800 Subject: [PATCH 09/14] =?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/TPMDataset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index 897fbe221..91322d18e 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -89,7 +89,7 @@ class TPMDataset extends Component { } mysonChange = (e) => { - console.log(`全选checked = ${e.target.checked}`); + // console.log(`全选checked = ${e.target.checked}`); if (e.target.checked === true) { let mydata=[]; let datas=[]; From 2563ab1401e60381f22997608d0c13367ba589de 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 10:16:51 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E5=BC=80=E5=90=AF=E8=B0=83=E6=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 2 +- public/react/src/modules/tpm/TPMBanner.js | 1802 +++++++++-------- .../tpm/TPMsettings/Shixuninformation.js | 7 +- .../modules/tpm/TPMsettings/TPMsettings.js | 2 +- .../Challenges/Challengesjupyter.js | 4 +- 5 files changed, 956 insertions(+), 861 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index dad5993e9..55569e072 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -52,7 +52,7 @@ export function initAxiosInterceptors(props) { //proxy="http://47.96.87.25:48080" proxy="https://pre-newweb.educoder.net" proxy="https://test-newweb.educoder.net" - //proxy="http://192.168.2.63:3001" + proxy="https://test-jupyterweb.educoder.net" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index d025443cf..f405aece6 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -1,16 +1,16 @@ -import React, { Component } from 'react'; +import React, {Component} from 'react'; -import { Redirect } from 'react-router'; +import {Redirect} from 'react-router'; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; import PropTypes from 'prop-types'; -import { Rating ,Progress} from "@icedesign/base"; +import {Rating, Progress} from "@icedesign/base"; -import {Modal,Input,Radio,Pagination,message,Spin,Icon,Tooltip,Rate} from 'antd'; +import {Modal, Input, Radio, Pagination, message, Spin, Icon, Tooltip, Rate} from 'antd'; -import AccountProfile from"../user/AccountProfile"; +import AccountProfile from "../user/AccountProfile"; import 'antd/lib/pagination/style/index.css'; @@ -27,516 +27,599 @@ const Search = Input.Search; const RadioGroup = Radio.Group; class TPMBanner extends Component { - constructor(props) { - super(props) - this.state={ - Forkvisible: false, - Senttothetype:false, - Senttothevcalue:undefined, - courses_count:1, - course_list:[], - pagenum:1, - publishbox:"", - publishboxstatus:0, - pages:1, - Issuevisible:false, - evaluation_set_position:[], - tag_position:[], - Forkauthentication:false, - can_fork:undefined, - certi_url:undefined, - showradios:false, - startbtn:false, - Searchvalue:"", - startshixunCombattype:false, - shixunsmessage:"", - shixunsreplace:false, - hidestartshixunsreplacevalue:"", - isIE:false, - Forkvisibletype: false, - isSpin:false, - Senttothevcaluetype:false, - jupyterbool:false, - } - } - - // star_info:[0, 0, 0, 0, 0, 0], - // star_infos:[0, 0, 0, 0, 0, 0], - // shixunsDetails:{}, - // shixunId: undefined, - // componentWillReceiveProps(newProps, newContext){ - // this.setState({ - // shixunsDetails: newProps.shixunsDetails - // }); - // } - - IEVersion=()=>{ - var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 - var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 - var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 - var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; - if(isIE) { - var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); - reIE.test(userAgent); - var fIEVersion = parseFloat(RegExp["$1"]); - if(fIEVersion == 7) { - return 7; - } else if(fIEVersion == 8) { - return 8; - } else if(fIEVersion == 9) { - return 9; - } else if(fIEVersion == 10) { - return 10; - } else { - return 6;//IE版本<=7 - } - } else if(isEdge) { - return 'edge';//edge - } else if(isIE11) { - return 11; //IE11 - }else{ - return -1;//不是ie浏览器 - } + constructor(props) { + super(props) + this.state = { + Forkvisible: false, + Senttothetype: false, + Senttothevcalue: undefined, + courses_count: 1, + course_list: [], + pagenum: 1, + publishbox: "", + publishboxstatus: 0, + pages: 1, + Issuevisible: false, + evaluation_set_position: [], + tag_position: [], + Forkauthentication: false, + can_fork: undefined, + certi_url: undefined, + showradios: false, + startbtn: false, + Searchvalue: "", + startshixunCombattype: false, + shixunsmessage: "", + shixunsreplace: false, + hidestartshixunsreplacevalue: "", + isIE: false, + Forkvisibletype: false, + isSpin: false, + Senttothevcaluetype: false, + jupyterbool: false, } - componentDidMount() { - let thiisie=this.IEVersion(); - if(thiisie!=-1){ - this.setState({ - isIE:true - }) - }else{ - this.setState({ - isIE:false - }) + } + + // star_info:[0, 0, 0, 0, 0, 0], + // star_infos:[0, 0, 0, 0, 0, 0], + // shixunsDetails:{}, + // shixunId: undefined, + // componentWillReceiveProps(newProps, newContext){ + // this.setState({ + // shixunsDetails: newProps.shixunsDetails + // }); + // } + + IEVersion = () => { + var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串 + var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器 + var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器 + var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1; + if (isIE) { + var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); + reIE.test(userAgent); + var fIEVersion = parseFloat(RegExp["$1"]); + if (fIEVersion == 7) { + return 7; + } else if (fIEVersion == 8) { + return 8; + } else if (fIEVersion == 9) { + return 9; + } else if (fIEVersion == 10) { + return 10; + } else { + return 6;//IE版本<=7 } + } else if (isEdge) { + return 'edge';//edge + } else if (isIE11) { + return 11; //IE11 + } else { + return -1;//不是ie浏览器 } - /* - * Fork - * */ - copyForkvisible = () => { - let {shixunsDetails} = this.props; - if (shixunsDetails.can_fork === null) { - this.setState({ - Forkvisible: true - }) - } else { - this.setState({ - Forkvisible: false, - Forkauthentication: true, - can_fork: shixunsDetails.can_fork.can_fork, - certi_url: shixunsDetails.can_fork.certi_url, - }) - } + } + componentDidMount() { + let thiisie = this.IEVersion(); + if (thiisie != -1) { + this.setState({ + isIE: true + }) + } else { + this.setState({ + isIE: false + }) + } + } + + /* + * Fork + * */ + copyForkvisible = () => { + let {shixunsDetails} = this.props; + if (shixunsDetails.can_fork === null) { + this.setState({ + Forkvisible: true + }) + } else { + this.setState({ + Forkvisible: false, + Forkauthentication: true, + can_fork: shixunsDetails.can_fork.can_fork, + certi_url: shixunsDetails.can_fork.certi_url, + }) } - hideForkvisible = () => { + } + + hideForkvisible = () => { + this.setState({ + Forkvisible: false, + Forkauthentication: false + }) + } + + addForkvisible = () => { + this.setState({ + Forkvisibletype: true, + }) + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/copy.json"; + axios.post(url).then((response) => { + if (response.data.status === 401) { + + } else { this.setState({ - Forkvisible: false, - Forkauthentication:false + Forkvisible: false, + Forkauthentication: false, + // Forkvisibletype:false }) + window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; + } + + }).catch((error) => { + console.log(error) + }); + + } + /* + * 发送至按钮 + * */ + Senttothe = () => { + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return } - addForkvisible = () => { + // if(this.props.checkIfProfileCompleted()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + // + // if(this.props.checkIfProfessionalCertification()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/search_user_courses.json"; + this.setState({ + Senttothetype: true + }) + + axios.get(url, { + params: { + page: 1, + limit: 10 + } + }).then((response) => { this.setState({ - Forkvisibletype: true, + courses_count: response.data.courses_count, + course_list: response.data.course_list }) - let id = this.props.match.params.shixunId; - let url = "/shixuns/" + id + "/copy.json"; - axios.post(url).then((response) => { - if(response.data.status===401){ - - }else{ - this.setState({ - Forkvisible: false, - Forkauthentication: false, - // Forkvisibletype:false - }) - window.location.href = "/shixuns/" + response.data.shixun + "/challenges"; - } + }).catch((error) => { + console.log(error) + }); + } + + SenttotheSearch = (value) => { + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/search_user_courses.json?search=" + value; + axios.get(encodeURI(url), { + params: { + page: 1, + limit: 10 + } + }).then((response) => { + this.setState({ + courses_count: response.data.courses_count, + course_list: response.data.course_list, + pages: 1, + Searchvalue: value + }) + }).catch((error) => { + console.log(error) + }); + } + + onChangeSenttothevcalue = (e) => { + this.setState({ + Senttothevcalue: e.target.value + }) + } + onChangesendeSenttothe = (pageNumber) => { + let {Searchvalue} = this.state; + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/search_user_courses.json?search=" + Searchvalue; + axios.get(url, { + params: { + page: pageNumber, + limit: 10 + } + }).then((response) => { + this.setState({ + courses_count: response.data.courses_count, + course_list: response.data.course_list, + pagenum: pageNumber, + pages: pageNumber + }) + }).catch((error) => { + console.log(error) + }); + } + sendeSenttothevcalue = () => { - }).catch((error) => { - console.log(error) - }); + let {Senttothevcalue} = this.state; + if (Senttothevcalue === undefined) { + this.setState({ + Senttothevcaluetype: true + }) + return } - /* - * 发送至按钮 - * */ - Senttothe=()=>{ - if(this.props.checkIfLogin()===false){ - this.props.showLoginDialog() - return - } - - // if(this.props.checkIfProfileCompleted()===false){ - // this.setState({ - // AccountProfiletype:true - // }) - // return - // } - // - // if(this.props.checkIfProfessionalCertification()===false){ - // this.setState({ - // AccountProfiletype:true - // }) - // return - // } - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json"; - this.setState({ - Senttothetype:true - }) + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/send_to_course.json"; + axios.post(url, { + course_id: Senttothevcalue + }).then((response) => { - axios.get(url, { - params: { - page:1, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list - }) - }).catch((error) => { - console.log(error) - }); + this.props.showSnackbar(response.data.message); + this.setState({ + Senttothetype: false, + Searchvalue: "", + pages: 1 + }) + // window.location.href = response.data.url; + // response.data.course_id + this.props.history.replace(response.data.first_category_url); + + }).catch((error) => { + console.log(error) + }); + + } + + hideSenttothevcalue = () => { + this.setState({ + Senttothetype: false, + Searchvalue: "", + pages: 1 + }) + + + } + + /* + * 撤销发布按钮 + * */ + + ModalCancel = () => { + this.setState({ + Modalstype: false + }) + } + ModalSave = () => { + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/cancel_publish.json"; + axios.get(url).then((response) => { + this.props.showSnackbar(response.data.message); + window.location.reload() + }).catch((error) => { + console.log(error) + }); + } + cancel_publish = () => { + this.setState({ + Modalstype: true, + Modalstopval: "是否确认撤销发布?", + ModalCancel: this.ModalCancel, + ModalSave: this.ModalSave, + }) + } + + + /* + * 申请发布按钮 + * */ + applyrelease = () => { + let id = this.props.match.params.shixunId; + let url = "/shixuns/" + id + "/publish.json"; + axios.get(url).then((response) => { + let evaluation_set_position + if (response.data.evaluation_set_position === null) { + evaluation_set_position = [] + } else { + evaluation_set_position = response.data.evaluation_set_position + } + this.setState({ + Issuevisible: true, + tag_position: response.data.tag_position, + evaluation_set_position: evaluation_set_position, + publishboxstatus: response.data.status, + }) + }).catch((error) => { + console.log(error) + }); + }; + + hiddenIssuevisible = (val) => { + this.setState({ + Issuevisible: false + }) + if (val === 0 || val === 1) { + window.location.reload() } - SenttotheSearch=(value)=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json?search="+value; - axios.get(encodeURI(url), { - params: { - page:1, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list, - pages:1, - Searchvalue:value - }) - }).catch((error) => { - console.log(error) - }); - } + } + + //重置按钮 + // resetshixunCombat=(id)=>{ + // let zrl="/myshixuns/"+id+"/reset_my_game.json"; + // axios.get(zrl).then((response) => { + // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; + // message.success('重置成功'); + // }).catch((error) => { + // console.log(error) + // }); + // } + + // reset_my_game + hidestartshixunsreplace = (url) => { + this.setState({ + isSpin: true, + }) + axios.get(url).then((response) => { + if (response.status === 200) { + // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; + // this.props.history.push(path); + message.success('重置成功,正在进入实训!'); + this.startshixunCombat(response.data.shixun_identifier, 1); + this.setState({ + shixunsreplace: false, + isSpin: false, + }) - onChangeSenttothevcalue=(e)=>{ - this.setState({ - Senttothevcalue:e.target.value - }) - } - onChangesendeSenttothe=(pageNumber)=>{ - let{Searchvalue}=this.state; - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/search_user_courses.json?search="+Searchvalue; - axios.get(url, { - params: { - page:pageNumber, - limit:10 - }}).then((response) => { - this.setState({ - courses_count:response.data.courses_count, - course_list:response.data.course_list, - pagenum: pageNumber, - pages: pageNumber - }) - }).catch((error) => { - console.log(error) - }); - } - sendeSenttothevcalue=()=>{ - - let {Senttothevcalue}=this.state; - - if(Senttothevcalue===undefined){ - this.setState({ - Senttothevcaluetype:true - }) - return - } - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/send_to_course.json"; - axios.post(url,{ - course_id:Senttothevcalue - }).then((response) => { - - this.props.showSnackbar(response.data.message); - this.setState({ - Senttothetype:false, - Searchvalue:"", - pages:1 - }) - // window.location.href = response.data.url; - // response.data.course_id - this.props.history.replace(response.data.first_category_url); + // message.success('重置成功,正在进入实训!'); + // this.startshixunCombat(); + } + } + ).catch((error) => { + this.setState({ + startbtn: false, + shixunsreplace: false, + isSpin: false + }) + }); - }).catch((error) => { - console.log(error) - }); + } - } - hideSenttothevcalue=()=>{ + //开始实战按钮 + startshixunCombat = (id, reset) => { + + if(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true){ + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return + } + + if (this.props.checkIfProfileCompleted() === false) { this.setState({ - Senttothetype:false, - Searchvalue:"", - pages:1 + AccountProfiletype: true }) + return + } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } - } - - /* - * 撤销发布按钮 - * */ - - ModalCancel=()=>{ - this.setState({ - Modalstype:false - }) - } - ModalSave=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/cancel_publish.json"; - axios.get(url).then((response) => { - this.props.showSnackbar(response.data.message); - window.location.reload() - }).catch((error) => { - console.log(error) - }); - } - cancel_publish=()=>{ - this.setState({ - Modalstype:true, - Modalstopval:"是否确认撤销发布?", - ModalCancel:this.ModalCancel, - ModalSave:this.ModalSave, - }) - } + let {shixunsDetails} = this.props + if (shixunsDetails.shixun_status > 1) { + this.setState({ + startbtn: true, + hidestartshixunsreplacevalue: "" + }) + } else { + this.setState({ + hidestartshixunsreplacevalue: "" + }) + } - /* - * 申请发布按钮 - * */ - applyrelease=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/" + id +"/publish.json"; - axios.get(url).then((response) => { - let evaluation_set_position - if(response.data.evaluation_set_position===null){ - evaluation_set_position=[] - }else{ - evaluation_set_position=response.data.evaluation_set_position - } + let url = "/shixuns/" + id + "/jupyter_exec.json"; + if (reset) { + url += '?reset=' + reset + } + axios.get(url).then((response) => { + if (response.status === 200) { + if (response.data.status === -2) { + // this.resetshixunCombat(response.data.message); this.setState({ - Issuevisible:true, - tag_position:response.data.tag_position, - evaluation_set_position:evaluation_set_position, - publishboxstatus:response.data.status, + startbtn: false, + shixunsreplace: true, + hidestartshixunsreplacevalue: response.data.message + ".json" }) - }).catch((error) => { - console.log(error) - }); - }; - - hiddenIssuevisible=(val)=>{ - this.setState({ - Issuevisible:false - }) - if(val===0||val===1){ - window.location.reload() - } + // this.shixunexec(response.data.message+".json") + } else if (response.data.status === -1) { + console.log(response) + } else if (response.data.status === -3) { + this.setState({ + shixunsmessage: response.data.message, + startshixunCombattype: true, + startbtn: false + }) + } else { + // let path="/tasks/"+response.data.game_identifier; + // this.props.history.push(path); - } - //重置按钮 - // resetshixunCombat=(id)=>{ - // let zrl="/myshixuns/"+id+"/reset_my_game.json"; - // axios.get(zrl).then((response) => { - // window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; - // message.success('重置成功'); - // }).catch((error) => { - // console.log(error) - // }); - // } + // this.context.router.history.push(path); + if (response.data.status != 401) { + window.location.href = "/tasks/" + response.data.identifier+`/jupyter`; + } - // reset_my_game - hidestartshixunsreplace=(url)=>{ + } + } + }).catch((error) => { this.setState({ - isSpin:true, + startbtn: false }) - axios.get(url).then((response) => { - if(response.status===200){ - // let path="/shixuns/"+response.data.shixun_identifier+"/challenges"; - // this.props.history.push(path); - message.success('重置成功,正在进入实训!'); - this.startshixunCombat(response.data.shixun_identifier, 1); - this.setState({ - shixunsreplace:false, - isSpin:false, - }) - - // message.success('重置成功,正在进入实训!'); - // this.startshixunCombat(); - }} - ).catch((error) => { - this.setState({ - startbtn:false, - shixunsreplace:false, - isSpin:false - }) - }); - - } - + }); + }else{ + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return + } - //开始实战按钮 - startshixunCombat=(id, reset)=>{ + if (this.props.checkIfProfileCompleted() === false) { + this.setState({ + AccountProfiletype: true + }) + return + } - if(this.props.checkIfLogin()===false){ - this.props.showLoginDialog() - return - } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } - if(this.props.checkIfProfileCompleted()===false){ - this.setState({ - AccountProfiletype:true - }) - return - } + let {shixunsDetails} = this.props + if (shixunsDetails.shixun_status > 1) { + this.setState({ + startbtn: true, + hidestartshixunsreplacevalue: "" + }) + } else { + this.setState({ + hidestartshixunsreplacevalue: "" + }) + } - // if(this.props.checkIfProfessionalCertification()===false){ - // this.setState({ - // AccountProfiletype:true - // }) - // return - // } - let {shixunsDetails} = this.props - if( shixunsDetails.shixun_status>1){ + let url = "/shixuns/" + id + "/shixun_exec.json"; + if (reset) { + url += '?reset=' + reset + } + axios.get(url).then((response) => { + if (response.status === 200) { + if (response.data.status === -2) { + // this.resetshixunCombat(response.data.message); this.setState({ - startbtn:true, - hidestartshixunsreplacevalue:"" + startbtn: false, + shixunsreplace: true, + hidestartshixunsreplacevalue: response.data.message + ".json" }) - }else{ + // this.shixunexec(response.data.message+".json") + } else if (response.data.status === -1) { + console.log(response) + } else if (response.data.status === -3) { this.setState({ - hidestartshixunsreplacevalue:"" + shixunsmessage: response.data.message, + startshixunCombattype: true, + startbtn: false }) - } - + } else { + // let path="/tasks/"+response.data.game_identifier; + // this.props.history.push(path); - let url="/shixuns/"+id+"/shixun_exec.json" ; - if (reset) { - url += '?reset=' + reset - } - axios.get(url).then((response) => { - if(response.status===200){ - if(response.data.status===-2){ - // this.resetshixunCombat(response.data.message); - this.setState({ - startbtn:false, - shixunsreplace:true, - hidestartshixunsreplacevalue:response.data.message+".json" - }) - // this.shixunexec(response.data.message+".json") - }else if(response.data.status===-1){ - console.log(response) - }else if(response.data.status===-3){ - this.setState({ - shixunsmessage:response.data.message, - startshixunCombattype:true, - startbtn:false - }) - }else{ - // let path="/tasks/"+response.data.game_identifier; - // this.props.history.push(path); - - - // this.context.router.history.push(path); - if(response.data.status!=401){ - window.location.href = "/tasks/"+response.data.game_identifier; - } - - } - } - }).catch((error) => { - this.setState({ - startbtn:false - }) - }); - } - tocertification=()=>{ - let{certi_url}=this.state; - this.setState({ - Forkauthentication:false - }) - window.location.href=certi_url; - } + // this.context.router.history.push(path); + if (response.data.status != 401) { + window.location.href = "/tasks/" + response.data.game_identifier; + } - SenttotheValue=(e)=>{ + } + } + }).catch((error) => { this.setState({ - Searchvalue:e.target.value + startbtn: false }) + }); } - hidestartshixunCombattype=()=>{ - this.setState({ - startshixunCombattype:false - }) - } - hideAccountProfile=()=>{ - this.setState({ - AccountProfiletype:false - }) - } - - - showonMouseOver=()=>{ - $("#ratePanel").show(); - this.setState({ - showradios:true - }) - } - - hideonMouseOut=()=>{ - $("#ratePanel").hide(); - this.setState({ - showradios:false - }) - } - - render() { - let { - Forkvisible, - Senttothetype, - Senttothevcalue, - evaluation_set_position, - Forkauthentication, - can_fork, - certi_url, - tag_position, - courses_count, - course_list, - Issuevisible, - publishboxstatus, - showradios, - startbtn, - Searchvalue, - startshixunCombattype, - shixunsmessage, - pages, - shixunsreplace, - hidestartshixunsreplacevalue, - Forkvisibletype, - AccountProfiletype, - isIE} = this.state; - let {shixunsDetails, shixunId, star_info, star_infos} = this.props; - let challengeBtnTipText = ''; - let challengeBtnText = '模拟实战'; - // let star_info=[] + } + + tocertification = () => { + let {certi_url} = this.state; + this.setState({ + Forkauthentication: false + }) + window.location.href = certi_url; + } + + SenttotheValue = (e) => { + this.setState({ + Searchvalue: e.target.value + }) + } + + hidestartshixunCombattype = () => { + this.setState({ + startshixunCombattype: false + }) + } + + hideAccountProfile = () => { + this.setState({ + AccountProfiletype: false + }) + } + + + showonMouseOver = () => { + $("#ratePanel").show(); + this.setState({ + showradios: true + }) + } + + hideonMouseOut = () => { + $("#ratePanel").hide(); + this.setState({ + showradios: false + }) + } + + render() { + let { + Forkvisible, + Senttothetype, + Senttothevcalue, + evaluation_set_position, + Forkauthentication, + can_fork, + certi_url, + tag_position, + courses_count, + course_list, + Issuevisible, + publishboxstatus, + showradios, + startbtn, + Searchvalue, + startshixunCombattype, + shixunsmessage, + pages, + shixunsreplace, + hidestartshixunsreplacevalue, + Forkvisibletype, + AccountProfiletype, + isIE + } = this.state; + let {shixunsDetails, shixunId, star_info, star_infos} = this.props; + let challengeBtnTipText = ''; + let challengeBtnText = '模拟实战'; + // let star_info=[] // if (shixunsDetails.status === 0) { // // } else if (shixunsDetails.status === 1) { @@ -545,265 +628,270 @@ class TPMBanner extends Component { // challengeBtnTipText = '开始学习并完成实战任务' // // } - if(shixunsDetails!=undefined){ - if (shixunsDetails.shixun_status === 0 ) { - challengeBtnText = '继续实战' - } else if (shixunsDetails.shixun_status === 1) { - challengeBtnText = '查看实战' - } else if (shixunsDetails.shixun_status === 3) { - challengeBtnText = '继续实战' - }else{ - challengeBtnText = "开始实战" - } + if (shixunsDetails != undefined) { + if (shixunsDetails.shixun_status === 0) { + challengeBtnText = '继续实战' + } else if (shixunsDetails.shixun_status === 1) { + challengeBtnText = '查看实战' + } else if (shixunsDetails.shixun_status === 3) { + challengeBtnText = '继续实战' + } else { + challengeBtnText = "开始实战" } + } + + // let list=shixunsDetails.task_operation; + // if(list!=undefined){ + // if (shixunsDetails.status === 0 ) { + // for(var i=0; i<list.length; i++){ + // challengeBtnText =list[0] + // } + // } else if (shixunsDetails.status === 1) { + // for(var i=0; i<list.length; i++){ + // challengeBtnText =list[0] + // } + // } else if (shixunsDetails.status === 3) { + // for(var i=0; i<list.length; i++){ + // challengeBtnText =list[0] + // } + // }else{ + // for(var i=0; i<list.length; i++){ + // challengeBtnText =list[0] + // } + // } + // } + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + }; - // let list=shixunsDetails.task_operation; - // if(list!=undefined){ - // if (shixunsDetails.status === 0 ) { - // for(var i=0; i<list.length; i++){ - // challengeBtnText =list[0] - // } - // } else if (shixunsDetails.status === 1) { - // for(var i=0; i<list.length; i++){ - // challengeBtnText =list[0] - // } - // } else if (shixunsDetails.status === 3) { - // for(var i=0; i<list.length; i++){ - // challengeBtnText =list[0] - // } - // }else{ - // for(var i=0; i<list.length; i++){ - // challengeBtnText =list[0] - // } - // } + const antIcon = <Icon type="loading" style={{fontSize: 24}} spin/>; + const MyRate = ({defaultValue, ...rest}) => { + let myValue = defaultValue; + // console.log(myValue-Math.floor(myValue)) + // if (myValue < Math.ceil(myValue)) { + // myValue = Math.floor(myValue) + 0.5; // } - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - }; - - const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />; - const MyRate = ({ defaultValue, ...rest }) => { - let myValue = defaultValue; - // console.log(myValue-Math.floor(myValue)) - // if (myValue < Math.ceil(myValue)) { - // myValue = Math.floor(myValue) + 0.5; - // } - - return <Rating {...rest} value={myValue} />; - }; - return ( - - shixunsDetails===undefined?"": -<div className="shixunDetail"> - <div className="shixunDetail_top"> - - {AccountProfiletype===true?<AccountProfile - hideAccountProfile={()=>this.hideAccountProfile()} - {...this.props} - {...this.state} - />:""} - - - {this.state.Modalstype===true?<Modals - modalsType={this.state.Modalstype} - modalsTopval={this.state.Modalstopval} - modalCancel={this.state.ModalCancel} - modalSave={this.state.ModalSave} - modalsBottomval={this.state.ModalsBottomval} - loadtype={this.state.Loadtype} - />:""} - - <div className="educontent clearfix"> - <p className="clearfix"> + + return <Rating {...rest} value={myValue}/>; + }; + + console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter) + + return ( + + shixunsDetails === undefined ? "" : + <div className="shixunDetail"> + <div className="shixunDetail_top"> + + {AccountProfiletype === true ? <AccountProfile + hideAccountProfile={() => this.hideAccountProfile()} + {...this.props} + {...this.state} + /> : ""} + + + {this.state.Modalstype === true ? <Modals + modalsType={this.state.Modalstype} + modalsTopval={this.state.Modalstopval} + modalCancel={this.state.ModalCancel} + modalSave={this.state.ModalSave} + modalsBottomval={this.state.ModalsBottomval} + loadtype={this.state.Loadtype} + /> : ""} + + <div className="educontent clearfix"> + <p className="clearfix"> <a href={"/shixuns/" + shixunsDetails.identifier + "/challenges"} className="font-28 color-white mr10 fl">{shixunsDetails.name}</a> { - shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" : - <a href={"/shixuns/" + shixunsDetails.fork_from.fork_identifier + "/challenges"} - className="fl mt5" - target="_blank" - data-tip-right={"forked from " + shixunsDetails.fork_from.username + " / " + shixunsDetails.fork_from.name}> - <i className="iconfont icon-fork color-grey-74 font-20 fl"></i> - </a> + shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" : + <a href={"/shixuns/" + shixunsDetails.fork_from.fork_identifier + "/challenges"} + className="fl mt5" + target="_blank" + data-tip-right={"forked from " + shixunsDetails.fork_from.username + " / " + shixunsDetails.fork_from.name}> + <i className="iconfont icon-fork color-grey-74 font-20 fl"></i> + </a> } - </p> - <div className="clearfix mt50"> - {/*<style>*/} - {/*{*/} - {/*`*/} - {/*.anticon-star{*/} - {/*font-size:14px;*/} - {/*}*/} - {/*.pathInfo{*/} - {/*margin-right:-5px;*/} - {/*}*/} - {/*.ant-rate{*/} - {/*color: #FFA800;*/} - {/*}*/} - {/*`*/} - {/*}*/} - {/*</style>*/} - <ul className="fl color-grey-c pathInfo" > - <li> - <span>学习人数</span> - <span className="mt10">{shixunsDetails.stu_num}</span> - </li> - {/*<li>*/} - {/*<span>经验值</span>*/} - {/*<span className="mt10">{shixunsDetails.experience}</span>*/} - {/*</li>*/} - <li> - <span>难度级别</span> - <span className="shixunsdiffcult mt10">{shixunsDetails.diffcult}</span> - - </li> + </p> + <div className="clearfix mt50"> + {/*<style>*/} + {/*{*/} + {/*`*/} + {/*.anticon-star{*/} + {/*font-size:14px;*/} + {/*}*/} + {/*.pathInfo{*/} + {/*margin-right:-5px;*/} + {/*}*/} + {/*.ant-rate{*/} + {/*color: #FFA800;*/} + {/*}*/} + {/*`*/} + {/*}*/} + {/*</style>*/} + <ul className="fl color-grey-c pathInfo"> + <li> + <span>学习人数</span> + <span className="mt10">{shixunsDetails.stu_num}</span> + </li> + {/*<li>*/} + {/*<span>经验值</span>*/} + {/*<span className="mt10">{shixunsDetails.experience}</span>*/} + {/*</li>*/} + <li> + <span>难度级别</span> + <span className="shixunsdiffcult mt10">{shixunsDetails.diffcult}</span> + + </li> </ul> - <div className="pr fl" id="commentsStar" onMouseOver={()=>this.showonMouseOver()} onMouseOut={()=>this.hideonMouseOut()}> - <div className={"color-grey-c ml15"} style={{color: "#Fff",textAlign: "center"}}>学员评分</div> - <div className="rateYo"> - <MyRate allowHalf defaultValue={star_info[0]} disabled/> - </div> - <div id="ratePanel" className="showratePanel" style={{"width":"530px"}} onMouseOut={()=>this.hideonMouseOut()}> - <div className="pr"> - <span className="rateTrangle"></span> - <div className="pr clearfix ratePanelContent" style={{height: '177px'}}> - <div className="fl totalScore"> - <div> + <div className="pr fl" id="commentsStar" onMouseOver={() => this.showonMouseOver()} + onMouseOut={() => this.hideonMouseOut()}> + <div className={"color-grey-c ml15"} style={{color: "#Fff", textAlign: "center"}}>学员评分</div> + <div className="rateYo"> + <MyRate allowHalf defaultValue={star_info[0]} disabled/> + </div> + <div id="ratePanel" className="showratePanel" style={{"width": "530px"}} + onMouseOut={() => this.hideonMouseOut()}> + <div className="pr"> + <span className="rateTrangle"></span> + <div className="pr clearfix ratePanelContent" style={{height: '177px'}}> + <div className="fl totalScore"> + <div> <span - className="font-24 color-yellow-ff lineh-20 mb10 ml20">{star_infos[0]}分</span> - <span className="displayblock">总评分</span> - <div className="rateYo"> - {showradios === true ? - <MyRate allowHalf defaultValue={star_info[0]} disabled/> - : ""} - </div> - </div> - </div> - <div className="fr" style={{width: '375px'}}> - <div className="clearfix"> - <div className="rateYo fl mt3"> - {showradios === true ? - <MyRate allowHalf defaultValue={5} disabled/> - : ""} - </div> - <Progress percent={star_infos[1]} showInfo={false}></Progress> - <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[1]}%</span> - </div> - <div className="clearfix"> - <div className="rateYo fl mt3"> - {showradios === true ? - <MyRate allowHalf defaultValue={4} disabled/> - : ""} - </div> - <Progress percent={star_infos[2]} showInfo={false}></Progress> - <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[2]}%</span> - </div> - <div className="clearfix"> - <div className="rateYo fl mt3"> - {showradios === true ? - <MyRate allowHalf defaultValue={3} disabled/> - : ""} - </div> - <Progress percent={star_infos[3]} showInfo={false}></Progress> - <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[3]}%</span> - </div> - <div className="clearfix"> - <div className="rateYo fl mt3"> - {showradios === true ? - <MyRate allowHalf defaultValue={2} disabled/> - : ""} - </div> - <Progress percent={star_infos[4]} showInfo={false}></Progress> - <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[4]}%</span> - </div> - <div className="clearfix"> - <div className="rateYo fl mt3"> - {showradios === true ? - <MyRate allowHalf defaultValue={1} disabled/> - : ""} - </div> - <Progress percent={star_infos[5]} showInfo={false}></Progress> - <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[5]}%</span> - </div> - </div> + className="font-24 color-yellow-ff lineh-20 mb10 ml20">{star_infos[0]}分</span> + <span className="displayblock">总评分</span> + <div className="rateYo"> + {showradios === true ? + <MyRate allowHalf defaultValue={star_info[0]} disabled/> + : ""} </div> + </div> </div> + <div className="fr" style={{width: '375px'}}> + <div className="clearfix"> + <div className="rateYo fl mt3"> + {showradios === true ? + <MyRate allowHalf defaultValue={5} disabled/> + : ""} + </div> + <Progress percent={star_infos[1]} showInfo={false}></Progress> + <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[1]}%</span> + </div> + <div className="clearfix"> + <div className="rateYo fl mt3"> + {showradios === true ? + <MyRate allowHalf defaultValue={4} disabled/> + : ""} + </div> + <Progress percent={star_infos[2]} showInfo={false}></Progress> + <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[2]}%</span> + </div> + <div className="clearfix"> + <div className="rateYo fl mt3"> + {showradios === true ? + <MyRate allowHalf defaultValue={3} disabled/> + : ""} + </div> + <Progress percent={star_infos[3]} showInfo={false}></Progress> + <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[3]}%</span> + </div> + <div className="clearfix"> + <div className="rateYo fl mt3"> + {showradios === true ? + <MyRate allowHalf defaultValue={2} disabled/> + : ""} + </div> + <Progress percent={star_infos[4]} showInfo={false}></Progress> + <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[4]}%</span> + </div> + <div className="clearfix"> + <div className="rateYo fl mt3"> + {showradios === true ? + <MyRate allowHalf defaultValue={1} disabled/> + : ""} + </div> + <Progress percent={star_infos[5]} showInfo={false}></Progress> + <span className="fr ml10 color-grey-6 font-12 mt4">{star_infos[5]}%</span> + </div> + </div> + </div> </div> + </div> </div> { - startbtn === false && shixunsDetails.shixun_status != -1 ? - <Tooltip placement="bottom" title={ - shixunsDetails.task_operation === undefined ? "" : shixunsDetails.task_operation[0] === "开始实战" ? "开始学习并完成实战任务" : shixunsDetails.task_operation[0] === "继续挑战" ? "继续完成后续学习和实战任务" : - shixunsDetails.task_operation[0] === "查看实战" ? "查看我的实战光辉历史" : - shixunsDetails.task_operation[0] === "模拟实战" ? "模拟完成实战任务" : shixunsDetails.task_operation[0] === "开启挑战" ? "开始学习并完成实战任务" : "" - }> - <a onClick={()=>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] : "模拟实战"} - </a> - </Tooltip> - : "" + startbtn === false && shixunsDetails.shixun_status != -1 ? + <Tooltip placement="bottom" title={ + shixunsDetails.task_operation === undefined ? "" : shixunsDetails.task_operation[0] === "开始实战" ? "开始学习并完成实战任务" : shixunsDetails.task_operation[0] === "继续挑战" ? "继续完成后续学习和实战任务" : + shixunsDetails.task_operation[0] === "查看实战" ? "查看我的实战光辉历史" : + shixunsDetails.task_operation[0] === "模拟实战" ? "模拟完成实战任务" : shixunsDetails.task_operation[0] === "开启挑战" ? "开始学习并完成实战任务" : "" + }> + <a onClick={() => 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] : "模拟实战"} + </a> + </Tooltip> + : "" } <Modal - keyboard={false} - title="提示" - visible={startshixunCombattype} - closable={false} - footer={null} + keyboard={false} + title="提示" + visible={startshixunCombattype} + closable={false} + footer={null} > - <div className="task-popup-content"> - <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!</p> - </div> - <div className="task-popup-submit clearfix"> - {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} - <a className="task-btn task-btn-orange fr mr51" onClick={this.hidestartshixunCombattype}>知道啦</a> - </div> - {/*<p className="inviteTipbtn with100 fl">*/} - {/*<a onClick={this.hidestartshixunCombattype}>知道了</a>*/} - {/*</p>*/} + <div className="task-popup-content"> + <p className="task-popup-text-center font-16 pb20">目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!</p> + </div> + <div className="task-popup-submit clearfix"> + {/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/} + <a className="task-btn task-btn-orange fr mr51" onClick={this.hidestartshixunCombattype}>知道啦</a> + </div> + {/*<p className="inviteTipbtn with100 fl">*/} + {/*<a onClick={this.hidestartshixunCombattype}>知道了</a>*/} + {/*</p>*/} </Modal> <Modal - keyboard={false} - title="提示" - visible={shixunsreplace} - closable={false} - footer={null} + keyboard={false} + title="提示" + visible={shixunsreplace} + closable={false} + footer={null} > - <Spin indicator={antIcon} spinning={this.state.isSpin}> + <Spin indicator={antIcon} spinning={this.state.isSpin}> <div className="task-popup-content"> - <p className="task-popup-text-center font-16 pb20">实训已经更新了,正在为您重置!</p> + <p className="task-popup-text-center font-16 pb20">实训已经更新了,正在为您重置!</p> </div> <div className="task-popup-submit clearfix"> - <a className="task-btn task-btn-orange fr mr51" - onClick={() => this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了</a> + <a className="task-btn task-btn-orange fr mr51" + onClick={() => this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了</a> </div> - </Spin> + </Spin> </Modal> <Modal - keyboard={false} - visible={startbtn} - closable={false} - footer={null} - className="startbtnModal" + keyboard={false} + visible={startbtn} + closable={false} + footer={null} + className="startbtnModal" > - <Spin size="large"/> + <Spin size="large"/> </Modal> { - startbtn === true ? - <a className="fr user_default_btn edu-greyback-btn mr15 font-18">开启中</a> : "" + startbtn === true ? + <a className="fr user_default_btn edu-greyback-btn mr15 font-18">开启中</a> : "" } {/*{*/} @@ -815,172 +903,173 @@ class TPMBanner extends Component { {/*}*/} {shixunsDetails.shixun_status === 0 && this.props.identity < 5 ? - <a onClick={this.applyrelease} className="fr user_default_btn user_blue_btn mr20 font-18 height39" - id="challenge_begin">申请发布</a> : "" + <a onClick={this.applyrelease} className="fr user_default_btn user_blue_btn mr20 font-18 height39" + id="challenge_begin">申请发布</a> : "" } <Modal - keyboard={false} - title="提示" - visible={Issuevisible} - closable={false} - footer={null} + keyboard={false} + title="提示" + visible={Issuevisible} + closable={false} + footer={null} > - { - publishboxstatus === 0 ? <div className="task-popup-content"> - <p className="task-popup-text-center font-16 mt10 mb10"> - 发布申请已提交,请等待管理员的审核<br/> - </p> - </div> : publishboxstatus === 1 ? - <div className="task-popup-content"> - <p className="task-popup-text-center font-16 mt10 mb10"> - 发布申请已提交,请等待管理员的审核<br/> - <span className="font-12 color-grey-8"> • 我们将在1-2个工作日内完成审核</span> - </p> - </div> : publishboxstatus === 2 ? <div className="task-popup-content"> - <p className="task-popup-text-center font-16 mt10 mb10"> - 第 - { - evaluation_set_position.map((item, key) => { - return ( - <span key={key}>{item}<span - style={{display: key != evaluation_set_position.length-1 ? "inline-block" : 'none'}}>,</span></span> - ) - }) - } - 关评测设置尚未完成,无法申请发布 - </p> - </div> : publishboxstatus === 3 ? - <div className="task-popup-content"> - <p className="task-popup-text-center font-16 mt10 mb10"> - 每一个关卡至少需要一个技能标签<br/> - 第 - { - tag_position.map((item, key) => { - return ( - <span key={key}>{item}<span - style={{display: key != tag_position.length-1 ? "inline-block" : 'none'}}>,</span></span> - ) - }) - } - 关尚未设置技能标签,请补充 - </p> - </div> : - <div className="task-popup-content"> - <p className="task-popup-text-center font-16 mt10 mb10"> - 尚未创建任务的实训,不能申请发布 - </p> - </div> - } - <div className="mb15 clearfix edu-txt-center"> - <a onClick={() => this.hiddenIssuevisible(publishboxstatus)} - className="task-btn task-btn-orange pop_close">知道啦</a> - </div> + { + publishboxstatus === 0 ? <div className="task-popup-content"> + <p className="task-popup-text-center font-16 mt10 mb10"> + 发布申请已提交,请等待管理员的审核<br/> + </p> + </div> : publishboxstatus === 1 ? + <div className="task-popup-content"> + <p className="task-popup-text-center font-16 mt10 mb10"> + 发布申请已提交,请等待管理员的审核<br/> + <span className="font-12 color-grey-8"> • 我们将在1-2个工作日内完成审核</span> + </p> + </div> : publishboxstatus === 2 ? <div className="task-popup-content"> + <p className="task-popup-text-center font-16 mt10 mb10"> + 第 + { + evaluation_set_position.map((item, key) => { + return ( + <span key={key}>{item}<span + style={{display: key != evaluation_set_position.length - 1 ? "inline-block" : 'none'}}>,</span></span> + ) + }) + } + 关评测设置尚未完成,无法申请发布 + </p> + </div> : publishboxstatus === 3 ? + <div className="task-popup-content"> + <p className="task-popup-text-center font-16 mt10 mb10"> + 每一个关卡至少需要一个技能标签<br/> + 第 + { + tag_position.map((item, key) => { + return ( + <span key={key}>{item}<span + style={{display: key != tag_position.length - 1 ? "inline-block" : 'none'}}>,</span></span> + ) + }) + } + 关尚未设置技能标签,请补充 + </p> + </div> : + <div className="task-popup-content"> + <p className="task-popup-text-center font-16 mt10 mb10"> + 尚未创建任务的实训,不能申请发布 + </p> + </div> + } + <div className="mb15 clearfix edu-txt-center"> + <a onClick={() => this.hiddenIssuevisible(publishboxstatus)} + className="task-btn task-btn-orange pop_close">知道啦</a> + </div> </Modal> {shixunsDetails.shixun_status === 1 && this.props.identity < 5 ? - <a onClick={this.cancel_publish} className="fr user_default_btn user_blue_btn mr20 font-18 height39" - id="challenge_begin">撤销发布</a> : "" + <a onClick={this.cancel_publish} className="fr user_default_btn user_blue_btn mr20 font-18 height39" + id="challenge_begin">撤销发布</a> : "" } { - <a onClick={this.Senttothe} - className="fr user_default_btn user_blue_btn mr20 font-18" - data-tip-down="" - style={{display: shixunsDetails.shixun_status === 0 || shixunsDetails.shixun_status === 3 ||shixunsDetails.shixun_status === 1 ||shixunsDetails.shixun_status === -1 ? "none" : "block"}} - data-remote="true"> - <Tooltip placement="bottom" title={"以实训作业的形式发送到我的课堂"}> - 发送至 - </Tooltip> - </a> + <a onClick={this.Senttothe} + className="fr user_default_btn user_blue_btn mr20 font-18" + data-tip-down="" + style={{display: shixunsDetails.shixun_status === 0 || shixunsDetails.shixun_status === 3 || shixunsDetails.shixun_status === 1 || shixunsDetails.shixun_status === -1 ? "none" : "block"}} + data-remote="true"> + <Tooltip placement="bottom" title={"以实训作业的形式发送到我的课堂"}> + 发送至 + </Tooltip> + </a> } <Modal - keyboard={false} - title="发送实训" - visible={Senttothetype} - closable={false} - footer={null} + keyboard={false} + title="发送实训" + visible={Senttothetype} + closable={false} + footer={null} > - <div className=""> - <div className="newupload_conbox"> - - <div className="mb15 font-14 edu-txt-center color-orange-tip"> - 选择的实训将会发送到指定课堂 - </div> - - <div className="mb10 edu-position"> - <Search - placeholder="输入课堂名称的关键字进行搜索" - value={Searchvalue} - onInput={this.SenttotheValue} - onSearch={(value) => this.SenttotheSearch(value)} - style={{width: '100%'}} - /> - </div> - <style> - {` + <div className=""> + <div className="newupload_conbox"> + + <div className="mb15 font-14 edu-txt-center color-orange-tip"> + 选择的实训将会发送到指定课堂 + </div> + + <div className="mb10 edu-position"> + <Search + placeholder="输入课堂名称的关键字进行搜索" + value={Searchvalue} + onInput={this.SenttotheValue} + onSearch={(value) => this.SenttotheSearch(value)} + style={{width: '100%'}} + /> + </div> + <style> + {` .edu-h270{ height:270px; overflow-y: auto; } `} - </style> - - <div id="search_course_list" className={courses_count > 12?"cdefault ":"cdefault "}> - <div className="clearfix mb20 edu-bg-light-blue edu-h270"> - <ul> - <RadioGroup onChange={this.onChangeSenttothevcalue} value={Senttothevcalue}> - { - course_list === undefined ? "" : course_list.map((item, key) => { - return ( - <Radio style={radioStyle} value={item.course_id} - key={key}>{item.name}</Radio> - ) - }) - } - </RadioGroup> - </ul> - </div> - </div> - {this.state.Senttothevcaluetype===true?<div className={"color-red"}>请选择你要发送的课堂</div>:""} - <div className="mt10 marginauto" style={{display: courses_count > 12 ? "block" : "none"}}> - <Pagination size="small" className="mb20" - showQuickJumper defaultCurrent={1} current={pages} pageSize={12} - total={courses_count} onChange={this.onChangesendeSenttothe}/> - </div> - - <div className="mt10 marginauto flexbannerright"> - <div className={"-flex"}></div> - <div className={"-flex"}></div> - <div className={"-flex"}> - <a onClick={this.hideSenttothevcalue} - className="pop_close task-btn mr10 ml25 margin-tp26">取消</a> - <a className="task-btn task-btn-orange margin-tp26" - onClick={this.sendeSenttothevcalue} - id="submit_send_shixun">确定</a> - </div> + </style> + + <div id="search_course_list" className={courses_count > 12 ? "cdefault " : "cdefault "}> + <div className="clearfix mb20 edu-bg-light-blue edu-h270"> + <ul> + <RadioGroup onChange={this.onChangeSenttothevcalue} value={Senttothevcalue}> + { + course_list === undefined ? "" : course_list.map((item, key) => { + return ( + <Radio style={radioStyle} value={item.course_id} + key={key}>{item.name}</Radio> + ) + }) + } + </RadioGroup> + </ul> + </div> + </div> + {this.state.Senttothevcaluetype === true ? <div className={"color-red"}>请选择你要发送的课堂</div> : ""} + <div className="mt10 marginauto" style={{display: courses_count > 12 ? "block" : "none"}}> + <Pagination size="small" className="mb20" + showQuickJumper defaultCurrent={1} current={pages} pageSize={12} + total={courses_count} onChange={this.onChangesendeSenttothe}/> + </div> + + <div className="mt10 marginauto flexbannerright"> + <div className={"-flex"}></div> + <div className={"-flex"}></div> + <div className={"-flex"}> + <a onClick={this.hideSenttothevcalue} + className="pop_close task-btn mr10 ml25 margin-tp26">取消</a> + <a className="task-btn task-btn-orange margin-tp26" + onClick={this.sendeSenttothevcalue} + id="submit_send_shixun">确定</a> + </div> - </div> + </div> - </div> </div> + </div> </Modal> {shixunsDetails.shixun_status === 3 && <a className="fr user_default_btn edu-greyback-btn mr15 font-18">已关闭</a> } - {shixunsDetails.shixun_status === -1 && - <a className="fr user_default_btn edu-greyback-btn mr15 font-18">已删除</a> - } + {shixunsDetails.shixun_status === -1 && + <a className="fr user_default_btn edu-greyback-btn mr15 font-18">已删除</a> + } - {this.props.identity < 8&&shixunsDetails.shixun_status != -1 ?<div className="fr user_default_btn user_blue_btn mr20" - style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "flex"}}> - <Tooltip placement="bottom" title={"基于这个实训修改形成新的实训"}> + {this.props.identity < 8 && shixunsDetails.shixun_status != -1 ? + <div className="fr user_default_btn user_blue_btn mr20" + style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "flex"}}> + <Tooltip placement="bottom" title={"基于这个实训修改形成新的实训"}> <span className="flex1 edu-txt-center fl font-18" onClick={this.copyForkvisible} style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "inline-block"}} @@ -989,27 +1078,27 @@ class TPMBanner extends Component { </span> </Tooltip> - <Modal - keyboard={false} - title="提示" - visible={Forkvisible} - closable={false} - footer={null} + <Modal + keyboard={false} + title="提示" + visible={Forkvisible} + closable={false} + footer={null} > - {Forkvisibletype===true? + {Forkvisibletype === true ? <Spin tip="请等待正在复制中..." - style={{marginLeft:'38%'}} + style={{marginLeft: '38%'}} > - </Spin>: + </Spin> : <div> - <div className="task-popup-content"><p - className="task-popup-text-center font-16 pb20">复制将在后台执行,平台将为你创建<br/>一个新的同名实训和内容,请问是否继续?</p> - </div> - <div className="task-popup-submit clearfix"> - <a onClick={this.hideForkvisible} className="task-btn fl">取消</a> - <a className="task-btn task-btn-orange fr" onClick={this.addForkvisible}>确定</a> - </div> + <div className="task-popup-content"><p + className="task-popup-text-center font-16 pb20">复制将在后台执行,平台将为你创建<br/>一个新的同名实训和内容,请问是否继续?</p> + </div> + <div className="task-popup-submit clearfix"> + <a onClick={this.hideForkvisible} className="task-btn fl">取消</a> + <a className="task-btn task-btn-orange fr" onClick={this.addForkvisible}>确定</a> + </div> </div> } @@ -1017,40 +1106,41 @@ class TPMBanner extends Component { </Modal> <Modal - keyboard={false} - title="提示" - visible={Forkauthentication} - closable={false} - footer={null} + keyboard={false} + title="提示" + visible={Forkauthentication} + closable={false} + footer={null} > - <div className="task-popup-content"><p - className="task-popup-text-center font-16 pb20">{can_fork}<br/>请问是否前往进行认证?</p> - </div> - <div className="task-popup-submit clearfix"> - <a onClick={this.hideForkvisible} className="task-btn fl">取消</a> - <a className="task-btn task-btn-orange fr" onClick={this.tocertification}>确定</a> - </div> + <div className="task-popup-content"><p + className="task-popup-text-center font-16 pb20">{can_fork}<br/>请问是否前往进行认证?</p> + </div> + <div className="task-popup-submit clearfix"> + <a onClick={this.hideForkvisible} className="task-btn fl">取消</a> + <a className="task-btn task-btn-orange fr" onClick={this.tocertification}>确定</a> + </div> </Modal> {!!shixunsDetails.fork_num && <Link to={"/shixuns/" + shixunId + "/fork_list"} className="forkNum" data-tip-down="Fork实训列表"> - {shixunsDetails.fork_num} + {shixunsDetails.fork_num} </Link> } - </div>:""} + </div> : ""} + + </div> </div> + </div> + <div className="alert alert-orange mb15 mt15 clearfix" + style={{display: shixunsDetails.shixun_status === 1 ? "block" : "none"}} + >正在等待管理员的审核。在审核通过前,可以随时撤销发布 + </div> </div> - </div> - <div className="alert alert-orange mb15 mt15 clearfix" - style={{display:shixunsDetails.shixun_status === 1?"block":"none"}} - >正在等待管理员的审核。在审核通过前,可以随时撤销发布</div> -</div> - - ); - } + ); + } } 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 { })( <div className=" fl pr mr20"> <Select placeholder="请选择小类别" + mode="multiple" onChange={this.selectright} value={this.state.choice_small_type.length===0||this.state.choice_small_type[0]===""||this.state.choice_small_type===[]?undefined:this.state.choice_small_type} style={{width: 180,height:30}} diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index c405e3e9f..652cd2d38 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -99,7 +99,7 @@ export default class TPMsettings extends Component { } </style> <Tabs tabBarExtraContent={ - <div className={"mb20"}> + <div className={"mb20 mr20"}> <Button type="primary" ghost className={"Permanentban"}> 永久关闭 </Button> diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index bf2550a62..a60a24313 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -73,8 +73,8 @@ class Challengesjupyter extends Component { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { }else{ - console.log("componentDidMountChallengesjupyter"); - console.log(response.data); + // console.log("componentDidMountChallengesjupyter"); + // console.log(response.data); if(response.data.status===0){ this.setState({ jupyter_url:response.data.url, From b29eb4d619bcf7d1749dde8b697e16040be50c56 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 10:23:32 +0800 Subject: [PATCH 11/14] =?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 | 4 ++-- public/react/src/modules/tpm/TPMIndex.js | 2 +- public/react/src/modules/tpm/component/TPMNav.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/tpm/TPMBanner.js b/public/react/src/modules/tpm/TPMBanner.js index f405aece6..c78c05b92 100644 --- a/public/react/src/modules/tpm/TPMBanner.js +++ b/public/react/src/modules/tpm/TPMBanner.js @@ -677,8 +677,8 @@ class TPMBanner extends Component { return <Rating {...rest} value={myValue}/>; }; - - console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter) + // + // console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter) return ( diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 0fe17be2e..ba7fb25e3 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -279,7 +279,7 @@ class TPMIndex extends Component { let url = window.location.href; let flag = url.indexOf("add_file")>-1; - console.log(this.state.is_jupyter); + // console.log(this.state.is_jupyter); return ( <div className="newMain clearfix"> {/*头部*/} diff --git a/public/react/src/modules/tpm/component/TPMNav.js b/public/react/src/modules/tpm/component/TPMNav.js index 1d03d12da..6b259c95b 100644 --- a/public/react/src/modules/tpm/component/TPMNav.js +++ b/public/react/src/modules/tpm/component/TPMNav.js @@ -15,8 +15,8 @@ class TPMNav extends Component { // console.log(this.props.propaedeutics) const challengesPath = `/shixuns/${shixunId}/challenges`; // console.log(match.path) - console.log("TPMNavTPMNavTPMNav"); - console.log(is_jupyter); + // console.log("TPMNavTPMNavTPMNav"); + // console.log(is_jupyter); return ( <div className="bor-bottom-greyE clearfix pl20 pr20 pt40 pb20 edu-back-white challengeNav"> <Link From 5e5fb1663aa9e7c5ac0b89e2c424d03c7a9efce8 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 10:23:52 +0800 Subject: [PATCH 12/14] =?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/AppConfig.js | 8 +++++++- .../tpm/shixunchild/Challenges/Challengesjupyter.js | 2 +- .../modules/tpm/shixunchild/shixunchildCss/Challenges.css | 2 -- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index dad5993e9..11ee68653 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -52,6 +52,7 @@ export function initAxiosInterceptors(props) { //proxy="http://47.96.87.25:48080" proxy="https://pre-newweb.educoder.net" proxy="https://test-newweb.educoder.net" + proxy="https://test-jupyterweb.educoder.net" //proxy="http://192.168.2.63:3001" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; @@ -88,7 +89,12 @@ export function initAxiosInterceptors(props) { url = `${config.url}`; } } - + //保存jupyter 到 tpm 中 //获取jupyter 到 tpm 中 + if(config.params&&config.params.redirect_uri!=undefined){ + if(config.params.redirect_uri.indexOf('/jupyters')!=-1){ + url = `${config.url}`; + } + } if(`${config[0]}`!=`true`){ if (window.location.port === "3007") { // if (url.indexOf('.json') == -1) { diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index bf2550a62..a4483f24d 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -259,7 +259,7 @@ class Challengesjupyter extends Component { <div className="sortinxdirection mt60"> <div className="renwuxiangssi sortinxdirection"> <div><p className="renwuxiangqdiv">任务详情</p></div> - <div><p className="renwuxiangqdivtest ml24">示例</p></div> + <div><p className="renwuxiangqdivtest ml24">(请将实训题目写在下方)</p></div> </div> <div className="renwuxiangssit xaxisreverseorder"> <div className="challenbaocun" onClick={() => this.modifyjupyter(this.props)}><p diff --git a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css index f7924158b..feb71fa46 100644 --- a/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css +++ b/public/react/src/modules/tpm/shixunchild/shixunchildCss/Challenges.css @@ -52,8 +52,6 @@ width:32px; height:30px; font-size:16px; - font-family:MicrosoftYaHei; - color:#4CACFF; line-height:30px; } From 964bdf03b3d57944de613b679f3affee6cb7a412 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 10:27:52 +0800 Subject: [PATCH 13/14] =?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/AppConfig.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index ca6560ab0..13b0bd8c6 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -90,6 +90,13 @@ export function initAxiosInterceptors(props) { } } + if(config.params&&config.params.redirect_uri!=undefined){ + debugger + if(config.params.redirect_uri.indexOf('jupyters')!=-1){ + url = `${config.url}`; + } + } + if(`${config[0]}`!=`true`){ if (window.location.port === "3007") { // if (url.indexOf('.json') == -1) { From ac0bea697815a75aee940079ceda2dca8b99e152 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 10:37:22 +0800 Subject: [PATCH 14/14] =?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/AppConfig.js | 8 -------- .../shixunchild/Challenges/Challengesjupyter.js | 14 +++++++------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 13b0bd8c6..5a2d64164 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -89,14 +89,6 @@ export function initAxiosInterceptors(props) { url = `${config.url}`; } } - - if(config.params&&config.params.redirect_uri!=undefined){ - debugger - if(config.params.redirect_uri.indexOf('jupyters')!=-1){ - url = `${config.url}`; - } - } - if(`${config[0]}`!=`true`){ if (window.location.port === "3007") { // if (url.indexOf('.json') == -1) { diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 83185bbf0..658e5d9da 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -69,12 +69,13 @@ class Challengesjupyter extends Component { identifier:id, } axios.get(ChallengesURL, {params: datas}).then((response) => { - if (response.status === 200) { + debugger if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { }else{ // console.log("componentDidMountChallengesjupyter"); // console.log(response.data); + debugger if(response.data.status===0){ this.setState({ jupyter_url:response.data.url, @@ -86,7 +87,6 @@ class Challengesjupyter extends Component { } } - } }).catch((error) => { console.log(error) }); @@ -146,7 +146,7 @@ class Challengesjupyter extends Component { }; - modifyjupyter=(propsysl)=>{ + modifyjupyter=()=>{ // console.log("propsysl"); // console.log(propsysl); let id=this.props.match.params.shixunId; @@ -253,7 +253,7 @@ class Challengesjupyter extends Component { } </style> { - this.props.jupyter_url === null || this.props.jupyter_url === undefined ? + this.state.jupyter_url === null || this.state.jupyter_url === undefined ? "" : <div className="sortinxdirection mt60"> @@ -262,7 +262,7 @@ class Challengesjupyter extends Component { <div><p className="renwuxiangqdivtest ml24">(请将实训题目写在下方)</p></div> </div> <div className="renwuxiangssit xaxisreverseorder"> - <div className="challenbaocun" onClick={() => this.modifyjupyter(this.props)}><p + <div className="challenbaocun" onClick={() => this.modifyjupyter(this.state)}><p className="challenbaocuntest">应用到实训</p></div> </div> </div> @@ -294,10 +294,10 @@ class Challengesjupyter extends Component { <div className="pb47"> { - this.props.jupyter_url===null || this.props.jupyter_url===undefined? + this.state.jupyter_url===null || this.state.jupyter_url===undefined? "" : - <iframe src={this.props.jupyter_url} + <iframe src={this.state.jupyter_url} sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame" name="framename" width="100%" height="700" frameBorder="0" ></iframe>