Merge branches 'dev_aliyun', 'develop' and 'jupyter' of https://bdgit.educoder.net/Hjqreturn/educoder into jupyter

chromesetting
杨树明 5 years ago
commit a2ab39335f

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

@ -68,6 +68,9 @@ class AttachmentsController < ApplicationController
@attachment.author_id = current_user.id
@attachment.disk_directory = month_folder
@attachment.cloud_url = remote_path
@attachment.container_id = conversion_container_id(params[:container_id], params[:container_type])
@attachment.container_type = params[:container_type]
@attachment.attachtype = params[:attachtype]
@attachment.save!
else
logger.info "文件已存在id = #{@attachment.id}, filename = #{@attachment.filename}"
@ -91,6 +94,22 @@ class AttachmentsController < ApplicationController
end
end
# 多文件删除
def destroy_files
files = Attachment.where(id: params[:id])
begin
files.each do |file|
file_path = absolute_path(local_path(file))
file.destroy!
delete_file(file_path)
end
render_ok
rescue => e
uid_logger_error(e.message)
tip_exception(e.message)
end
end
private
def find_file
@file =
@ -196,4 +215,12 @@ class AttachmentsController < ApplicationController
end
end
end
def conversion_container_id id, type
if id.is_a?(String) && type == 'Shixun'
Shixun.find_by_identifier(id).id
else
id
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

@ -0,0 +1,92 @@
require 'net/http'
class JupytersController < ApplicationController
include JupyterService
before_action :shixun
def open
#打开tpm - juypter接口
shixun = @shixun
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = "tpm#{shixun.id}"
params = {tpiID: tpiID, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
logger.info "test_juypter: uri->#{uri}, params->#{params}"
res = uri_post uri, params
logger.info "test_juypter: #{res}"
render plain: "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
def open1
## 打开tpi
game = Game.find(2170158)
shixun = game.myshixun.shixun
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = game.myshixun.id
params = {tpiID: tpiID, :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
repo_save_path = game.myshixun.repo_save_path
render plain: "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
def test
render plain: 'test'
end
def save()
# 保存01.ipy
author_name = current_user.real_name
author_email = current_user.git_mail
message = "User submitted"
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true
src_url = URI("https://47519.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_tpm3575/01.ipynb?download=true")
response = Net::HTTP.get_response(src_url)
if response.code.to_i != 200
raise("获取文件内容失败:#{response.code}")
end
content = response.body
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)
render plain: 'save: #{c.size}'
end
private
def shixun
@shixun = Shixun.find(3575)
end
end

@ -3,6 +3,7 @@ class ShixunsController < ApplicationController
include ApplicationHelper
include ElasticsearchAble
include CoursesHelper
include JupyterService
before_action :require_login, :check_auth, except: [:download_file, :index, :menus, :show, :show_right, :ranking_list,
:discusses, :collaborators, :fork_list, :propaedeutics]
@ -24,6 +25,10 @@ class ShixunsController < ApplicationController
before_action :special_allowed, only: [:send_to_course, :search_user_courses]
helper_method :jupyter_url_with_shixun, :jupyter_port_with_shixun
## 获取课程列表
def index
@shixuns = current_laboratory.shixuns.unhidden
@ -364,76 +369,112 @@ 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
begin
@shixun = CreateShixunService.call(current_user, shixun_params, params)
rescue => e
logger_error("shixun_create_error: #{e.message}")
tip_exception("创建实训失败!")
end
end
ActiveRecord::Base.transaction do
# 保存jupyter到版本库
def update_jupyter
jupyter_save_with_shixun(@shixun, params[:jupyter_port])
end
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
ShixunSchool.create!(arr)
end
# 实训合作者
@shixun.shixun_members.create!(user_id: current_user.id, role: 1)
# 镜像-实训关联表
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?
end
end
rescue => e
uid_logger_error(e.message)
tip_exception("基本信息更新失败:#{e.message}")
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])
# 实训权限设置
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
# 将实训标志为该云上实验室建立
Laboratory.current.laboratory_shixuns.create!(shixun: @shixun, ownership: true)
rescue Exception => e
uid_logger_error(e.message)
tip_exception("实训创建失败")
raise ActiveRecord::Rollback
# 实训学习页面设置
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
# Jupyter数据集
def jupyter_data_sets
page = params[:page] || 1
limit = params[:limit] || 10
data_sets = @shixun.jupyter_data_sets
@data_count = data_sets.count
@data_sets= data_sets.page(page).per(limit)
end
def apply_shixun_mirror
form_params = params.permit(*%i[language runtime run_method attachment_id])
form = ApplyShixunMirrorForm.new(form_params)
@ -462,61 +503,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 +538,8 @@ class ShixunsController < ApplicationController
# @evaluate_scirpt = @shixun.evaluate_script || "无"
end
# 获取脚本内容
def get_script_contents
mirrir_script = MirrorScript.find(params[:script_id])
@ -1021,10 +1009,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
@ -1033,8 +1020,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

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

@ -163,9 +163,12 @@ module ExportHelper
count_2 = common_homeworks.size
count_3 = group_homeworks.size
count_4 = tasks.size
all_user_ids = all_members.pluck(:user_id)
#实训作业
shixun_homeworks.each_with_index do |s,index|
all_student_works = s.score_student_works #该实训题的全部用户回答
all_student_works = s.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #该实训题的全部用户回答
title_no = index.to_i + 1
student_work_to_xlsx(all_student_works,s)
shixun_work_display_name = format_sheet_name (title_no.to_s + "." + s.name).strip.first(30)
@ -175,7 +178,7 @@ module ExportHelper
#普通作业
common_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works #当前用户的对该作业的回答
all_student_works = c.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
@ -187,7 +190,7 @@ module ExportHelper
#分组作业
group_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works #当前用户的对该作业的回答
all_student_works = c.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
@ -197,7 +200,7 @@ module ExportHelper
#毕设任务
tasks.each_with_index do |c,index|
all_student_works = c.score_graduation_works #当前用户的对该作业的回答
all_student_works = c.score_graduation_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + count_3 + index.to_i + 1
graduation_work_to_xlsx(all_student_works,c,current_user)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
@ -207,7 +210,7 @@ module ExportHelper
#试卷的导出
exercises.each_with_index do |c,index|
all_student_works = c.score_exercise_users #当前用户的对该作业的回答
all_student_works = c.score_exercise_users.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1
get_export_users(c,course,all_student_works)
work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30)

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

