Merge branch 'dev_jupyter' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter

chromesetting
guange 5 years ago
commit 5c783fe775

@ -283,7 +283,7 @@ class ApplicationController < ActionController::Base
# 测试版前端需求 # 测试版前端需求
logger.info("subdomain:#{request.subdomain}") logger.info("subdomain:#{request.subdomain}")
if request.subdomain == "test-newweb" if request.subdomain != "www"
if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除
User.current = User.find 81403 User.current = User.find 81403
elsif params[:debug] == 'student' elsif params[:debug] == 'student'

@ -178,64 +178,70 @@ class ChallengesController < ApplicationController
# tab 0:过关任务的更新; 1:评测设置的更新; 2:表示参考答案的更新; # tab 0:过关任务的更新; 1:评测设置的更新; 2:表示参考答案的更新;
def update def update
ActiveRecord::Base.transaction do begin
tab = params[:tab].to_i ActiveRecord::Base.transaction do
@challenge.update_attributes(challenge_params) tab = params[:tab].to_i
if tab == 0 && @challenge.st == 0 @challenge.update_attributes(challenge_params)
@challenge.challenge_tags.delete_all if tab == 0 && @challenge.st == 0
if params[:challenge_tag].present? @challenge.challenge_tags.delete_all
params[:challenge_tag].each do |input| if params[:challenge_tag].present?
ChallengeTag.create!(:name => input, :challenge_id => @challenge.id) params[:challenge_tag].each do |input|
ChallengeTag.create!(:name => input, :challenge_id => @challenge.id)
end
end end
end elsif tab == 1
elsif tab == 1 path = @challenge.path
path = @challenge.path exec_path = @challenge.exec_path
exec_path = @challenge.exec_path test_set = @challenge.test_sets
test_set = @challenge.test_sets sets_output = test_set.map(&:output)
sets_output = test_set.map(&:output) sets_input = test_set.map(&:input)
sets_input = test_set.map(&:input) sets_open = test_set.map(&:is_public)
sets_open = test_set.map(&:is_public) set_score = test_set.map(&:score)
set_score = test_set.map(&:score) set_match_rule = test_set.map(&:match_rule)
set_match_rule = test_set.map(&:match_rule) params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0}
params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0} params_output = params[:test_set].map{|set| set[:output] }
params_output = params[:test_set].map{|set| set[:output] } params_input = params[:test_set].map{|set| set[:input] }
params_input = params[:test_set].map{|set| set[:input] } params_score = params[:test_set].map{|set| set[:score]}
params_score = params[:test_set].map{|set| set[:score]} params_test_set = params[:test_set].map{|set| set[:match_rule]}
params_test_set = params[:test_set].map{|set| set[:match_rule]} # 测试集变化则需要更新(输入、 输出、 是否隐藏)
# 测试集变化则需要更新(输入、 输出、 是否隐藏) if sets_output != params_output || sets_open != params_hidden || sets_input != params_input ||
if sets_output != params_output || sets_open != params_hidden || sets_input != params_input || set_score != params_score || params_test_set != set_match_rule
set_score != params_score || params_test_set != set_match_rule test_set.delete_all unless test_set.blank?
test_set.delete_all unless test_set.blank? params[:test_set].each_with_index do |set, index|
params[:test_set].each_with_index do |set, index| # last 末尾匹配, full: 全完匹配
# last 末尾匹配, full: 全完匹配 logger.info("set: #{set}; match_rule : #{set[:match_rule]}")
logger.info("set: #{set}; match_rule : #{set[:match_rule]}") match_rule = set[:match_rule] == 'last' ? 'last' : 'full'
match_rule = set[:match_rule] == 'last' ? 'last' : 'full' TestSet.create(:challenge_id => @challenge.id,
TestSet.create(:challenge_id => @challenge.id, :input => "#{set[:input]}",
:input => "#{set[:input]}", :output => "#{set[:output]}",
:output => "#{set[:output]}", :is_public => params_hidden[index],
:is_public => params_hidden[index], :score => set[:score],
:score => set[:score], :match_rule => "#{match_rule}",
:match_rule => "#{match_rule}", :position => (index + 1))
:position => (index + 1)) end
@challenge.update_column(:modify_time, Time.now)
# 测试集的
@shixun.myshixuns.update_all(:system_tip => 0)
end end
@challenge.update_column(:modify_time, Time.now) 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)
@shixun.myshixuns.update_all(:system_tip => 0) end
end # 关卡评测执行文件如果被修改,需要修改脚本内容
if params[:challenge][:show_type].to_i == -1 script = modify_shixun_script @shixun, @shixun.evaluate_script
@challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil) @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
# 关卡评测执行文件如果被修改,需要修改脚本内容
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
end end
# 参考答案的'增,删,改' # 参考答案的'增,删,改'

@ -1,6 +1,6 @@
class GamesController < ApplicationController class GamesController < ApplicationController
before_action :require_login, :check_auth before_action :require_login, :check_auth
before_action :find_game before_action :find_game, except: [:jupyter]
before_action :find_shixun, only: [:show, :answer, :rep_content, :choose_build, :game_build, :game_status] before_action :find_shixun, only: [:show, :answer, :rep_content, :choose_build, :game_build, :game_status]
before_action :allowed before_action :allowed
@ -91,6 +91,19 @@ class GamesController < ApplicationController
end end
end end
def jupyter
# Jupyter没有challenge
@myshixun = Myshixun.find_by_identifier params[:identifier]
@shixun = @myshixun.shixun
# 判断tpm是否修改了
begin
@tpm_modified = @myshixun.repository_is_modified(@shixun.repo_path) # 判断TPM和TPI的版本库是否被改了
rescue
uid_logger("实训平台繁忙繁忙等级81")
end
end
def reset_vnc_link def reset_vnc_link
begin begin
# 删除vnc的pod # 删除vnc的pod

