Merge branches 'dev_aliyun' and 'dev_jupyter' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_jupyter

chromesetting
杨树明 5 years ago
commit d341889aae

11
.gitignore vendored

@ -6,6 +6,7 @@
# Ignore bundler config.
/.bundle
/bundle
# Ignore lock config file
*.lock
@ -70,3 +71,13 @@ vendor/bundle/
/workspace
/log
/public/admin
/mysql_data
.generators
.rakeTasks
db/bak/
docker/
educoder.sql
redis_data/
Dockerfile

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

@ -57,7 +57,6 @@ class AttachmentsController < ApplicationController
@attachment = Attachment.where(disk_filename: disk_filename,
author_id: current_user.id,
cloud_url: remote_path).first
if @attachment.blank?
@attachment = Attachment.new
@attachment.filename = upload_file.original_filename
@ -68,6 +67,7 @@ class AttachmentsController < ApplicationController
@attachment.author_id = current_user.id
@attachment.disk_directory = month_folder
@attachment.cloud_url = remote_path
@attachment.disk_directory = save_path
@attachment.save!
else
logger.info "文件已存在id = #{@attachment.id}, filename = #{@attachment.filename}"
@ -196,4 +196,5 @@ class AttachmentsController < ApplicationController
end
end
end
end

@ -13,6 +13,9 @@ class ChallengesController < ApplicationController
include ShixunsHelper
include ChallengesHelper
# 新建实践题
def new
@position = @shixun.challenges.count + 1
@ -160,6 +163,8 @@ class ChallengesController < ApplicationController
@shixun.increment!(:visits)
end
def show
@tab = params[:tab].nil? ? 1 : params[:tab].to_i
challenge_num = @shixun.challenges_count

@ -1,15 +1,18 @@
class GamesController < ApplicationController
before_action :require_login, :check_auth
before_action :find_game
before_action :find_game, except: [:jupyter]
before_action :find_shixun, only: [:show, :answer, :rep_content, :choose_build, :game_build, :game_status]
before_action :allowed
before_action :allowed, except: [:jupyter]
#require 'iconv'
include GamesHelper
include ApplicationHelper
def show
uid_logger("--games show start")
# 防止评测中途ajaxE被取消;3改成0是为了处理首次进入下一关的问题
@ -88,6 +91,22 @@ class GamesController < ApplicationController
end
end
def jupyter
# Jupyter没有challenge
@myshixun = Myshixun.find_by_identifier params[:identifier]
unless current_user.id == @myshixun.user_id || current_user.admin_or_business?
raise Educoder::TipException.new(403, "..")
end
@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
begin
# 删除vnc的pod

@ -0,0 +1,46 @@
class JupytersController < ApplicationController
include JupyterService
before_action :shixun, only: [:open, :open1, :test, :save]
def save_with_tpi
myshixun = Myshixun.find_by(identifier: params[:identifier])
jupyter_save_with_game(myshixun, params[:jupyter_port])
render json: {status: 0}
end
def save_with_tpm
shixun = Shixun.find_by(identifier: params[:identifier])
jupyter_save_with_shixun(shixun, params[:jupyter_port])
render json: {status: 0}
end
def get_info_with_tpi
myshixun = Myshixun.find_by(identifier: params[:identifier])
url = jupyter_url_with_game(myshixun)
port = jupyter_port_with_game(myshixun)
render json: {status: 0, url: url, port: port}
end
def get_info_with_tpm
shixun = Shixun.find_by(identifier: params[:identifier])
url = jupyter_url_with_shixun(shixun)
port = jupyter_port_with_shixun(shixun)
render json: {status: 0, url: url, port: port}
end
def reset_with_tpi
myshixun = Myshixun.find_by(identifier: params[:identifier])
info = jupyter_tpi_reset(myshixun)
render json: {status: 0, url: info[:url], port: info[:port]}
end
def reset_with_tpm
shixun = Shixun.find_by(identifier: params[:identifier])
info = jupyter_tpm_reset(shixun)
render json: {status: 0, url: info[:url], port: info[:port]}
end
end

@ -366,6 +366,31 @@ class MyshixunsController < ApplicationController
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

@ -6,16 +6,17 @@ class ShixunsController < ApplicationController
before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list,
:discusses, :collaborators, :fork_list, :propaedeutics]
before_action :check_account, only: [:new, :create, :shixun_exec]
before_action :check_account, only: [:new, :create, :shixun_exec, :jupyter_exec]
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
:propaedeutics, :departments, :apply_shixun_mirror,
:propaedeutics, :departments, :apply_shixun_mirror, :jupyter_exec,
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file]
before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy,
:add_file, :jupyter_exec]
before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :apply_public,
:shixun_members_added, :change_manager, :collaborators_delete,
@ -364,73 +365,158 @@ class ShixunsController < ApplicationController
end
def create
# 评测脚本的一些操作
main_type, sub_type = params[:main_type], params[:small_type]
mirror = MirrorScript.where(:mirror_repository_id => main_type)
identifier = generate_identifier Shixun, 8
@shixun = Shixun.new(shixun_params)
@shixun.identifier = identifier
@shixun.user_id = current_user.id
@shixun.reset_time, @shixun.modify_time = Time.now, Time.now
if sub_type.blank?
shixun_script = mirror.first.try(:script)
else
main_mirror = MirrorRepository.find(main_type).type_name
sub_mirror = MirrorRepository.where(id: sub_type).pluck(:type_name)
if main_mirror == "Java" && sub_mirror.include?("Mysql")
shixun_script = mirror.last.try(:script)
else
shixun_script = mirror.first.try(:script)
shixun_script = modify_shixun_script @shixun, shixun_script
@shixun = CreateShixunService.call(current_user, shixun_params, params)
end
# 保存jupyter到版本库
def update_jupyter
jupyter_save_with_shixun(@shixun, params[:jupyter_port])
end
ActiveRecord::Base.transaction do
def update
# 镜像方面
mirror_ids = MirrorRepository.where(id: params[:main_type])
.or( MirrorRepository.where(id: params[:sub_type])).pluck(:id).uniq
old_mirror_ids = @shixun.shixun_mirror_repositories
.where(mirror_repository_id: params[:main_type])
.or(@shixun.shixun_mirror_repositories.where(mirror_repository_id: params[:sub_type]))
.pluck(:mirror_repository_id).uniq
new_mirror_id = (mirror_ids - old_mirror_ids).map{|id| {mirror_repository_id: id}} # 转换成数组hash方便操作
logger.info("##########new_mirror_id: #{new_mirror_id}")
logger.info("##########old_mirror_ids: #{old_mirror_ids}")
logger.info("##########mirror_ids: #{mirror_ids}")
# 服务配置方面
service_create_params = service_config_params[:shixun_service_configs]
.select{|config| !old_mirror_ids.include?(config[:mirror_repository_id]) &&
MirrorRepository.find(config[:mirror_repository_id]).name.present?}
service_update_params = service_config_params[:shixun_service_configs]
.select{|config| old_mirror_ids.include?(config[:mirror_repository_id])}
logger.info("#########service_create_params: #{service_create_params}")
logger.info("#########service_update_params: #{service_update_params}")
begin
@shixun.save!
# shixun_info关联ß
ShixunInfo.create!(shixun_id: @shixun.id, evaluate_script: shixun_script, description: params[:description])
# 实训的公开范围
if params[:scope_partment].present?
arr = []
ids = School.where(:name => params[:scope_partment]).pluck(:id).uniq
ids.each do |id|
arr << { :school_id => id, :shixun_id => @shixun.id }
ActiveRecord::Base.transaction do
@shixun.update_attributes(shixun_params)
@shixun.shixun_info.update_attributes(shixun_info_params)
# 镜像变动
@shixun.shixun_mirror_repositories.where.not(mirror_repository_id: old_mirror_ids).destroy_all
@shixun.shixun_mirror_repositories.create!(new_mirror_id)
# 镜像变动要更换服务配置
@shixun.shixun_service_configs.where.not(mirror_repository_id: old_mirror_ids).destroy_all
@shixun.shixun_service_configs.create!(service_create_params)
service_update_params&.map do |service|
smr = @shixun.shixun_service_configs.find_by(mirror_repository_id: service[:mirror_repository_id])
smr.update_attributes(service)
end
# 添加第二仓库(管理员权限)
if current_user.admin_or_business?
if params[:is_secret_repository]
add_secret_repository if @shixun.shixun_secret_repository.blank?
else
# 如果有仓库,就要删
if @shixun.shixun_secret_repository&.repo_name
@shixun.shixun_secret_repository.lock!
GitService.delete_repository(repo_path: @shixun.shixun_secret_repository.repo_path)
@shixun.shixun_secret_repository.destroy
end
end
end
end
rescue => e
uid_logger_error(e.message)
tip_exception("基本信息更新失败:#{e.message}")
end
ShixunSchool.create!(arr)
end
# 实训合作者
@shixun.shixun_members.create!(user_id: current_user.id, role: 1)
# 实训权限设置
def update_permission_setting
# 查找需要增删的高校id
school_id = School.where(:name => params[:scope_partment]).pluck(:id)
old_school_ids = @shixun.shixun_schools.pluck(:school_id)
school_params = (school_id - old_school_ids).map{|id| {school_id: id}}
begin
ActiveRecord::Base.transaction do
@shixun.update_attributes!(shixun_params)
@shixun.shixun_schools.where.not(school_id: school_id).destroy_all if school_id.present?
@shixun.shixun_schools.create!(school_params)
end
rescue => e
uid_logger_error("实训权限设置失败--------#{e.message}")
tip_exception("实训权限设置失败")
end
end
# 镜像-实训关联表
ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => main_type.to_i) if main_type.present?
# 实训主镜像服务配置
ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => main_type.to_i)
if sub_type.present?
sub_type.each do |mirror|
ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
# 实训子镜像服务配置
name = MirrorRepository.find_by(id: mirror).try(:name) #查看镜像是否有名称,如果没有名称就不用服务配置
ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror) if name.present?
# 实训学习页面设置
def update_learn_setting
begin
ActiveRecord::Base.transaction do
@shixun.update_attributes!(shixun_params)
end
rescue => e
uid_logger_error("实训学习页面设置失败--------#{e.message}")
tip_exception("实训学习页面设置失败")
end
end
# 创建版本库
repo_path = repo_namespace(User.current.login, @shixun.identifier)
GitService.add_repository(repo_path: repo_path)
# todo: 为什么保存的时候要去除后面的.git呢??
@shixun.update_column(:repo_name, repo_path.split(".")[0])
# Jupyter数据集
def get_data_sets
page = params[:page] || 1
limit = params[:limit] || 10
data_sets = @shixun.data_sets
@data_count = data_sets.count
@data_sets= data_sets.page(page).per(limit)
@absolute_folder = edu_setting('shixun_folder')
end
# 实训测试集附件
def upload_data_sets
upload_file = params["file"]
raise "未上传文件" unless upload_file
folder = edu_setting('shixun_folder')
raise "存储目录未定义" unless folder.present?
rep_name = @shixun.data_sets.pluck(:filename).include?(upload_file.original_filename)
raise "文件名已经存在\"#{upload_file.original_filename}\", 请删除后再上传" if rep_name
tpm_folder = params[:identifier] # 这个是实训的identifier
save_path = File.join(folder, tpm_folder)
ext = file_ext(upload_file.original_filename)
local_path, digest = file_save_to_local(save_path, upload_file.tempfile, ext)
content_type = upload_file.content_type.presence || 'application/octet-stream'
disk_filename = local_path[save_path.size + 1, local_path.size]
@attachment = Attachment.where(disk_filename: disk_filename,
author_id: current_user.id).first
if @attachment.blank?
@attachment = Attachment.new
@attachment.filename = upload_file.original_filename
@attachment.disk_filename = local_path[save_path.size + 1, local_path.size]
@attachment.filesize = upload_file.tempfile.size
@attachment.content_type = content_type
@attachment.digest = digest
@attachment.author_id = current_user.id
@attachment.disk_directory = tpm_folder
@attachment.cloud_url = remote_path
@attachment.container_id = @shixun.id
@attachment.container_type = @shixun.class.name
@attachment.attachtype = 2
@attachment.save!
else
logger.info "文件已存在id = #{@attachment.id}, filename = #{@attachment.filename}"
end
render_ok
end
# 将实训标志为该云上实验室建立
Laboratory.current.laboratory_shixuns.create!(shixun: @shixun, ownership: true)
rescue Exception => e
uid_logger_error(e.message)
tip_exception("实训创建失败")
raise ActiveRecord::Rollback
# 多文件删除
def destroy_data_sets
files = Attachment.where(id: params[:id])
shixun_folder= edu_setting("shixun_folder")
begin
files.each do |file|
file_path = "#{shixun_folder}/#{file.relative_path_filename}"
delete_file(file_path)
end
files.destroy_all
render_ok
rescue => e
uid_logger_error(e.message)
tip_exception(e.message)
end
end
@ -462,61 +548,6 @@ class ShixunsController < ApplicationController
tip_exception("申请失败")
end
def update
ActiveRecord::Base.transaction do
begin
@shixun.shixun_mirror_repositories.destroy_all
if params[:main_type].present?
ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => params[:main_type].to_i)
end
if params[:small_type].present?
params[:small_type].each do |mirror|
ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
end
end
@shixun.update_attributes(shixun_params)
@shixun.shixun_info.update_attributes(shixun_info_params)
@shixun.shixun_schools.delete_all
# scope_partment: 高校的名称
if params[:scope_partment].present?
arr = []
ids = School.where(:name => params[:scope_partment]).pluck(:id).uniq
ids.each do |id|
arr << { :school_id => id, :shixun_id => @shixun.id }
end
ShixunSchool.create!(arr)
end
# 超级管理员和运营人员才能保存 中间层服务器pod信息的配置
# 如果镜像改动了,则也需要更改
mirror = @shixun.shixun_service_configs.map(&:mirror_repository_id).sort
new_mirror = params[:shixun_service_configs].map{|c| c[:mirror_repository_id]}.sort
if current_user.admin? || current_user.business? || (mirror != new_mirror)
@shixun.shixun_service_configs.destroy_all
service_config_params[:shixun_service_configs].each do |config|
name = MirrorRepository.find_by_id(config[:mirror_repository_id])&.name
# 不保存没有镜像的配置
@shixun.shixun_service_configs.create!(config) if name.present?
end
end
# 添加第二仓库
if params[:is_secret_repository]
add_secret_repository if @shixun.shixun_secret_repository.blank?
else
# 如果有仓库,就要删
if @shixun.shixun_secret_repository&.repo_name
@shixun.shixun_secret_repository.lock!
GitService.delete_repository(repo_path: @shixun.shixun_secret_repository.repo_path)
@shixun.shixun_secret_repository.destroy
end
end
rescue Exception => e
uid_logger_error("实训保存失败--------#{e.message}")
tip_exception("实训保存失败")
raise ActiveRecord::Rollback
end
end
end
# 永久关闭实训
def close
@ -552,6 +583,8 @@ class ShixunsController < ApplicationController
# @evaluate_scirpt = @shixun.evaluate_script || "无"
end
# 获取脚本内容
def get_script_contents
mirrir_script = MirrorScript.find(params[:script_id])
@ -708,112 +741,40 @@ class ShixunsController < ApplicationController
end
end
# def shixun_exec
# if is_shixun_opening?
# tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}")
# end
# current_myshixun = @shixun.current_myshixun(current_user.id)
#
# min_challenges = @shixun.challenges.pluck(:id , :st)
# # 因为读写分离有延迟所以如果是重置来的请求可以先跳过重置过来的params[:reset]为1
# if current_myshixun && params[:reset] != "1"
# games = current_myshixun.games
# # 如果TPM和TPI的管卡数不相等或者关卡顺序错了说明实训被极大的改动需要重置,实训发布前打过的实训都需要重置
# if is_shixun_reset?(games, min_challenges, current_myshixun)
# # 这里页面弹框要收到 当前用户myshixun的identifier.
# tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game")
# end
#
#
# if current_myshixun.repo_name.nil?
# g = Gitlab.client
# repo_name = g.project(current_myshixun.gpid).try(:path_with_namespace)
# current_myshixun.update_column(:repo_name, repo_name)
# end
#
# # 如果存在实训,则直接进入实训
# # 如果实训允许跳关传参params[:challenge_id]跳入具体的关卡
# @current_task =
# if params[:challenge_id]
# game = games.where(challenge_id: params[:challenge_id]).take
# if @shixun.task_pass || game.status != 3
# game
# else
# current_myshixun.current_task(games)
# end
# else
# current_myshixun.current_task(games)
# end
# else
# # 如果未创建关卡一定不能开启实训否则TPI没法找到当前的关卡
# if @shixun.challenges_count == 0
# tip_exception("开启实战前请先创建实训关卡")
# end
#
# # 判断实训是否全为选择题
# is_choice_type = (min_challenges.size == min_challenges.select{|challenge| challenge.last == 1}.count)
# if !is_choice_type
# commit = GitService.commits(repo_path: @repo_path).try(:first)
# uid_logger("First comit########{commit}")
# tip_exception("开启实战前请先在版本库中提交代码") if commit.blank?
# commit_id = commit["id"]
# end
#
# begin
# ActiveRecord::Base.transaction do
# begin
# myshixun_identifier = generate_identifier Myshixun, 10
# myshixun_params = {user_id: current_user.id, identifier: myshixun_identifier,
# modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
# onclick_time: Time.now, commit_id: commit_id}
# @myshixun = @shixun.myshixuns.create!(myshixun_params)
# # 其它创建关卡等操作
# challenges = @shixun.challenges
# # 之所以增加user_id是为了方便统计查询性能
# game_attrs = %i[challenge_id myshixun_id status user_id open_time identifier modify_time created_at updated_at]
# Game.bulk_insert(*game_attrs) do |worker|
# base_attr = {myshixun_id: @myshixun.id, user_id: @myshixun.user_id}
# challenges.each_with_index do |challenge, index|
# status = (index == 0 ? 0 : 3)
# game_identifier = generate_identifier(Game, 12)
# worker.add(base_attr.merge(challenge_id: challenge.id, status: status, open_time: Time.now,
# identifier: game_identifier, modify_time: challenge.modify_time))
# end
# end
# @current_task = @myshixun.current_task(@myshixun.games)
# rescue Exception => e
# logger.error("------ActiveRecord::RecordInvalid: #{e.message}")
# raise("ActiveRecord::RecordInvalid")
# end
# end
# # 如果实训是纯选择题则不需要去fork仓库以及中间层的相关操作了
# ActiveRecord::Base.transaction do
# unless is_choice_type
# # fork仓库
# cloud_bridge = edu_setting('cloud_bridge')
# project_fork(@myshixun, @repo_path, current_user.login)
# rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
# uid_logger("start openGameInstance")
# uri = "#{cloud_bridge}/bridge/game/openGameInstance"
# logger.info("end openGameInstance")
# params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last}
# uid_logger("openGameInstance params is #{params}")
# interface_post uri, params, 83, "实训云平台繁忙繁忙等级83"
# end
# end
# rescue Exception => e
# logger.info("shixun_exec error: #{e.message}")
# if e.message != "ActiveRecord::RecordInvalid"
# logger.error("##########project_fork error #{e.message}")
# @myshixun.destroy!
# end
# raise "实训云平台繁忙繁忙等级81"
# end
# end
# end
# gameID 及实训ID
# status: 0 , 1 申请过, 2实训关卡路径未填 3 实训标签未填, 4 实训未创建关卡
# jupyter开启挑战
def jupyter_exec
begin
if is_shixun_opening?
tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}")
end
current_myshixun = @shixun.current_myshixun(current_user.id)
if current_myshixun
@myshixun = current_myshixun
else
commit = GitService.commits(repo_path: @repo_path).try(:first)
uid_logger("First comit########{commit}")
tip_exception("开启实战前请先在版本库中提交代码") if commit.blank?
commit_id = commit["id"]
cloud_bridge = edu_setting('cloud_bridge')
myshixun_identifier = generate_identifier Myshixun, 10
ActiveRecord::Base.transaction do
@myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier,
modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
onclick_time: Time.now, commit_id: commit_id)
# fork仓库
project_fork(@myshixun, @repo_path, current_user.login)
rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
uri = "#{cloud_bridge}/bridge/game/openGameInstance"
params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last}
interface_post uri, params, 83, "实训云平台繁忙繁忙等级83"
end
end
rescue => e
uid_logger_error(e.message)
tip_exception("实训云平台繁忙繁忙等级81")
end
end
def publish
@status = 0
@position = []
@ -1035,10 +996,9 @@ class ShixunsController < ApplicationController
private
def shixun_params
raise("实训名称不能为空") if params[:shixun][:name].blank?
params.require(:shixun).permit(:name, :trainee, :webssh, :can_copy, :use_scope, :vnc, :test_set_permission,
:task_pass, :multi_webssh, :opening_time, :mirror_script_id, :code_hidden,
:hide_code, :forbid_copy, :vnc_evaluate, :code_edit_permission)
:hide_code, :forbid_copy, :vnc_evaluate, :code_edit_permission, :is_jupyter)
end
def validate_review_shixun_params
@ -1047,8 +1007,6 @@ private
end
def shixun_info_params
raise("实训描述不能为空") if params[:shixun_info][:description].blank?
raise("评测脚本不能为空") if params[:shixun_info][:evaluate_script].blank?
params.require(:shixun_info).permit(:description, :evaluate_script)
end
@ -1116,4 +1074,35 @@ private
ShixunSecretRepository.create!(repo_name: repo_path.split(".")[0], shixun_id: @shixun.id)
end
def file_save_to_local(save_path, temp_file, ext)
unless Dir.exists?(save_path)
FileUtils.mkdir_p(save_path) ##不成功这里会抛异常
end
digest = md5_file(temp_file)
digest = "#{digest}_#{(Time.now.to_f * 1000).to_i}"
local_file_path = File.join(save_path, digest) + ext
save_temp_file(temp_file, local_file_path)
[local_file_path, digest]
end
def save_temp_file(temp_file, save_file_path)
File.open(save_file_path, 'wb') do |f|
temp_file.rewind
while (buffer = temp_file.read(8192))
f.write(buffer)
end
end
end
def file_ext(file_name)
ext = ''
exts = file_name.split(".")
if exts.size > 1
ext = ".#{exts.last}"
end
ext
end
end