@ -9,6 +9,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
@ -54,6 +55,8 @@ class Shixun < ApplicationRecord
has_many :laboratory_shixuns, dependent: :destroy
belongs_to :laboratory, optional: true
# Jupyter数据集,附件
has_many :jupyter_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,7 +1,7 @@
class ShixunInfo < ApplicationRecord
belongs_to :shixun
validates_uniqueness_of :shixun_id
validates_presence_of :shixun_id
validates_presence_of :shixun_id, :description
after_commit :create_diff_record

@ -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,119 @@
#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, :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 jupyter_url_with_game(game)
## 打开tpi
shixun = game.myshixun.shixun
if shixun.is_jupyter?
shixun_tomcat = edu_setting('cloud_bridge')
uri = "#{shixun_tomcat}/bridge/jupyter/get"
tpiID = game.myshixun.id
params = {tpiID: tpiID, :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
repo_save_path = game.myshixun.repo_save_path
"https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
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 = URI("https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true")
response = Net::HTTP.get_response(src_url)
if response.code.to_i != 200
raise("获取文件内容失败:#{response.code}")
end
content = response.body
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(game,jupyter_port)
author_name = current_user.real_name
author_email = current_user.git_mail
message = "User submitted"
tpiID = game.myshixun.id
repo_save_path = game.myshixun.repo_save_path
src_url = URI("https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true")
response = Net::HTTP.get_response(src_url)
if response.code.to_i != 200
raise("获取文件内容失败:#{response.code}")
end
content = response.body
c = GitService.update_file(repo_path: game.myshixun.repo_path,
file_path: "01.ipynb",
message: message,
content: content,
author_name: author_name,
author_email: author_email)
return c.size
end
end

@ -0,0 +1,104 @@
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])
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
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|

@ -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,5 +14,6 @@ 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,10 @@
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)
end
end
json.data_sets_count @data_count

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

@ -3,3 +3,5 @@ json.identity User.current.shixun_identity(@shixun)
json.power @power
json.partial! 'shixuns/top', locals: { shixun: @shixun, current_myshixun: @current_myshixun }
json.secret_repository @shixun.shixun_secret_repository.present?
json.jupyter_url jupyter_url_with_shixun(@shixun)
json.jupyter_port jupyter_port_with_shixun(@shixun)

@ -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,16 @@ Rails.application.routes.draw do
get 'auth/qq/callback', to: 'oauth/qq#create'
get 'auth/failure', to: 'oauth/base#auth_failure'
resources :jupyters do
collection do
get :open
get :open1
get :test
get :save
end
end
resources :edu_settings
scope '/api' do
get 'home/index'
@ -35,6 +45,9 @@ Rails.application.routes.draw do
end
end
resources :hacks, path: :problems, param: :identifier do
collection do
get :unpulished_list
@ -229,6 +242,7 @@ Rails.application.routes.draw do
end
member do
post :update_jupyter
post :copy
get :propaedeutics
get :show_right
@ -261,6 +275,9 @@ Rails.application.routes.draw do
get :shixun_exec
post :review_shixun
get :review_newest_record
post :update_permission_setting
post :update_learn_setting
get :jupyter_data_sets
end
resources :challenges do
@ -744,7 +761,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.

