diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb
index df1a25b56..354d63f6d 100644
--- a/app/controllers/challenges_controller.rb
+++ b/app/controllers/challenges_controller.rb
@@ -178,64 +178,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/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)
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
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
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index 11ee68653..ca6560ab0 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -89,12 +89,7 @@ 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/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]
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
+
+ return
{shixunsDetails.name}
{
- shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" :
-
-
-
+ shixunsDetails.fork_from === undefined || shixunsDetails.fork_from === null ? "" :
+
+
+
}
-
-
+
-
目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!
-*/} - {/*知道了*/} - {/*
*/} +目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!
+*/} + {/*知道了*/} + {/*
*/}实训已经更新了,正在为您重置!
+实训已经更新了,正在为您重置!
- 发布申请已提交,请等待管理员的审核
--
- 发布申请已提交,请等待管理员的审核
-- • 我们将在1-2个工作日内完成审核 -
- 第 - { - evaluation_set_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关评测设置尚未完成,无法申请发布 -
-- 每一个关卡至少需要一个技能标签
-- 第 - { - tag_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关尚未设置技能标签,请补充 -
- 尚未创建任务的实训,不能申请发布 -
-+ 发布申请已提交,请等待管理员的审核
++
+ 发布申请已提交,请等待管理员的审核
++ • 我们将在1-2个工作日内完成审核 +
+ 第 + { + evaluation_set_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关评测设置尚未完成,无法申请发布 +
++ 每一个关卡至少需要一个技能标签
++ 第 + { + tag_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关尚未设置技能标签,请补充 +
+ 尚未创建任务的实训,不能申请发布 +
+-
- {
- course_list === undefined ? "" : course_list.map((item, key) => {
- return (
- {item.name}
- )
- })
- }
-
-
-+
+ {
+ course_list === undefined ? "" : course_list.map((item, key) => {
+ return (
+ {item.name}
+ )
+ })
+ }
+
+
+复制将在后台执行,平台将为你创建
-一个新的同名实训和内容,请问是否继续?
复制将在后台执行,平台将为你创建
+一个新的同名实训和内容,请问是否继续?
{can_fork}
-请问是否前往进行认证?
{can_fork}
+请问是否前往进行认证?