@ -365,6 +365,31 @@ class MyshixunsController < ApplicationController
end end
end end
def sync_code
shixun_tomcat = edu_setting('cloud_bridge')
begin
git_myshixun_url = repo_ip_url @myshixun.repo_path
git_shixun_url = repo_ip_url @myshixun.shixun.try(:repo_path)
git_myshixun_url = Base64.urlsafe_encode64(git_myshixun_url)
git_shixun_url = Base64.urlsafe_encode64(git_shixun_url)
# todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改.
params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}",
identifier: "xinhu1ji2qu3"}
uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository"
res = uri_post uri, params
if (res && res['code'] != 0)
tip_exception("实训云平台繁忙繁忙等级95")
end
shixun_new_commit = GitService.commits(repo_path: @myshixun.shixun.repo_path).first["id"]
@myshixun.update_attributes!(commit_id: shixun_new_commit, reset_time: @myshixun.shixun.try(:reset_time))
# 更新完成后,弹框则隐藏不再提示
@myshixun.update_column(:system_tip, false)
render_ok
rescue Exception => e
tip_exception("立即更新代码失败!#{e.message}")
end
end
# -----End # -----End

@ -6,16 +6,17 @@ class ShixunsController < ApplicationController
before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list, before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list,
:discusses, :collaborators, :fork_list, :propaedeutics] :discusses, :collaborators, :fork_list, :propaedeutics]
before_action :check_account, only: [:new, :create, :shixun_exec] before_action :check_account, only: [:new, :create, :shixun_exec, :jupyter_exec]
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror, :propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course] :get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror, :propaedeutics, :departments, :apply_shixun_mirror, :jupyter_exec,
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course] :get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file] before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy,
:add_file, :jupyter_exec]
before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish,
:shixun_members_added, :change_manager, :collaborators_delete, :shixun_members_added, :change_manager, :collaborators_delete,
@ -691,112 +692,40 @@ class ShixunsController < ApplicationController
end end
end end
# def shixun_exec # jupyter开启挑战
# if is_shixun_opening? def jupyter_exec
# tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") begin
# end if is_shixun_opening?
# current_myshixun = @shixun.current_myshixun(current_user.id) tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}")
# end
# min_challenges = @shixun.challenges.pluck(:id , :st) current_myshixun = @shixun.current_myshixun(current_user.id)
# # 因为读写分离有延迟所以如果是重置来的请求可以先跳过重置过来的params[:reset]为1 if current_myshixun
# if current_myshixun && params[:reset] != "1" @myshixun = current_myshixun
# games = current_myshixun.games else
# # 如果TPM和TPI的管卡数不相等或者关卡顺序错了说明实训被极大的改动需要重置,实训发布前打过的实训都需要重置 commit = GitService.commits(repo_path: @repo_path).try(:first)
# if is_shixun_reset?(games, min_challenges, current_myshixun) uid_logger("First comit########{commit}")
# # 这里页面弹框要收到 当前用户myshixun的identifier. tip_exception("开启实战前请先在版本库中提交代码") if commit.blank?
# tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game") commit_id = commit["id"]
# end cloud_bridge = edu_setting('cloud_bridge')
# myshixun_identifier = generate_identifier Myshixun, 10
# ActiveRecord::Base.transaction do
# if current_myshixun.repo_name.nil? @myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier,
# g = Gitlab.client modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
# repo_name = g.project(current_myshixun.gpid).try(:path_with_namespace) onclick_time: Time.now, commit_id: commit_id)
# current_myshixun.update_column(:repo_name, repo_name) # fork仓库
# end project_fork(@myshixun, @repo_path, current_user.login)
# rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
# # 如果存在实训,则直接进入实训 uri = "#{cloud_bridge}/bridge/game/openGameInstance"
# # 如果实训允许跳关传参params[:challenge_id]跳入具体的关卡 params = {tpiID: "#{myshixun.id}", tpmGitURL: rep_url, tpiRepoName: myshixun.repo_name.split("/").last}
# @current_task = interface_post uri, params, 83, "实训云平台繁忙繁忙等级83"
# if params[:challenge_id] end
# game = games.where(challenge_id: params[:challenge_id]).take end
# if @shixun.task_pass || game.status != 3 rescue => e
# game uid_logger_error(e.message)
# else tip_exception("实训云平台繁忙繁忙等级81")
# current_myshixun.current_task(games) end
# end end
# else
# current_myshixun.current_task(games)
# end
# else
# # 如果未创建关卡一定不能开启实训否则TPI没法找到当前的关卡
# if @shixun.challenges_count == 0
# tip_exception("开启实战前请先创建实训关卡")
# end
#
# # 判断实训是否全为选择题
# is_choice_type = (min_challenges.size == min_challenges.select{|challenge| challenge.last == 1}.count)
# if !is_choice_type
# commit = GitService.commits(repo_path: @repo_path).try(:first)
# uid_logger("First comit########{commit}")
# tip_exception("开启实战前请先在版本库中提交代码") if commit.blank?
# commit_id = commit["id"]
# end
#
# begin
# ActiveRecord::Base.transaction do
# begin
# myshixun_identifier = generate_identifier Myshixun, 10
# myshixun_params = {user_id: current_user.id, identifier: myshixun_identifier,
# modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
# onclick_time: Time.now, commit_id: commit_id}
# @myshixun = @shixun.myshixuns.create!(myshixun_params)
# # 其它创建关卡等操作
# challenges = @shixun.challenges
# # 之所以增加user_id是为了方便统计查询性能
# game_attrs = %i[challenge_id myshixun_id status user_id open_time identifier modify_time created_at updated_at]
# Game.bulk_insert(*game_attrs) do |worker|
# base_attr = {myshixun_id: @myshixun.id, user_id: @myshixun.user_id}
# challenges.each_with_index do |challenge, index|
# status = (index == 0 ? 0 : 3)
# game_identifier = generate_identifier(Game, 12)
# worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now,
# identifier: game_identifier, modify_time: challenge.modify_time))
# end
# end
# @current_task = @myshixun.current_task(@myshixun.games)
# rescue Exception => e
# logger.error("------ActiveRecord::RecordInvalid: #{e.message}")
# raise("ActiveRecord::RecordInvalid")
# end
# end
# # 如果实训是纯选择题则不需要去fork仓库以及中间层的相关操作了
# ActiveRecord::Base.transaction do
# unless is_choice_type
# # fork仓库
# cloud_bridge = edu_setting('cloud_bridge')
# project_fork(@myshixun, @repo_path, current_user.login)
# rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
# uid_logger("start openGameInstance")
# uri = "#{cloud_bridge}/bridge/game/openGameInstance"
# logger.info("end openGameInstance")
# params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last}
# uid_logger("openGameInstance params is #{params}")
# interface_post uri, params, 83, "实训云平台繁忙繁忙等级83"
# end
# end
# rescue Exception => e
# logger.info("shixun_exec error: #{e.message}")
# if e.message != "ActiveRecord::RecordInvalid"
# logger.error("##########project_fork error #{e.message}")
# @myshixun.destroy!
# end
# raise "实训云平台繁忙繁忙等级81"
# end
# end
# end
# gameID 及实训ID
# status: 0 , 1 申请过, 2实训关卡路径未填 3 实训标签未填, 4 实训未创建关卡
def publish def publish
@status = 0 @status = 0
@position = [] @position = []