@ -204,7 +204,7 @@ class SubjectsController < ApplicationController
def add_shixun_to_stage
identifier = generate_identifier Shixun, 8
ActiveRecord::Base.transaction do
@shixun = Shixun.create!(name: params[:name], user_id: current_user.id, identifier: identifier)
@shixun = Shixun.create!(name: params[:name], user_id: current_user.id, identifier: identifier, is_jupyter: params[:is_jupyter])
# 添加合作者
@shixun.shixun_members.create!(user_id: current_user.id, role: 1)
# 创建长字段

@ -4,4 +4,7 @@ module ChallengesHelper
str.gsub(/\A\r/, "\r\r")
end
end

@ -33,6 +33,10 @@ class Attachment < ApplicationRecord
File.join(File.join(Rails.root, "files"), disk_directory.to_s, disk_filename.to_s)
end
def relative_path_filename
File.join(disk_directory.to_s, disk_filename.to_s)
end
def title
title = filename
if container && container.is_a?(StudentWork) && author_id != User.current.id

@ -28,6 +28,11 @@ class Myshixun < ApplicationRecord
"#{self.repo_name}.git"
end
def repo_save_path
self.repo_name.split('/').last
end
def is_complete?
self.status == 1
end

@ -52,7 +52,8 @@ module Searchable::Shixun
challenges_count: challenges_count,
study_count: myshixuns_count,
star: averge_star,
level: shixun_level
level: shixun_level,
is_jupyter: is_jupyter
}
end

@ -10,6 +10,7 @@ class Shixun < ApplicationRecord
# webssh 0不开启webssh1开启练习模式; 2开启评测模式
# trainee 实训的难度
# vnc: VCN实训是否用于评测
validates_presence_of :name, message: "实训名称不能为空"
has_many :challenges, -> {order("challenges.position asc")}, dependent: :destroy
has_many :challenge_tags, through: :challenges
has_many :myshixuns, :dependent => :destroy
@ -55,6 +56,8 @@ class Shixun < ApplicationRecord
has_many :laboratory_shixuns, dependent: :destroy
belongs_to :laboratory, optional: true
# Jupyter数据集,附件
has_many :data_sets, ->{where(attachtype: 2)}, class_name: 'Attachment', as: :container, dependent: :destroy
scope :search_by_name, ->(keyword) { where("name like ? or description like ? ",
"%#{keyword}%", "%#{keyword}%") }

@ -1,8 +1,6 @@
class ShixunInfo < ApplicationRecord
belongs_to :shixun
validates_uniqueness_of :shixun_id
validates_presence_of :shixun_id
after_commit :create_diff_record
private

@ -2,4 +2,5 @@ class ShixunMirrorRepository < ApplicationRecord
belongs_to :shixun
belongs_to :mirror_repository
validates_uniqueness_of :shixun_id, :scope => :mirror_repository_id
validates_presence_of :shixun_id, :mirror_repository_id
end

@ -1,4 +1,6 @@
class ShixunServiceConfig < ApplicationRecord
belongs_to :shixun
belongs_to :mirror_repository
validates_presence_of :shixun_id, :mirror_repository_id
end

@ -0,0 +1,188 @@
#coding=utf-8
module JupyterService
def _open_shixun_jupyter(shixun)
if shixun.is_jupyter?
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = "tpm#{shixun.id}"
params = {tpiID: tpiID, identifier: shixun.identifier, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
logger.info "test_juypter: uri->#{uri}, params->#{params}"
res = uri_post uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级99")
end
logger.info "test_juypter: #{res}"
@shixun_jupyter_port = res['port']
return "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
end
def jupyter_url_with_shixun(shixun)
#打开tpm - juypter接口
_open_shixun_jupyter(shixun)
end
def jupyter_port_with_shixun(shixun)
if @shixun_jupyter_port.to_i <=0
_open_shixun_jupyter(shixun)
end
@shixun_jupyter_port
end
def _open_game_jupyter(myshixun)
## 打开tpi
shixun = myshixun.shixun
if shixun.is_jupyter?
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = myshixun.id
params = {tpiID: tpiID, identifier: shixun.identifier, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_post uri, params
logger.info "test_juypter: #{res}"
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级99")
end
@game_jupyter_port = res['port']
repo_save_path = myshixun.repo_save_path
"https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
end
def jupyter_url_with_game(myshixun)
_open_game_jupyter(myshixun)
end
def jupyter_port_with_game(myshixun)
if @game_jupyter_port.to_i <=0
_open_game_jupyter(myshixun)
end
@game_jupyter_port
end
def jupyter_save_with_shixun(shixun,jupyter_port)
author_name = current_user.real_name
author_email = current_user.git_mail
message = "User submitted"
tpiID = "tpm#{shixun.id}"
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true
src_url = "https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
response = Faraday.get(src_url)
if response.status.to_i != 200
raise("获取文件内容失败:#{response.status}")
end
content = response.body.force_encoding('utf-8')
c = GitService.update_file(repo_path: shixun.repo_path,
file_path: "01.ipynb",
message: message,
content: content,
author_name: author_name,
author_email: author_email)
return c.size
end
def jupyter_save_with_game(myshixun,jupyter_port)
author_name = current_user.real_name
author_email = current_user.git_mail
message = "User submitted"
tpiID = myshixun.id
repo_save_path = myshixun.repo_save_path
src_url = "https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
response = Faraday.get(src_url)
if response.status.to_i != 200
raise("获取文件内容失败:#{response.status}")
end
content = response.body.force_encoding('utf-8')
c = GitService.update_file(repo_path: myshixun.repo_path,
file_path: "01.ipynb",
message: message,
content: content,
author_name: author_name,
author_email: author_email)
return c.size
end
##重置jupyter环境
def jupyter_tpi_reset(myshixun)
jupyter_delete_tpi(myshixun)
url = jupyter_url_with_game(myshixun)
port = jupyter_port_with_game(myshixun)
{url: url, port: port}
end
## 重置tpm环境
def jupyter_tpm_reset(shixun)
jupyter_delete_tpm(shixun)
url = jupyter_url_with_shixun(shixun)
port = jupyter_port_with_shixun(shixun)
{url: url, port: port}
end
# 删除pod
def jupyter_delete_tpi(myshixun)
myshixun_id = myshixun.id
digest = myshixun.identifier + edu_setting('bridge_secret_key')
digest_key = Digest::SHA1.hexdigest("#{digest}")
begin
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/delete"
Rails.logger.info("#{current_user} => cloese_jupyter digest is #{digest}")
params = {:tpiID => myshixun_id, :digestKey => digest_key, :identifier => myshixun.identifier}
res = uri_post uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级110")
end
end
end
def jupyter_delete_tpm(shixun)
tpiID = "tpm#{shixun.id}"
digest = shixun.identifier + edu_setting('bridge_secret_key')
digest_key = Digest::SHA1.hexdigest("#{digest}")
begin
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/delete"
Rails.logger.info("#{current_user} => cloese_jupyter digest is #{digest}")
params = {:tpiID => tpiID, :digestKey => digest_key, :identifier => shixun.identifier}
res = uri_post uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级110")
end
end
end
end

@ -0,0 +1,109 @@
class CreateShixunService < ApplicationService
attr_reader :user, :params, :permit_params
def initialize(user, permit_params, params)
@user = user
@params = params
@permit_params = permit_params
end
def call
shixun = Shixun.new(permit_params)
identifier = Util::UUID.generate_identifier(Shixun, 8)
shixun.identifier= identifier
shixun.user_id = user.id
main_mirror = MirrorRepository.find params[:main_type]
sub_mirrors = MirrorRepository.where(id: params[:sub_type])
begin
ActiveRecord::Base.transaction do
shixun.save!
# 获取脚本内容
shixun_script = get_shixun_script(shixun, main_mirror, sub_mirrors)
# 创建额外信息
ShixunInfo.create!(shixun_id: shixun.id, evaluate_script: shixun_script, description: params[:description])
# 创建合作者
shixun.shixun_members.create!(user_id: user.id, role: 1)
# 创建镜像
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => main_mirror.id)
# 创建主服务配置
ShixunServiceConfig.create!(:shixun_id => shixun.id, :mirror_repository_id => main_mirror.id)
# 创建子镜像相关数据(实训镜像关联表,子镜像服务配置)
sub_mirrors.each do |sub|
ShixunMirrorRepository.create!(:shixun_id => shixun.id, :mirror_repository_id => sub.id)
# 实训子镜像服务配置
name = sub.name #查看镜像是否有名称,如果没有名称就不用服务配置
ShixunServiceConfig.create!(:shixun_id => shixun.id, :mirror_repository_id => sub.id) if name.present?
end
# 创建版本库
repo_path = repo_namespace(user.login, shixun.identifier)
GitService.add_repository(repo_path: repo_path)
shixun.update_column(:repo_name, repo_path.split(".")[0])
# 如果是云上实验室,创建相关记录
if !Laboratory.current.main_site?
Laboratory.current.laboratory_shixuns.create!(shixun: shixun, ownership: true)
end
return shixun
end
rescue => e
Rails.logger.error("shixun_create_error: #{e.message}")
raise("创建实训失败!")
end
end
private
def get_shixun_script shixun, main_mirror, sub_mirrors
if !shixun.is_jupyter?
mirror = main_mirror.mirror_scripts
if main_mirror.blank?
modify_shixun_script shixun, mirror.first&.(:script)
else
sub_name = sub_mirrors.pluck(:type_name)
if main_mirror.type_name == "Java" && sub_name.include?("Mysql")
mirror.last.try(:script)
else
shixun_script = mirror.first&.script
modify_shixun_script shixun, shixun_script
end
end
end
end
def modify_shixun_script shixun, script
if script.present?
source_class_name = []
challenge_program_name = []
shixun.challenges.map(&:exec_path).each do |exec_path|
challenge_program_name << "\"#{exec_path}\""
if shixun.main_mirror_name == "Java"
if exec_path.nil? || exec_path.split("src/")[1].nil?
source = "\"\""
else
source = "\"#{exec_path.split("src/")[1].split(".java")[0]}\""
end
logger.info("----source: #{source}")
source_class_name << source.gsub("/", ".") if source.present?
elsif shixun.main_mirror_name.try(:first) == "C#"
if exec_path.nil? || exec_path.split(".")[1].nil?
source = "\"\""
else
source = "\"#{exec_path.split(".")[0]}.exe\""
end
source_class_name << source if source.present?
end
end
script = if script.include?("sourceClassName") && script.include?("challengeProgramName")
script.gsub(/challengeProgramNames=\(.*\)/,"challengeProgramNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)").gsub(/sourceClassNames=\(.*\)/, "sourceClassNames=\(#{source_class_name.reject(&:blank?).join(" ")}\)")
else
script.gsub(/challengeProgramNames=\(.*\)/,"challengeProgramNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)").gsub(/sourceClassNames=\(.*\)/, "sourceClassNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)")
end
end
return script
end
# 版本库目录空间
def repo_namespace(user, shixun_identifier)
"#{user}/#{shixun_identifier}.git"
end
end

@ -4,8 +4,10 @@ json.description @shixun.description
json.power @editable
json.shixun_identifier @shixun.identifier
json.shixun_status @shixun.status
json.is_jupyter @shixun.is_jupyter?
json.allow_skip @shixun.task_pass
# 列表
if @challenges.present?
json.challenge_list @challenges do |challenge|

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

@ -13,6 +13,7 @@ json.array! shixuns do |shixun|
json.identifier shixun.identifier
json.name shixun.name
json.status shixun.status
json.is_jupyter shixun.is_jupyter?
json.power (current_user.shixun_permission(shixun)) # 现在首页只显示已发布的实训
# REDO: 局部缓存
json.tag_name @tag_name_map&.fetch(shixun.id, nil) || shixun.tag_repertoires.first.try(:name)

@ -14,6 +14,7 @@ json.stu_num shixun.myshixuns_count
json.experience shixun.all_score
json.diffcult diff_to_s(shixun.trainee)
json.score_info shixun.shixun_preference_info # todo: 这块可以改成只显示实训的平均分,不用每次都去取每种星的分数了。
json.is_jupyter shixun.is_jupyter
# 用于是否显示导航栏中的'背景知识'
json.propaedeutics shixun.propaedeutics.present?

@ -0,0 +1,11 @@
json.data_sets do
json.array! @data_sets do |set|
json.id set.id
json.title set.title
json.author set.author.real_name
json.created_on set.created_on
json.filesize number_to_human_size(set.filesize)
json.file_path "#{@absolute_folder}/#{set.relative_path_filename}"
end
end
json.data_sets_count @data_count

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

@ -2,6 +2,7 @@ json.shixun do
json.status @shixun.status
json.name @shixun.name
json.description @shixun.description
json.is_jupyter @shixun.is_jupyter
# 镜像大小类别
json.main_type @main_type
@ -41,6 +42,9 @@ json.shixun do
json.(config, :cpu_limit, :lower_cpu_limit, :memory_limit, :request_limit, :mirror_repository_id)
end
end
json.jupyter_url jupyter_url(@shixun)
end

@ -7,3 +7,4 @@ json.status shixun.status
json.human_status shixun.human_status
json.challenges_count shixun.challenges_count
json.finished_challenges_count @finished_challenges_count_map&.fetch(shixun.id, 0) || shixun.finished_challenges_count(user)
json.is_jupyter shixun.is_jupyter

@ -1,4 +1,6 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

@ -9,6 +9,8 @@ Rails.application.routes.draw do
get 'auth/qq/callback', to: 'oauth/qq#create'
get 'auth/failure', to: 'oauth/base#auth_failure'
resources :edu_settings
scope '/api' do
get 'home/index'
@ -23,6 +25,17 @@ Rails.application.routes.draw do
put 'commons/unhidden', to: 'commons#unhidden'
delete 'commons/delete', to: 'commons#delete'
resources :jupyters do
collection do
get :save_with_tpi
get :save_with_tpm
get :get_info_with_tpi
get :get_info_with_tpm
get :reset_with_tpi
get :reset_with_tpm
end
end
resources :memos do
member do
post :sticky_or_cancel
@ -35,6 +48,9 @@ Rails.application.routes.draw do
end
end
resources :hacks, path: :problems, param: :identifier do
collection do
get :unpulished_list
@ -171,6 +187,7 @@ Rails.application.routes.draw do
post :html_content
get :open_webssh
get :challenges
post :sync_code
end
collection do
get :sigle_mul_test
@ -206,6 +223,7 @@ Rails.application.routes.draw do
get :check_test_sets
get :unlock_choose_answer
get :get_choose_answer
get :jupyter
end
collection do
@ -264,6 +282,12 @@ Rails.application.routes.draw do
get :shixun_exec
post :review_shixun
get :review_newest_record
post :update_permission_setting
post :update_learn_setting
get :get_data_sets
get :jupyter_exec
post :upload_data_sets
delete :destroy_data_sets
end
resources :challenges do
@ -748,7 +772,11 @@ Rails.application.routes.draw do
resources :poll_bank_questions
resources :attachments
resources :attachments do
collection do
delete :destroy_files
end
end
resources :schools do
member do

@ -0,0 +1,5 @@
class AddIsJupyterForShixuns < ActiveRecord::Migration[5.2]
def change
add_column :shixuns, :is_jupyter, :boolean, :default => false
end
end

@ -0,0 +1,17 @@
class AddIndexForShixunSecretRepositories < ActiveRecord::Migration[5.2]
def change
shixun_ids = ShixunSecretRepository.pluck(:shixun_id).uniq
shixuns = Shixun.where(id: shixun_ids)
shixuns.find_each do |shixun|
id = shixun.shixun_secret_repository.id
shixun_secret_repositories = ShixunSecretRepository.where(shixun_id: shixun.id).where.not(id: id)
shixun_secret_repositories.destroy_all
end
remove_index :shixun_secret_repositories, :shixun_id
add_index :shixun_secret_repositories, :shixun_id, unique: true
end
end

@ -0,0 +1,35 @@
version: '3'
services:
mysql:
image: mysql:5.7.17
command: --sql-mode=""
restart: always
volumes:
- ./mysql_data/:/var/lib/mysql
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: 123456789
MYSQL_DATABASE: educoder
redis:
image: redis:3.2
container_name: redis
restart: always
ports:
- "6379:6379"
volumes:
- ./redis_data:/data
web:
image: guange/educoder:latest
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 4000 -b '0.0.0.0'"
stdin_open: true
tty: true
volumes:
- .:/app
ports:
- "4000:4000"
depends_on:
- mysql
- redis

Binary file not shown.

@ -326,7 +326,7 @@ module.exports = {
comments: false
},
compress: {
drop_debugger: true,
drop_debugger: false,
drop_console: false
}
}