@ -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'),
@ -615,7 +620,7 @@ class App extends Component {
<Route path="/shixuns/:shixunId" component={TPMIndexComponent}>
</Route>
{/*列表页*/}
{/*列表页 实训项目列表*/}
<Route path="/shixuns" component={TPMShixunsIndexComponent}/>
@ -697,6 +702,10 @@ class App extends Component {
(props) => (<Developer {...this.props} {...props} {...this.state} />)
}/>
<Route path="/jupytertpi"
component={JupyterTPI}
/>
<Route exact path="/"
// component={ShixunsHome}
render={

@ -13,7 +13,7 @@ function locationurl(list){
if (window.location.port === "3007") {
} else {
window.location.replace(list)
window.location.href(list)
}
}
let hashTimeout

@ -756,7 +756,7 @@ class Fileslists extends Component{
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
// course_groups={this.state.course_groups}
/>:""}
{/*发送*/}

@ -428,6 +428,9 @@ class NewShixunModel extends Component{
.ant-drawer-body {
padding:15px 24px 24px 0px;
}
.ant-dropdown {
z-index:11000
}
`
}
</style>
@ -536,6 +539,21 @@ class NewShixunModel extends Component{
className="fl task-hide edu-txt-left mt3"
name="shixun_homework[]"
></Checkbox>
{
this.props.type==='shixuns'?
(
item.is_jupyter===true?
<div className="myysljupyter fl ml15 mt3 intermediatecenter">
<p className="myysljupytertest">
Jupyter
</p>
</div>
:""
)
:""
}
<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}}
>

@ -385,3 +385,22 @@
.newshixunmodels{
margin: 0 auto;
}
.myysljupyter{
width:48px;
height:22px;
background:#FF6802;
border-radius:2px 10px 10px 2px;
}
.myysljupytertest{
width:39px;
height:16px;
font-size:12px;
color:#FFFFFF;
line-height:16px;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

@ -492,13 +492,13 @@ class YslDetailCards extends Component{
:<i className="iconfont icon-bofang progressRing-part font-18 mt10"></i>
}
</span>
<span className={this.props.current_user&&this.props.current_user.admin===false&&line.shixun_status==="暂未公开"?"paragraph_name color204":"paragraph_name color-grey3"}>
<span className={this.props.current_user&&this.props.current_user.admin===false&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?"paragraph_name color204":"paragraph_name color-grey3"}>
<span className="subject_stage_shixun_index">{key+1}</span>-{index+1}&nbsp;&nbsp;{line.shixun_name}
</span>
</li>
{
this.props.current_user&&this.props.current_user.admin===false&&line.shixun_status==="暂未公开"?
this.props.current_user&&this.props.current_user.admin===false&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?
<li className="fr status_li"><span className="fr color204">暂未公开</span></li>
:
<li className={showparagraph===false?"none":"fr status_li"}>
@ -512,7 +512,7 @@ class YslDetailCards extends Component{
</li>
}
{this.props.current_user&&this.props.current_user.admin===false&&line.shixun_status==="暂未公开"?"": <li className={showparagraph===false?"fr status_li":"fr status_li"}>
{this.props.current_user&&this.props.current_user.admin===false&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?"": <li className={showparagraph===false?"fr status_li":"fr status_li"}>
{
showparagraphkey === key && showparagraphindex === index ? "" :
<span className="fr color204">实验任务 <span

@ -159,7 +159,7 @@ class ShixunsHome extends Component {
}
</style>
<div className="clearfix edu-back-white pb40 pt30 mb20 banners" id="index-top" onMouseMove={this.bannaronmousemove} onMouseOut={this.bannaronmouseout}>
<div className="educontent pr educontentSlider">
<div className="educontent pr educontentSlider" style={{"width":'1200px'}}>
{homedatalist===undefined?"":
<Slider
nextArrow={<CustomNextArrow />}
@ -240,7 +240,7 @@ class ShixunsHome extends Component {
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实践课程</p>
<p className="color-grey-cd font-12">TRAINING COURSE</p>
</div>
<Link to={"/paths"} className="moreitem">更多<i className="fa fa-angle-right ml5"></i></Link>
<Link to={"/paths"} className="moreitem mr18">更多<i className="fa fa-angle-right ml5"></i></Link>
<div className="square-list clearfix" style={{'width':'100%','padding-left':'25px'}}>
@ -319,7 +319,7 @@ class ShixunsHome extends Component {
<p className="color-dark edu-txt-center font-24" style={{lineHeight: '30px'}}>实训项目</p>
<p className="color-grey-cd font-12">DEVELOPMENT COMMUNITY</p>
</div>
<Link to={"/shixuns"} className="moreitem">更多<i className="fa fa-angle-right ml5"></i></Link>
<Link to={"/shixuns"} className="moreitem mr18">更多<i className="fa fa-angle-right ml5"></i></Link>
<div className="square-list clearfix" style={{'width':'100%','padding-left':'25px'}}>
<style>

@ -0,0 +1,50 @@
import React, {Component} from 'react';
class Bottomsubmit extends Component {
constructor(props) {
super(props)
this.state = {
}
}
cannelfun=()=>{
window.location.href=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()}><span> </span></button>
</div>
</div>
</div>
);
}
}
export default Bottomsubmit;

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

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

@ -55,7 +55,8 @@ class TPMBanner extends Component {
isIE:false,
Forkvisibletype: false,
isSpin:false,
Senttothevcaluetype:false
Senttothevcaluetype:false,
jupyterbool:false,
}
}
@ -656,7 +657,7 @@ class TPMBanner extends Component {
{/*<span className="mt10">{shixunsDetails.experience}</span>*/}
{/*</li>*/}
<li>
<span>难度系数</span>
<span>难度级别</span>
<span className="shixunsdiffcult mt10">{shixunsDetails.diffcult}</span>
</li>

@ -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,545 @@
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 {getUploadActionUrl} from 'educoder';
import moment from 'moment';
const confirm = Modal.confirm;
class TPMDataset extends Component {
constructor(props) {
super(props)
this.state = {
datas: [0, 1, 2, 3, 4, 5],
value: undefined,
columns: [
{
title: '文件',
dataIndex: 'number',
key: 'number',
align: 'left',
className: " font-14 wenjiantit",
width: '220px',
render: (text, record) => (
<div>
{record.title}
</div>
)
},
{
title: '最后修改时间',
dataIndex: 'number',
key: 'number',
align: 'center',
className: "edu-txt-center font-14 zuihoushijian",
width: '150px',
render: (text, record) => (
<div>
{record.timedata}
</div>
)
},
{
title: '最后修改人',
dataIndex: 'number',
key: 'number',
align: 'center',
className: "edu-txt-center font-14 ",
render: (text, record) => (
<div>
{record.author}
</div>
)
},
{
title: '文件大小',
dataIndex: 'number',
key: 'number',
align: 'center',
className: "edu-txt-center font-14 ",
render: (text, record) => (
<div>
{record.filesize}
</div>
)
},
],
page: 1,
limit: 10,
selectedRowKeys: [],
mylistansum:30,
collaboratorList:[],
fileList:[],
file:null,
datalist:[],
data_sets_count:0,
selectedRowKeysdata:[],
}
}
componentDidMount() {
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,
})
// console.log(mydata);
// console.log(datas);
} else {
this.setState({
selectedRowKeys: [],
})
}
}
getdatas = () => {
let id=this.props.match.params.shixunId;
let collaborators=`/shixuns/${id}/jupyter_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,
});
}
}
}).catch((error)=>{
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,
});
}
}
}).catch((error)=>{
console.log(error)
});
}
showModal = (id, status) => {
};
handleOk = (id, editid) => {
};
handleCancel = (e) => {
};
paginationonChanges = (pageNumber) => {
// //console.log('Page: ');
this.setState({
page: pageNumber,
})
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;
}
// 附件相关 START
handleChange = (info) => {
debugger
if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let {fileList} = this.state;
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
console.log("handleChange1");
// if(fileList.length===0){
let fileLists = info.fileList;
this.setState({
// fileList:appendFileSizeToUploadFileAll(fileList),
fileList: fileLists,
deleteisnot: false
});
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(){
debugger
console.log("删除");
console.log(this.state.selectedRowKeysdata);
const url = `/attachments/destroy_files.json`;
axios.delete(url, {
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);
});
}
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, datas, page, limit, selectedRowKeys,mylistansum,fileList,datalist,data_sets_count} = 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: true,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file, fileList) => {
debugger
if (this.state.fileList.length >= 1) {
return false
}
// console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 50;
if (!isLt150M) {
// this.props.showNotification(`文件大小必须小于50MB`);
notification.open(
{
message: '提示',
description:
'文件大小必须小于50MB',
}
)
}
if(this.state.file !== undefined){
console.log("763")
this.setState({
file:file
})
}else {
this.setState({
file:file
})
}
console.log("handleChange2");
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 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">
上传文件</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}
/>
</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;}