@ -163,9 +163,12 @@ module ExportHelper
count_2 = common_homeworks.size count_2 = common_homeworks.size
count_3 = group_homeworks.size count_3 = group_homeworks.size
count_4 = tasks.size count_4 = tasks.size
all_user_ids = all_members.pluck(:user_id)
#实训作业 #实训作业
shixun_homeworks.each_with_index do |s,index| 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 title_no = index.to_i + 1
student_work_to_xlsx(all_student_works,s) student_work_to_xlsx(all_student_works,s)
shixun_work_display_name = format_sheet_name (title_no.to_s + "." + s.name).strip.first(30) 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| 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 title_no = count_1 + index.to_i + 1
student_work_to_xlsx(all_student_works,c) student_work_to_xlsx(all_student_works,c)
@ -187,7 +190,7 @@ module ExportHelper
#分组作业 #分组作业
group_homeworks.each_with_index do |c,index| 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 title_no = count_1 + count_2 + index.to_i + 1
student_work_to_xlsx(all_student_works,c) student_work_to_xlsx(all_student_works,c)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30) 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| 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 title_no = count_1 + count_2 + count_3 + index.to_i + 1
graduation_work_to_xlsx(all_student_works,c,current_user) graduation_work_to_xlsx(all_student_works,c,current_user)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30) 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| 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 title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1
get_export_users(c,course,all_student_works) get_export_users(c,course,all_student_works)
work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30) work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30)

@ -17,10 +17,17 @@ class SyncTrustieJob < ApplicationJob
"number": count "number": count
} }
uri = URI.parse(url) uri = URI.parse(url)
# http = Net::HTTP.new(uri.hostname, uri.port)
if api_host if api_host
http = Net::HTTP.new(uri.hostname, uri.port) 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 end
end end

@ -0,0 +1,7 @@
json.user do
json.partial! 'users/user', user: current_user
end
json.(@shixun, :id, :identifier, :status, :name)
json.myshixun_identifier @myshixun.identifier
json.tpm_modified @tpm_modified

@ -0,0 +1 @@
json.identifier @myshixun.identifier

@ -184,6 +184,7 @@ Rails.application.routes.draw do
post :html_content post :html_content
get :open_webssh get :open_webssh
get :challenges get :challenges
post :sync_code
end end
collection do collection do
get :sigle_mul_test get :sigle_mul_test
@ -219,6 +220,7 @@ Rails.application.routes.draw do
get :check_test_sets get :check_test_sets
get :unlock_choose_answer get :unlock_choose_answer
get :get_choose_answer get :get_choose_answer
get :jupyter
end end
collection do collection do
@ -278,6 +280,7 @@ Rails.application.routes.draw do
post :update_permission_setting post :update_permission_setting
post :update_learn_setting post :update_learn_setting
get :jupyter_data_sets get :jupyter_data_sets
get :jupyter_exec
end end
resources :challenges do resources :challenges do

@ -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