File diff suppressed because one or more lines are too long

@ -316,6 +316,11 @@ const RecordDetail = Loadable({
loader: () => import('./modules/developer/recordDetail'),
loading: Loading
});
// jupyter tpi
const JupyterTPI = Loadable({
loader: () => import('./modules/tpm/jupyter'),
loading: Loading
});
// //个人竞赛报名
// const PersonalCompetit = Loadable({
// loader: () => import('./modules/competition/personal/PersonalCompetit.js'),
@ -610,12 +615,21 @@ class App extends Component {
<Route path="/shixuns/new" component={Newshixuns}>
</Route>
{/* jupyter */}
<Route path="/tasks/:identifier/jupyter/"
render={
(props) => {
return (<JupyterTPI {...this.props} {...props} {...this.state}/>)
}
}
/>
<Route path="/tasks/:stageId" component={IndexWrapperComponent}/>
<Route path="/shixuns/:shixunId" component={TPMIndexComponent}>
</Route>
{/*列表页*/}
{/*列表页 实训项目列表*/}
<Route path="/shixuns" component={TPMShixunsIndexComponent}/>

@ -13,7 +13,7 @@ function locationurl(list){
if (window.location.port === "3007") {
} else {
window.location.replace(list)
window.location.href(list)
}
}
let hashTimeout
@ -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,6 @@ export function initAxiosInterceptors(props) {
url = `${config.url}`;
}
}
if(`${config[0]}`!=`true`){
if (window.location.port === "3007") {
// if (url.indexOf('.json') == -1) {
@ -109,15 +109,15 @@ export function initAxiosInterceptors(props) {
}
//
// console.log(config);
if (config.method === "post") {
if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 显示这个方法会影响到定制信息
// console.log(config);
// console.log(JSON.parse(config));
// console.log(config.url);
// console.log("被阻止了是重复请求=================================");
return false;
}
}
// if (config.method === "post") {
// if (requestMap[config.url] === true) { // 避免重复的请求 导致页面f5刷新 也会被阻止 显示这个方法会影响到定制信息
// // console.log(config);
// // console.log(JSON.parse(config));
// // console.log(config.url);
// // console.log("被阻止了是重复请求=================================");
// return false;
// }
// }
// 非file_update请求
if (config.url.indexOf('update_file') === -1) {
requestMap[config.url] = true;

@ -31,7 +31,7 @@ export function getUrl(path, goTest) {
// testbdweb.educoder.net testbdweb.trustie.net
// const local = goTest ? 'https://testeduplus2.educoder.net' : 'http://localhost:3000'
// const local = 'https://testeduplus2.educoder.net'
const local = 'https://test-newweb.educoder.net'
const local = 'https://test-jupyterweb.educoder.net'
if (isDev) {
return `${local}${path?path:''}`
}
@ -55,6 +55,10 @@ export function getUrl2(path, goTest) {
export function getUploadActionUrl(path, goTest) {
return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}`
}
export function getUploadActionUrltwo(id) {
return `${getUrl()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}`
}
export function getUploadActionUrlOfAuth(id) {
return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}`
}

@ -4,12 +4,12 @@
* @Github:
* @Date: 2019-12-10 09:03:48
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-10 09:05:41
* @LastEditTime: 2019-12-12 10:53:47
*/
import { Icon } from 'antd';
const MyIcon = Icon.createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_1535266_ss6796i6f6j.js'
scriptUrl: '//at.alicdn.com/t/font_1535266_i4ilpm93kp.js'
});
export default MyIcon;

@ -3,7 +3,7 @@
// export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil';
export { getImageUrl as getImageUrl, getUrl as getUrl, getUrl2 as getUrl2, setImagesUrl as setImagesUrl
, getUploadActionUrl as getUploadActionUrl, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
, getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo , getUploadActionUrlOfAuth as getUploadActionUrlOfAuth
, getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode } from './UrlTool';
export { default as queryString } from './UrlTool2';

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

@ -494,7 +494,7 @@ class NewShixunModel extends Component{
<div className="clearfix sortinxdirection mt30 intermediatecenterysls">
<p className="nandu">筛选</p>
<p className={belongtoindex===0?"clickbutstwo ml13":"clickbutstwos ml13"} onClick={()=>this.belongto("all")}>全部实训</p>
<p className={belongtoindex===1?"clickbutstwo ml20":"clickbutstwos ml20"} onClick={()=>this.belongto("mine")}>普通实训</p>
<p className={belongtoindex===1?"clickbutstwo ml20":"clickbutstwos ml20"} onClick={()=>this.belongto("mine")}>我的实训</p>
</div>:""
}
{/*{this.props.type==='shixuns'? <Dropdown overlay={menus}>*/}
@ -581,11 +581,26 @@ class NewShixunModel extends Component{
className="fl task-hide edu-txt-left mt3"
name="shixun_homework[]"
></Checkbox>
<a target="_blank" href={this.props.type==='shixuns'?`/shixuns/${item.identifier}/challenges`:`/paths/${item.id}`} className="ml15 fl font-16 color-dark maxwidth1100"
dangerouslySetInnerHTML={{__html: item.title}}
>
</a>
{
this.props.type==='shixuns'?
(
item.is_jupyter===true?
<div className="myysljupyter fl ml20 mt3 intermediatecenter">
<p className="myysljupytertest">
Jupyter
</p>
</div>
:""
)
:""
}
<div className="cl"></div>
<style>
{

@ -385,6 +385,29 @@
.newshixunmodels{
margin: 0 auto;
}
.myysljupyter{
width:54px;
height:24px;
text-align: center;
border-radius:5px;
border:1px solid #FF6802;
margin-top: 4px;
}
.myysljupytertest{
width:54px;
height:16px;
line-height:16px;
font-size:12px;
color:#FF6802;
line-height:16px;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* 中间居中 */
.intermediatecenter{

@ -14,7 +14,7 @@ function UserInfo (props) {
const {image_url, name} = props.userInfo;
return (
<div className={'avator_nicker'}>
<img alt="用户头像" className={'student_img'} src={getImageUrl(`images/${image_url}` || 'images/educoder/headNavLogo.png?1526520218')} />
<img style={{ display: image_url ? 'inline-block' : 'none'}} alt="用户头像" className={'student_img'} src={getImageUrl(`images/${image_url}` || 'images/educoder/headNavLogo.png?1526520218')} />
<span className={'student_nicker'}>
{name || ''}
</span>

@ -1,11 +1,14 @@
.banner-wrap{
width: 100%;
height: 300px;
background-image: url(/static/media/path.e39ba7de.png);
background-color: #000a4f;
/* background-size: cover; */
background-position: center;
background-repeat: no-repeat;
// background-image: url(/static/media/path.e39ba7de.png);
// background: #000a4f url(../../images/oj//oj_banner.jpg) none center;
// background-color: #000a4f;
// /* background-size: cover; */
// background-position: center;
// background-repeat: no-repeat;
background: rgb(0, 1, 35) url(../../images/oj/oj_banner.jpg) no-repeat center;
background-size: cover;
}
.developer-list{

@ -334,6 +334,33 @@ class ShixunsHome extends Component {
.square-Item:nth-child(4n+0) {
margin-right: 25px;
}
.tag-org{
position: absolute;
left: 0px;
top: 20px;
}
.tag-org-name{
width:66px;
height:28px;
background:#FF6802;
width:66px;
height:28px;
border-radius:0px 20px 20px 0px;
}
.tag-org-name-test{
width:45px;
height:23px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
margin-right: 6px;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
`
}
</style>
@ -345,7 +372,13 @@ class ShixunsHome extends Component {
<span className="tag-name"> {item.tag_name}</span>
{/*<img style={{display:item.tag_name===null?"none":'block'}} src={require(`./tag2.png`)}/>*/}
</div>
{
item.is_jupyter===true?
<div className="tag-org">
<p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p>
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div>
:""}
<div className={item.power === false ? "closeSquare" : "none"}>
<img src={getImageUrl("images/educoder/icon/lockclose.svg")}
className="mt80 mb25"/>

@ -0,0 +1,54 @@
import React, {Component} from 'react';
import {
Button,
} from 'antd';
class Bottomsubmit extends Component {
constructor(props) {
super(props)
this.state = {}
}
cannelfun = () => {
// window.location.href=
this.props.history.replace(this.props.url);
}
render() {
return (
<div>
<style>
{
`
.newFooter{
display:none;
}
`
}
</style>
<div className="clearfix bor-bottom-greyE edu-back-white orderingbox newshixunbottombtn">
<div className=" edu-txt-center padding13-30">
<button type="button" className="ant-btn mr20 newshixunmode backgroundFFF" onClick={() => this.cannelfun()}>
<span> </span></button>
<Button type="button" className="ant-btn newshixunmode mr40 ant-btn-primary" type="primary"
htmlType="submit" onClick={() => this.props.onSubmits()}
loading={this.props.loadings}><span>{this.props.bottomvalue===undefined?"确 定":this.props.bottomvalue}</span></Button>
</div>
</div>
</div>
);
}
}
export default Bottomsubmit;

@ -28,6 +28,9 @@ render() {
`
body{
overflow: hidden !important;
}
.ant-modal-body {
padding: 20px 40px;
}
`
}

@ -1,12 +1,13 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Modal,Input} from 'antd';
import {Modal,Input,Form,Radio} from 'antd';
class Addshixuns extends Component {
constructor(props) {
super(props);
this.state = {
shixunname:undefined,
shixunzero:false
shixunzero:false,
is_jupyter:"1"
}
}
@ -52,12 +53,22 @@ class Addshixuns extends Component {
})
return
}
this.props.Setaddshixuns(shixunname);
let is_jupyter=this.state.is_jupyter==="1"?false:true
this.props.Setaddshixuns(shixunname,is_jupyter);
this.props.modalCancel();
}
GrouponChange = e => {
this.setState({
is_jupyter: e.target.value,
});
};
render() {
const formItemLayout = {
labelCol: { span: 4 },
wrapperCol: { span: 14 },
};
return(
<Modal
className={this.props.className}
@ -81,6 +92,14 @@ class Addshixuns extends Component {
</style>:""}
<div className="task-popup-content">
<Form {...formItemLayout}>
<Form.Item label="实训类型">
<Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}>
<Radio value="1">普通实训</Radio>
<Radio value="2">jupyter实训</Radio>
</Radio.Group>
</Form.Item>
</Form>
<p className="task-popup-text-center font-16">
<span style={{ "line-height":"30px"}}>实训名称</span>
<span><Input style={{ width:"80%"}} className="yslzxueshisy " placeholder="请输入60字以内的实训名称" onChange={this.handleChange} addonAfter={String(this.state.shixunname===undefined?0:this.state.shixunname.length)+"/60"} maxLength={60} />

@ -320,7 +320,7 @@ class DetailCardsEditAndAdd extends Component{
})
}
Getaddshixuns=(value)=>{
Getaddshixuns=(value,is_jupyter)=>{
let {
shixuns_listeditlist,
shixuns_listedit,
@ -329,7 +329,8 @@ class DetailCardsEditAndAdd extends Component{
let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json';
axios.post(url,{
name:value
name:value,
is_jupyter:is_jupyter
}).then((response) => {
if(response){
if(response.data){
@ -383,7 +384,7 @@ class DetailCardsEditAndAdd extends Component{
{this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)}
Setaddshixuns={(value,is_jupyter)=>this.Getaddshixuns(value,is_jupyter)}
{...this.props}
{...this.state}
/>:""}

@ -320,7 +320,7 @@ class DetailCardsEditAndEdit extends Component{
notification.open(data);
}
Getaddshixuns=(value)=>{
Getaddshixuns=(value,is_jupyter)=>{
let {
shixuns_listeditlist,
shixuns_listedit,
@ -329,7 +329,8 @@ class DetailCardsEditAndEdit extends Component{
let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json';
axios.post(url,{
name:value
name:value,
is_jupyter:is_jupyter
}).then((response) => {
if(response){
if(response.data){
@ -383,7 +384,7 @@ class DetailCardsEditAndEdit extends Component{
</Modals>
{this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)}
Setaddshixuns={(value,is_jupyter)=>this.Getaddshixuns(value,is_jupyter)}
{...this.props}
{...this.state}
/>:""}

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

@ -1,14 +1,10 @@
import React, {Component} from 'react';
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 {Modal,Input,Radio,Pagination,message,Spin,Icon,Tooltip,Rate} from 'antd';
import {Modal, Input, Radio, Pagination, message, Spin, Icon, Tooltip, Button,Popover} from 'antd';
import AccountProfile from "../user/AccountProfile";
@ -55,7 +51,10 @@ class TPMBanner extends Component {
isIE: false,
Forkvisibletype: false,
isSpin: false,
Senttothevcaluetype:false
Senttothevcaluetype: false,
jupyterbool: false,
openknow:false,
openshowpublictype:false
}
}
@ -97,7 +96,55 @@ class TPMBanner extends Component {
return -1;//不是ie浏览器
}
}
openknow=()=>{
let storage=window.localStorage;
this.setState({
openknow:false
})
storage.setItem("shixunopenprocess",true);
}
openshowpublic=()=>{
let storage=window.localStorage;
this.setState({
openshowpublictype:false
})
storage.setItem("openopenpublictype",true);
}
componentDidUpdate(prevProps, prevState) {
if (prevProps != this.props) {
let shixunopenprocess=window.localStorage.shixunopenprocess;
let openopenpublictype=window.localStorage.openopenpublictype;
if(this.props.shixunsDetails.shixun_status === 0 && this.props.identity < 5){
if(shixunopenprocess===undefined||shixunopenprocess===false){
this.setState({
openknow:true
})
}else{
this.setState({
openknow:false
})
}
}
if(this.props.shixunsDetails.shixun_status === 2 && this.props.shixunsDetails.public===0 && this.props.identity < 5){
if(openopenpublictype===undefined||openopenpublictype===false){
this.setState({
openshowpublictype:true
})
}else{
this.setState({
openshowpublictype:false
})
}
}
}
}
componentDidMount() {
let thiisie = this.IEVersion();
if (thiisie != -1) {
this.setState({
@ -109,6 +156,7 @@ class TPMBanner extends Component {
})
}
}
/*
* Fork
* */
@ -191,7 +239,8 @@ class TPMBanner extends Component {
params: {
page: 1,
limit: 10
}}).then((response) => {
}
}).then((response) => {
this.setState({
courses_count: response.data.courses_count,
course_list: response.data.course_list
@ -208,7 +257,8 @@ class TPMBanner extends Component {
params: {
page: 1,
limit: 10
}}).then((response) => {
}
}).then((response) => {
this.setState({
courses_count: response.data.courses_count,
course_list: response.data.course_list,
@ -233,7 +283,8 @@ class TPMBanner extends Component {
params: {
page: pageNumber,
limit: 10
}}).then((response) => {
}
}).then((response) => {
this.setState({
courses_count: response.data.courses_count,
course_list: response.data.course_list,
@ -292,7 +343,10 @@ class TPMBanner extends Component {
ModalCancel = () => {
this.setState({
Modalstype:false
Modalstype: false,
Modalstopval: "",
modalsMidval:undefined,
ModalsBottomval:"",
})
}
ModalSave = () => {
@ -305,16 +359,53 @@ class TPMBanner extends Component {
console.log(error)
});
}
cancel_publish = () => {
this.setState({
Modalstype: true,
Modalstopval: "是否确认撤销发布?",
modalsMidval:"撤销发布后,学员将无法进行练习,若您新增关",
ModalsBottomval:"卡,学员需要重新体验课程",
ModalCancel: this.ModalCancel,
ModalSave: this.ModalSave,
})
}
openpublic=()=>{
let id = this.props.match.params.shixunId;
let url = `/shixuns/${id}/apply_public.json`;
axios.get(url).then((response) => {
if(response.data.status===0){
window.location.reload()
}
}).catch((error) => {
console.log(error)
});
}
ModalhidenpublicSave=()=>{
let id = this.props.match.params.shixunId;
let url = `/shixuns/${id}/cancel_apply_public.json`;
axios.get(url).then((response) => {
if(response.data.status===0){
window.location.reload()
}
}).catch((error) => {
console.log(error)
});
}
hidenpublic=()=>{
this.setState({
Modalstype: true,
Modalstopval: "是否确认撤销公开?",
modalsMidval:" ",
ModalsBottomval:" ",
ModalCancel: this.ModalCancel,
ModalSave: this.ModalhidenpublicSave,
})
}
/*
* 申请发布按钮
* */
@ -328,12 +419,17 @@ class TPMBanner extends Component {
} else {
evaluation_set_position = response.data.evaluation_set_position
}
if(response.data.status===0){
window.location.reload()
}else{
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)
});
@ -378,7 +474,8 @@ class TPMBanner extends Component {
// message.success('重置成功,正在进入实训!');
// this.startshixunCombat();
}}
}
}
).catch((error) => {
this.setState({
startbtn: false,
@ -393,6 +490,79 @@ class TPMBanner extends Component {
//开始实战按钮
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({
AccountProfiletype: true
})
return
}
// if(this.props.checkIfProfessionalCertification()===false){
// this.setState({
// AccountProfiletype:true
// })
// return
// }
let {shixunsDetails} = this.props
if (shixunsDetails.shixun_status > 1) {
this.setState({
startbtn: true,
hidestartshixunsreplacevalue: ""
})
} else {
this.setState({
hidestartshixunsreplacevalue: ""
})
}
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({
startbtn: false,
shixunsreplace: true,
hidestartshixunsreplacevalue: response.data.message + ".json"
})
// this.shixunexec(response.data.message+".json")
} else if (response.data.status === -1) {
} 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.identifier+`/jupyter`;
}
}
}
}).catch((error) => {
this.setState({
startbtn: false
})
});
}else{
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
@ -440,7 +610,7 @@ class TPMBanner extends Component {
})
// 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,
@ -466,6 +636,9 @@ class TPMBanner extends Component {
});
}
}
tocertification = () => {
let {certi_url} = this.state;
this.setState({
@ -531,7 +704,8 @@ class TPMBanner extends Component {
hidestartshixunsreplacevalue,
Forkvisibletype,
AccountProfiletype,
isIE} = this.state;
isIE
} = this.state;
let {shixunsDetails, shixunId, star_info, star_infos} = this.props;
let challengeBtnTipText = '';
let challengeBtnText = '模拟实战';
@ -593,6 +767,9 @@ class TPMBanner extends Component {
return <Rating {...rest} value={myValue}/>;
};
//
// console.log(this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter)
return (
shixunsDetails === undefined ? "" :
@ -612,6 +789,7 @@ class TPMBanner extends Component {
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
modalsBottomval={this.state.ModalsBottomval}
modalsMidval={this.state.modalsMidval}
loadtype={this.state.Loadtype}
/> : ""}
@ -656,18 +834,21 @@ class TPMBanner extends Component {
{/*<span className="mt10">{shixunsDetails.experience}</span>*/}
{/*</li>*/}
<li>
<span>难度系数</span>
<span>难度级别</span>
<span className="shixunsdiffcult mt10">{shixunsDetails.diffcult}</span>
</li>
</ul>
<div className="pr fl" id="commentsStar" onMouseOver={()=>this.showonMouseOver()} onMouseOut={()=>this.hideonMouseOut()}>
{
this.props.is_jupyter===false?
<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 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'}}>
@ -735,6 +916,9 @@ class TPMBanner extends Component {
</div>
</div>
:""
}
{
startbtn === false && shixunsDetails.shixun_status != -1 ?
@ -814,8 +998,21 @@ class TPMBanner extends Component {
{/*}*/}
{shixunsDetails.shixun_status === 0 && this.props.identity < 5 ?
<Popover
content={
<pre className={"bannerpd201"}>
<div>您编辑完成后可以马上使用到自</div>
<div className={"wechatcenter mt10"}>己的课堂和实训课程哦</div>
<div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openknow} >我知道了</Button></div>
</pre>
}
trigger="click"
placement="bottom"
visible={this.state.openknow}
>
<a onClick={this.applyrelease} className="fr user_default_btn user_blue_btn mr20 font-18 height39"
id="challenge_begin">申请发布</a> : ""
id="challenge_begin">发布</a>
</Popover>: ""
}
<Modal
@ -878,7 +1075,32 @@ class TPMBanner extends Component {
</Modal>
{shixunsDetails.shixun_status === 1 && this.props.identity < 5 ?
{shixunsDetails.shixun_status === 2 && shixunsDetails.public===0 && this.props.identity < 5 ?
<Popover
content={
<pre className={"bannerpd201"}>
<div>申请公开成功后您的实训将会展示实训列表</div>
<div className={"wechatcenter mt10"}>平台审核通过您将获得<span className={"FF6802"}> 1000 </span></div>
<div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openshowpublic} >我知道了</Button></div>
</pre>
}
trigger="click"
placement="bottom"
visible={this.state.openshowpublictype}
>
<Button type="primary" ghost id="challenge_begin" onClick={this.openpublic} className="fr user_default_btn user_blue_btn mr20 font-18 height39">
申请公开
</Button>
</Popover>: ""
}
{shixunsDetails.shixun_status === 2 && shixunsDetails.public===1 && this.props.identity < 5 ?
<Button type="primary" ghost id="challenge_begin" onClick={this.hidenpublic} className="fr user_default_btn user_blue_btn mr20 font-18 height39">
撤销公开
</Button>: ""
}
{shixunsDetails.shixun_status === 2 && shixunsDetails.public===0 && 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> : ""
}
@ -977,7 +1199,8 @@ class TPMBanner extends Component {
}
{this.props.identity < 8&&shixunsDetails.shixun_status != -1 ?<div className="fr user_default_btn user_blue_btn mr20"
{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"
@ -1045,7 +1268,8 @@ class TPMBanner extends Component {
</div>
<div className="alert alert-orange mb15 mt15 clearfix"
style={{display: shixunsDetails.shixun_status === 1 ? "block" : "none"}}
>正在等待管理员的审核在审核通过前可以随时撤销发布</div>
>正在等待管理员的审核在审核通过前可以随时撤销发布
</div>
</div>
);

@ -8,7 +8,7 @@ import { CircularProgress } from 'material-ui/Progress';
import './TPMShixunDiscuss.css'
import Challenges from './shixunchild/Challenges/Challenges'
import Challengesjupyter from './shixunchild/Challenges/Challengesjupyter'
import TPMRightSection from './component/TPMRightSection'
import TPMNav from './component/TPMNav'
@ -20,7 +20,7 @@ class TPMChallenge extends Component {
}
render() {
const { loadingContent, shixun, user, match
const { loadingContent, shixun, user, match,jupyterbool,is_jupyter
} = this.props;
return (
<React.Fragment>
@ -32,10 +32,19 @@ class TPMChallenge extends Component {
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
{
is_jupyter===true?
<Challengesjupyter
{...this.props}
/>
:
<Challenges
{...this.props}
/>
}
</div>

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

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

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

@ -0,0 +1,593 @@
import React, {Component} from 'react';
import {Redirect} from 'react-router';
import {List, Typography, Tag, Modal, Radio, Checkbox, Table, Pagination,Upload,notification} from 'antd';
import { NoneData } from 'educoder'
import TPMRightSection from './component/TPMRightSection';
import TPMNav from './component/TPMNav';
import axios from 'axios';
import './tpmmodel/tpmmodel.css'
import {getUploadActionUrltwo,appendFileSizeToUploadFileAll} from 'educoder';
import moment from 'moment';
const confirm = Modal.confirm;
class TPMDataset extends Component {
constructor(props) {
super(props)
this.state = {
value: undefined,
columns: [
{
title: '文件',
dataIndex: 'title',
key: 'title',
align: 'left',
className: " font-14 wenjiantit",
width: '220px',
render: (text, record) => (
<div>
{record.title}
</div>
)
},
{
title: '最后修改时间',
dataIndex: 'timedata',
key: 'timedata',
align: 'center',
className: "edu-txt-center font-14 zuihoushijian",
width: '150px',
render: (text, record) => (
<div>
{record.timedata}
</div>
)
},
{
title: '最后修改人',
dataIndex: 'author',
key: 'author',
align: 'center',
className: "edu-txt-center font-14 ",
render: (text, record) => (
<div>
{record.author}
</div>
)
},
{
title: '文件大小',
dataIndex: 'filesize',
key: 'filesize',
align: 'center',
className: "edu-txt-center font-14 ",
render: (text, record) => (
<div>
{record.filesize}
</div>
)
},
],
page: 1,
limit: 10,
selectedRowKeys: [],
mylistansum:30,
collaboratorList:[],
fileList:[],
fileListimgs:[],
file:null,
datalist:[],
data_sets_count:0,
selectedRowKeysdata:[],
loadingstate:false,
checked: false,
}
}
componentDidMount() {
this.setState({
loadingstate:true,
})
this.getdatas()
}
mysonChange = (e) => {
// console.log(`全选checked = ${e.target.checked}`);
if (e.target.checked === true) {
let mydata=[];
let datas=[];
for(let i=0;i<this.state.collaboratorList.data_sets.length;i++){
mydata.push(this.state.collaboratorList.data_sets[i].id);
datas.push(i);
}
this.setState({
selectedRowKeysdata:mydata,
selectedRowKeys: datas,
checked:true,
})
// console.log(mydata);
// console.log(datas);
} else {
this.setState({
selectedRowKeysdata:[],
selectedRowKeys: [],
checked:false,
})
}
}
getdatas = () => {
let id=this.props.match.params.shixunId;
let collaborators=`/shixuns/${id}/get_data_sets.json`;
axios.get(collaborators,{params:{
page:1,
limit:10,
}}).then((response)=> {
if(response.status===200){
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{
let datalists=[];
for(let i=0;i<response.data.data_sets.length;i++){
const datas=response.data.data_sets;
var timedata = moment(datas[i].created_on).format('YYYY-MM-DD HH:mm');
datalists.push({
timedata:timedata,
author:datas[i].author,
filesize:datas[i].filesize,
id:datas[i].id,
title:datas[i].title,
})
}
this.setState({
collaboratorList: response.data,
data_sets_count:response.data.data_sets_count,
datalist:datalists,
selectedRowKeysdata:[],
selectedRowKeys: [],
checked:false,
});
}
}
setTimeout(() => {
this.setState({
loadingstate:false,
})
}, 500)
}).catch((error)=>{
setTimeout(() => {
this.setState({
loadingstate:false,
})
}, 500)
console.log(error)
});
}
getdatastwo = (page,limit) => {
let id=this.props.match.params.shixunId;
let collaborators=`/shixuns/${id}/jupyter_data_sets.json`;
axios.get(collaborators,{params:{
page:page,
limit:limit,
}}).then((response)=> {
if(response.status===200){
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{
let datalists=[];
for(let i=0;i<response.data.data_sets.length;i++){
const datas=response.data.data_sets;
var timedata = moment(datas[i].created_on).format('YYYY-MM-DD HH:mm');
datalists.push({
timedata:timedata,
author:datas[i].author,
filesize:datas[i].filesize,
id:datas[i].id,
title:datas[i].title,
})
}
this.setState({
collaboratorList: response.data,
data_sets_count:response.data.data_sets_count,
datalist:datalists,
selectedRowKeysdata:[],
selectedRowKeys: [],
checked:false,
});
}
}
setTimeout(() => {
this.setState({
loadingstate:false,
})
}, 500)
}).catch((error)=>{
setTimeout(() => {
this.setState({
loadingstate:false,
})
}, 500)
console.log(error)
});
}
getdatasthree = (page,limit) => {
let id=this.props.match.params.shixunId;
let collaborators=`/shixuns/${id}/jupyter_data_sets.json`;
axios.get(collaborators,{params:{
page:page,
limit:limit,
}}).then((response)=> {
if(response.status===200){
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{
}
}
}).catch((error)=>{
});
}
paginationonChanges = (pageNumber) => {
// //console.log('Page: ');
this.setState({
page: pageNumber,
loadingstate:true,
})
this.getdatastwo(pageNumber,10);
}
onSelectChange = (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
this.setState(
{
selectedRowKeys
}
);
let mydata=[];
for(let i=0;i<selectedRows.length;i++){
mydata.push(selectedRows[i].id);
}
this.setState({
selectedRowKeysdata:mydata,
})
console.log(mydata);
}
rowClassName = (record, index) => {
let className = 'light-row';
if (index % 2 === 1) className = 'dark-row';
return className;
}
handleChange = (info) => {
if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){
let fileList = info.fileList;
this.setState({
fileList: appendFileSizeToUploadFileAll(fileList),
});
if(info.file.status === 'done'){
//done 成功就会调用这个方法
this.getdatas();
}
}
}
onAttachmentRemove = (file) => {
// debugger
if(!file.percent || file.percent == 100){
confirm({
title: '确定要删除这个附件吗?',
okText: '确定',
cancelText: '取消',
// content: 'Some descriptions',
onOk: () => {
console.log("665")
this.deleteAttachment(file)
},
onCancel() {
console.log('Cancel');
},
});
return false;
}
}
deleteRemovedata(){
if(this.state.selectedRowKeysdata===undefined || this.state.selectedRowKeysdata===null ||this.state.selectedRowKeysdata.length===0){
this.props.showNotification(`请选择要删除的文件`);
return
}
let id=this.props.match.params.shixunId;
confirm({
title: '确定要删除文件吗?',
okText: '确定',
cancelText: '取消',
// content: 'Some descriptions',
onOk: () => {
const url = `/shixuns/${id}/destroy_data_sets.json`;
axios.delete(url,
{ params: {
id:this.state.selectedRowKeysdata,
}}
)
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
this.props.showNotification(`删除成功`);
this.getdatas()
}
}
})
.catch(function (error) {
console.log(error);
});
},
onCancel() {
console.log('Cancel');
},
});
}
deleteAttachment = (file) => {
// console.log(file);
let id=file.response ==undefined ? file.id : file.response.id
const url = `/attachements/destroy_files.json`
axios.delete(url, {
id:[id],
})
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
// console.log('--- success')
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
deleteisnot:true
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
render() {
const {tpmLoading, shixun, user, match} = this.props;
const {columns, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count,loadingstate} = this.state;
const rowSelection = {
selectedRowKeys,
onChange: this.onSelectChange,
};
// getCheckboxProps: record => ({
// disabled: record.name === 'Disabled User', // Column configuration not to be checked
// name: record.name,
// }),
let id=this.props.match.params.shixunId;
const uploadProps = {
width: 600,
fileList,
data:{
attachtype: 2,
container_id:this.props.match.params.shixunId,
container_type: "Shixun",
},
multiple: false,
//multiple 是否支持多选 查重的时候不能多选 不然弹许多框出来
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUploadActionUrltwo(id)}`,
showUploadList:false,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {
//上传前的操作
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
this.props.showNotification('文件大小必须小于150MB!');
}
return isLt150M;
},
};
return (
<React.Fragment>
<div className="tpmComment educontent clearfix mt30 mb80">
<div className="with65 fl edu-back-white commentsDelegateParent">
<TPMNav
match={match}
user={user}
shixun={shixun}
{...this.props}
is_jupyter={this.props.is_jupyter}
></TPMNav>
<div className="padding20 edu-back-white mt20 " style={{minHeight: '463px'}}>
<div className="sortinxdirection">
<div className="tpmwidth">
<Checkbox checked={this.state.checked} onChange={this.mysonChange}>全选</Checkbox>
</div>
<div className="tpmwidth xaxisreverseorder">
<style>
{
`
.ant-upload-list{
display:none
}
`
}
</style>
<div className="deletebuttom intermediatecenter "> <Upload {...uploadProps}><p className="deletebuttomtest" type="upload">
上传文件</p> </Upload></div>
{
data_sets_count>0?
<div
className={selectedRowKeys.length > 0 ? "deletebutomtextcode intermediatecenter mr21" : "deletebutom intermediatecenter mr21"} onClick={()=>this.deleteRemovedata()}>
<p className="deletebutomtext" >删除</p></div>
:""
}
</div>
</div>
<div className="mt24">
<style>{`
.ant-spin-nested-loading > div > .ant-spin .ant-spin-dot {
top: 72%;}
}
.edu-table .ant-table-tbody > tr > td {
height: 42px;
}
.edu-table .ant-table-thead > tr > th{
height: 42px;
}
.ysltableowss .ant-table-thead > tr > th{
height: 42px;
}
.ysltableowss .ant-table-tbody > tr > td{
height: 42px;
}
.ysltableowss .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
.mysjysltable4 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 0px;
}
.ant-table-thead .ant-table-selection-column span{
visibility:hidden;
}
.ant-table-thead > tr > th {
background:#FFFFFF !important;
}
.ant-table table {
width: 100%;
text-align: left;
border-radius: 4px 4px 0 0;
border-collapse: separate;
border-spacing: 0;
border-left: 1px solid #eeeeee;
border-top: 1px solid #eeeeee;
border-right: 1px solid #eeeeee;
}
`}</style>
{data_sets_count===0?
<div className="edu-table edu-back-white ysltableowss">
<style>
{
`
.ant-table-tbody{
display:none;
}
.ant-table-placeholder{
display:none;
}
.ant-table table {
border-bottom: 1px solid #eeeeee !important;
}
`
}
</style>
<Table
columns={columns}
pagination={false}
className="mysjysltable4"
rowSelection={rowSelection}
rowClassName={this.rowClassName}
/>
</div>
:
<div className="edu-table edu-back-white ysltableowss">
<Table
dataSource={datalist}
columns={columns}
pagination={false}
className="mysjysltable4"
rowSelection={rowSelection}
rowClassName={this.rowClassName}
loading={loadingstate}
/>
</div>
}
{
data_sets_count>=11?
<div className="edu-txt-center mt40 mb20">
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit}
total={data_sets_count}
></Pagination>
</div>
:""
}
{ data_sets_count===0?
<NoneData style={{width: '100%'}}></NoneData>:""
}
</div>
</div>
</div>
<div className="with35 fr pl20">
<TPMRightSection
{...this.props}
/>
</div>
</div>
</React.Fragment>
);
}
}
export default TPMDataset;

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

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

@ -114,7 +114,7 @@ body>.-task-title {
/*-------------------个人主页:右侧提示区域--------------------------*/
.-task-sidebar{position:fixed;width:40px;height:180px;right:0;bottom:30px;z-index: 10;}
.-task-sidebar{position:fixed;width:40px;height:180px;right:0;bottom:80px !important;z-index: 10;}
.-task-sidebar>div{height: 40px;line-height: 40px;box-sizing: border-box;width:40px;background:#4CACFF;color:#fff;font-size:20px;text-align:center;margin-bottom:5px;border-radius: 4px;}
.-task-sidebar>div i{ color:#fff;}
.-task-sidebar>div i:hover{color: #fff!important;}

@ -22,13 +22,16 @@ import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'
import TPMsettings from './TPMsettings/TPMsettings';
//import TPMsettings from './TPMsettings/oldTPMsettings';
import TPMChallengeComponent from './TPMChallengeContainer';
import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent';
import TPMRanking_listComponent from './TPMRanking_listContainer';
import TPMCollaboratorsComponent from './TPMCollaboratorsContainer';
import Audit_situationComponent from './Audit_situationComponent';
import TPMDataset from './TPMDataset';
import '../page/tpiPage.css'
import TPMNav from "./component/TPMNav";
const $ = window.$
//任务
@ -142,13 +145,15 @@ class TPMIndex extends Component {
identity:undefined,
TPMRightSectionData:undefined,
PropaedeuticsList: undefined,
tpmindexjupyterbool:false,
is_jupyter:false,
}
}
componentDidMount = () => {
let id = this.props.match.params.shixunId;
console.log('props', this.props);
// console.log('props', this.props);
// let collaborators = `/shixuns/` + id + `/propaedeutics.json`;
//
// axios.get(collaborators).then((response) => {
@ -192,7 +197,7 @@ class TPMIndex extends Component {
propaedeutics:response.data.propaedeutics,
status: response.data.shixun_status,
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) => {
@ -204,7 +209,8 @@ class TPMIndex extends Component {
power: undefined,
identity: undefined,
status: undefined,
propaedeutics:undefined
propaedeutics:undefined,
is_jupyter:false,
});
});
@ -270,31 +276,42 @@ class TPMIndex extends Component {
// }
render() {
let url = window.location.href;
let flag = url.indexOf("add_file")>-1;
// console.log(this.state.is_jupyter);
return (
<div className="newMain clearfix">
{/*头部*/}
{
!flag &&
<TPMBanner
{...this.props}
{...this.state}
is_jupyter={this.state. is_jupyter}
></TPMBanner>
}
{/*筛选*/}
{/*{*/}
{/* tpmindexjupyterbool===false?*/}
{/* :""*/}
{/*}*/}
{/* */}
<Switch {...this.props}>
<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 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 exact path="/shixuns/:shixunId/challenges" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props}
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
@ -304,24 +321,24 @@ class TPMIndex extends Component {
}></Route>
<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 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 exact path="/shixuns/:shixunId/propaedeutics" component={TPMPropaedeuticsComponent}></Route> */}
<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 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>
@ -330,7 +347,7 @@ class TPMIndex extends Component {
<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)}
setSearchValue={this.setSearchValue}
setHotLabelIndex={this.setHotLabelIndex}
@ -342,14 +359,19 @@ class TPMIndex extends Component {
(props) => (<TPMsettings {...this.props} {...this.state} {...props} />)
}></Route>
{/*实训项目条目塞选*/}
<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 exact path="/shixuns/:shixunId/dataset" render={
(props) => (<TPMDataset {...this.props} {...this.state} {...props} is_jupyter={this.state.is_jupyter}
/>)
}></Route>
<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>
@ -400,7 +422,7 @@ class TPMIndex extends Component {
}></Route>
<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>

@ -23,7 +23,7 @@ const versionNum = '0001';
// let _url_origin = getUrl()
let _url_origin='';
if(window.location.port === "3007"){
_url_origin="http://pre-newweb.educoder.net";
_url_origin="https://test-newweb.educoder.net";
}
// let _url_origin=`https://www.educoder.net`;

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

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

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

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

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

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

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

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

@ -0,0 +1,385 @@
import React, {Component} from 'react';
//MonacoDiffEditor 对比模式
import {
Badge,
Select,
Radio,
Checkbox,
Modal,
DatePicker,
Button,
} from 'antd';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment';
import axios from 'axios';
import './css/TPMsettings.css';
import {handleDateStrings} from "./oldTPMsettings";
import Bottomsubmit from "../../modals/Bottomsubmit";
const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
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 {
constructor(props) {
super(props)
this.state = {
can_copy: false,
use_scope: 0,
opening_time: null,
opentime: false,
oldscope_partment: [],
scope_partment: [],
loading: false
}
}
componentDidMount() {
if (this.props.data) {
if (this.props.data.shixun) {
this.setState({
can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
use_scope: this.props.data && this.props.data.shixun.use_scope,
opening_time: this.props.data && this.props.data.shixun.opening_time,
opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true,
oldscope_partment: this.props.data && this.props.data.shixun.scope_partment,
})
}
}
let departmentsUrl = `/shixuns/departments.json`;
axios.get(departmentsUrl).then((response) => {
if (response.status === 200) {
if (response.data.message === undefined) {
this.setState({
departmentslist: response.data.shools_name
});
}
}
}).catch((error) => {
console.log(error)
});
}
componentDidUpdate(prevProps, prevState) {
if (prevProps.data != this.props.data) {
if (this.props.data) {
if (this.props.data.shixun) {
this.setState({
can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
use_scope: this.props.data && this.props.data.shixun.use_scope,
opening_time: this.props.data && this.props.data.shixun.opening_time,
opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true,
oldscope_partment: this.props.data && this.props.data.shixun.scope_partment,
})
}
}
}
}
onChangeTimePicker = (value, dateString) => {
this.setState({
opening_time: dateString === "" ? "" : handleDateStrings(dateString)
})
}
onSubmits = () => {
this.setState({
loading: true
})
let {can_copy, use_scope, scope_partment, opening_time} = this.state;
let id = this.props.match.params.shixunId;
let url = `/shixuns/${id}/update_permission_setting.json`;
axios.post(url,
{
scope_partment: scope_partment,
shixun: {
can_copy: can_copy,
use_scope: use_scope,
opening_time: opening_time
}
}
).then((response) => {
if (response.data.status === -1) {
} else {
this.props.getdatas("3")
this.props.showNotification("权限配置保存成功!")
this.setState({
loading: false
})
}
}).catch((error) => {
this.setState({
loading: false
})
})
}
CheckboxonChange = (e) => {
this.setState({
can_copy: e.target.checked
})
}
SelectOpenpublic = (e) => {
this.setState({
use_scope: e.target.value
});
}
shixunScopeInput = (e) => {
let {scope_partment, oldscope_partment} = this.state;
let datalist = scope_partment;
if (datalist === undefined) {
datalist = []
}
datalist.push(e)
let scopetype = false;
scope_partment.map((item, key) => {
if (item === e) {
scopetype = true
}
})
oldscope_partment.map((item, key) => {
if (item === e) {
scopetype = true
}
})
if (scopetype === false) {
this.setState({
scope_partment: datalist
});
} else {
this.props.showNotification("请勿指定相同的单位")
}
}
shixunsfetch = (value, callback) => {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
currentValue = value;
function fake() {
let departmentsUrl = `/shixuns/departments.json?q=` + currentValue;
axios.get(departmentsUrl).then((response) => {
callback(response.data.shools_name);
}).catch((error) => {
console.log(error)
});
}
timeout = setTimeout(fake, 300);
}
shixunHandleSearch = (value) => {
this.shixunsfetch(value, departmentslist => this.setState({departmentslist}));
}
deleteScopeInput = (key) => {
let {scope_partment} = this.state;
let datalist = scope_partment;
datalist.splice(key, 1);
this.setState({
scope_partment: datalist
});
}
setopentime = (e) => {
this.setState({
opentime: e.target.checked
})
}
render() {
let options;
if (this.state.departmentslist != undefined) {
options = this.state.departmentslist.map((d, k) => {
return (
<Option key={d} id={k}>{d}</Option>
)
})
}
const dateFormat = 'YYYY-MM-DD HH:mm';
return (
<div>
<div className="educontent mb200 edu-back-white padding10-20 pdb30 mb50">
<div className="clearfix ml40">
<span className="color-grey-6 mt5 fl font-16 ml20" style={{minWidth: '45px'}}>复制:</span>
<span className="fl mt8 ml13">
<Checkbox
checked={this.state.can_copy}
onChange={this.CheckboxonChange}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则允许已职业认证的教师复制该实训</label>
</span>
</div>
<div className="edu-back-white mb10 ml30 mt20">
{this.props.data && this.props.data.shixun.use_scope === 0 && this.props.data && this.props.data.shixun.status === 2 ? "" :
<div>
<span className="color-grey-6 mt5 fl font-16" style={{minWidth: '45px'}}>公开程度:</span>
<span className="fl mt8 ml20">
<RadioGroup onChange={this.SelectOpenpublic} value={this.state.use_scope}>
<Radio className="radioStyle" value={0}><span>对所有单位公开</span> <span
className="color-grey-9">实训发布后所有用户可见</span></Radio>
<Radio className="radioStyle" value={1}><span>对指定单位公开</span> <span
className="color-grey-9">实训发布后仅对下方指定单位的用户可见</span></Radio>
</RadioGroup>
<div className="clearfix" id="unit-all"
style={{display: this.state.use_scope === 0 ? 'none' : 'block'}}>
<div className="fl ml25">
<div className="fl" id="unit-input-part" style={{width: '100%'}}>
<div id="person-unit" className="fl pr mr10">
<div className="shixunScopeInput fl">
<Select
style={{width: '200px'}}
placeholder="请输入并选择单位名称"
onChange={(value) => this.shixunScopeInput(value)}
onSearch={this.shixunHandleSearch}
showSearch
value={this.state.scope_partment}
defaultActiveFirstOption={false}
showArrow={false}
filterOption={false}
notFoundContent={null}
className={this.props.scope_partmenttype === true ? "bor-red" : ""}
>
{options}
</Select>
</div>
<span className="color-grey-9 openrenyuan">请通过搜索并选中单位名称进行添加</span>
</div>
</div>
<div style={{width: '100%'}}>
<div className="mt20 clearfix" id="task_tag_content">
{
this.state.oldscope_partment.map((item, key) => {
return (
<li key={key} className={"fl mr20"}>
<Button type="primary" ghost className={"Permanentban "}>
{item}
</Button>
</li>
)
})
}
{
this.state.scope_partment === undefined ? "" : this.state.scope_partment.map((item, key) => {
return (
<li key={key} className={"fl mr20"}>
<Badge count={"x"} onClick={(key) => this.deleteScopeInput(key)}>
<Button type="primary" ghost className={"Permanentban "}>
{item}
</Button>
</Badge>
</li>
)
})
}
</div>
</div>
<span
className={this.props.scope_partmenttype === true ? "color-orange ml20 fl" : "color-orange ml20 fl none"}
id="public_unit_notice">
<i className="fa fa-exclamation-circle mr3"></i>
请选择需要公开的单位
</span>
</div>
</div>
</span>
</div>}
<div className="clearfix mt20">
<span className="color-grey-6 mt5 fl font-16" style={{minWidth: '45px'}}>开启时间:</span>
<span className="fl mt8 ml20">
<Checkbox
checked={this.state.opentime === undefined ? false : this.state.opentime}
onChange={this.setopentime}></Checkbox>
<label style={{top: '6px'}}
className="color-grey-9 ml10">选中则学员在指定的开启时间后才能开启学习不选中则学员在实训发布后能立即开启学习</label>
<div className={"both"}></div>
{this.state.opentime === false ? "" : <div className="mt20 ml25">
<DatePicker
showToday={false}
showTime={{format: 'HH:mm'}}
format="YYYY-MM-DD HH:mm"
width={178}
locale={locale}
disabledTime={disabledDateTime}
disabledDate={disabledDate}
placeholder="请输入开启时间"
value={this.state.opening_time === null || this.state.opening_time === "" ? "" : moment(this.state.opening_time, dateFormat)}
onChange={this.onChangeTimePicker}
dropdownClassName="hideDisable"
/>
</div>}
</span>
</div>
</div>
</div>
{this.props.identity < 5 ?
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${this.props.match.params.shixunId}/challenges`}
onSubmits={this.onSubmits} loadings={this.state.loading} bottomvalue={ this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter === true?"确 定":"下一步"} /> : ""}
</div>
);
}
}

@ -0,0 +1,348 @@
import React, {Component} from 'react';
import {
Radio,
Checkbox,
} from 'antd';
import axios from 'axios';
import './css/TPMsettings.css';
import Bottomsubmit from "../../modals/Bottomsubmit";
const RadioGroup = Radio.Group;
export default class Shixuninformation extends Component {
constructor(props) {
super(props)
this.state = {
vnc: false,
hide_code: false,
is_secret_repository: false,
code_hidden: false,
forbid_copy: false,
test_set_permission: true,
task_pass: true,
websshshow: false,
multi_webssh: false,
opensshRadio: null,
loading: false
}
}
componentDidMount() {
if (this.props.data ) {
if (this.props.data.shixun) {
this.setState({
vnc: this.props.data && this.props.data.shixun.vnc,
code_hidden: this.props.data && this.props.data.shixun.code_hidden,
forbid_copy: this.props.data && this.props.data.shixun.forbid_copy,
hide_code: this.props.data && this.props.data.shixun.hide_code,
task_pass: this.props.data && this.props.data.shixun.task_pass,
test_set_permission: this.props.data && this.props.data.shixun.test_set_permission,
is_secret_repository: this.props.data && this.props.data.shixun.is_secret_repository,
websshshow: this.props.data && this.props.data.shixun.webssh === 0 ? false : true,
multi_webssh: this.props.data && this.props.data.shixun.multi_webssh,
opensshRadio: this.props.data && this.props.data.shixun.webssh === 0 ? null : this.props.data && this.props.data.shixun.webssh,
})
// if(this.props.data && this.props.data.shixun.status===0){
// this.setState({
// task_pass:true
// })
// }
}
}
}
componentDidUpdate(prevProps, prevState) {
if (prevProps.data != this.props.data) {
if (this.props.data) {
if (this.props.data.shixun) {
this.setState({
vnc: this.props.data && this.props.data.shixun.vnc,
code_hidden: this.props.data && this.props.data.shixun.code_hidden,
forbid_copy: this.props.data && this.props.data.shixun.forbid_copy,
hide_code: this.props.data && this.props.data.shixun.hide_code,
task_pass: this.props.data && this.props.data.shixun.task_pass,
test_set_permission: this.props.data && this.props.data.shixun.test_set_permission,
is_secret_repository: this.props.data && this.props.data.shixun.is_secret_repository,
websshshow: this.props.data && this.props.data.shixun.webssh === 0 ? false : true,
multi_webssh: this.props.data && this.props.data.shixun.multi_webssh,
opensshRadio: this.props.data && this.props.data.shixun.webssh === 0 ? null : this.props.data && this.props.data.shixun.webssh,
})
// if(this.props.data && this.props.data.shixun.status===0){
// this.setState({
// task_pass:true
// })
// }
}
}
}
}
onSubmits = () => {
this.setState({
loading: true
})
let id = this.props.match.params.shixunId;
let url = `/shixuns/${id}/update_permission_setting.json`;
axios.post(url,
{
shixun: {
code_hidden: this.state.code_hidden,
forbid_copy: this.state.forbid_copy,
hide_code: this.state.hide_code,
multi_webssh: this.state.multi_webssh,
task_pass: this.state.task_pass,
test_set_permission: this.state.test_set_permission,
vnc: this.state.vnc,
webssh: this.state.websshshow === false ? 0 : this.state.opensshRadio,
},
is_secret_repository: this.state.is_secret_repository
}
).then((response) => {
if (response.data.status === -1) {
} else {
this.props.getdatas()
this.props.showNotification("学习页面设置保存成功!")
this.setState({
loading: false
})
}
}).catch((error) => {
this.setState({
loading: false
})
})
}
Checkvnc = () => {
console.log(this.state.vnc)
if (this.state.vnc === false) {
this.setState({
hide_code: false,
is_secret_repository: false,
code_hidden: false,
forbid_copy: false,
multi_webssh: false,
websshshow: false,
})
}
this.setState({
vnc: !this.state.vnc
})
}
Checkhide_code = () => {
if (this.state.hide_code === false) {
this.setState({
is_secret_repository: false
})
}
this.setState({
hide_code: !this.state.hide_code
})
}
Checkis_secret_repository = () => {
this.setState({
is_secret_repository: !this.state.is_secret_repository
})
}
Checkcode_hidden = () => {
this.setState({
code_hidden: !this.state.code_hidden
})
}
Checkforbid_copy = () => {
this.setState({
forbid_copy: !this.state.forbid_copy
})
}
Checktask_pass = () => {
this.setState({
task_pass: !this.state.task_pass
})
}
Checktest_set_permission = () => {
this.setState({
test_set_permission: !this.state.test_set_permission
})
}
Checkwebsshshow = () => {
if (this.state.websshshow === false) {
this.setState({
vnc: false,
opensshRadio: 1
})
} else {
this.setState({
multi_webssh: false,
opensshRadio: null
})
}
this.setState({
websshshow: !this.state.websshshow
})
}
Checkmulti_webssh = () => {
this.setState({
multi_webssh: !this.state.multi_webssh
})
}
opensshRadio = (e) => {
if (e.target.value === 1) {
this.setState({
multi_webssh: false
})
} else {
this.setState({
multi_webssh: true
})
}
this.setState({
opensshRadio: e.target.value
});
}
render() {
// console.log(this.props)
return (
<div>
<div className="educontent mb200 edu-back-white padding10-20 pdb30 mb50">
{this.state.websshshow === true ? "" : <div className="clearfix mb20">
<span className="color-grey-6 mt5 fl font-16" style={{minWidth: '45px'}}>开启图形化界面</span>
<span className="fl mt8">
<Checkbox
checked={this.state.vnc}
onChange={this.Checkvnc}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则给学员的实践任务启动Ubuntu系统的图形化界面</label>
</span>
</div>}
{this.state.vnc === true ? "" : <div className="clearfix mb20">
<span className="color-grey-6 mt5 fl font-16 ml64" style={{minWidth: '45px'}}>命令行</span>
<span className="fl mt8">
<Checkbox
checked={this.state.websshshow}
onChange={this.Checkwebsshshow}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则给学员的实践任务提供命令行窗口</label>
</span>
</div>}
{this.state.vnc === true ? "" : this.state.websshshow === true ? <div>
<span className="fl ml160">
<RadioGroup onChange={this.opensshRadio} value={this.state.opensshRadio}>
<Radio className="radioStyle font-14" value={1}><span>命令行练习窗口</span> <span
className="color-grey-9">选中则给学员提供用于练习操作的命令行命令行的操作不会对学生的实验环境造成影响</span></Radio>
<Radio className="radioStyle font-14" value={2}><span>命令行评测窗口</span> <span
className="color-grey-9">选中则给学员提供用于评测操作的命令行命令行的操作可以对学生的实验环境产生影响</span></Radio>
</RadioGroup>
</span>
{this.state.opensshRadio === 2 ? <span className="fl ml180">
<div className="clearfix mb20">
<span className="fl mt8 ml5">
<Checkbox
checked={this.state.multi_webssh}
onChange={this.Checkmulti_webssh}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">
<span className="color-grey-6 font-14" style={{minWidth: '45px'}}>多个命令行窗口</span>
选中则允许学员同时开启多个命令行窗口</label>
</span>
</div>
</span> : ""}
</div> : ""}
{this.state.vnc === true ? "" : <div className="clearfix mb20">
<span className="color-grey-6 mt5 fl font-16 ml17" style={{minWidth: '45px'}}>隐藏代码窗口</span>
<span className="fl mt8">
<Checkbox
checked={this.state.hide_code}
onChange={this.Checkhide_code}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则学员页面不显示代码窗口</label>
</span>
</div>}
{this.state.vnc === true || this.state.hide_code === true ? "" : <div className="clearfix mb20">
<span className="color-grey-6 mt5 fl font-16 ml33" style={{minWidth: '45px'}}>公开版本库</span>
<span className="fl mt8">
<Checkbox
checked={this.state.is_secret_repository}
onChange={this.Checkis_secret_repository}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则允许学员修改版本库中的全部文件</label>
</span>
</div>}
{this.state.vnc === true ? "" : <div className="clearfix mb20">
<span className="color-grey-6 mt5 fl font-16 ml17" style={{minWidth: '45px'}}>隐藏代码目录</span>
<span className="fl mt8">
<Checkbox
checked={this.state.code_hidden}
onChange={this.Checkcode_hidden}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则学员页面不显示版本库目录</label>
</span>
</div>}
{this.state.vnc === true ? "" : <div className="clearfix mb20">
<span className="color-grey-6 mt5 fl font-16 ml17" style={{minWidth: '45px'}}>禁用复制粘贴</span>
<span className="fl mt8">
<Checkbox
checked={this.state.forbid_copy}
onChange={this.Checkforbid_copy}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则学员页面不允许使用复制和粘贴功能</label>
</span>
</div>}
<div className="clearfix mb20">
<span className="color-grey-6 mt5 fl font-16 ml80" style={{minWidth: '45px'}}>跳关</span>
<span className="fl mt8">
<Checkbox
checked={this.state.task_pass}
onChange={this.Checktask_pass}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则允许学员跳关学习实训关卡任务</label>
</span>
</div>
<div className="clearfix mb20">
<span className="color-grey-6 mt5 fl font-16 ml32s" style={{minWidth: '45px'}}>测试集解锁</span>
<span className="fl mt8">
<Checkbox
checked={this.state.test_set_permission}
onChange={this.Checktest_set_permission}></Checkbox>
<label style={{top: '6px'}} className="color-grey-9 ml10">选中则允许学员允许学员通过金币解锁查看隐藏测试集的内容</label>
</span>
</div>
</div>
{this.props.identity < 5 ?
<Bottomsubmit {...this.props} {...this.state} url={`/shixuns/${this.props.match.params.shixunId}/challenges`}
onSubmits={this.onSubmits} loadings={this.state.loading}/> : ""}
</div>
);
}
}

File diff suppressed because it is too large Load Diff

@ -111,3 +111,43 @@ a.newuse_scope-btn {
.ml82{
margin-left:82px;
}
.Permanentban{
color:#5091FF !important;
border-color: #5091FF !important;
}
/*tab*/
.ant-tabs-nav{
padding-bottom:18px;
padding-top: 18px;
}
.ant-tabs-extra-content{
margin-top: 18px;
}
.pdb30{
padding-bottom: 30px;
}
.openrenyuan{
margin-top: 5px !important;
display: inline-block;
}
.ml81{
margin-left:81px;
}
.ml32s{
margin-left: 32px;
}
.ml64{
margin-left: 64px;
}
.ml160{
margin-left: 160px;
}

File diff suppressed because it is too large Load Diff

@ -344,7 +344,7 @@ export default class TPMMDEditor extends Component {
</div>
</div>
<div className={"fr rememberTip"}>
{noStorage == true ? ' ' : <p id={`e_tips_mdEditor_${mdID}`} className="edu-txt-right color-grey-cd font-12"> </p>}
{noStorage == true ? ' ' : <div id={`e_tips_mdEditor_${mdID}`} className="edu-txt-right color-grey-cd font-12"> </div>}
{/* {noStorage == true ? ' ' : <p id={`e_tips_mdEditor_${mdID}`} className="edu-txt-right color-grey-cd font-12"> </p>} */}
</div>
</React.Fragment>

@ -5,7 +5,11 @@ import { BrowserRouter as Router, Route, Link } from "react-router-dom";
class TPMNav extends Component {
render() {
const { user, match, shixun, secret_repository } = this.props;
// console.log("componentDidMount");
// console.log("TPMNavTPMNavTPMNavTPMNav");
// console.log(this.props);
const { user, match, shixun, secret_repository,is_jupyter} = this.props;
let isAdminOrCreator = false;
if (user) {
isAdminOrCreator = user.admin || user.manager
@ -15,6 +19,9 @@ 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);
const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:"";
return (
<div className="bor-bottom-greyE clearfix pl20 pr20 pt40 pb20 edu-back-white challengeNav">
<Link
@ -28,27 +35,65 @@ class TPMNav extends Component {
>背景知识</Link>
}
{ this.props.identity >4||this.props.identity===undefined ?"":<Link to={`/shixuns/${shixunId}/repository`}
className={`${match.url.indexOf('/repository') != -1 ? 'active' : ''} fl mr40`}>版本库</Link>}
{ this.props.identity >4||this.props.identity===undefined ?"":
(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`}
className={`${match.url.indexOf('secret_repository') != -1 ? 'active' : ''} fl mr40`}>私密版本库</Link>}
<Link to={`/shixuns/${shixunId}/collaborators`}
className={`${match.url.indexOf('collaborators') != -1 ? 'active' : ''} fl mr40`}>合作者</Link>
{/*jupyter*/}
{
this.props.is_jupyter===true?
(
is_teacher===true?
<Link to={`/shixuns/${shixunId}/dataset`}
className={`${match.url.indexOf('dataset') != -1 ? 'active' : ''} fl mr40`}>数据集</Link>
:""
)
:""
}
{
this.props.is_jupyter === false ?
<Link to={`/shixuns/${shixunId}/shixun_discuss`}
className={`${match.url.indexOf('shixun_discuss') != -1 ? 'active' : ''} fl mr40`}>评论</Link>
:""
}
{
this.props.is_jupyter === false ?
<Link to={`/shixuns/${shixunId}/ranking_list`}
className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl mr40`}>排行榜</Link>
className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl mr40`}>排行榜</Link>:""
}
{this.props.identity >2||this.props.identity===undefined?"":
(this.props.is_jupyter === false?
<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>
:
is_teacher===true?
<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>
:
""
{this.props.identity >2||this.props.identity===undefined?"":<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>}
)
}
<a
href={`/shixuns/${shixunId}/settings`} className="edu-default-btn edu-blueline-btn ml20 fr"
style={{display: this.props.identity >4||this.props.identity===undefined ? "none" : 'block'}}
>配置</a>
{this.props.identity >4||this.props.identity===undefined ? "":<Link to={`/shixuns/${shixunId}/settings`} className="edu-default-btn edu-blueline-btn ml20 fr"
>配置</Link>}
</div>
);
}

@ -0,0 +1,230 @@
/*
* @Description: jupyter tpi
* @Author: tangjiang
* @Github:
* @Date: 2019-12-11 08:35:23
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-13 15:25:50
*/
import './index.scss';
import React, { useEffect, useState } from 'react';
import SplitPane from 'react-split-pane';
import { Button, Modal } from 'antd';
import {
connect
} from 'react-redux';
import UserInfo from '../../developer/components/userInfo';
import actions from '../../../redux/actions';
import LeftPane from './leftPane';
import RightPane from './rightPane';
function JupyterTPI (props) {
// 获取 identifier 值
const {
match: {
params = {}
},
url,
loading, // 保存按钮状态
total,
pagination,
dataSets, // 数据集
jupyter_info,
getJupyterInfo,
syncJupyterCode,
jupyter_tpi_url_state,
getJupyterTpiDataSet,
getJupyterTpiUrl,
saveJupyterTpi,
changeLoadingState,
changeGetJupyterUrlState,
jupyter_identifier,
changeCurrentPage
} = props;
const {identifier} = params;
const [userInfo, setUserInfo] = useState({});
const [jupyterInfo, setJupyterInfo] = useState({});
const [updateTip, setUpdateTip] = useState(true);
const [myIdentifier, setMyIdentifier] = useState('');
useEffect(() => {
/* jupyter TPI
* 获取 用户信息,
* 实训的 identifier, 状态 名称 是否被修改等信息
*/
getJupyterInfo(identifier);
}, [identifier]);
useEffect(() => {
// 设置jupyter信息
setJupyterInfo(jupyter_info || {});
const {user, tpm_modified, myshixun_identifier} = jupyter_info;
if (user) {
setUserInfo(user);
}
if (myshixun_identifier) {
setMyIdentifier(myshixun_identifier);
}
// 同步代码
if (tpm_modified && updateTip && myshixun_identifier) {
setUpdateTip(false);
Modal.confirm({
title: '更新通知',
content: (<div className="update_notice">
<p className="update_txt">关卡任务的代码文件有更新啦</p>
<p className="update_txt">更新操作将保留已完成的评测记录和成绩</p>
<p className="update_txt">还未完成评测的任务代码请自行保存</p>
</div>),
okText: '确定',
cancelText: '取消',
onOk () {
syncJupyterCode(myshixun_identifier, '同步成功');
}
})
}
}, [props]);
// 重置实训
const handleClickResetTpi = () => {
Modal.confirm({
title: '重置实训',
content: (
<p style={{ lineHeight: '24px' }}>
你在本文件中修改的内容将丢失,<br />
是否确定重新加载初始代码
</p>
),
okText: '确定',
cancelText: '取消',
onOk () {
console.log('调用重置代码....', myIdentifier);
if (myIdentifier) {
syncJupyterCode(myIdentifier, '重置成功');
}
}
})
}
// 退出实训
const handleClickQuitTpi = () => {
// console.log(jupyterInfo);
const { identifier } = jupyterInfo;
if (!identifier) return;
props.history.push(`/shixuns/${identifier}/challenges`);
}
// 重新获取 jupyter url
const handleOnReloadUrl = (id) => {
// console.log('jupyter 信息: ', jupyterInfo);
// 改变加载状态值
changeGetJupyterUrlState(-1);
getJupyterTpiUrl({identifier: myIdentifier});
}
// 保存代码
const handleOnSave = () => {
// 改变按钮状态
changeLoadingState(true);
saveJupyterTpi();
}
// 分页信息改变时
const handlePageChange = (current) => {
// 改变当前页
changeCurrentPage(current);
// 分页查找数据
getJupyterTpiDataSet(jupyter_identifier);
}
return (
<div className="jupyter_area">
<div className="jupyter_header">
<UserInfo userInfo={userInfo} />
<p className="jupyter_title">
<span className="title_desc" style={{ marginTop: '20px' }}>{jupyterInfo.name}</span>
<span className="title_time"></span>
</p>
<p className="jupyter_btn">
{/* sync | poweroff */}
<Button
className="btn_common"
type="link"
icon="sync"
onClick={handleClickResetTpi}
>重置实训</Button>
<Button
className="btn_common"
type="link"
icon="poweroff"
onClick={handleClickQuitTpi}
>退出实训</Button>
</p>
</div>
<div className="jupyter_ctx">
<SplitPane split="vertical" minSize={350} maxSize={-350} defaultSize="30%">
<div className={'split-pane-left'}>
<LeftPane
dataSets={dataSets}
total={total}
pagination={pagination}
onPageChange={handlePageChange}
/>
</div>
<SplitPane split="vertical" defaultSize="100%" allowResize={false}>
<RightPane
identifier={myIdentifier}
status={jupyter_tpi_url_state}
url={url}
loading={loading}
onReloadUrl={handleOnReloadUrl}
onSave={handleOnSave}
/>
<div />
</SplitPane>
</SplitPane>
</div>
</div>
);
}
const mapStateToProps = (state) => {
const {
jupyter_info,
jupyter_tpi_url,
jupyter_data_set,
jupyter_tpi_url_state,
jupyter_data_set_count,
jupyter_pagination,
jupyter_identifier
} = state.jupyterReducer;
const { loading } = state.commonReducer;
return {
loading,
jupyter_info,
url: jupyter_tpi_url,
dataSets: jupyter_data_set,
jupyter_tpi_url_state,
total: jupyter_data_set_count,
pagination: jupyter_pagination,
jupyter_identifier
};
}
const mapDispatchToProps = (dispatch) => ({
changeGetJupyterUrlState: (status) => dispatch(actions.changeGetJupyterUrlState(status)),
getJupyterInfo: (identifier) => dispatch(actions.getJupyterInfo(identifier)),
// 重置代码
syncJupyterCode: (identifier, msg) => dispatch(actions.syncJupyterCode(identifier, msg)),
getJupyterTpiDataSet: (identifier, current) => dispatch(actions.getJupyterTpiDataSet(identifier, current)),
getJupyterTpiUrl: (identifier) => dispatch(actions.getJupyterTpiUrl(identifier)),
saveJupyterTpi: () => dispatch(actions.saveJupyterTpi()),
changeLoadingState: (flag) => dispatch(actions.changeLoadingState(flag)),
changeCurrentPage: (current) => dispatch(actions.changeCurrentPage(current))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(JupyterTPI);

@ -0,0 +1,105 @@
.Resizer {
background: #000;
opacity: 0.2;
z-index: 1;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-moz-background-clip: padding;
-webkit-background-clip: padding;
background-clip: padding-box;
}
.Resizer:hover {
-webkit-transition: all 2s ease;
transition: all 2s ease;
}
.Resizer.horizontal {
height: 11px;
margin: -5px 0;
border-top: 5px solid rgba(255, 255, 255, 0);
border-bottom: 5px solid rgba(255, 255, 255, 0);
cursor: row-resize;
width: 100%;
}
.Resizer.horizontal:hover {
border-top: 5px solid rgba(0, 0, 0, 0.5);
border-bottom: 5px solid rgba(0, 0, 0, 0.5);
}
.Resizer.vertical {
width: 11px;
margin: 0 -5px;
border-left: 5px solid rgba(255, 255, 255, 0);
border-right: 5px solid rgba(255, 255, 255, 0);
cursor: col-resize;
}
.Resizer.vertical:hover {
border-left: 5px solid rgba(0, 0, 0, 0.5);
border-right: 5px solid rgba(0, 0, 0, 0.5);
}
.Resizer.disabled {
cursor: not-allowed;
}
.Resizer.disabled:hover {
border-color: transparent;
}
.jupyter_area{
.jupyter_header{
position: relative;
height: 60px;
line-height: 60px;
background-color: #070F1A;
padding-left: 30px;
.jupyter_title{
display: flex;
flex-direction: column;
// justify-content: space-around;
align-items: center;
height: 100%;
color: #fff;
.title_desc{
margin-top: 12px;
font-size: 16px;
}
.title_time{
font-size: 12px;
}
// text-align: center;
}
.jupyter_btn{
position: absolute;
right: 10px;
top: 14px;
.btn_common{
color: #888;
}
.btn_common:hover{
// background-color: #29BD8B;
// color: #29BD8B;
color: #1890ff;
}
}
}
.jupyter_ctx{
position: relative;
height: calc(100vh - 60px);
}
.update_notice{
text-align: center;
.update_txt{
line-height: 18px;
font-size: 14px;
}
}
}

@ -0,0 +1,88 @@
/*
* @Description:
* @Author: tangjiang
* @Github:
* @Date: 2019-12-12 10:34:03
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-13 16:28:33
*/
import './index.scss';
import React, { useState, useEffect } from 'react';
import {Icon, Empty, Pagination, Tooltip } from 'antd';
import MyIcon from '../../../../common/components/MyIcon';
function LeftPane (props) {
// 获取数据集
const {
dataSets = [],
total,
pagination,
onPageChange
} = props;
const emptyCtx = (
<div className="jupyter_empty">
<Empty />
</div>
);
// const listCtx = ;
const [renderCtx, setRenderCtx] = useState(() => (emptyCtx));
useEffect(() => {
if (dataSets.length > 0) {
console.log('数据集的个数: ', dataSets.length);
const oList = dataSets.map((item, i) => {
return (
<li className="jupyter_item" key={`key_${i}`}>
<Tooltip
placement="right"
title={item.file_path}
mouseLeaveDelay={0.3}
>
<Icon type="file-text" className="jupyter_icon"/>
<span className="jupyter_name">{item.title}</span>
</Tooltip>
</li>
);
});
const oUl = (
<ul className="jupyter_data_list">
{ oList }
</ul>
);
setRenderCtx(oUl);
}
}, [props]);
// 分页处理
const handleChangePage = (page) => {
// console.log(page, pageSize);
// setCurrent(page);
onPageChange && onPageChange(page);
}
return (
<div className="jupyter_data_sets_area">
<h2 className="jupyter_h2_title">
<MyIcon type="iconwenti" className="jupyter_data_icon"/> 数据集
{/* <span className="iconfont icon-java jupyter_data_icon"></span>数据集 */}
</h2>
{ renderCtx }
<div className='jupyter_pagination'>
<Pagination
simple
current={pagination.page}
pageSize={pagination.limit}
total={total}
onChange={handleChangePage}
/>
</div>
</div>
)
}
export default LeftPane;

@ -0,0 +1,72 @@
.jupyter_data_sets_area{
height: 100%;
background: #fff;
.jupyter_h2_title{
height: 44px;
line-height: 44px;
// background-color: #EEEEEE;
background: #fff;
padding: 0 30px;
font-size: 16px;
// box-size: border-box;
box-sizing: border-box;
border-bottom: 1px solid rgba(238,238,238,1);
.jupyter_data_icon{
// color: #7286ff;
color: #1890ff;
font-size: 24px;
position: relative;
top: 2px;
transform: scale(1.5);
margin-right: 5px;
}
}
.jupyter_data_list,
.jupyter_empty{
height: calc(100vh - 160px);
overflow-y: auto;
}
.jupyter_data_list{
.jupyter_item{
line-height:45px;
border-bottom: 1px solid rgba(238,238,238, 1);
padding: 0 30px 0 60px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
cursor: pointer;
transition: .3s;
&:hover{
background-color: rgba(235, 235, 235, .3);
}
.jupyter_icon{
color: rgb(74, 188, 125);
font-size: 16px;
transform: scale(1.2);
margin-right: 5px;
}
.jupyter_name{
color: #000;
font-size: 16px;
}
}
}
.jupyter_empty{
display: flex;
align-items: center;
justify-content: center;
width: 100%;
}
.jupyter_pagination{
display: flex;
justify-content: center;
align-items: center;
height: 56px;
box-sizing: border-box;
border-top: 1px solid rgba(238,238,238,1);
}
}

@ -0,0 +1,91 @@
/*
* @Description:
* @Author: tangjiang
* @Github:
* @Date: 2019-12-12 15:04:20
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-13 11:25:22
*/
import './index.scss';
import React, { useEffect, useState } from 'react';
import { Spin, Button } from 'antd';
function RightPane (props) {
const {
status,
url,
onReloadUrl,
onSave,
loading
} = props;
const [renderCtx, setRenderCtx] = useState(() => loadInit);
// 重新获取 url
const handleClickReload = () => {
onReloadUrl && onReloadUrl();
}
const loadInit = (
<div className="jupyter_loading_init">
<Spin tip="加载中..."></Spin>
</div>
);
const loadError = (
<div className="jupyter_load_url_error">
<span className="iconfont icon-jiazaishibai1 icon-error"></span>
<p className="jupyter_error_txt">
实训加载失败
<span
className="jupyter_reload"
onClick={handleClickReload}
>重新加载</span>
</p>
</div>
);
// 保存
const handleClickSubmit = () => {
console.log('调用了保存接口....');
onSave && onSave();
}
useEffect(() => {
if (status === -1) {
setRenderCtx(() => loadInit);
} else if (status === 0 && url) {
setRenderCtx(() => (
<div className="jupyter_result">
<div className="jupyter_iframe">
<iframe
title=" "
width="100%"
height="100%"
src={url}
className='jupyter_iframe_style'
></iframe>
</div>
<div className="jupyter_submit">
<Button
loading={loading}
type="primary"
onClick={handleClickSubmit}
>保存</Button>
</div>
</div>
));
} else {
setRenderCtx(() => loadError);
}
}, [status, url, loading]);
return (
<div className="jupyter_right_pane_area">
{ renderCtx }
</div>
)
}
export default RightPane;

@ -0,0 +1,74 @@
.jupyter_right_pane_area{
position: relative;
height: calc(100vh - 60px);
// background: pink;
.jupyter_load_url_error,
.jupyter_loading_init{
display: flex;
position: relative;
align-items: center;
justify-content: center;
height: 100%;
&::before{
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
content: '';
}
}
.jupyter_loading_init{
&::before{
background-color: rgba(0,0,0,.2);
}
}
.jupyter_load_url_error{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
// &::before{
// background-color: rgba(0,0,0,.2);
// }
.jupyter_error_txt{
position: relative;
z-index: 1;
font-size: 12px;
.jupyter_reload{
cursor: pointer;
color: #1890ff;
}
}
.icon-error{
position: relative;
color: #DCE0E6;
transform: scale(5);
top: -35px;
}
}
.jupyter_result{
height: 100%;
.jupyter_iframe{
height: calc(100% - 56px);
// background: pink;
.jupyter_iframe_style{
border: none;
outline: none;
}
}
.jupyter_submit{
display: flex;
align-items: center;
height: 56px;
justify-content: flex-end;
padding-right: 30px;
}
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,111 @@
import React, { Component } from 'react';
import {Button,Form,Input} from 'antd';
import axios from 'axios';
import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
class Osshackathonmd extends Component{
constructor(props) {
super(props)
this.contentMdRef = React.createRef();
this.state={
title_num: 0,
title_value: undefined
}
}
componentDidUpdate =(prevState)=>{
// if(prevState!=this.props){
// let url=`/osshackathon/edit_hackathon.json`;
// axios.get(url).then((result)=>{
// if(result.status==200){
// this.setState({
// title_value:result.data.name
// })
// this.contentMdRef.current.setValue(result.data.description);
// }
// })
// }
}
componentDidMount(){
let url=`/osshackathon/edit_hackathon.json`;
axios.get(url).then((result)=>{
if(result.status==200){
this.setState({
title_value:result.data.name
})
this.contentMdRef.current.setValue(result.data.description === null ? "" : result.data.description);
}
})
}
// 输入title
changeTitle = (e) => {
// title_num: 60 - parseInt(e.target.value.length),
this.setState({
title_num: e.target.value.length,
title_value: e.target.value
})
}
handleSubmit = () => {
let {title_value}=this.state;
const mdContnet = this.contentMdRef.current.getValue().trim();
// if(mdContnet.length>10000){
// this.props.showNotification("内容超过10000个字");
// return
// }
let url=`/osshackathon/update_hackathon.json`;
axios.post(url,{
name:title_value,
description:mdContnet,
}
).then((response) => {
if(response.data.status===0){
this.props.getosshackathon()
this.props.hidehackathonedit()
this.props.showNotification(`提交成功`);
}
}).catch((error) => {
console.log(error)
})
}
render() {
// console.log(this.props.tabkey)
// console.log(chart_rules)
return (
<div className={"mt20"}>
<Form>
<Form.Item label="标题">
<Input placeholder="请输入标题"
value={this.state.title_value}
onInput={this.changeTitle}
className="searchView searchViewAfter h45input" style={{"width": "100%"}} maxLength="60"
addonAfter={String(this.state.title_value === undefined || this.state.title_value === null ? 0 : this.state.title_value.length) + "/60"}
/>
</Form.Item>
<Form.Item label="描述">
<TPMMDEditor ref={this.contentMdRef} placeholder="请输入描述" mdID={'courseContentMD'} refreshTimeout={1500}
className="courseMessageMD"
initValue={this.state.description === null ? "" : this.state.description}></TPMMDEditor>
</Form.Item>
</Form>
<div className="clearfix mt30 mb30">
<div className={"fr"}>
<Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<a className="defalutCancelbtn fl" onClick={() => this.props.hidehackathonedit()}>取消</ a>
</div>
</div>
</div>
)
}
}
export default Osshackathonmd;

@ -392,6 +392,442 @@ a.white-btn.use_scope-btn:hover{
border-color: #096dd9;
}
.ant-btn:hover, .ant-btn:focus, .ant-btn:active, .ant-btn.active{
background-color: #4CACFF;
/*.ant-btn:hover, .ant-btn:focus, .ant-btn:active, .ant-btn.active{*/
/* background-color: #4CACFF;*/
/*}*/
.newViewAfter .ant-input{
line-height: 40px !important;
height: 40px !important;
box-shadow: none!important;
}
.width30{
width: 30%;
}
.newshixunheadersear{
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
margin: 0 auto;
}
.packinput .ant-input{
height: 55px;
width:663px !important;
font-size: 14px;
/*color: #681616 !important;*/
border-color: #E1EDF8 !important;
padding-left: 20px;
}
.packinput .ant-input-group-addon .ant-btn{
width:137px !important;
font-size: 18px;
height: 53px;
background:rgba(76,172,255,1);
}
.tabtitle{
height: 62px !important;
-webkit-box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15);
box-shadow: 3px 10px 21px 0px rgba(76, 76, 76, 0.15);
border-radius: 6px;
background: #fff;
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
}
.tabtitles2{
background: #fff;
height: 62px !important;
width: 1200px;
}
.tabtitless{
height: 62px !important;
line-height: 62px !important;
}
.tabtitle1{
}
.tabtitle2{
margin-left: 30px !important;
}
.counttit{
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
}
.counttittext{
text-align: left;
width: 1200px;
height: 18px;
color: #888888;
font-size: 13px;
margin-top: 24px;
}
.counttittexts{
color: #4CACFF !important;
font-size: 13px;
}
.mainx{
display: -ms-flexbox;
display: flex;
-ms-flex-pack: center;
justify-content: center;
margin-top: 17px;
}
.project-packages-list{
}
.project-package-item{
display: -ms-flexbox;
display: flex;
-ms-flex-direction:column;
flex-direction:column;
margin-bottom: 20px;
padding: 20px;
background: white;
/* box-shadow: 1px 3px 3px 1px rgba(156,156,156,0.16); */
}
.xuxianpro{
height: 20px;
border-bottom: 1px dashed;
border-color: #EAEAEA;
margin-bottom: 18px;
}
.magr11{
margin-top: 11px;
}
.highlight{
color: #4CACFF;
}
.fonttext{
font-size: 20px;
font-weight:bold;
}
.fontextcolor{
color: #777777;
}
.tzbq{
margin-left: 68px;
}
.tzbqx{
/* margin-left: 24px; */
}
.bjyss{
background: #F8F8F8;
}
.zj{
overflow:hidden;
-o-text-overflow:ellipsis;
text-overflow:ellipsis;
white-space:nowrap
}
.ziticor{
color: #777777;
font-size: 13px;
}
.foohter{
margin-top: 20px;
display: -ms-flexbox;
display: flex;
-ms-flex-direction:row;
flex-direction:row;
}
.maxwidth1100{
max-width: 1100px;
overflow:hidden;
-o-text-overflow:ellipsis;
text-overflow:ellipsis;
white-space:nowrap;
font-size: 18px !important;
font-weight: 500;
color: rgba(51,51,51,1) !important;
}
.newshixunmodelmidfont{
font-size: 14px;
font-weight: 400;
color: #999999;
margin-top: 15px;
margin-left: 30px;
max-width: 1100px;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
}
.newshixunmodelbotfont{
font-size:12px;
font-weight:400;
color:rgba(102,102,102,1);
margin-top: 15px;
margin-left: 30px;
}
.newshixunlist{
max-height:227px;
width: 1200px;
}
.xuxianpro {
height: 20px;
border-bottom: 1px dashed;
border-color: #eaeaea;
margin-bottom: 18px;
}
.newshixunpd030{
padding: 0px 30px;
}
.pd303010{
padding: 30px 30px 10px;
}
.newshixunfont12{
font-size: 12px;
color: rgba(76,172,255,1);
line-height: 21px;
}
.newshixunmode{
width: 100px;
height: 38px;
border-radius: 3px;
/*border: 1px solid rgba(191,191,191,1);*/
}
.ntopsj {
position: absolute;
top: -4px;
}
.nyslbottomsj {
position: absolute;
bottom: -6px;
}
.inherits .ant-dropdown-menu-item{
cursor: inherit !important;
}
.menus{
width: 91px;
text-align: center;
}
.newshixunmodelbotfont span{
display: inline-block;
margin-right: 34px;
}
.minhegiht300{
min-height: 300px;
}
.newshixunlist:hover{
-webkit-box-shadow: 1px 6px 16px rgba(156,156,156,0.16);
box-shadow: 1px 6px 16px rgba(156,156,156,0.16);
opacity: 1;
border-radius: 2px;
}
.newshixun500{
max-width: 500px;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
}
.mt3 {
margin-top: 3px !important;
}
.highlight{
color: #4CACFF;
}
.newshixunbottombtn{
position: fixed;
z-index: 1000;
bottom: 0px;
width: 100%;
height: 63px;
background: rgba(255,255,255,1);
-webkit-box-shadow: 0px -4px 4px 0px rgba(0,0,0,0.05);
box-shadow: 0px -4px 4px 0px rgba(0,0,0,0.05);
}
.mb60shixun{
margin-bottom: 60px !important;
}
.padding13-30 {
padding: 13px 30px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.displaymodulat {
display: -ms-flexbox;
display: flex;
display: -webkit-flex;
-ms-flex-direction: column;
flex-direction: column;
-ms-flex-align: center;
align-items: center;
}
.WordNumberTextarea {
outline: none; /* 去掉输入字符时的默认样式 */
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
background-color: white;
text-shadow: none;
-webkit-writing-mode: horizontal-tb !important;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
resize: none; /*禁止拉伸*/
border: none; /*去掉默认边框*/
width: 100%;
height: 130px;
border: none;
display: block;
}
.WordNumbernote {
padding: 0;
margin: 0;
list-style: none;
text-decoration: none;
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
height: auto;
border: 1px solid rgba(234, 234, 234, 1);
border-radius: 0.125rem;
margin: 10px 10px 0px 10px;
padding: 10px 10px 5px 10px;
backgroud: rgba(234, 234, 234, 1);
width: 530px;
margin-left: 10px;
margin-top: 25px;
height: 214px !important;
}
.WordNumbernote .WordNumberTextarea {
outline: none;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
background-color: white;
text-shadow: none;
-webkit-writing-mode: horizontal-tb !important;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
resize: none;
border: none;
width: 100%;
height: 169px !important;
border: none;
display: block;
}
.WordNumberTextarea-count {
display: inline-block;
float: right;
font-size: 16px;
color: #adadad;
padding-right: 0.25rem;
}
.borerinput {
border: 1px solid #DD1717 !important;
}
.borerinputs {
border: 1px solid #eee !important;
}
.mexertwo {
display: -ms-flexbox;
display: flex;
-ms-flex-direction: initial;
flex-direction: initial;
}
.mexeheigth {
line-height: 40px;
}
.mexeheigth2 {
line-height: 40px;
width: 74px;
}
.minbuttionte {
/* display: flex; */
margin-top: 20px;
width: 100%;
/* align-items: center; */
margin-bottom: 17px;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
-ms-flex-align: center;
align-items: center;
-ms-flex-pack: center;
justify-content: center;
-ms-flex-direction: initial;
flex-direction: initial;
}
.initialflex{
display: -ms-flexbox;
display: flex;
-ms-flex-direction:initial;
flex-direction:initial;
}
.newshixunheadersear{
margin: 0 auto;
}
.newshixunmodels{
margin: 0 auto;
}
.backgroundFFF{
background: #FFF !important;
}
.relative{
position: relative;
}
.pd40px{
padding-bottom: 40px;
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,329 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { getImageUrl ,markdownToHTML, configShareForCustom} from 'educoder'
import { CircularProgress } from 'material-ui/Progress';
import { Modal, Spin, Tooltip ,message,Icon} from 'antd';
import LoadingSpin from '../../../../common/LoadingSpin';
import 'antd/lib/pagination/style/index.css';
import '../shixunchildCss/Challenges.css'
import ReactDOM from 'react-dom';
import axios from 'axios';
import AccountProfile from"../../../user/AccountProfile";
const $ = window.$;
class Challengesjupyter extends Component {
constructor(props) {
super(props)
this.state = {
ChallengesDataList: undefined,
operate: true,
startbtns: false,
iFrameHeight: '0px',
jupyter_port:0,
jupyter_url:null,
username:"",
booljupyterurls:false,
loading:false,
}
}
ChallengesList = () => {
let id = this.props.match.params.shixunId;
let ChallengesURL = `/shixuns/` + id + `/challenges.json`;
axios.get(ChallengesURL).then((response) => {
if (response.status === 200) {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{
configShareForCustom(this.props.shixunsDetails.name, response.data.description)
this.setState({
ChallengesDataList: response.data,
sumidtype: false,
});
}
}
}).catch((error) => {
//console.log(error)
});
}
componentDidMount() {
setTimeout(this.ChallengesList(), 1000);
let id = this.props.match.params.shixunId;
let ChallengesURL = `/jupyters/get_info_with_tpm.json`;
let datas={
identifier:id,
}
axios.get(ChallengesURL, {params: datas}).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
setTimeout(() => {
this.setState({
booljupyterurls:true,
})
}, 600)
}else{
if(response.data.status===0){
setTimeout(() => {
this.setState({
jupyter_url:response.data.url,
jupyter_port:response.data.port,
booljupyterurls:true,
})
}, 800)
}else{
setTimeout(() => {
this.setState({
booljupyterurls:true,
})
}, 600)
}
}
}).catch((error) => {
setTimeout(() => {
this.setState({
booljupyterurls:true,
})
}, 600)
});
}
updatamakedowns = () => {
this.setState({
loading:true,
booljupyterurls:false
})
let id = this.props.match.params.shixunId;
let ChallengesURL = `/jupyters/get_info_with_tpm.json`;
let datas={
identifier:id,
}
axios.get(ChallengesURL, {params: datas}).then((response) => {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
setTimeout(() => {
this.setState({
booljupyterurls:true,
})
}, 600)
}else{
if(response.data.status===0){
setTimeout(() => {
this.setState({
jupyter_url:response.data.url,
jupyter_port:response.data.port,
booljupyterurls:true,
})
}, 800)
this.setState({
})
}else{
setTimeout(() => {
this.setState({
booljupyterurls:true,
})
}, 600)
}
}
}).catch((error) => {
setTimeout(() => {
this.setState({
booljupyterurls:true,
})
}, 600)
});
}
modifyjupyter=()=>{
let id=this.props.match.params.shixunId;
var jupyter_port="";
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={
identifier:id,
jupyter_port:jupyter_port,
}
axios.get(url, {params: data})
.then((result) => {
if (result.data.status === 0) {
this.props.showNotification(`应用成功`);
}
}).catch((error) => {
})
}
render() {
let{ChallengesDataList,booljupyterurls}=this.state;
let id = this.props.match.params.shixunId;
const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
return (
<React.Fragment>
<div className="mt30 pl20 pr20" >
<p className="clearfix mb20">
<span className="font-16 fl">简介</span>
<Tooltip placement="bottom" title={"编辑"}>
<a style={{ display: this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status < 3 ? "block" : 'none' }}
href={"/shixuns/" + id + "/settings?edit=1"} className="ring-green fr">
<img src={getImageUrl("images/educoder/icon/edit.svg")} className="fl mt3 ml2" />
</a>
</Tooltip>
</p>
<div className="justify break_full_word new_li "
id="challenge_editorMd_description">
<p id="ReactMarkdown" style={{overflow:'hidden'}}>
{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":
<div className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(ChallengesDataList.description).replace(/▁/g,"▁▁▁")}}></div>
}
</p>
{
booljupyterurls===true?
(
this.state.jupyter_url === null?
<div className="mt50 intermediatecenter juplbool">
<span className="icon iconfontysl icon-jiazaishibai1"></span>
<p className="intermediatecenter sortinxdirection mt5 juplboolp"><p className="colorbluetest">加载实训出错是否</p><p className="colorbluetwo" onClick={()=>this.updatamakedowns()}></p></p>
</div>
:""
)
:""
}
<style>
{
`
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.sortinxdirection{
display: flex;
flex-direction:row;
}
.xaxisreverseorder{
display: flex;
flex-direction:row-reverse;
}
;
}
`
}
</style>
{
this.state.jupyter_url === null || this.state.jupyter_url === undefined ?
""
:
(
is_teacher===true?
<div className="sortinxdirection mt60">
<div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div>
<div><p className="renwuxiangqdivtest ml1 shixunbingbaocun">请将实训题目写在下方并保存</p></div>
</div>
<div className="renwuxiangssit xaxisreverseorder">
<div className="challenbaocun" onClick={() => this.modifyjupyter(this.state)}><p
className="challenbaocuntest">应用到实训</p></div>
</div>
</div>
:
""
)
}
<style>
{
`
iframe {
border-width: 0px;
border-style: inset;
border-color: initial;
border-image: initial;
}
iframe {
border-left: 1px solid #eeeeee;
border-top: 1px solid #eeeeee;
border-right: 1px solid #eeeeee;
border-bottom: 1px solid #eeeeee;
}
#header{
visibility:hidden;
}
`
}
</style>
{
is_teacher===true?
<div className="mt35">
<div className="pb47">
{
this.state.jupyter_url===null || this.state.jupyter_url===undefined?
(
booljupyterurls===false?
<LoadingSpin></LoadingSpin>
:""
)
:
<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>
}
</div>
</div>
:""
}
</div>
</div>
</React.Fragment>
)
}
}
export default Challengesjupyter;

@ -3,7 +3,134 @@
line-height: 30px;
}
.height28 {
height: 30px;
line-height:28px;
}
.line27{
line-height: 27px;
vertical-align: 1px;
}
/* 中间居中 */
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* 简单居中 */
.intermediatecenterysls{
display: flex;
align-items: center;
}
.spacearound{
display: flex;
justify-content: space-around;
}
.spacebetween{
display: flex;
justify-content: space-between;
}
/* 头顶部居中 */
.topcenter{
display: -webkit-flex;
flex-direction: column;
align-items: center;
}
/* x轴正方向排序 */
/* 一 二 三 四 五 六 七 八 */
.sortinxdirection{
display: flex;
flex-direction:row;
}
/* x轴反方向排序 */
/* 八 七 六 五 四 三 二 一 */
.xaxisreverseorder{
display: flex;
flex-direction:row-reverse;
}
/* 垂直布局 正方向*/
/*
*/
.verticallayout{
display: flex;
flex-direction:column;
}
/* 垂直布局 反方向*/
.reversedirection{
display: flex;
flex-direction:column-reverse;
}
.yslwushiwidth{
width: 50%;
}
.yslwushiwidth90{
width: 90%;
}
.yslwushiwidth10{
width: 10%;
}
.yslwushiwidthbuton{
width: 110px;
}
.yslwushiwidthcolortest{
color: #A8A8A8;
font-size:16px;
}
.yslusername{
color: #000000;
font-size: 18px;
}
.yslusercjz{
width:60px;
height:28px;
border-radius:3px;
border:1px solid #F38B03;
}
.yslusercjztest{
width:60px;
height:28px;
font-size:16px;
color:#F38B03;
line-height:28px;
text-align: center;
}
.w18{
width: 18px;
}
.maxnamewidth150{
width: 150px;
max-width: 150px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.fabushixunwidth{
color: #000000;
font-size: 16px;
}
.fabushixunwidthcolor{
color: #4CACFF;
font-size: 16px;
}
.divfontexdivs{
border-left: 1px solid #eeeeee;
border-top: 1px solid #eeeeee;
border-right: 1px solid #eeeeee;
border-bottom: 1px solid #eeeeee;
}

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Redirect } from 'react-router';
import {Modal, Button, Radio, Input, Checkbox,message,Spin, Icon} from 'antd';
import {Modal, Button, Radio, Input, Checkbox,message,Spin, Icon,Pagination} from 'antd';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
@ -48,7 +48,9 @@ class Collaborators extends Component {
user_name:undefined,
school_name:undefined,
spinnings:false,
useristrue:false
useristrue:false,
mylistansum:6,
limit:20,
}
}
componentDidMount() {
@ -434,7 +436,10 @@ class Collaborators extends Component {
collaboratorListsumtype,
user_name,
school_name,
useristrue
useristrue,
mylistansum,
page,
limit
} = this.state;
let {loadingContent} = this.props;
const radioStyle = {
@ -448,18 +453,32 @@ class Collaborators extends Component {
console.log(Searchadmin)
return (
<React.Fragment>
<p className="clearfix mt30"
style={{display:this.props.identity<5?"block":"none"}}
<p className=" mt30 sortinxdirection"
style={{display:this.props.identity<5?"flex":"none"}}
>
<div className="yslwushiwidth">
<p className="edu-default-btn edu-greenback-btn ml20 height28 yslwushiwidthcolortest">{collaboratorList&&collaboratorList.length}</p>
</div>
<div className="yslwushiwidth xaxisreverseorder">
<a onClick={() => this.showCollaboratorsvisible("cooperation")}
className="edu-default-btn edu-greenback-btn fr mr20 height40"
className="edu-default-btn edu-greenback-btn mr20 height40 yslwushiwidthbuton"
data-remote="true">
<span className={"line27"}>+ </span>
</a>
<a onClick={() => this.showCollaboratorsvisible("admin")}
style={{display:this.props.identity===1?"block":"none"}}
style={{display:this.props.identity===1?"flex":"none"}}
data-remote="true"
className="edu-default-btn edu-greenback-btn fr mr20 height40">更换管理员</a>
className="edu-default-btn edu-greenback-btn mr20 height40 yslwushiwidthbuton">
<p style={{
textAlign: "center",
width:'100%',
lineHeight: "29px",
}}>更换管理员</p>
</a>
</div>
</p>
<Modal
@ -537,6 +556,8 @@ class Collaborators extends Component {
<span className="fl edu-txt-w100 task-hide font-bd">职业</span>
<span className="fl edu-txt-w180 task-hide font-bd ml80">单位</span>
</p>
<div className="mt5" style={{background: '#f7f9fd'}}>
<Spin indicator={antIcon} spinning={this.state.spinnings}>
<div className="clearfix">
@ -584,39 +605,58 @@ class Collaborators extends Component {
onClick={() => this.submit_add_collaborators_form()}>确定</a>
</div>
</Modal>:""}
<style>
{
`
.collaborators-item-middles{width: 100% !important; margin-left: 20px;}
.ysltithead{
padding-bottom: 20px;
}
`
}
</style>
<div className="pl20" id="collaborators_list_info">
{
collaboratorList===undefined?"":collaboratorList.map((item,key)=>{
if(key<collaboratorListsum){
return(
<div className="collaborators-item clearfix" key={key}>
<div className="collaborators-item clearfix sortinxdirection ysltithead" key={key}>
<a href={item.user.user_url} target="_blank" className="mr20 fl">
<img alt="用户头像" className="radius" height="80" src={getImageUrl("images/"+item.user.image_url)} width="80"/></a>
<div className="fl collaborators-item-middle">
<p className="mb10">
<a href={item.user.user_url} target="_blank">{item.user.name}</a>
<span className="ml20" style={{display:this.props.power===false?"none":"inline-block"}}>{item.user.shixun_manager === true ? "(管理员)" : ""}</span>
</p>
<p className="color-grey-B2 font-12 mb10"><span className="mr20">{item.user.identity}</span><span>{item.user.school_name}</span></p>
<div className="fl collaborators-item-middles">
<p className="mb10 ">
<span className="mr20">发布&nbsp;&nbsp;{item.user.user_shixuns_count}</span>
{/*<span>粉丝&nbsp;&nbsp;*/}
{/*<span id="user_h_fan_count">{item.user.fans_count}</span>*/}
{/*</span>*/}
</p>
<a href={item.user.user_url} target="_blank" className="yslusername">{item.user.name}</a>
{/* <p className="color-grey-B2 task-hide">{item.user.brief_introduction}</p> */}
<span className={item&&item.user&&item.user.shixun_manager === true?"ml20 yslusercjz ":"ml20"} style={{display:this.props.power===false?"none":"inline-block"}}><p className="yslusercjztest">{item.user.shixun_manager === true ? "创建者" : ""}</p></span>
</p>
<p className="color-grey-B2 font-12 mb10 sortinxdirection mt14">
<p className="yslwushiwidth90 sortinxdirection">
<p className="mr20 font-16 w70">{item.user.identity}</p>
<p className={item.user.school_name===null||item.user.school_name===""?"":"mr40 font-16 maxnamewidth150"}>{item.user.school_name}</p>
<p className="fabushixunwidth">发布实训项目&nbsp;&nbsp;<span className="fabushixunwidthcolor ml2">{item.user.user_shixuns_count}</span></p>
</p>
<div className="xaxisreverseorder yslwushiwidth10">
{item.user.shixun_manager === true ? "" :
<i className="iconfont icon-shanchu newbianji1 color-grey-c font-16 w40"
style={{display: this.props.power === false ? "none" : "block"}}
onClick={() => this.collaborators_delete(item.user.user_id)}>
</i>
}
</div>
{item.user.shixun_manager === true ? "" : <a className="fr color-grey-c mr40 mt35 font-16"
style={{display: this.props.power === false ? "none" : "block"}}
onClick={() => this.collaborators_delete(item.user.user_id)}>删除</a>}
</p>
{/*<p className="mb10">*/}
{/* */}
{/* /!*<span>粉丝&nbsp;&nbsp;*!/*/}
{/* /!*<span id="user_h_fan_count">{item.user.fans_count}</span>*!/*/}
{/* /!*</span>*!/*/}
{/*</p>*/}
{/* <p className="color-grey-B2 task-hide">{item.user.brief_introduction}</p> */}
</div>
{/*<a href="/watchers/unwatch?object_id=3039&amp;object_type=user&amp;shixun_id=61&amp;target_id=3039" className="fr user_default_btn user_private_btn mt30 font-16 mr20" data-method="post" data-remote="true" rel="nofollow">取消关注</a>*/}
</div>
@ -647,6 +687,17 @@ class Collaborators extends Component {
className={collaboratorList.length>10&&collaboratorListsumtype===true?"":"none"}
style={{textAlign:'center',borderTop:'1px solid #eee'}}>
<a className="loadMore" onClick={this.loadMore}>加载更多</a>
{/*{*/}
{/* mylistansum>5?*/}
{/* <div className="edu-txt-center mt40 mb40">*/}
{/* <Pagination showQuickJumper current={page}*/}
{/* onChange={this.paginationonChanges} pageSize={limit}*/}
{/* total={mylistansum}*/}
{/* ></Pagination>*/}
{/* </div>*/}
{/* :""*/}
{/*}*/}
</div>
</React.Fragment>

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

@ -26,3 +26,80 @@
height: 27px;
line-height: 25px;
}
.challenbaocun{
width:103px;
height:30px;
background:#29BD8B;
border-radius:3px;
cursor:pointer
}
.challenbaocuntest{
width:103px;
height:30px;
font-size:16px;
color:#FFFFFF;
text-align: center;
line-height:30px;
cursor:pointer
}
.renwuxiangqdiv{
width:72px;
height:30px;
font-size:18px;
color:#000000;
line-height:30px;
}
.renwuxiangqdivtest{
height:30px;
font-size:16px;
line-height:30px;
}
.renwuxiangssi{
width: 50%;
}
.renwuxiangssit{
width: 50%;
}
.pb47{
padding-bottom: 47px;
}
.colorbluetwo{
color: #1E8FFD;
font-size: 12px;
cursor:pointer;
margin-right: 18px;
}
.colorbluetest{
color: #06101A;
font-size: 12px;
cursor:default
}
.shixunbingbaocun{
font-size:14px;
color:#888888;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.iconfontysl{
vertical-align:middle;
font-family:"iconfont" !important;
font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
font-size: 100px;
color: #F5F5F5;
}
.juplbool{
position: relative;
}
.juplboolp{
position: absolute;
bottom: 21px;
}

@ -95,6 +95,33 @@ class ShixunCard extends Component {
left: 10px;
bottom: 125px;
}
.tag-org{
position: absolute;
left: 0px;
top: 20px;
}
.tag-org-name{
width:66px;
height:28px;
background:#FF6802;
width:66px;
height:28px;
border-radius:0px 20px 20px 0px;
}
.tag-org-name-test{
width:45px;
height:23px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
margin-right: 6px;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
`
}
</style>
@ -105,6 +132,14 @@ class ShixunCard extends Component {
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div>
}
{
item.is_jupyter===true?
<div className="tag-org">
<p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p>
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div>
:""}
<div className={item.power === false ? "closeSquare" : "none"}>
<img src={getImageUrl("images/educoder/icon/lockclose.svg")}
className="mt80 mb25"/>

@ -275,10 +275,10 @@ render() {
}
<div className="fl pr shaiAllItem mt1">
<li className={this.state.diff===0?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(0)}>全部难度</li>
<li className={this.state.diff===1?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(1)}>初级学员</li>
<li className={this.state.diff===2?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(2)}>中级学员</li>
<li className={this.state.diff===3?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(3)}>高级学员</li>
<li className={this.state.diff===4?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(4)}>顶级学员</li>
<li className={this.state.diff===1?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(1)}>初级</li>
<li className={this.state.diff===2?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(2)}>中级</li>
<li className={this.state.diff===3?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(3)}>高级</li>
<li className={this.state.diff===4?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(4)}>高级</li>
</div>
</div>

@ -404,7 +404,7 @@ class ShixunsIndex extends Component {
{...this.state}
OnSearchInput={this.OnSearchInput.bind(this)}
/>
{/*下方图片*/}
<ShixunCard
typepvisible={typepvisible}
middleshixundata={middleshixundata.shixuns}

@ -112,3 +112,11 @@ a:active{text-decoration:none;}
.width360{
width:360px;
}
.bannerpd201{
padding: 20px 20px 10px 20px;
}
.FF6802{
color:#FF6802;
}

@ -0,0 +1,129 @@
.tpmborder{
border: 1px solid;
}
/* 中间居中 */
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* 简单居中 */
.intermediatecenterysls{
display: flex;
align-items: center;
}
.spacearound{
display: flex;
justify-content: space-around;
}
.spacebetween{
display: flex;
justify-content: space-between;
}
/* 头顶部居中 */
.topcenter{
display: -webkit-flex;
flex-direction: column;
align-items: center;
}
/* x轴正方向排序 */
/* 一 二 三 四 五 六 七 八 */
.sortinxdirection{
display: flex;
flex-direction:row;
}
/* x轴反方向排序 */
/* 八 七 六 五 四 三 二 一 */
.xaxisreverseorder{
display: flex;
flex-direction:row-reverse;
}
/* 垂直布局 正方向*/
/*
*/
.verticallayout{
display: flex;
flex-direction:column;
}
/* 垂直布局 反方向*/
.reversedirection{
display: flex;
flex-direction:column-reverse;
}
.deletebutom{
width:85px;
height:30px;
background:#C4C4C4;
border-radius:3px;
cursor:pointer
}
.deletebutomtext{
width:28px;
height:19px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
cursor:pointer
}
.deletebuttom{
width:85px;
height:30px;
background:#29BD8B;
border-radius:3px;
cursor:pointer
}
.deletebuttomtest{
width:56px;
height:19px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
cursor:pointer
}
.tpmwidth{
width: 50%;
}
.mr21{
margin-right: 21px;
}
.wenjiantit{
width: 220px;
}
.zuihoushijian{
width: 125px;
}
.zuihouxiugairen{
width: 70px;
}
.wenjiandaxiao{
width: 56px;
}
.deletebutomtextcode{
width:85px;
height:30px;
background:#FF5555;
border-radius:3px;
cursor:pointer
}
.light-row{
background: #F7F7F8;
}
.dark-row{
background: #FFFFFF;
}

@ -329,6 +329,34 @@ class InfosShixun extends Component{
bottom: 100px;
}
.square-list{width: 100%;box-sizing: border-box;margin-top:10px}
.tag-org{
position: absolute;
left: 0px;
top: 20px;
}
.tag-org-name{
width:66px;
height:28px;
background:#FF6802;
width:66px;
height:28px;
border-radius:0px 20px 20px 0px;
}
.tag-org-name-test{
width:45px;
height:23px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
margin-right: 6px;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
`
}
</style>
@ -350,6 +378,15 @@ class InfosShixun extends Component{
{/*<img className="fl" src={setImagesUrl("images/educoder/tag2.png")}/>*/}
</div>
}
{
item.is_jupyter===true?
<div className="tag-org">
<p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p>
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div>
:""}
<a href="javascript:void(0)" className="square-img">
<img src={setImagesUrl(`${item.image_url}`)}/>
</a>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save