@ -20,15 +20,18 @@ import TPMRepositoryComponent from './TPMRepositoryComponent';
import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits';
import TPMsettings from './TPMsettings/TPMsettings';
//import TPMsettings from './TPMsettings/TPMsettings';
import TPMsettings from './TPMsettings/oldTPMsettings';
import 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,6 +145,8 @@ class TPMIndex extends Component {
identity:undefined,
TPMRightSectionData:undefined,
PropaedeuticsList: undefined,
tpmindexjupyterbool:false,
is_jupyter:false,
}
}
@ -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,10 +276,13 @@ 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
@ -281,20 +290,27 @@ class TPMIndex extends Component {
{...this.state}
></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 +320,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 +346,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 +358,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 +421,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,178 @@
import React, { Component } from 'react';
import MonacoEditor from 'react-monaco-editor';
//MonacoDiffEditor 对比模式
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip} from 'antd';
// import "antd/dist/antd.css";
import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment';
import axios from 'axios';
import './css/TPMsettings.css';
import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
import {handleDateStrings} from "./oldTPMsettings";
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
const confirm = Modal.confirm;
function range(start, end) {
const result = [];
for (let i = start; i < end; i++) {
result.push(i);
}
return result;
}
function disabledDateTime() {
return {
// disabledHours: () => range(0, 24).splice(4, 20),
disabledMinutes: () => range(1, 30).concat(range(31, 60)),
// disabledSeconds: () => [0, 60],
};
}
function disabledDate(current) {
return current && current < moment().endOf('day').subtract(1, 'days');
}
export default class Shixuninformation extends Component {
constructor(props) {
super(props)
this.state = {
}
}
onChangeTimePicker =(value, dateString)=> {
this.setState({
opening_time: dateString=== ""?"":moment(handleDateStrings(dateString))
})
}
render() {
let {can_copy}=this.state;
let options;
if (this.props.departmentslist != undefined) {
options = this.props.departmentslist.map((d, k) => {
return (
<Option key={d} id={k}>{d}</Option>
)
})
}
return (
<div className="educontent mb50 edu-back-white padding10-20">
<div className="clearfix ml30">
<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>复制:</span>
<span className="fl mt5">
<Checkbox checked={this.props.data&&this.props.data.shixun.can_copy === undefined ? false : this.props.data&&this.props.data.shixun.can_copy} onChange={this.props.data&&this.props.data.shixun.can_copy}></Checkbox>
<label style={{top:'6px'}} className="color-grey-9 ml10">(勾选则允许已认证的教师复制该实训)</label>
</span>
</div>
<div className="edu-back-white mb10 padding40-20" style={{display:this.props.identity===1?"block":this.props.data&&this.props.data.shixun.status===2&&this.props.data&&this.props.data.shixun.use_scope===0||this.props.data&&this.props.data.shixun.status===1&&this.props.data&&this.props.data.shixun.use_scope===0?"none":"block"}}>
<p className="color-grey-6 font-16 mb30">公开程度</p>
<RadioGroup onChange={this.SelectOpenpublic} value={this.props.data&&this.props.data.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 none" id="unit-all" style={{display: this.props.scopetype === false ? '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
defaultActiveFirstOption={false}
showArrow={false}
filterOption={false}
notFoundContent={null}
className={this.props.scope_partmenttype===true?"bor-red":""}
>
{options}
</Select>
</div>
<span className="color-grey-9">(搜索并选中添加单位名称)</span>
</div>
</div>
<div style={{width:'100%'}}>
<div className="mt20 clearfix" id="task_tag_content">
{
this.props.scope_partment===undefined?"":this.props.scope_partment.map((item,key)=>{
return(
<li className="task_tag_span" key={key}><span>{item}</span>
<a style={{ color: 'rgba(0,0,0,.25)' }}
onClick={(key)=>this.deleteScopeInput(key)}
>
{this.props.identity===1?"x":this.state.status===2&&this.props.scope_partment===this.props.scope_partments||this.state.status===1&&this.props.scope_partment===this.props.scope_partments?"":"×"}
</a>
</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 className="clearfix mt20 ml30">
<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>开启时间:</span>
<span className="fl mt5">
<DatePicker
showToday={false}
showTime={{ format: 'HH:mm' }}
format="YYYY-MM-DD HH:mm"
width={178}
locale={locale}
disabledTime={disabledDateTime}
disabledDate={disabledDate}
placeholder="请选择开启时间"
value={this.props.shixun.opening_time===null||this.props.shixun.opening_time===""?"":moment(this.props.shixun.opening_time, dateFormat)}
onChange={this.onChangeTimePicker}
dropdownClassName="hideDisable"
/>
<label style={{top:'6px'}} className="color-grey-9 ml10" >为空则学员在实训发布后能随时开启实训挑战否则学员在开启时间后才能开启实训挑战</label>
</span>
</div>
</div>
</div>
</div>
</div>
);
}
}

@ -0,0 +1,33 @@
import React, { Component } from 'react';
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb,Upload,Button,notification, Tooltip,Tabs} from 'antd';
import axios from 'axios';
import './css/TPMsettings.css';
import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder';
export default class Shixuninformation extends Component {
constructor(props) {
super(props)
this.state = {
}
}
render() {
return (
<div className="educontent mb50 edu-back-white padding10-20">
1111
</div>
);
}
}

@ -0,0 +1,775 @@
import React, {Component} from 'react';
import MonacoEditor from 'react-monaco-editor';
import {
Input,
Select,
Radio,
Checkbox,
Popconfirm,
message,
Modal,
Icon,
DatePicker,
Breadcrumb,
Upload,
Button,
notification,
Tooltip,
Tabs,
Form
} from 'antd';
import axios from 'axios';
import TPMMDEditor from "../challengesnew/TPMMDEditor";
import Bottomsubmit from "../../modals/Bottomsubmit";
import {getUploadActionUrl} from 'educoder';
import './css/TPMsettings.css';
import '../newshixuns/css/Newshixuns.css';
const Option = Select.Option;
class Shixuninformation extends Component {
constructor(props) {
super(props)
this.contentMdRef = React.createRef();
this.state = {
NAME_COUNT: 60,
shixunmemoMDvalue: "",
language: "java",
testscripttiptype:false,
shixunName:'',
trainee:undefined,
choice_small_type:[]
}
}
componentDidMount() {
}
componentDidUpdate(prevProps, prevState) {
if(prevProps.data!=this.props.data){
console.log(this.props.data)
if(this.props.data){
this.setState({
shixunName:this.props.data.shixun.name,
trainee:this.props.data.shixun.trainee,
choice_main_type:this.props.data.shixun.choice_main_type,
choice_small_type:this.props.data.shixun.choice_small_type,
choice_standard_scripts:this.props.data.shixun.choice_standard_scripts,
})
this.props.form.setFieldsValue({
name:this.props.data.shixun.name,
})
this.contentMdRef.current.setValue(this.props.data.shixun.description);
}
}
}
getshixunmemoMDvalue = (value, e) => {
this.setState({
shixunmemoMDvalue: value
})
}
testscripttip=(val)=>{
if(val===0){
this.setState({
testscripttiptype:true
})
}else if(val===1){
this.setState({
testscripttiptype:false
})
}
}
post_apply = () => {
this.setState({
postapplyvisible: true
})
}
sendhideModaly = () => {
this.setState({
postapplyvisible: false,
})
if (this.state.file !== undefined) {
// this.deleteAttachment(this.state.file);
this.setState({
file: undefined,
deleteisnot: true,
language: "",
runtime: "",
run_method: "",
fileList: []
})
} else {
this.setState({
file: undefined,
deleteisnot: true,
language: "",
runtime: "",
run_method: "",
fileList: []
})
}
}
sendsure_apply = () => {
let {language, runtime, run_method} = this.state;
if (!language || language === "") {
// this.props.showNotification(`请填写该镜像是基于什么语言`);
this.setState({
languagewritetype: true
})
return
}
if (!runtime || runtime === "") {
// this.props.showNotification(`请填写该镜像是基于什么语言系统环境`);
this.setState({
systemenvironmenttype: true
})
return;
}
if (!run_method || run_method === "") {
// this.props.showNotification(`请填写该镜像中测试代码运行方式`);
this.setState({
testcoderunmodetype: true
})
return;
}
var attachment_ids = undefined;
if (this.state.fileList) {
attachment_ids = this.state.fileList.map(item => {
return item.response ? item.response.id : item.id
})
}
if (attachment_ids === undefined || attachment_ids.length === 0) {
this.setState({
attachmentidstype: true
})
return;
}
var data = {
language: language,
runtime: runtime,
run_method: run_method,
attachment_id: attachment_ids[0],
}
var url = `/shixuns/apply_shixun_mirror.json`;
axios.post(url, data
).then((response) => {
try {
if (response.data) {
if (this.state.file !== undefined) {
this.setState({
file: undefined,
deleteisnot: true,
language: "",
runtime: "",
run_method: "",
fileList: []
})
} else {
this.setState({
file: undefined,
deleteisnot: true,
language: "",
runtime: "",
run_method: "",
fileList: []
})
}
notification.open(
{
message: '提示',
description:
'提交成功!',
}
)
this.sendhideModaly()
}
} catch (e) {
}
})
}
bigClass = (value) => {
let list=[]
list.push(this.props.data.shixun.choice_main_type)
this.props.data.shixun.choice_small_type.map((item,key)=>{
list.push(item)
})
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs;
let newshixun_service_configsagin=[];
newshixun_service_configs.map((item,key)=>{
list.map((its,index)=>{
if(item.mirror_repository_id===its){
newshixun_service_configsagin.push(item)
}
})
})
this.props.data.shixun.main_type.some((item,key)=> {
if (item.id === value) {
newshixun_service_configsagin[0]={
mirror_repository_id:value,
name:item.type_name,
cpu_limit:1,
lower_cpu_limit:0.1,
memory_limit:1024,
request_limit:10
}
return true
}
}
)
let url = `/shixuns/get_mirror_script.json?mirror_id=`+value;
axios.get(url).then((response) => {
if (response.status === 200) {
// console.log(response.data)
this.setState({
choice_main_type: value,
standard_scripts:response.data,
choice_standard_scripts:null,
shixun_service_configs:newshixun_service_configsagin,
shixun_service_configlist:newshixun_service_configsagin,
})
}
}).catch((error) => {
console.log(error)
});
}
littleClass = (value) => {
let newshixun_service_configs=this.props.data.shixun.shixun_service_configs;
let newchoice_small_type=this.props.data.shixun.choice_small_type;
let list=[]
list.push(this.props.data.shixun.choice_main_type)
newchoice_small_type.map((item,key)=>{
list.push(item)
})
let newshixun_service_configsagin=[]
newshixun_service_configs.map((item,key)=>{
list.map((its,index)=>{
if(item.mirror_repository_id===its){
newshixun_service_configsagin.push(item)
}
})
})
this.props.data.shixun.small_type.some((items,keys)=> {
if (items.id === value) {
newshixun_service_configsagin.push({
mirror_repository_id:value,
name:items.type_name,
cpu_limit:1,
lower_cpu_limit:0.1,
memory_limit:1024,
request_limit:10
})
return true
}
}
)
newchoice_small_type.push(value)
this.setState({
choice_small_type: newchoice_small_type,
shixun_service_configs:newshixun_service_configsagin,
shixun_service_configlist:newshixun_service_configsagin,
})
}
render() {
let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false;
console.log(operateauthority)
const {getFieldDecorator} = this.props.form;
const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state;
const {shixun_service_configs}=this.props;
const uploadProps = {
width: 600,
fileList,
multiple: true,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUploadActionUrl()}`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file, fileList) => {
if (this.state.fileList.length >= 1) {
return false
}
// console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 50;
if (!isLt150M) {
// this.props.showNotification(`文件大小必须小于50MB`);
notification.open(
{
message: '提示',
description:
'文件大小必须小于50MB',
}
)
}
if (this.state.file !== undefined) {
console.log("763")
this.setState({
file: file
})
} else {
this.setState({
file: file
})
}
console.log("handleChange2");
return isLt150M;
},
}
return (
<div>
<div className="educontent mb50 edu-back-white padding10-20">
<Form>
<Form.Item
label="名称"
style={{"borderBottom": 'none'}}
className="mt15"
>
{getFieldDecorator('name', {
rules: [{
required: true, message: '请输入选题名称',
}, {
max: 60, message: '请输入名称最大限制60个字符',
}, {
whitespace: true, message: '请勿输入空格'
}],
})(
<Input placeholder="请输入名称最大限制60个字符"
className={"input-100-45 greyInput"}
onInput={this.shixunNameInput} autoComplete="off"
addonAfter={`${String(!this.state.shixunName ? 0 : this.state.shixunName.length)}/${this.state.NAME_COUNT}`}
className="newViewAfter"/>
)}
</Form.Item>
<Form.Item
label="简介"
style={{"borderBottom": 'none', 'marginBottom': '0px'}}
className="chooseDes pr"
>
<TPMMDEditor ref={this.contentMdRef} placeholder="请输入简介" mdID={'courseContentMD'}
refreshTimeout={1500}
className="courseMessageMD"
// initValue={this.state.description === null ? "" : this.state.description}
></TPMMDEditor>
</Form.Item>
<Form.Item
label={"难易度"}
style={{"borderBottom": 'none'}}
className="chooseDes pr"
>
{getFieldDecorator('trainee', {
rules: [{required: true, message: '请选择难易度'}],
})(
<div className="with15 fl pr">
<Select placeholder="请选择难易度"
style={{width: 180}}
onChange={this.Selectthestudent}
value={this.state.trainee}
>
<Option value={1}>初级</Option>
<Option value={2}>中级</Option>
<Option value={3}>中高级</Option>
<Option value={4}>高级</Option>
</Select>
</div>
)}
<span className="fl ml20 color-grey">实训的难易程度</span>
</Form.Item>
<Form.Item
label={"实验环境"}
style={{"borderBottom": 'none', 'width': '18%', 'float': 'left'}}
className="chooseDes pr"
>
<div>
{getFieldDecorator('selectleft', {
rules: [{required: true, message: '请选择主类别'}],
})(
<div className="width100 fl mr20">
<Select placeholder="请选择主类别" value={this.state.choice_main_type === "" ? undefined : this.state.choice_main_type}
style={{width: 180}}
onChange={operateauthority?this.bigClass:""}
optionFilterProp="children"
filterOption={(input, option) =>
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{
this.props.data === undefined ? "" : this.props.data.shixun.main_type.map((item, key) => {
return (
<Option value={item.id} key={key} >
<Tooltip placement="right" title={item.description=== ""?"无描述":item.description} >
{item.type_name}
</Tooltip>
</Option>
)
})
}
</Select>
</div>
)}
</div>
</Form.Item>
<Form.Item
style={{"borderBottom": 'none', 'width': '61%', 'float': 'left', 'marginTop': '40px'}}
className="chooseDes pr"
>
<div className=" fl pr mr20">
{getFieldDecorator('selectright', {
rules: [{required: true, message: '请选择小类别'}],
})(
<div className=" fl pr mr20">
<Select placeholder="请选择小类别"
onChange={this.selectright}
value={this.state.choice_small_type.length===0||this.state.choice_small_type[0]===""||this.state.choice_small_type===[]?undefined:this.state.choice_small_type}
style={{width: 180,height:30}}
disabled={operateauthority?false:true}
onDeselect={operateauthority?this.Deselectlittle:""}
onSelect={operateauthority?this.littleClass:""}
defaultOpen={false}
>
{
this.props.data === undefined ? "" : this.props.data.shixun.small_type.map((item, key) => {
return(
<Option value={item.id} key={key}>
<Tooltip placement="right" title={item.description=== ""?"无描述":item.description} >
{item.type_name}
</Tooltip>
</Option>
)
})
}
</Select>
</div>
)}
<span className="fl ml20 color-grey lineh-20">
<div>
<div className={"font-12"}>
已安装软件hadoop3.1.0jdk1.8
</div>
<div className={"font-12"}>
说明添加了hadoop3.1.0jdk1.8的源码包添加了hadoop3.1.0jdk1.8的源码包
</div>
</div>
</span>
</div>
</Form.Item>
<div className={"both"}></div>
<div className=" color-grey lineh-20 mb20">
没有实验环境
<a className="color-blue" onClick={this.post_apply}> 申请新建</a>
</div>
<Form.Item
label={"评测脚本"}
style={{"borderBottom": 'none'}}
className="chooseDes pr"
>
{getFieldDecorator('select123', {
rules: [{required: true, message: '请选择评测脚本'}],
})(
<div className="with15 fl pr">
<Select placeholder="请选择选择脚本"
style={{width: 180}}
className="fl"
disabled={operateauthority?false:true}
value={choice_standard_scripts === undefined||choice_standard_scripts === null ? undefined :choice_standard_scripts.id===undefined?choice_standard_scripts:choice_standard_scripts.id}
onChange={operateauthority?this.SelectScput:""}>
{
this.props.data === undefined ? "" : this.props.data.shixun.standard_scripts.map((item, key) => {
return (
<Option value={parseInt(item.id)} name={item.scptname} key={key}>{item.scptname}</Option>
)
})
}
</Select>
</div>
)}
<span className="fl ml20 color-blue">
使用自定义脚本
<span className={"color-grey ml10"} onClick={()=>this.testscripttip(0)}>
<Icon type="exclamation-circle"/>
</span>
<div className="invite-tip clearfix none " id="test_script_tip"
style={{top: '33px', left: '-15px',width: '450px',zIndex: '10',display: this.state.testscripttiptype===true?'block':"none"}}>
<style>
{
`
.top-black-trangle{
right: auto;
left: 0px;
}
`
}
</style>
<span className="top-black-trangle"></span>
<div className="padding20 invitecontent clearfix">
<p className="font-12 edu-txt-left">
使用自定义模板平台无法自动更新脚本请在关卡创建完后手动更新脚本中的必填参<br/>
数和以下2个数组元素<br/>
challengeProgramNames<br/>
sourceClassNames<br/><br/>
示例有2个关卡的实训<br/><br/>
各关卡的待编译文件为<br/>
src/step1/HelloWorld.java<br/>
src/step2/Other.java<br/><br/>
各关卡的编译后生成的执行文件为<br/>
step1.HelloWorld<br/>
step2.Other<br/><br/>
则数组元素更新如下<br/>
challengeProgramNames=("src/step1/<br/>
HelloWorld.java" "src/step2/Other.java")<br/>
sourceClassNames=("step1.HelloWorld<br/>
" "step2.Other")<br/><br/>
其它参数可按实际需求定制
</p>
</div>
<p className="inviteTipbtn with100 fl">
<a onClick={()=>this.testscripttip(1)}>知道了</a>
</p>
</div>
</span>
</Form.Item>
<div className="mt30 clearfix df">
<div
className={operateauthority === false ? 'nonemodel' : ""}
></div>
<div className="flex1">
<div className="fl" style={{border: '1px solid #ccc'}}>
<MonacoEditor
height="450"
width="1150"
language={this.state.language}
value={shixunmemoMDvalue}
options={{
selectOnLineNumbers: true
}}
onChange={this.getshixunmemoMDvalue}
// onChange={this.getshixunmemoMDvalue}
/>
</div>
</div>
</div>
</Form>
<span className="ant-form-text mt20" >私密版本库
<Checkbox>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox>
</span>
{this.props.identity<3?<div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">服务配置</p>
{ shixun_service_configs&&shixun_service_configs.map((item,key)=>{
return(
<div key={key}>
<div id="5">
<div className="color-grey-6 font-16 mt30 mb20" id="shixun_scenario_type_name">
<span className={"fl"}>{item.name}</span>
{/*<span className={"fr mr40"} onClick={()=>this.Deselectlittle(item.mirror_repository_id)}><i className="fa fa-times-circle color-grey-c font-16 fl"></i></span>*/}
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">CPU()</label>
<div className="pr fl with80 status_con">
<input type="text" value={item.cpu_limit} onInput={(e)=>this.setConfigsInputs(e,key,1)}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">最低CPU()</label>
<div className="pr fl with80 status_con">
<input type="text" value={item.lower_cpu_limit} onInput={(e)=>this.setConfigsInputs(e,key,2)}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">内存限制(M)</label>
<div className="pr fl with80 status_con">
<input type="text" value={item.memory_limit} onInput={(e)=>this.setConfigsInputs(e,key,3)}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">内存要求(M)</label>
<div className="pr fl with20 status_con">
<input type="text" value={item.request_limit} onInput={(e)=>this.setConfigsInputs(e,key,4)}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<label className="panel-form-label fl" style={{width: '48%'}}>温馨提示纯编程类型实训建议使用默认值对于大数据等建议使用最大内存的30%</label>
<div className="cl"></div>
</div>
</div>
</div>
)
})}
</div> :""}
{postapplyvisible === true ? <style>
{
`
body{
overflow: hidden !important;
}
`
}
</style> : ""}
<Modal
keyboard={false}
title="申请新建"
visible={postapplyvisible}
closable={false}
footer={null}
width={850}
heigth={720}
>
<div>
<li className="clearfix ml82">
<label className="fl mt10 "><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea
className={this.state.languagewritetype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"}
style={{width: '89%', height: '100px'}}
onInput={this.setlanguagewrite}
value={languagewrite}
placeholder="请填写该镜像是基于什么语言示例Python"
id="demand_info"></textarea>
</li>
<div className={"color-red shixunspanred"}>{this.state.languagewritetype === true ? "请填写该镜像语言" : ""}</div>
<li className="clearfix ml1">
<label className="panel-form-label fl ml50"><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea
className={this.state.systemenvironmenttype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"}
onInput={this.setsystemenvironment}
style={{height: '100px'}}
value={systemenvironment}
placeholder="请填写该镜像是基于什么linux系统环境,代码运行环境"
id="demand_info"></textarea>
</li>
<div
className={"color-red shixunspanred"}>{this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}</div>
<li className="clearfix">
<label className="fl mt10"><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea
className={this.state.testcoderunmodetype === true ? "fl task-form-80 task-height-150 bor-reds" : "fl task-form-80 task-height-150"}
onInput={this.settestcoderunmode}
value={testcoderunmode}
style={{height: '100px'}}
placeholder="请填写该镜像中测试代码运行方式"
id="demand_info"></textarea>
</li>
<div
className={"color-red shixunspanred"}>{this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}</div>
<li className="clearfix ml50">
<label className="panel-form-label fl mt-5"><span
className="color-red fl">*</span>&nbsp;&nbsp;</label>
<div className="mt10" style={{
display: "inline-block"
}}>
<Upload {...uploadProps}>
<Icon type="upload" className="fl mt3"> </Icon>
<span className="color-blue fl cdefault">上传附件</span>
<span className="color-grey-c fl ml10 ">(单个文件50M以内)</span>
</Upload>
</div>
</li>
<div className={"color-red shixunspanred"}>
{this.state.attachmentidstype === true ? "请上传附件" : ""}
</div>
<li className="edu-txt-center clearfix ">
<a className="pop_close task-btn mr30"
onClick={() => this.sendhideModaly()}
>取消</a>
<Button type="primary" onClick={() => this.sendsure_apply()}
className="task-btn task-btn-orange">确定</Button>
</li>
<div className="cl"></div>
</div>
{/*</Form>*/}
</Modal>
</div>
<Bottomsubmit url={`/shixuns/${this.props.match.params.shixunId}/challenges`} onSubmits={ this.sendsure_apply}/>
</div>
);
}
}
const TopShixuninformation = Form.create({name: 'newshixun'})(Shixuninformation);
export default TopShixuninformation;

File diff suppressed because it is too large Load Diff

@ -111,3 +111,18 @@ 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;
}

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,7 @@ import { BrowserRouter as Router, Route, Link } from "react-router-dom";
class TPMNav extends Component {
render() {
const { user, match, shixun, secret_repository } = this.props;
const { user, match, shixun, secret_repository,is_jupyter} = this.props;
let isAdminOrCreator = false;
if (user) {
isAdminOrCreator = user.admin || user.manager
@ -15,6 +15,8 @@ class TPMNav extends Component {
// console.log(this.props.propaedeutics)
const challengesPath = `/shixuns/${shixunId}/challenges`;
// console.log(match.path)
console.log("TPMNavTPMNavTPMNav");
console.log(is_jupyter);
return (
<div className="bor-bottom-greyE clearfix pl20 pr20 pt40 pb20 edu-back-white challengeNav">
<Link
@ -28,14 +30,30 @@ 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?
<Link to={`/shixuns/${shixunId}/dataset`}
className={`${match.url.indexOf('dataset') != -1 ? 'active' : ''} fl mr40`}>数据集</Link>
:""
}
<Link to={`/shixuns/${shixunId}/shixun_discuss`}
className={`${match.url.indexOf('shixun_discuss') != -1 ? 'active' : ''} fl mr40`}>评论</Link>
@ -45,10 +63,8 @@ class TPMNav extends Component {
{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,47 @@
/*
* @Description: jupyter tpi
* @Author: tangjiang
* @Github:
* @Date: 2019-12-11 08:35:23
* @LastEditors: tangjiang
* @LastEditTime: 2019-12-11 09:13:09
*/
import './index.scss';
import React from 'react';
import SplitPane from 'react-split-pane';
import { Button } from 'antd';
import UserInfo from '../../developer/components/userInfo';
function JupyterTPI (props) {
return (
<div className="jupyter_area">
<div className="jupyter_header">
<UserInfo userInfo={{}} />
<p className="jupyter_title">
<span className="title_desc">MySQL数据库编程开发实训(基础篇)</span>
<span className="title_time">时间</span>
</p>
<p className="jupyter_btn">
{/* sync | poweroff */}
<Button className="btn_common" type="link" icon="sync">重置实训</Button>
<Button className="btn_common" type="link" icon="poweroff">退出实训</Button>
</p>
</div>
<div className="jupyter_ctx">
<SplitPane split="vertical" minSize={350} maxSize={-350} defaultSize="30%">
<div className={'split-pane-left'}>
左侧内容
</div>
<SplitPane split="vertical" defaultSize="100%" allowResize={false}>
<div>右侧内容</div>
<div />
</SplitPane>
</SplitPane>
</div>
</div>
);
}
export default JupyterTPI;

@ -0,0 +1,93 @@
.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;
.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:hover{
// background-color: #29BD8B;
color: #29BD8B;
}
}
}
.jupyter_ctx{
position: relative;
height: calc(100vh - 60px);
}
}

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;

@ -395,3 +395,439 @@ a.white-btn.use_scope-btn:hover{
.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,316 @@
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 '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,
}
}
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);
// console.log("componentDidMount");
// console.log("Challengesjupyter");
// console.log(this.props);
let id = this.props.match.params.shixunId;
let ChallengesURL = `/jupyters/get_info_with_tpm.json`;
let datas={
identifier:id,
}
axios.get(ChallengesURL, {params: datas}).then((response) => {
if (response.status === 200) {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{
console.log("componentDidMountChallengesjupyter");
console.log(response.data);
if(response.data.status===0){
this.setState({
jupyter_url:response.data.url,
jupyter_port:response.data.port,
})
}else{
}
}
}
}).catch((error) => {
console.log(error)
});
}
updatamakedown = (id) => {
}
// 关卡的上移下移操作
operations = (sumid, type) => {
}
delOperations = (sumid) => {
}
clonedelOperationss = () => {
}
delOperationss = () => {
}
startgameid=(id)=>{
}
hidestartshixunsreplace=(url)=>{
}
//编辑实训题目选择题
EditTraining=(type, ids, path)=>{
}
//开始实战按钮
startshixunCombat = (type, ids, id) => {
}
hidestartshixunCombattype=()=>{
}
hideAccountProfile=()=>{
};
modifyjupyter=(propsysl)=>{
// console.log("propsysl");
// console.log(propsysl);
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.post(url, data)
.then((result) => {
if (result.data.status === 0) {
this.props.showNotification(`应用成功`);
}
}).catch((error) => {
})
}
sendToken=()=>{
// console.log("sendToken");
// const iframe = document.getElementById('iframe');
// console.log("modifyjupyter");
// const frameWindow = iframe.contentWindow;
// console.log("frameWindow");
// console.log(frameWindow);
}
render() {
let{ChallengesDataList}=this.state;
let id = this.props.match.params.shixunId;
// var deptObjs=document.getElementById("IFRAMEID").contentWindow.document.getElementById("TAGID");
// //判断此元素是否存在
// if(deptObjs!=null){
// //设置该元素的样式或其他属性
// deptObjs.setAttribute('style',' height: 20px !important;'); //!important用来提升指定样式条目的应用优先权
// }
// var submitObj = document.getElementById('submit');
// if(submitObj){
// submitObj.style.color = 'green';
// }
// const dom = document.getElementById('shutdown');
// ReactDOM.unmountComponentAtNode(dom)
// // window.$('#picture_display').hide();
// window.$('.data-tip-right').hide()
// window.onload=()=>{
// debugger
// var _iframe = document.getElementById('header');
// console.log(_iframe);
// // .contentWindow.document.getElementById('shutdown_widget') //get iframe下的id
// // _iframe.style.display= "none"; //修改样式
// }
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>
<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.props.jupyter_url === null || this.props.jupyter_url === undefined ?
""
:
<div className="sortinxdirection mt60">
<div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div>
<div><p className="renwuxiangqdivtest ml24">示例</p></div>
</div>
<div className="renwuxiangssit xaxisreverseorder">
<div className="challenbaocun" onClick={() => this.modifyjupyter(this.props)}><p
className="challenbaocuntest">应用到实训</p></div>
</div>
</div>
}
<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>
<div className="mt35">
{/*https://48888.jupyter.educoder.net/tree?*/}
<div className="pb47">
{
this.props.jupyter_url===null || this.props.jupyter_url===undefined?
""
:
<iframe src={this.props.jupyter_url}
sandbox="allow-same-origin allow-scripts allow-top-navigation " scrolling="no" id="frame"
name="framename" width="100%" height="700" frameBorder="0"
></iframe>
}
</div>
</div>
</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,44 @@
height: 27px;
line-height: 25px;
}
.challenbaocun{
width:103px;
height:30px;
background:#29BD8B;
border-radius:3px;
}
.challenbaocuntest{
width:103px;
height:30px;
font-size:16px;
color:#FFFFFF;
text-align: center;
line-height:30px;
cursor:default
}
.renwuxiangqdiv{
width:72px;
height:30px;
font-size:18px;
color:#000000;
line-height:30px;
}
.renwuxiangqdivtest{
width:32px;
height:30px;
font-size:16px;
font-family:MicrosoftYaHei;
color:#4CACFF;
line-height:30px;
}
.renwuxiangssi{
width: 30%;
}
.renwuxiangssit{
width: 70%;
}
.pb47{
padding-bottom: 47px;
}

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

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

@ -0,0 +1,121 @@
.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;
}
.deletebutomtext{
width:28px;
height:19px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
}
.deletebuttom{
width:85px;
height:30px;
background:#29BD8B;
border-radius:3px;
}
.deletebuttomtest{
width:56px;
height:19px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
}
.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;
}
.light-row{
background: #F7F7F8;
}
.dark-row{
background: #FFFFFF;
}

@ -20,12 +20,13 @@ class SearchPage extends Component{
page:1,
perpages:20,
data:[],
jupyterbool:false,
}
}
//切换tab
changeTab=(e)=>{
// course 课堂, shixun 开发社区 subject 实践课程 memo 交流问答
// course 2 课堂, shixun 0 实训项目 subject 1 实践课程 memo 3交流问答
let types ="";
if(parseInt(e.key)===0){
@ -178,7 +179,19 @@ class SearchPage extends Component{
<div className="mainx">
<style>
{
`
.maxnamewidth92{
max-width: 92%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
`
}
</style>
<div className="educontent project-packages-list mb30">
{data === undefined ? "" : data.map((item, key) => {
return (
@ -193,10 +206,28 @@ class SearchPage extends Component{
<div className={"font-16 color-dark fl "} style={{width:"100%"}} >
{/*标题*/}
<span className={"markdown-body fonttext"}
<div className="sortinxdirection jupytertextheig" style={{width:"100%"}}>
<span className={"markdown-body fonttext maxnamewidth92"}
dangerouslySetInnerHTML={{__html:item.title}}/>
{
type==="shixun"?
(
item.is_jupyter===true?
<div className="jupytertext intermediatecenter ml15"><p className="jupytertextp">Jupyter</p></div>
:""
)
:""
}
</div>
{/*描述*/}
<div>
{item.content.content === undefined || item.content.content===0?"": item.content.content.map((item4, key4) => {
return (
<span className={"markdown-body magr11 fontextcolor"}
@ -354,7 +385,7 @@ class SearchPage extends Component{
{
count && count && count> perpages ?
<div className="edu-txt-center" style={{paddingBottom:"30px"}}>
<div className="edu-txt-center" style={{marginBottom:"30px",paddingBottom:"30px"}}>
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={perpages}
total={count}></Pagination>

@ -132,3 +132,44 @@
display: flex;
flex-direction:row;
}
.jupytertext{
width:54px;
height:24px;
background:#FF6802;
border-radius:2px 10px 10px 2px;
margin-top: 2px;
text-align: center;
}
.jupytertextp{
width:39px;
height:16px;
font-size:12px;
color:#FFFFFF;
line-height:16px;
}
/* x轴正方向排序 */
/* 一 二 三 四 五 六 七 八 */
.sortinxdirection{
display: flex;
flex-direction:row;
}
/* x轴反方向排序 */
/* 八 七 六 五 四 三 二 一 */
.xaxisreverseorder{
display: flex;
flex-direction:row-reverse;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.jupytertextheig{
height: 32px;
line-height: 32px;
}
.ml9{
margin-left: 9px;
}

@ -674,7 +674,7 @@ input.radio-width90{ width: 90px; }
.ringauto{width: 20px;height: 20px;line-height: 20px;text-align: center;border-radius: 50%;background-color: #F4FAFF;margin-right:5px;}
/*-------------------个人主页:右侧提示区域--------------------------*/
.-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;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;}

Loading…
Cancel
Save