@ -52,6 +52,7 @@ export function initAxiosInterceptors(props) {
//proxy="http://47.96.87.25:48080" //proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net" proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net" proxy="https://test-newweb.educoder.net"
proxy="https://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001" //proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求 // 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
@ -88,7 +89,6 @@ export function initAxiosInterceptors(props) {
url = `${config.url}`; url = `${config.url}`;
} }
} }
if(`${config[0]}`!=`true`){ if(`${config[0]}`!=`true`){
if (window.location.port === "3007") { if (window.location.port === "3007") {
// if (url.indexOf('.json') == -1) { // if (url.indexOf('.json') == -1) {

@ -38,9 +38,9 @@ class VNCContainer extends Component {
} }
shouldComponentUpdate () { // shouldComponentUpdate () {
return false; // return false;
} // }
getSecondDrawerWidth = () => { getSecondDrawerWidth = () => {
return $('#game_right_contents').width() - firstDrawerWidth return $('#game_right_contents').width() - firstDrawerWidth
@ -337,11 +337,11 @@ class VNCContainer extends Component {
width={firstDrawerWidth} width={firstDrawerWidth}
closable={false} closable={false}
onClose={this.onBottomDrawerClose} onClose={this.onBottomDrawerClose}
visible={this.state.bottomDrawer} visible={this.state.bottomDrawer===undefined?false:this.state.bottomDrawer}
className={'codeEvaluateDrawer'} className={'codeEvaluateDrawer'}
placement="bottom" placement="bottom"
getContainer={false} getContainer={false}
style={{ position: 'absolute', bottom: '25px', zIndex: 1 }} style={{ position: 'absolute', bottom: '-25px', zIndex: 1 }}
afterVisibleChange={(visible) => { afterVisibleChange={(visible) => {
if (visible) { if (visible) {
const canvas = $('.vncDisply canvas')[0] const canvas = $('.vncDisply canvas')[0]

@ -212,6 +212,7 @@ class Audit_situationComponent extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
<div className="padding20 edu-back-white mt20" style={{minHeight: '640px'}}> <div className="padding20 edu-back-white mt20" style={{minHeight: '640px'}}>

File diff suppressed because it is too large Load Diff

@ -20,7 +20,7 @@ class TPMChallenge extends Component {
} }
render() { render() {
const { loadingContent, shixun, user, match,jupyterbool const { loadingContent, shixun, user, match,jupyterbool,is_jupyter
} = this.props; } = this.props;
return ( return (
<React.Fragment> <React.Fragment>
@ -32,13 +32,15 @@ class TPMChallenge extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
{ {
jupyterbool===true? is_jupyter===true?
<Challengesjupyter <Challengesjupyter
{...this.props} {...this.props}
/> />
: <Challenges :
<Challenges
{...this.props} {...this.props}
/> />
} }

@ -15,13 +15,16 @@ class TPMChallengeContainer extends Component {
render() { render() {
const { tpmLoading } = this.props; const { tpmLoading } = this.props;
const user = this.props.current_user; const user = this.props.current_user;
// console.log("TPMChallengeContainerTPMChallengeContainer");
// console.log(this.props);
return ( return (
<React.Fragment> <React.Fragment>
{ tpmLoading ? <div style={{ minHeight: '886px'}}></div> : { tpmLoading ? <div style={{ minHeight: '886px'}}></div> :
<TPMChallenge <TPMChallenge
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
> >
</TPMChallenge> </TPMChallenge>
} }

@ -31,6 +31,7 @@ class TPMCollaborators extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
<Collaborators <Collaborators
{...this.props} {...this.props}

@ -35,7 +35,7 @@ class TPMChallengeContainer extends Component {
{...this.state} {...this.state}
user={user} user={user}
aboutFocus={this.props.aboutFocus} aboutFocus={this.props.aboutFocus}
is_jupyter={this.props.is_jupyter}
> >
</TPMCollaborators> </TPMCollaborators>
} }

@ -89,7 +89,7 @@ class TPMDataset extends Component {
} }
mysonChange = (e) => { mysonChange = (e) => {
console.log(`全选checked = ${e.target.checked}`); // console.log(`全选checked = ${e.target.checked}`);
if (e.target.checked === true) { if (e.target.checked === true) {
let mydata=[]; let mydata=[];
let datas=[]; let datas=[];
@ -103,8 +103,8 @@ class TPMDataset extends Component {
selectedRowKeysdata:mydata, selectedRowKeysdata:mydata,
selectedRowKeys: datas, selectedRowKeys: datas,
}) })
console.log(mydata); // console.log(mydata);
console.log(datas); // console.log(datas);
} else { } else {
@ -237,6 +237,7 @@ class TPMDataset extends Component {
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
debugger
if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let {fileList} = this.state; let {fileList} = this.state;
@ -256,6 +257,7 @@ class TPMDataset extends Component {
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
debugger
if(!file.percent || file.percent == 100){ if(!file.percent || file.percent == 100){
confirm({ confirm({
title: '确定要删除这个附件吗?', title: '确定要删除这个附件吗?',
@ -357,7 +359,7 @@ class TPMDataset extends Component {
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
beforeUpload: (file, fileList) => { beforeUpload: (file, fileList) => {
debugger
if (this.state.fileList.length >= 1) { if (this.state.fileList.length >= 1) {
return false return false
} }
@ -400,6 +402,7 @@ class TPMDataset extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
<div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}> <div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}>

@ -38,7 +38,7 @@ class TPMRanking_listContainer extends Component {
{...this.state} {...this.state}
user={user} user={user}
aboutFocus={this.props.aboutFocus} aboutFocus={this.props.aboutFocus}
is_jupyter={this.props.is_jupyter}
> >
</TPMForklist> </TPMForklist>
} }

@ -42,6 +42,7 @@ class TPMForklist extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
{ loadingContent ? { loadingContent ?
<CircularProgress size={40} thickness={3} style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '200px', display: 'block' }}/> : <CircularProgress size={40} thickness={3} style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '200px', display: 'block' }}/> :

@ -20,6 +20,8 @@ import TPMRepositoryComponent from './TPMRepositoryComponent';
import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits';
//import TPMsettings from './TPMsettings/TPMsettings';
import TPMsettings from './TPMsettings/oldTPMsettings'; import TPMsettings from './TPMsettings/oldTPMsettings';
import TPMChallengeComponent from './TPMChallengeContainer'; import TPMChallengeComponent from './TPMChallengeContainer';
@ -29,6 +31,7 @@ import TPMCollaboratorsComponent from './TPMCollaboratorsContainer';
import Audit_situationComponent from './Audit_situationComponent'; import Audit_situationComponent from './Audit_situationComponent';
import TPMDataset from './TPMDataset'; import TPMDataset from './TPMDataset';
import '../page/tpiPage.css' import '../page/tpiPage.css'
import TPMNav from "./component/TPMNav";
const $ = window.$ const $ = window.$
//任务 //任务
@ -143,6 +146,7 @@ class TPMIndex extends Component {
TPMRightSectionData:undefined, TPMRightSectionData:undefined,
PropaedeuticsList: undefined, PropaedeuticsList: undefined,
tpmindexjupyterbool:false, tpmindexjupyterbool:false,
is_jupyter:false,
} }
} }
@ -193,7 +197,7 @@ class TPMIndex extends Component {
propaedeutics:response.data.propaedeutics, propaedeutics:response.data.propaedeutics,
status: response.data.shixun_status, status: response.data.shixun_status,
secret_repository: response.data.secret_repository, secret_repository: response.data.secret_repository,
is_jupyter:response.data.is_jupyter=== undefined||response.data.is_jupyter===null?false:response.data.is_jupyter,
}); });
} }
}).catch((error) => { }).catch((error) => {
@ -205,7 +209,8 @@ class TPMIndex extends Component {
power: undefined, power: undefined,
identity: undefined, identity: undefined,
status: undefined, status: undefined,
propaedeutics:undefined propaedeutics:undefined,
is_jupyter:false,
}); });
}); });
@ -274,6 +279,7 @@ class TPMIndex extends Component {
let url = window.location.href; let url = window.location.href;
let flag = url.indexOf("add_file")>-1; let flag = url.indexOf("add_file")>-1;
// console.log(this.state.is_jupyter);
return ( return (
<div className="newMain clearfix"> <div className="newMain clearfix">
{/*头部*/} {/*头部*/}
@ -295,16 +301,16 @@ class TPMIndex extends Component {
<Switch {...this.props}> <Switch {...this.props}>
<Route path="/shixuns/:shixunId/repository/:repoId/commits" render={ <Route path="/shixuns/:shixunId/repository/:repoId/commits" render={
(props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props} (props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
<Route path="/shixuns/:shixunId/secret_repository/:repoId/commits" render={ <Route path="/shixuns/:shixunId/secret_repository/:repoId/commits" render={
(props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props} secret_repository_tab={true} (props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props} secret_repository_tab={true} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
{/*任务*/}
<Route exact path="/shixuns/:shixunId/challenges" render={ <Route exact path="/shixuns/:shixunId/challenges" render={
(props) => (<TPMChallengeComponent {...this.props} jupyterbool={true} {...this.state} {...props} (props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
@ -314,24 +320,24 @@ class TPMIndex extends Component {
}></Route> }></Route>
<Route path="/shixuns/:shixunId/repository" render={ <Route path="/shixuns/:shixunId/repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} (props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
<Route path="/shixuns/:shixunId/secret_repository" render={ <Route path="/shixuns/:shixunId/secret_repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} secret_repository_tab={true} (props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props} secret_repository_tab={true} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
{/* <Route exact path="/shixuns/:shixunId/propaedeutics" component={TPMPropaedeuticsComponent}></Route> */} {/* <Route exact path="/shixuns/:shixunId/propaedeutics" component={TPMPropaedeuticsComponent}></Route> */}
<Route exact path="/shixuns/:shixunId/propaedeutics" render={ <Route exact path="/shixuns/:shixunId/propaedeutics" render={
(props) => (<TPMPropaedeuticsComponent {...this.props} {...this.state} {...props} (props) => (<TPMPropaedeuticsComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
<Route exact path="/shixuns/:shixunId/collaborators" render={ <Route exact path="/shixuns/:shixunId/collaborators" render={
(props) => (<TPMCollaboratorsComponent {...this.props} {...this.state} {...props} (props) => (<TPMCollaboratorsComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
@ -340,7 +346,7 @@ class TPMIndex extends Component {
<Route path="/shixuns/:shixunId/shixun_discuss" render={ <Route path="/shixuns/:shixunId/shixun_discuss" render={
(props) => (<TPMShixunDiscussContainer {...this.props} {...this.state} {...props} (props) => (<TPMShixunDiscussContainer {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
initForumState={(data)=>this.initForumState(data)} initForumState={(data)=>this.initForumState(data)}
setSearchValue={this.setSearchValue} setSearchValue={this.setSearchValue}
setHotLabelIndex={this.setHotLabelIndex} setHotLabelIndex={this.setHotLabelIndex}
@ -354,17 +360,17 @@ class TPMIndex extends Component {
{/*实训项目条目塞选*/} {/*实训项目条目塞选*/}
<Route exact path="/shixuns/:shixunId/ranking_list" render={ <Route exact path="/shixuns/:shixunId/ranking_list" render={
(props) => (<TPMRanking_listComponent {...this.props} {...this.state} {...props} (props) => (<TPMRanking_listComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
{/*合作者*/}
<Route exact path="/shixuns/:shixunId/dataset" render={ <Route exact path="/shixuns/:shixunId/dataset" render={
(props) => (<TPMDataset {...this.props} {...this.state} {...props} (props) => (<TPMDataset {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
<Route exact path="/shixuns/:shixunId/audit_situation" render={ <Route exact path="/shixuns/:shixunId/audit_situation" render={
(props) => (<Audit_situationComponent {...this.props} {...this.state} {...props} (props) => (<Audit_situationComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>
@ -415,7 +421,7 @@ class TPMIndex extends Component {
}></Route> }></Route>
<Route exact path="/shixuns/:shixunId" render={ <Route exact path="/shixuns/:shixunId" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props} (props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>) />)
}></Route> }></Route>

@ -52,6 +52,7 @@ class TPMPropaedeutics extends Component {
shixun={shixun} shixun={shixun}
{...this.state} {...this.state}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
/> />
<Propaedeutics <Propaedeutics

@ -26,6 +26,7 @@ class TPMPropaedeuticsComponent extends Component {
{ tpmLoading ? <div style={{ minHeight: '886px'}}></div> : { tpmLoading ? <div style={{ minHeight: '886px'}}></div> :
<TPMPropaedeutics <TPMPropaedeutics
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
> >
</TPMPropaedeutics> </TPMPropaedeutics>
} }

@ -38,6 +38,7 @@ class TPMRanking_list extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
<Ranking_list <Ranking_list

@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
import TPMRanking_list from './TPMRanking_list' import TPMRanking_list from './TPMRanking_list'
import axios from 'axios'; import axios from 'axios';
import TPMNav from "./component/TPMNav";
class TPMRanking_listContainer extends Component { class TPMRanking_listContainer extends Component {
constructor(props) { constructor(props) {
@ -26,7 +27,9 @@ class TPMRanking_listContainer extends Component {
{...this.state} {...this.state}
user={user} user={user}
aboutFocus={this.props.aboutFocus} aboutFocus={this.props.aboutFocus}
> is_jupyter={this.props.is_jupyter}
>
</TPMRanking_list> </TPMRanking_list>
} }
</React.Fragment> </React.Fragment>

@ -35,6 +35,7 @@ class TPMRepository extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
{/* <RepositoryChooseModal {...this.props}></RepositoryChooseModal> */} {/* <RepositoryChooseModal {...this.props}></RepositoryChooseModal> */}
{ loadingContent ? { loadingContent ?

@ -200,6 +200,7 @@ class TPMRepositoryComponent extends Component {
{...this.state} {...this.state}
nameTypeMap={this.nameTypeMap} nameTypeMap={this.nameTypeMap}
fetchRepo={this.fetchRepo} fetchRepo={this.fetchRepo}
is_jupyter={this.props.is_jupyter}
> >
</TPMRepository> </TPMRepository>
: :

@ -44,6 +44,7 @@ class TPMShixunDiscuss extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
{ loadingContent ? { loadingContent ?
<CircularProgress size={40} thickness={3} style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '200px', display: 'block' }}/> : <CircularProgress size={40} thickness={3} style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '200px', display: 'block' }}/> :

@ -33,7 +33,7 @@ class TPMShixunDiscussContainer extends Component {
{...this.state} {...this.state}
user={user} user={user}
aboutFocus={this.props.aboutFocus} aboutFocus={this.props.aboutFocus}
is_jupyter={this.props.is_jupyter}
> >
</TPMShixunDiscuss> </TPMShixunDiscuss>
} }

@ -33,7 +33,24 @@ const Option = Select.Option;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
const confirm = Modal.confirm; const confirm = Modal.confirm;
function range(start, end) {
const result = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
}
function disabledDateTime() {
return {
// disabledHours: () => range(0, 24).splice(4, 20),
disabledMinutes: () => range(1, 30).concat(range(31, 60)),
// disabledSeconds: () => [0, 60],
};
}
function disabledDate(current) {
return current && current < moment().endOf('day').subtract(1, 'days');
}
export default class Shixuninformation extends Component { export default class Shixuninformation extends Component {
@ -63,7 +80,7 @@ export default class Shixuninformation extends Component {
}) })
} }
return ( return (
<div> <div className="educontent mb50 edu-back-white padding10-20">
<div className="clearfix ml30"> <div className="clearfix ml30">
<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>复制:</span> <span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>复制:</span>
<span className="fl mt5"> <span className="fl mt5">

@ -23,7 +23,7 @@ export default class Shixuninformation extends Component {
render() { render() {
return ( return (
<div> <div className="educontent mb50 edu-back-white padding10-20">
1111 1111
</div> </div>
); );

@ -11,17 +11,10 @@ import Configuration from './Configuration';
import LearningSettings from './LearningSettings'; import LearningSettings from './LearningSettings';
import Bottomsubmit from "../../modals/Bottomsubmit";
import moment from 'moment';
import axios from 'axios'; import axios from 'axios';
import './css/TPMsettings.css'; import './css/TPMsettings.css';
import {getImageUrl, toPath, getUrl, appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
const {TabPane} = Tabs; const {TabPane} = Tabs;
// 处理整点 半点 // 处理整点 半点
@ -90,11 +83,23 @@ export default class TPMsettings extends Component {
render() { render() {
return ( return (
<div>
<div className="educontent mt30 mb50 edu-back-white padding10-20"> <div>
<style>
{
`
.ant-tabs-bar{
width: 1200px;
margin: 0 auto;
background: #fff;
border-bottom: 0px;
margin-top: 30px!important;
}
`
}
</style>
<Tabs tabBarExtraContent={ <Tabs tabBarExtraContent={
<div className={"mb20"}> <div className={"mb20 mr20"}>
<Button type="primary" ghost className={"Permanentban"}> <Button type="primary" ghost className={"Permanentban"}>
永久关闭 永久关闭
</Button> </Button>
@ -124,9 +129,6 @@ export default class TPMsettings extends Component {
</Tabs> </Tabs>
</div> </div>
<Bottomsubmit/>
</div>
); );
} }
} }

@ -5,7 +5,7 @@ import { BrowserRouter as Router, Route, Link } from "react-router-dom";
class TPMNav extends Component { class TPMNav extends Component {
render() { render() {
const { user, match, shixun, secret_repository } = this.props; const { user, match, shixun, secret_repository,is_jupyter} = this.props;
let isAdminOrCreator = false; let isAdminOrCreator = false;
if (user) { if (user) {
isAdminOrCreator = user.admin || user.manager isAdminOrCreator = user.admin || user.manager
@ -15,6 +15,8 @@ class TPMNav extends Component {
// console.log(this.props.propaedeutics) // console.log(this.props.propaedeutics)
const challengesPath = `/shixuns/${shixunId}/challenges`; const challengesPath = `/shixuns/${shixunId}/challenges`;
// console.log(match.path) // console.log(match.path)
// console.log("TPMNavTPMNavTPMNav");
// console.log(is_jupyter);
return ( return (
<div className="bor-bottom-greyE clearfix pl20 pr20 pt40 pb20 edu-back-white challengeNav"> <div className="bor-bottom-greyE clearfix pl20 pr20 pt40 pb20 edu-back-white challengeNav">
<Link <Link
@ -28,8 +30,15 @@ class TPMNav extends Component {
>背景知识</Link> >背景知识</Link>
} }
{ this.props.identity >4||this.props.identity===undefined ?"":<Link to={`/shixuns/${shixunId}/repository`} { this.props.identity >4||this.props.identity===undefined ?"":
className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</Link>} (this.props.is_jupyter===false?
<Link to={`/shixuns/${shixunId}/repository`}
className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</Link>
:"")
}
{this.props.identity >4||this.props.identity===undefined ?"": secret_repository && <Link to={`/shixuns/${shixunId}/secret_repository`} {this.props.identity >4||this.props.identity===undefined ?"": secret_repository && <Link to={`/shixuns/${shixunId}/secret_repository`}
className={`${match.url.indexOf('secret_repository') != -1 ? 'active' : ''} fl mr40`}>私密版本库</Link>} className={`${match.url.indexOf('secret_repository') != -1 ? 'active' : ''} fl mr40`}>私密版本库</Link>}
@ -37,8 +46,13 @@ class TPMNav extends Component {
className={`${match.url.indexOf('collaborators') != -1 ? 'active' : ''} fl mr40`}>合作者</Link> className={`${match.url.indexOf('collaborators') != -1 ? 'active' : ''} fl mr40`}>合作者</Link>
{/*jupyter*/} {/*jupyter*/}
<Link to={`/shixuns/${shixunId}/dataset`} {
className={`${match.url.indexOf('dataset') != -1 ? 'active' : ''} fl mr40`}>数据集</Link> this.props.is_jupyter===true?
<Link to={`/shixuns/${shixunId}/dataset`}
className={`${match.url.indexOf('dataset') != -1 ? 'active' : ''} fl mr40`}>数据集</Link>
:""
}
<Link to={`/shixuns/${shixunId}/shixun_discuss`} <Link to={`/shixuns/${shixunId}/shixun_discuss`}
className={`${match.url.indexOf('shixun_discuss') != -1 ? 'active' : ''} fl mr40`}>评论</Link> className={`${match.url.indexOf('shixun_discuss') != -1 ? 'active' : ''} fl mr40`}>评论</Link>

@ -265,7 +265,7 @@ class Newshixuns extends Component {
{ {
message: '提示', message: '提示',
description: description:
'提交成功!', '新建申请已提交,请等待管理员审核。',
} }
) )
@ -589,10 +589,12 @@ class Newshixuns extends Component {
)} )}
<span className="fl ml20 color-grey lineh-20"> <span className="fl ml20 color-grey lineh-20">
<div> <div>
{this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" : {this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
<div className={"font-12"} style={{'max-width':'700px'}}> <div className={"font-12"} style={{'max-width':'700px'}}>
{`已安装软件:${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`} {`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`已安装软件:`+this.state.mainvalues}`}
{` 说明:添加了${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`} {`${this.state.subvalues===undefined||this.state.subvalues=== ""?"":this.state.mainvalues===undefined||this.state.mainvalues=== ""?`已安装软件:`+this.state.subvalues:this.state.subvalues}`}
{`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`说明:添加了`+this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues=== ""?"":
this.state.mainvalues===undefined||this.state.mainvalues=== ""?`说明:添加了`+this.state.subvalues:this.state.subvalues}`}
</div>} </div>}
</div> </div>
@ -697,27 +699,6 @@ class Newshixuns extends Component {
{/*</Form>*/} {/*</Form>*/}
</Modal> </Modal>
<Modal
keyboard={false}
title="提示"
visible={postapplytitle}
closable={false}
footer={null}
>
<div>
<div className="task-popup-content"><p
className="task-popup-text-center font-16"><span
className="font-17 mt10">新建申请已提交请等待管理员的审核</span></p>
<li className="font-14 mt15 color-grey-6 edu-txt-center">我们将在1-2个工作日内与您联系
</li>
</div>
<div className="task-popup-OK clearfix">
<a className="task-btn task-btn-orange"
onClick={this.yeshidemodel}>知道啦</a>
</div>
</div>
</Modal>
</div> </div>
</div> </div>

@ -60,12 +60,37 @@ class Challengesjupyter extends Component {
componentDidMount() { componentDidMount() {
setTimeout(this.ChallengesList(), 1000); setTimeout(this.ChallengesList(), 1000);
// console.log("componentDidMount");
// console.log("Challengesjupyter");
// console.log(this.props);
let id = this.props.match.params.shixunId;
let ChallengesURL = `/jupyters/get_info_with_tpm.json`;
let datas={
identifier:id,
}
axios.get(ChallengesURL, {params: datas}).then((response) => {
debugger
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
console.log("componentDidMount"); }else{
console.log("Challengesjupyter"); // console.log("componentDidMountChallengesjupyter");
console.log(this.props); // console.log(response.data);
debugger
if(response.data.status===0){
this.setState({
jupyter_url:response.data.url,
jupyter_port:response.data.port,
})
}else{
}
}
}).catch((error) => {
console.log(error)
});
} }
@ -121,19 +146,25 @@ class Challengesjupyter extends Component {
}; };
modifyjupyter=(propsysl)=>{ modifyjupyter=()=>{
console.log("propsysl"); // console.log("propsysl");
console.log(propsysl); // console.log(propsysl);
let id=this.props.match.params.shixunId; let id=this.props.match.params.shixunId;
var jupyter_port="";
const url=`/shixuns/${id}/update_jupyter.json`; try{
jupyter_port= parseInt(this.state.jupyter_port);
}catch (e) {
jupyter_port=this.state.jupyter_port;
}
const url=`/jupyters/save_with_tpm.json`;
const data={ const data={
identifier:id, identifier:id,
jupyter_port:propsysl.shixunsDetails.jupyter_port jupyter_port:jupyter_port,
} }
axios.post(url, data) axios.post(url, data)
.then((result) => { .then((result) => {
if (result.data.status == 0) { if (result.data.status === 0) {
this.props.showNotification(`应用成功`); this.props.showNotification(`应用成功`);
} }
}).catch((error) => { }).catch((error) => {
@ -221,13 +252,22 @@ class Challengesjupyter extends Component {
` `
} }
</style> </style>
{
this.state.jupyter_url === null || this.state.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.state)}><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> <style>
{ {
` `
@ -254,18 +294,13 @@ class Challengesjupyter extends Component {
<div className="pb47"> <div className="pb47">
{ {
this.props.shixunsDetails===null || this.props.shixunsDetails===undefined||JSON.stringify(this.props.shixunsDetails)==="{}"? this.state.jupyter_url===null || this.state.jupyter_url===undefined?
"" ""
: :
( <iframe src={this.state.jupyter_url}
this.props&&this.props.shixunsDetails&&this.props.shixunsDetails.jupyter_url?
<iframe src={this.props.shixunsDetails.jupyter_url}
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame" sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
name="framename" width="100%" height="700" frameBorder="0" name="framename" width="100%" height="700" frameBorder="0"
></iframe> ></iframe>
:""
)
} }
</div> </div>
</div> </div>

@ -3,6 +3,11 @@
line-height: 30px; line-height: 30px;
} }
.height28 {
height: 30px;
line-height:28px;
}
.line27{ .line27{
line-height: 27px; line-height: 27px;
vertical-align: 1px; vertical-align: 1px;

@ -457,7 +457,7 @@ class Collaborators extends Component {
style={{display:this.props.identity<5?"flex":"none"}} style={{display:this.props.identity<5?"flex":"none"}}
> >
<div className="yslwushiwidth"> <div className="yslwushiwidth">
<p className="edu-default-btn edu-greenback-btn ml20 height40 yslwushiwidthcolortest">共12</p> <p className="edu-default-btn edu-greenback-btn ml20 height28 yslwushiwidthcolortest">{collaboratorList&&collaboratorList.length}</p>
</div> </div>
<div className="yslwushiwidth xaxisreverseorder"> <div className="yslwushiwidth xaxisreverseorder">
@ -469,7 +469,13 @@ class Collaborators extends Component {
<a onClick={() => this.showCollaboratorsvisible("admin")} <a onClick={() => this.showCollaboratorsvisible("admin")}
style={{display:this.props.identity===1?"flex":"none"}} style={{display:this.props.identity===1?"flex":"none"}}
data-remote="true" data-remote="true"
className="edu-default-btn edu-greenback-btn mr20 height40 yslwushiwidthbuton">更换管理员</a> className="edu-default-btn edu-greenback-btn mr20 height40 yslwushiwidthbuton">
<p style={{
textAlign: "center",
width:'100%',
lineHeight: "29px",
}}>更换管理员</p>
</a>
</div> </div>

@ -67,6 +67,7 @@ class TPMRepositoryCommits extends Component {
user={user} user={user}
shixun={shixun} shixun={shixun}
{...this.props} {...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav> ></TPMNav>
{ loadingContent ? { loadingContent ?
<CircularProgress size={40} thickness={3} <CircularProgress size={40} thickness={3}

@ -52,8 +52,6 @@
width:32px; width:32px;
height:30px; height:30px;
font-size:16px; font-size:16px;
font-family:MicrosoftYaHei;
color:#4CACFF;
line-height:30px; line-height:30px;
} }

Loading…
Cancel
Save