调整jupyter

chromesetting
杨树林 5 years ago
commit 6071621f60

@ -465,9 +465,9 @@ class ApplicationController < ActionController::Base
# 实训主类别列表,自带描述
def shixun_main_type
list = []
mirrors = MirrorRepository.select([:id, :type_name, :description]).published_main_mirror
mirrors = MirrorRepository.select([:id, :type_name, :description, :name]).published_main_mirror
mirrors.try(:each) do |mirror|
list << {id: mirror.id, type_name: mirror.type_name, description: mirror.try(:description)}
list << {id: mirror.id, type_name: mirror.type_name, description: mirror.try(:description), mirror_name: mirror.name}
end
list
end
@ -475,9 +475,9 @@ class ApplicationController < ActionController::Base
# 小类别列表
def shixun_small_type
list = []
mirrors = MirrorRepository.select([:id, :type_name, :description]).published_small_mirror
mirrors = MirrorRepository.select([:id, :type_name, :description, :name]).published_small_mirror
mirrors.try(:each) do |mirror|
list << {id: mirror.id, type_name: mirror.type_name, description: mirror.description}
list << {id: mirror.id, type_name: mirror.type_name, description: mirror.description, mirror_name: mirror.name}
end
list
end

@ -68,7 +68,6 @@ class AttachmentsController < ApplicationController
@attachment.author_id = current_user.id
@attachment.disk_directory = month_folder
@attachment.cloud_url = remote_path
@attachment.disk_directory = save_path
@attachment.save!
else
logger.info "文件已存在id = #{@attachment.id}, filename = #{@attachment.filename}"

@ -78,7 +78,7 @@ class HomeworkCommonsController < ApplicationController
when '4'
sql_str = %Q((homework_detail_manuals.comment_status = #{order} and homework_detail_manuals.appeal_time > '#{Time.now}'))
when '5'
sql_str = %Q((homework_detail_manuals.comment_status = #{order} or (anonymous_comment = 0 and homework_commons.end_time <= '#{Time.now}')))
sql_str = %Q((anonymous_comment = 0 or (anonymous_comment = 1 and homework_detail_manuals.comment_status = #{order})) and ((allow_late= 0 and homework_commons.end_time <= '#{Time.now}') or (allow_late= 1 and late_time <= '#{Time.now}')))
else
sql_str = %Q(homework_detail_manuals.comment_status = #{order})
end
@ -167,11 +167,7 @@ class HomeworkCommonsController < ApplicationController
if params[:work_status].present?
params_work_status = params[:work_status]
work_status = params_work_status.map{|status| status.to_i}
all_student_works = @student_works.left_joins(:myshixun)
@student_works = all_student_works.where(work_status: work_status)
@student_works = @student_works.or(all_student_works.where(work_status: 0)).or(all_student_works.where(myshixuns: {status: 0})) if work_status.include?(3)
@student_works = @student_works.or(all_student_works.where(myshixuns: {status: 1})) if work_status.include?(4)
@student_works = @student_works.where(compelete_status: work_status)
end
# 分班情况
@ -198,7 +194,6 @@ class HomeworkCommonsController < ApplicationController
end
@work_count = @student_works.size
@work_excel = @student_works.where("work_status > 0")
# 排序
rorder = params[:order].blank? ? "update_time" : params[:order]
@ -208,6 +203,7 @@ class HomeworkCommonsController < ApplicationController
elsif rorder == "student_id"
@student_works = @student_works.joins(user: :user_extension).order("user_extensions.#{rorder} #{b_order}")
end
@work_excel = @student_works
# 分页参数
page = params[:page] || 1

@ -67,15 +67,11 @@ class ShixunsController < ApplicationController
## 排序参数
bsort = params[:sort] || 'desc'
case params[:order_by] || 'publish_time'
when 'new'
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.created_at #{bsort}")
case params[:order_by] || 'new'
when 'hot'
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.myshixuns_count #{bsort}")
when 'mine'
@shixuns = @shixuns.order("shixuns.created_at #{bsort}")
@shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.myshixuns_count #{bsort}")
else
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.publish_time #{bsort}")
@shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.publish_time #{bsort}")
end
# 用id计数会快10+MS左右,对于搜索的内容随着数据的增加,性能会提升一些。
@ -265,7 +261,12 @@ class ShixunsController < ApplicationController
project_fork(@new_shixun, @repo_path, current_user.login)
ShixunMember.create!(:user_id => User.current.id, :shixun_id => @new_shixun.try(:id), :role => 1)
# 如果是jupyter先创建一个目录,为了挂载(因为后续数据集开启Pod后环境在没销毁前你上传数据集是挂载不上目录的因此要先创建目录方便中间层挂载)
if @new_shixun.is_jupyter?
folder = EduSetting.get('shixun_folder')
path = "#{folder}/#{@new_shixun.identifier}"
FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
end
# 同步复制关卡
if @shixun.challenges.present?
@shixun.challenges.each do |challenge|
@ -399,13 +400,14 @@ class ShixunsController < ApplicationController
@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_mirror_repositories.create!(new_mirror_id) if new_mirror_id.present?
# 镜像变动要更换服务配置
@shixun.shixun_service_configs.where.not(mirror_repository_id: old_mirror_ids).destroy_all
@shixun.shixun_service_configs.create!(service_create_params)
@shixun.shixun_service_configs.create!(service_create_params) if service_create_params.present?
service_update_params&.map do |service|
smr = @shixun.shixun_service_configs.find_by(mirror_repository_id: service[:mirror_repository_id])
smr.update_attributes(service)
logger.info("########smr: #{smr}")
smr.update_attributes(service) if smr.present?
end
# 添加第二仓库(管理员权限)
if params[:is_secret_repository]
@ -461,7 +463,7 @@ class ShixunsController < ApplicationController
limit = params[:limit] || 10
data_sets = @shixun.data_sets
@data_count = data_sets.count
@data_sets= data_sets.page(page).per(limit)
@data_sets= data_sets.order("created_on desc").page(page).per(limit)
@absolute_folder = edu_setting('shixun_folder')
end
@ -756,7 +758,7 @@ class ShixunsController < ApplicationController
else
commit = GitService.commits(repo_path: @repo_path).try(:first)
uid_logger("First comit########{commit}")
tip_exception("开启实战前请先在版本库中提交代码") if commit.blank?
tip_exception("开启挑战前请先在Jupyter中填写内容") if commit.blank?
commit_id = commit["id"]
cloud_bridge = edu_setting('cloud_bridge')
myshixun_identifier = generate_identifier Myshixun, 10
@ -774,7 +776,7 @@ class ShixunsController < ApplicationController
end
rescue => e
uid_logger_error(e.message)
tip_exception("实训云平台繁忙繁忙等级81")
tip_exception("#{e.message}")
end
end

@ -559,6 +559,7 @@ class StudentWorksController < ApplicationController
if @work.work_status == 0
@work.work_status = 1
@work.commit_time = Time.now
@work.compelete_status = 1 if @homework.homework_type == "practice"
# 分组作业更新分组id
@work.group_id = @homework.max_group_id if @homework.homework_type == "group"
end
@ -739,7 +740,8 @@ class StudentWorksController < ApplicationController
comment: comment)
challenge_score.create_tiding current_user.id
if @work.work_status != 0 && @work.myshixun
HomeworksService.new.update_myshixun_work_score @work, @work.myshixun, @work.myshixun&.games, @homework, @homework.homework_challenge_settings
games = @work.myshixun.games.where(challenge_id: @homework.homework_challenge_settings.pluck(:challenge_id))
HomeworksService.new.update_myshixun_work_score @work, @work.myshixun, games, @homework, @homework.homework_challenge_settings
else
update_none_commit_work @work, @homework
end
@ -877,6 +879,7 @@ class StudentWorksController < ApplicationController
def update_none_commit_work work, homework
if work.work_status == 0
work.work_status = 1
work.compelete_status = 1
work.commit_time = homework.end_time
work.update_time = Time.now
end

@ -93,8 +93,8 @@ class Weapps::CoursesController < Weapps::BaseController
end
if course_group_id.present?
course_group = CourseGroup.find(course_group_id) if course_group_id != 0
@students = @students.where(course_group_id: course_group&.id.to_i)
@course_group = CourseGroup.find(course_group_id) if course_group_id != 0
@students = @students.where(course_group_id: @course_group&.id.to_i)
end
@students_count = @students.size
@ -167,6 +167,15 @@ class Weapps::CoursesController < Weapps::BaseController
normal_status(0, "修改成功")
end
# 分班列表
def course_groups
@course_groups = @course.course_groups
@course_groups = @course_groups.where("name like ?", "%#{params[:search]}%") unless params[:search].blank?
@all_group_count = @course_groups.size
@teachers = @course.teachers.includes(:user, :teacher_course_groups) if @user_course_identity < Course::NORMAL
@current_group_id = @course.students.where(user_id: current_user.id).take&.course_group_id if @user_course_identity == Course::STUDENT
end
private
def course_params

@ -210,7 +210,7 @@ module ApplicationHelper
# 普通/分组 作业作品状态数组
def student_work_status homework, user_id, course, work
status = []
homework_setting = homework.homework_group_setting user_id
homework_setting = homework.homework_group_setting user_id, true
work = work || StudentWork.create(homework_common_id: homework.id, user_id: user_id)
late_time = homework.late_time || course.end_date

@ -22,21 +22,21 @@ module ExportHelper
end
end
shixun_homeworks = shixun_homeworks&.includes(:score_student_works)
shixun_homeworks = shixun_homeworks&.includes(:student_works)
common_homeworks = homeworks.search_homework_type(1) #全部普通作业
common_titles = common_homeworks.pluck(:name)+ ["总得分"]
common_homeworks = common_homeworks&.includes(:score_student_works)
common_homeworks = common_homeworks&.includes(:student_works)
group_homeworks = homeworks.search_homework_type(3) #全部分组作业
group_titles = group_homeworks.pluck(:name)+ ["总得分"]
group_homeworks = group_homeworks&.includes(:score_student_works)
group_homeworks = group_homeworks&.includes(:student_works)
task_titles = tasks.pluck(:name) + ["总得分"]
tasks = tasks&.includes(:score_graduation_works)
tasks = tasks&.includes(:graduation_works)
exercise_titles = exercises.pluck(:exercise_name) + ["总得分"]
exercises = exercises&.includes(:score_exercise_users)
exercises = exercises&.includes(:exercise_users)
total_user_score_array = [] #学生总成绩集合
@ -67,7 +67,7 @@ module ExportHelper
#实训作业
if shixun_homeworks.size > 0
shixun_homeworks.each do |s|
user_student_work = s.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
user_student_work = s.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work.nil?
h_score = 0.0 #该作业的得分为0
else
@ -82,7 +82,7 @@ module ExportHelper
#普通作业
if common_homeworks.size > 0
common_homeworks.each do |c|
user_student_work_1 = c.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
user_student_work_1 = c.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work_1.nil?
h_score_1 = 0.0 #该作业的得分为0
else
@ -97,7 +97,7 @@ module ExportHelper
#分组作业
if group_homeworks.size > 0
group_homeworks.each do |g|
user_student_work_3 = g.score_student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
user_student_work_3 = g.student_works.select{|work| work.user_id == user.id}.first #当前用户的对该作业的回答
if user_student_work_3.nil?
h_score_3 = 0.0 #该作业的得分为0
else
@ -112,7 +112,7 @@ module ExportHelper
#毕设作业
if tasks.size > 0
tasks.each do |task|
graduation_work = task.score_graduation_works.select{|work| work.user_id == user.id}.first
graduation_work = task.graduation_works.select{|work| work.user_id == user.id}.first
if graduation_work.nil?
t_score = 0.0
else
@ -127,7 +127,7 @@ module ExportHelper
#试卷
if exercises.size > 0
exercises.each do |ex|
exercise_work = ex.score_exercise_users.select{|work| work.user_id == user.id}.first
exercise_work = ex.exercise_users.select{|work| work.user_id == user.id}.first
if exercise_work.nil?
e_score = 0.0
else
@ -168,7 +168,7 @@ module ExportHelper
#实训作业
shixun_homeworks.each_with_index do |s,index|
all_student_works = s.score_student_works.where(user_id: all_user_ids) #该实训题的全部用户回答
all_student_works = s.student_works.where(user_id: all_user_ids) #该实训题的全部用户回答
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)
@ -178,7 +178,7 @@ module ExportHelper
#普通作业
common_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
all_student_works = c.student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
title_no = count_1 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
@ -190,7 +190,7 @@ module ExportHelper
#分组作业
group_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
all_student_works = c.student_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
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)
@ -200,7 +200,7 @@ module ExportHelper
#毕设任务
tasks.each_with_index do |c,index|
all_student_works = c.score_graduation_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
all_student_works = c.graduation_works.where(user_id: all_user_ids) #当前用户的对该作业的回答
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)
@ -210,7 +210,7 @@ module ExportHelper
#试卷的导出
exercises.each_with_index do |c,index|
all_student_works = c.score_exercise_users.where(user_id: all_user_ids) #当前用户的对该作业的回答
all_student_works = c.exercise_users.where(user_id: all_user_ids) #当前用户的对该作业的回答
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)
@ -429,7 +429,7 @@ module ExportHelper
end
else #实训题
shixun = homework.shixuns.take
shixun_head_cells = %w(完成情况 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
shixun_head_cells = %w(截止前完成关卡 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
eff_boolean = homework.work_efficiency
if eff_boolean
eff_score_cell = ["效率分"]
@ -455,16 +455,18 @@ module ExportHelper
course_name = course.students.find_by(user_id: w.user_id).try(:course_group_name)
w_5 = course_name.present? ? course_name : "--"
#0 未提交, 1 按时提交, 2 延迟提交
if w.work_status == 0
w_6 = "未提交"
elsif w.work_status == 1
w_6 = "按时提交"
elsif w.work_status == 2
w_6 = "延迟提交"
if w.compelete_status == 0
w_6 = "未开启"
elsif w.compelete_status == 1
w_6 = "未通关"
elsif w.compelete_status == 2
w_6 = "按时通关"
elsif w.compelete_status == 3
w_6 = "迟交通关"
else
w_6 = "--"
end
w_7 = w.work_status == 0 ? '--' : myshixun.try(:passed_count).to_s+"/"+shixun.challenges_count.to_s
w_7 = myshixun&.time_passed_count(homework.homework_group_setting(w.user_id)&.end_time).to_i.to_s+"/"+shixun.challenges_count.to_s
w_8 = myshixun ? myshixun.try(:passed_time).to_s == "--" ? "--" : format_time(myshixun.try(:passed_time)) : "--" # 通关时间
w_9 = myshixun ? (myshixun.try(:passed_count).to_i > 0 ? myshixun.total_spend_time : '--') : "--" #总耗时
w_10 = myshixun ? myshixun.output_times : 0 #评测次数
@ -481,7 +483,7 @@ module ExportHelper
w_14 = nil
end
w_15 = w.work_score.nil? ? "--" : w.work_score.round(1)
w_16 = w.update_time ? format_time(w.update_time) : "--" "更新时间"
w_16 = w.update_time ? format_time(w.update_time) : "--"
myshixun_complete = myshixun && myshixun.status == 1
w_17 = myshixun_complete && w.cost_time ? (game_spend_time w.cost_time) : "未完成"
teacher_comment = w.shixun_work_comments.select{|comment| comment.challenge_id == 0}.first

@ -24,40 +24,37 @@ module HomeworkCommonsHelper
time = course.end_date.strftime("%Y-%m-%d")
time_status = 6
else
if homework_common.end_time && homework_common.end_time < Time.now && homework_common.allow_late &&
(homework_common.late_time.nil? || homework_common.late_time > Time.now)
status << "补交中"
end
ho_detail_manual = homework_common.homework_detail_manual
if ho_detail_manual
# 作业状态大于“提交”状态时,不用考虑分班权限
if ho_detail_manual.comment_status > 1
case ho_detail_manual.comment_status
when 3
if ho_detail_manual.evaluation_end && ho_detail_manual.evaluation_end > Time.now
status << "匿评中"
time = "提交剩余时间:" + how_much_time(ho_detail_manual.evaluation_end)
time_status = 3
end
when 4
if ho_detail_manual.appeal_time && ho_detail_manual.appeal_time > Time.now
status << "申诉中"
time = "申诉剩余时间:" + how_much_time(ho_detail_manual.appeal_time)
time_status = 4
end
when 2, 5, 6
status << "评阅中"
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
end
# 如果还在补交阶段则显示补交结束时间
if homework_common.end_time && homework_common.end_time < Time.now && homework_common.allow_late &&
homework_common.late_time && homework_common.late_time > Time.now
(homework_common.late_time.nil? || homework_common.late_time > Time.now)
status << "补交中"
time = "补交剩余时间:" + how_much_time(homework_common.late_time)
time_status = 2
end
case ho_detail_manual.comment_status
when 3
if ho_detail_manual.evaluation_end && ho_detail_manual.evaluation_end > Time.now
status << "匿评中"
time = "匿评剩余时间:" + how_much_time(ho_detail_manual.evaluation_end)
time_status = 3
end
when 4
if ho_detail_manual.appeal_time && ho_detail_manual.appeal_time > Time.now
status << "申诉中"
time = "申诉剩余时间:" + how_much_time(ho_detail_manual.appeal_time)
time_status = 4
end
else
if status.blank?
status << "已截止"
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
end
end
else
# member = course.course_members.find_by(user_id: user.id, is_active: 1)
# teacher_course_groups = member.try(:teacher_course_groups)
@ -65,25 +62,28 @@ module HomeworkCommonsHelper
# 作业统一设置、游客身份、超级管理员、分班权限不限的老师身份
if homework_common.unified_setting || identity > Course::STUDENT || identity == Course::ADMIN ||
(identity < Course::STUDENT && teacher_course_groups.blank?)
(identity < Course::STUDENT && teacher_course_groups.blank?)
case ho_detail_manual.comment_status
when 0
status << "未发布"
time = homework_common.publish_time.present? ? "将于 #{format_time(homework_common.publish_time)} 发布" : "创建于#{time_from_now(homework_common.created_at)}"
time_status = 0
when 1
if homework_common.end_time && homework_common.end_time >= Time.now
status << "提交中"
time = "提交剩余时间:" + how_much_time(homework_common.end_time)
time_status = 1
elsif homework_common.end_time && homework_common.end_time < Time.now
when 0
status << "未发布"
time = homework_common.publish_time.present? ? "将于 #{format_time(homework_common.publish_time)} 发布" : "创建于#{time_from_now(homework_common.created_at)}"
time_status = 0
when 1
if homework_common.end_time && homework_common.end_time >= Time.now
status << "提交中"
time = "提交剩余时间:" + how_much_time(homework_common.end_time)
time_status = 1
elsif homework_common.end_time && homework_common.end_time < Time.now
if homework_common.allow_late && (homework_common.late_time.nil? || homework_common.late_time >= Time.now)
status << "补交中"
time = "补交剩余时间:" + how_much_time(homework_common.late_time)
time_status = 2
else
status << "已截止"
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
if homework_common.allow_late && (homework_common.late_time.nil? || homework_common.late_time >= Time.now)
time = "补交剩余时间:" + how_much_time(homework_common.late_time)
time_status = 2
end
status << "评阅中"
end
end
end
else
# 未分班的学生始终显示“未发布”(按理不会来到这个判断)
@ -99,9 +99,9 @@ module HomeworkCommonsHelper
else
# 多个分班权限的取最小publish_time最大end_time
min_publish_time = homework_common.homework_group_settings.where.not(publish_time: nil).
where(course_group_id: teacher_course_groups.pluck(:course_group_id)).pluck(:publish_time).min
where(course_group_id: teacher_course_groups.pluck(:course_group_id)).pluck(:publish_time).min
max_end_time = homework_common.homework_group_settings.where.not(end_time: nil).
where(course_group_id: teacher_course_groups.pluck(:course_group_id)).pluck(:end_time).max
where(course_group_id: teacher_course_groups.pluck(:course_group_id)).pluck(:end_time).max
end
if min_publish_time.nil?
@ -116,24 +116,22 @@ module HomeworkCommonsHelper
status << "提交中"
time = "提交剩余时间:" + how_much_time(max_end_time)
time_status = 1
elsif homework_common.allow_late && (homework_common.late_time.nil? || homework_common.late_time >= Time.now)
status << "评阅中"
time = "补交剩余时间:" + how_much_time(homework_common.late_time)
time_status = 2
else
status << "评阅中"
time = ""
status << "已截止"
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
end
end
end
status << "未开启补交" if !homework_common.allow_late && time_status != 0
status << "未开启补交" if !homework_common.allow_late && time_status == 1
end
end
end
# 如果作业状态都没有的话,在课堂结束前,都显示评阅中
# 如果作业状态都没有的话,在课堂结束前,都显示已截止
if status.blank?
status << "评阅中"
status << "已截止"
time = course.end_date.present? ? ("评阅剩余时间:" + how_much_time(course.end_date.end_of_day)) : ""
time_status = 5
end
result[:status] = status
result[:time] = time
@ -144,7 +142,7 @@ module HomeworkCommonsHelper
# 阶段剩余时间
def left_time homework, user_id
setting = homework.homework_group_setting(user_id)
setting = homework.homework_group_setting(user_id, true)
if setting.publish_time && setting.publish_time < Time.now
if setting.end_time > Time.now
status = "剩余提交时间"
@ -224,10 +222,10 @@ module HomeworkCommonsHelper
# 作品状态
def practice_homework_status homework, member
[{id: 3, name: "未通关", count: homework.un_complete_count(member)},
{id: 4, name: "通关", count: homework.complete_count(member)},
{id: 1, name: "按时完成", count: homework.finished_count(member)},
{id: 2, name: "延时完成", count: homework.delay_finished_count(member)}]
[{id: 0, name: "未开启", count: homework.compelete_status_count(member, 0)},
{id: 1, name: "通关", count: homework.compelete_status_count(member, 1)},
{id: 2, name: "按时通关", count: homework.compelete_status_count(member, 2)},
{id: 3, name: "迟交通关", count: homework.compelete_status_count(member, 3)}]
end
# 作品状态

@ -121,7 +121,7 @@ class Game < ApplicationRecord
# 是否查看了答案(通关的是否在通关前看的答案)
def view_answer
answer_exists = Grade.exists?("container_type = 'Answer' and container_id = #{id} and created_at < '#{end_time}'")
answer_exists = Grade.where("container_type = 'Answer' and container_id = #{self.id} and created_at < '#{self.end_time}'").exists?
answer_open != 0 ? (status == 2 ? answer_exists : true) : false
end

@ -108,7 +108,7 @@ class HomeworkCommon < ApplicationRecord
# 是否在补交阶段内
def late_duration
homework_setting = self.homework_group_setting(User.current.id)
homework_setting = self.homework_group_setting(User.current.id, true)
!course.is_end && self.publish_time && self.publish_time < Time.now && homework_setting.end_time &&
homework_setting.end_time < Time.now && self.allow_late && (self.late_time.nil? || self.late_time > Time.now)
end
@ -119,7 +119,7 @@ class HomeworkCommon < ApplicationRecord
if self.course.is_end || (self.allow_late && self.late_time && self.late_time < Time.now)
status = true
elsif !self.allow_late
homework_setting = self.homework_group_setting(User.current.id)
homework_setting = self.homework_group_setting(User.current.id, true)
status = homework_setting.end_time && homework_setting.end_time < Time.now
end
status
@ -241,14 +241,8 @@ class HomeworkCommon < ApplicationRecord
self.teacher_works(member).delay_finished.count
end
# 未通关数
def un_complete_count member
teacher_works(member).count - complete_count(member)
end
# 通关数
def complete_count member
Myshixun.where(id: self.teacher_works(member).pluck(:myshixun_id), status: 1).count
def compelete_status_count member, status
teacher_works(member).where(compelete_status: status).count
end
# 分组作业的最大分组id
@ -257,12 +251,13 @@ class HomeworkCommon < ApplicationRecord
end
# 作业的分班设置时间
def homework_group_setting user_id
def homework_group_setting user_id, current_user=false
if unified_setting
homework_setting = self
else
member = course.course_member(user_id)
group_setting = self.homework_group_settings.find_by_course_group_id(member.try(:course_group_id))
# 当前用户是从course_member中取否则是从学生中取双重身份的原因
member = current_user ? course.course_member(user_id) : course.students.find_by(user_id: user_id)
group_setting = self.homework_group_settings.select{ |setting| setting.course_group_id == member.try(:course_group_id)}.first
homework_setting = group_setting.present? ? group_setting : self
end
homework_setting

@ -88,6 +88,11 @@ class Myshixun < ApplicationRecord
self.games.select{|game| game.status == 2}.size
end
# 指定时间前完成的关卡数
def time_passed_count time
time.present? ? self.games.select{|game| game.status == 2 && game.end_time < time}.size : 0
end
# 查看答案的关卡数,只统计通关前看的关卡
def view_answer_count
answer_ids = user.grades.joins("join games on grades.container_id = games.id").where("container_type = 'Answer' and games.status=2 and games.end_time > grades.created_at").pluck(:container_id)

@ -285,7 +285,7 @@ class Shixun < ApplicationRecord
end
def has_manager?(user)
return true if user.admin?
return true if user.admin? || user.business?
shixun_members.where(role: [1, 2]).exists?(user_id: user.id)
end

@ -123,6 +123,26 @@ class StudentWork < ApplicationRecord
end
end
# 实训作业的作品状态 0未提交1未通关2按时通关(提交截止前通关)3迟交通关提交截止-补交截止间通关)
def real_work_status
status = work_status
if status > 0 && myshixun
if myshixun.status != 1
status = 1
else
homework_end_time = homework_common.homework_group_setting(user_id)&.end_time
if homework_end_time.present? && homework_end_time > myshixun.passed_time
status = 2
elsif homework_end_time.present? && homework_common.allow_late && homework_common.late_time > myshixun.passed_time
status = 3
else
status = 1
end
end
end
status
end
# 更新作品成绩
def set_work_score
if work_status > 0 && homework_common && !self.ultimate_score

@ -322,11 +322,16 @@ class HomeworksService
work.efficiency = format("%.2f", efficiency)
if myshixun_endtime <= homework_end_or_late_time
work.compelete_status = myshixun_endtime < setting_time.publish_time ? 2 : 1
# 2是按时通关 3是迟交通关
work.compelete_status = myshixun_endtime < setting_time.end_time ? 2 : 3
# 如果作业的最大效率值有变更则更新所有作品的效率分
homework.update_column("max_efficiency", work.efficiency) if homework.work_efficiency && homework.max_efficiency < work.efficiency
else
work.compelete_status = 1 # 未通关
end
else
work.compelete_status = 1 # 未通关
end
work.late_penalty = work.work_status == 2 ? homework.late_penalty : 0
@ -346,7 +351,7 @@ class HomeworksService
work.work_score = format("%.2f",(score < 0 ? 0 : score).to_f) unless work.ultimate_score
#logger.info("#############work_score: #{score}")
work.calculation_time = Time.now
work.save!
work.save(validate: false)
end
end
end

@ -20,10 +20,8 @@ module JupyterService
logger.info "test_juypter: #{res}"
@shixun_jupyter_port = res['port']
jupyter_service = edu_setting('jupyter_service')
return "https://#{res['port']}.#{jupyter_service}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
"#{jupyter_service(res['port'])}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end
end
@ -50,7 +48,7 @@ module JupyterService
tpiID = myshixun.id
mount = myshixun.shixun.data_sets.present?
params = {tpiID: tpiID, identifier: shixun.identifier, needMount: mount,
params = {tpiID: tpiID, identifier: shixun.identifier, myshixunIdentifier: myshixun.identifier, needMount: mount,
:containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_post uri, params
@ -64,9 +62,7 @@ module JupyterService
repo_save_path = myshixun.repo_save_path
jupyter_service = edu_setting('jupyter_service')
"https://#{res['port']}.#{jupyter_service}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
"#{jupyter_service(res['port'])}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end
end
@ -89,10 +85,8 @@ module JupyterService
tpiID = "tpm#{shixun.id}"
jupyter_service = edu_setting('jupyter_service')
src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true
src_url = "https://#{jupyter_port}.#{jupyter_service}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
response = Faraday.get(src_url)
if response.status.to_i != 200
@ -119,9 +113,7 @@ module JupyterService
tpiID = myshixun.id
repo_save_path = myshixun.repo_save_path
jupyter_service = edu_setting('jupyter_service')
src_url = "https://#{jupyter_port}.#{jupyter_service}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
response = Faraday.get(src_url)
if response.status.to_i != 200
@ -195,5 +187,9 @@ module JupyterService
end
end
def jupyter_service jupyter_port
edu_setting('jupyter_service').gsub("PORT", jupyter_port)
end
end

@ -42,6 +42,12 @@ class CreateShixunService < ApplicationService
if !Laboratory.current.main_site?
Laboratory.current.laboratory_shixuns.create!(shixun: shixun, ownership: true)
end
# 如果是jupyter先创建一个目录,为了挂载(因为后续数据集开启Pod后环境在没销毁前你上传数据集是挂载不上目录的因此要先创建目录方便中间层挂载)
if shixun.is_jupyter?
folder = EduSetting.get('shixun_folder')
path = "#{folder}/#{identifier}"
FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
end
return shixun
end
rescue => e

@ -21,9 +21,17 @@
<td><%= myshixun.id %></td>
<td><%= myshixun.identifier %></td>
<td class="text-left">
<% current_task = myshixun.last_executable_task || myshixun.last_task %>
<%= link_to "/tasks/#{current_task.identifier}", target: '_blank' do %>
<%= overflow_hidden_span myshixun.shixun.name, width: 280 %>
<% if myshixun.shixun.is_jupyter? %>
<%= link_to "/tasks/#{myshixun.identifier}/jupyter", target: '_blank' do %>
<%= overflow_hidden_span myshixun.shixun.name, width: 280 %>
<% end %>
<% else %>
<% current_task = myshixun.last_executable_task || myshixun.last_task %>
<% if current_task %>
<%= link_to "/tasks/#{current_task.identifier}", target: '_blank' do %>
<%= overflow_hidden_span myshixun.shixun.name, width: 280 %>
<% end %>
<% end %>
<% end %>
</td>
<td><%= myshixun.shixun.user.real_name %></td>

@ -38,6 +38,7 @@ json.homeworks @homework_commons.each do |homework|
current_myshixun = homework.user_work(@user.id).try(:myshixun)
myshixun = current_myshixun ? current_myshixun : shixun.myshixuns.find_by(user_id: @user.id)
# json.game_count current_myshixun ? current_myshixun.exec_count : 0
json.shixun_status shixun.try(:status).to_i
json.task_operation task_operation_url(myshixun, shixun)
else
work = homework.user_work(@user.id)

@ -33,7 +33,8 @@ elsif @user_course_identity == Course::STUDENT
json.left_time left_time @homework, @current_user.id
if @homework.homework_type == "practice"
json.(@work, :id, :work_status, :update_time, :ultimate_score)
json.(@work, :id, :update_time, :ultimate_score)
myshixun = @work.myshixun || @shixun.myshixuns.find_by(user_id: @work.user_id)
json.calculation_time @work.calculation_time
json.late_penalty @work.late_penalty if @homework.allow_late
json.cost_time @work.myshixun.try(:total_spend_time)
@ -41,8 +42,10 @@ elsif @user_course_identity == Course::STUDENT
json.final_score work_score_format(@work.final_score, true, @score_open)
json.efficiency work_score_format(@work.efficiency, true, @score_open)
json.eff_score work_score_format(@work.eff_score, true, @score_open)
json.complete_count @work.myshixun.try(:passed_count)
json.view_answer_count @work.myshixun.try(:view_answer_count)
json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late
json.complete_count @work.myshixun&.time_passed_count(@homework.homework_group_setting(@work.user_id)&.end_time)
json.view_answer_count @work.myshixun.try(:view_answer_count).to_i
json.work_status @work.compelete_status
else
json.(@work, :id, :work_status, :update_time, :ultimate_score)
@ -87,7 +90,8 @@ if @homework.homework_type == "practice"
json.work_efficiency @homework.work_efficiency
json.student_works @student_works.each do |work|
json.(work, :id, :work_status, :update_time, :ultimate_score, :myshixun_id)
json.(work, :id, :update_time, :ultimate_score, :myshixun_id)
myshixun = work.myshixun || @shixun.myshixuns.find_by(user_id: work.user_id)
json.late_penalty work.late_penalty if @homework.allow_late
json.work_score work_score_format(work.work_score, @current_user == work.user, @score_open)
@ -96,12 +100,14 @@ if @homework.homework_type == "practice"
json.eff_score work_score_format(work.eff_score, @current_user == work.user, @score_open)
json.cost_time work.myshixun.try(:total_spend_time)
json.complete_count work.myshixun.try(:passed_count)
json.view_answer_count work.myshixun.try(:view_answer_count)
json.current_complete_count myshixun.try(:passed_count) if @homework.end_or_late
json.complete_count work.myshixun&.time_passed_count(@homework.homework_group_setting(work.user_id)&.end_time)
json.view_answer_count work.myshixun.try(:view_answer_count).to_i
json.user_login work.user.try(:login)
json.user_name work.user.try(:real_name)
json.student_id work.user.try(:student_id)
json.group_name @students.select{|student| student.user_id == work.user_id}.first.try(:course_group_name)
json.work_status work.compelete_status
end
elsif @homework.homework_type == "group" || @homework.homework_type == "normal"
json.anonymous_comment @homework.anonymous_comment

@ -18,5 +18,6 @@ json.shixuns_list do
json.challenges_count shixun.challenges_count
json.complete_status stage_myshixun_status(myshixuns.select{|ms| ms.shixun_id == shixun.id}.first)
json.shixun_status stage_shixun_status(subject.status, shixun.status, shixun.hidden)
json.allow_visit User.current.shixun_permission(shixun)
end
end

@ -0,0 +1,6 @@
json.course_groups @course_groups.each do |group|
json.(group, :id, :course_members_count, :name)
end
json.none_group_member_count @course.none_group_count
json.group_count @all_group_count

@ -1,2 +1,7 @@
json.students student_list @students, @course.excellent
json.students_count @students_count
json.students_count @students_count
if @course_group
json.course_group do
json.(@course_group, :id, :name, :invite_code, :course_members_count)
end
end

@ -957,6 +957,7 @@ Rails.application.routes.draw do
post :change_member_roles
get :students
delete :delete_course_students
get :course_groups
end
end

@ -0,0 +1,25 @@
class MigrateStudentWorkCompeleteStatus < ActiveRecord::Migration[5.2]
def change
student_works = StudentWork.where("myshixun_id is not null and myshixun_id != 0")
student_works.includes(homework_common: :homework_challenge_settings, myshixun: :games).find_each do |work|
if work.myshixun && work.homework_common
myshixun = work.myshixun
homework= work.homework_common
setting_time = homework.homework_group_setting(myshixun.user_id)
homework_end_or_late_time = homework.allow_late ? homework.late_time : setting_time.end_time
challenge_ids = homework.homework_challenge_settings.pluck(:challenge_id)
games = myshixun.games.select{ |game| challenge_ids.include?(game.challenge_id) }
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
if work.work_status != 0 && homework_end_or_late_time.present?
if myshixun_endtime.present? && myshixun_endtime <= homework_end_or_late_time
# 2是按时通关 3是迟交通关
compelete_status = setting_time.end_time.present? && myshixun_endtime < setting_time.end_time ? 2 : 3
else
compelete_status = 1 # 未通关
end
work.update_column("compelete_status", compelete_status)
end
end
end
end
end

@ -0,0 +1,5 @@
class ModifyTaskPassForShixuns < ActiveRecord::Migration[5.2]
def change
change_column :shixuns, :task_pass, :boolean, :default => true
end
end

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

@ -608,10 +608,10 @@ class App extends Component {
}
}
/>
<Route
path="/interesse" component={Interestpage}
{/*<Route*/}
{/* path="/interesse" component={Interestpage}*/}
/>
{/*/>*/}
<Route path="/shixuns/new" component={Newshixuns}>
</Route>

@ -52,7 +52,7 @@ export function initAxiosInterceptors(props) {
//proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net"
proxy="https://test-jupyterweb.educoder.net"
//proxy="https://test-jupyterweb.educoder.net"
//proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求

@ -414,7 +414,7 @@ class commonWork extends Component{
<Menu.Item key="2">补交中</Menu.Item>
<Menu.Item key="3">匿评中</Menu.Item>
<Menu.Item key="4">申诉中</Menu.Item>
<Menu.Item key="5">评阅中</Menu.Item>
<Menu.Item key="5">已截止</Menu.Item>
</Menu>
</div>
}

@ -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&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?"paragraph_name color204":"paragraph_name color-grey3"}>
<span className={line.allow_visit===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&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?
line.allow_visit===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&&this.props.current_user&&this.props.current_user.business===false&&line.shixun_status==="暂未公开"?"": <li className={showparagraph===false?"fr status_li":"fr status_li"}>
{line.allow_visit===false&&line.shixun_status==="暂未公开"?"": <li className={showparagraph===false?"fr status_li":"fr status_li"}>
{
showparagraphkey === key && showparagraphindex === index ? "" :
<span className="fr color204">实验任务 <span

@ -1037,7 +1037,7 @@ class PollNew extends Component {
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -1257,7 +1257,7 @@ class PollNew extends Component {
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -1448,10 +1448,7 @@ class PollNew extends Component {
// indexo 第几个数组
//object 单个数组数据
Deleteadddomthree = (indexo, object,bool) => {
this.setState({
Newdisplay:false,
newoption: false,
})
// console.log("deleteadddom 349")
var thiss = this;
let arr = this.state.adddom;
@ -1479,6 +1476,12 @@ class PollNew extends Component {
this.props.showNotification('题目不能为空!');
return
}
if (newarr[indexo].question.question_title.match(/^[ ]*$/)) {
this.props.showNotification('题目不能为空!');
return
}
if (max > 0) {
if (object.question.question_type === 1) {
this.props.showNotification('选项内容不能为空!');
@ -1578,7 +1581,7 @@ class PollNew extends Component {
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -1789,7 +1792,7 @@ class PollNew extends Component {
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选:最小和最大限制须同时为数值或者“--"`);
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return;
}
}
@ -2015,6 +2018,11 @@ class PollNew extends Component {
if (result.data.status === 0) {
this.props.showNotification(`已完成`);
thiss.thisinitializationdatanew();
this.setState({
Newdisplay:false,
newoption: false,
})
// console.log("确认创建问题")
// console.log(result)
// try {
@ -2026,11 +2034,24 @@ class PollNew extends Component {
//
// }
}
}else{
this.setState({
Newdisplay:true,
newoption: false,
})
}
// } catch (e) {
//
// }
}).catch((error) => {
console.log(error)
this.setState({
Newdisplay:true,
newoption: false,
})
})
@ -2090,11 +2111,24 @@ class PollNew extends Component {
if (result.data.status === 0) {
this.props.showNotification(`编辑题目成功`);
thiss.thisinitializationdatanew();
this.setState({
Newdisplay:false,
newoption: false,
})
}
} catch (e) {
// console.log("调用了edittotheserver")
console.log(e)
this.setState({
Newdisplay:true,
newoption: false,
})
}
}).catch((error) => {
console.log(error)
this.setState({
Newdisplay:true,
newoption: false,
})
})
}
@ -2679,7 +2713,8 @@ class PollNew extends Component {
// console.log("2301");
// console.log(newr);
// window.history.pushState('','',newUrl+'?tab='+e);
window.location.href = `/courses/${coursesId}/polls/${result.data.data.id}/edit`;
// window.location.href = `/courses/${coursesId}/polls/${result.data.data.id}/edit`;
})
} else {
@ -2767,6 +2802,7 @@ class PollNew extends Component {
height: '30px',
lineHeight: '30px',
};
const hejiine=this.state.mysingles + this.state.mydoubles + this.state.mymainsint;
// console.log(this.state.projects===undefined?"":this.state.projects.poll_questions)
var displaymysave = (mysave === true) ? "" : "display:none;";
@ -2936,7 +2972,7 @@ class PollNew extends Component {
{
this.state.mysingles + this.state.mydoubles + this.state.mymainsint === 0 ? "" :
hejiine=== 0 ? "" :
<div>
<span className="fl">
{this.state.mysingles === 0 ? "" : <span
@ -2953,7 +2989,7 @@ class PollNew extends Component {
</span>
<span className="fr">合计 <span
className="color-blue">{this.state.mysingles === undefined ? "" : this.state.mydoubles === undefined ? "" : this.state.mymainsint === undefined ? "" : this.state.mysingles + this.state.mydoubles + this.state.mymainsint}</span> </span>
className="color-blue">{this.state.mysingles === undefined ? "" : this.state.mydoubles === undefined ? "" : this.state.mymainsint === undefined ? "" : hejiine}</span> </span>
</div>
}

@ -233,8 +233,8 @@ class ShixunHomeworkPage extends Component {
/>
<a className="color-grey-9 fr font-16 summaryname ml20 mr20" onClick={()=>this.gotohome()}>返回</a>
{teacherdatapage&&teacherdatapage.shixun_status>1?<a className="color-grey-9 fr font-16 mr20"
href={`/shixuns/${teacherdatapage === undefined ? "" : teacherdatapage.shixun_identifier}/challenges`}
target={"_blank"}>实训详情</a>:""}
href={`/shixuns/${teacherdatapage === undefined ? "" : teacherdatapage.shixun_identifier}/challenges`}
target={"_blank"}>实训详情</a>:""}
</div>
@ -336,7 +336,7 @@ class ShixunHomeworkPage extends Component {
<a className="fr color-blue font-16"
href={`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${teacherdatapage === undefined ? "" : teacherdatapage.id}/commitsummary/${this.props.match.params.homeworkid}`}>{teacherdatapage.commit_des}</a>
}
{teacherdatapage === undefined ? "" :teacherdatapage&&teacherdatapage.shixun_status>1?<Startshixuntask
{teacherdatapage === undefined ? "" :teacherdatapage&&teacherdatapage.shixun_status>1&&teacherdatapage&&teacherdatapage.time_status<5?<Startshixuntask
{...this.props}
data={teacherdatapage}
/>:""}

@ -371,6 +371,7 @@ class ShixunhomeWorkItem extends Component{
{this.props.isStudent===true?this.props.course_identity===5?discussMessage&&discussMessage.shixun_status>1?
discussMessage.time_status<5?
<WordsBtn style="blue" className="colorblue font-16 mr20 fr mt10">
{startbtn===false?
(discussMessage.task_operation[0] == '继续挑战' || discussMessage.task_operation[0] == '查看实战' ?
@ -381,7 +382,7 @@ class ShixunhomeWorkItem extends Component{
<a className="btn colorblue" onClick={()=>this.taskoperationId(discussMessage.task_operation[1])}>
{discussMessage.task_operation[0]}
</a>):<a className="btn colorblue" ></a>}
</WordsBtn>:"":"":""
</WordsBtn>:"":"":"":""
}
</h6>

@ -1208,7 +1208,7 @@ class ShixunHomework extends Component{
{this.props.isAdmin()?<Menu.Item key="0">未发布</Menu.Item>:""}
<Menu.Item key="1">提交中</Menu.Item>
<Menu.Item key="2">补交中</Menu.Item>
<Menu.Item key="5">评阅中</Menu.Item>
<Menu.Item key="5">已截止</Menu.Item>
</Menu>
</div>
<div className="fr mt16 mb16 searchView">

@ -73,6 +73,14 @@
white-space:nowrap;
cursor: default;
}
.maxnamewidth120{
max-width: 120px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
cursor: default;
}
.maxnamewidth145{
max-width: 145px;
overflow:hidden;

@ -99,7 +99,6 @@ class Statistics extends Component{
}
getwork_scoredata=(page,group_ids,sort,key)=>{
this.setState({
page:page,
sort:sort,
@ -189,8 +188,45 @@ class Statistics extends Component{
}
//计算成绩
setComputeTimet = (homeworkid) => {
let url = `/courses/${homeworkid}/calculate_all_shixun_scores.json`;
try {
this.props.yslslowCheckresults();
} catch (e) {
}
axios.get(url).then((response) => {
if (response) {
if (response.data.status === 0) {
let{page,group_ids,sort}=this.state;
setTimeout(() => {
try {
this.props.showNotification(`${response.data.message}`);
} catch (e) {
}
try {
this.props.yslslowCheckresultsNo();
} catch (e) {
}
this.getwork_scoredata(page,group_ids,sort);
}, 2500);
}
}
}).catch((error) => {
try {
this.props.yslslowCheckresultsNo();
} catch (e) {
}
console.log(error)
});
};
render(){
let {nd1,nd2,nd3,data,bomdata,course_members}=this.state;
let {nd1,nd2,nd3,data,bomdata,course_members,activeKey}=this.state;
const columns = [
{
@ -356,16 +392,36 @@ class Statistics extends Component{
)
}
// console.log(this.props.isAdmin)
const operations = <React.Fragment>
{course_grouptype===false||this.state.course_groups.length===0?"":<Dropdownbox
{...this.props}
{...this.state}
postwork_scoredata={(group_idss)=>this.getwork_scoredata(1,group_idss,'desc')}
/>}
<a className={"ml20 ant-btn-link"} onClick={()=>this.derivefun(this.state.activeKey==="1"?`/courses/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出</a>
// console.log("Statistics");
// console.log(this.props.user.course_is_end)
const course_is_endismy=this.props&&this.props.user&&this.props.user.course_is_end;
const operations = <React.Fragment>
{course_grouptype===false||this.state.course_groups.length===0?"":
this.props.isAdmin()===true?
<Dropdownbox
{...this.props}
{...this.state}
postwork_scoredata={(group_idss)=>this.getwork_scoredata(1,group_idss,'desc')
}
/>
:""
}
{
this.state.activeKey==="1"?
(
course_is_endismy===false?
<a className={"ml20 ant-btn-link"} onClick={()=>this.setComputeTimet(this.props.match.params.coursesId)}>获取最新成绩</a>
:
""
)
:""
}
{
this.props.isAdmin()===true?
<a className={"ml20 ant-btn-link"} onClick={()=>this.derivefun(this.state.activeKey==="1"?`/courses/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出</a>
:""
}
</React.Fragment>;
return(
<React.Fragment>
@ -542,7 +598,7 @@ class Statistics extends Component{
}
`
}</style>
<Tabs className="statisticsTabs" activeKey={this.state.activeKey} onChange={this.activeKey} tabBarExtraContent={this.props.isAdmin()===true?operations:""}>
<Tabs className="statisticsTabs" activeKey={this.state.activeKey} onChange={this.activeKey} tabBarExtraContent={operations}>
<TabPane tab="学习成绩" key="1" className={"statisticsTabs1"} >
{bomdata===undefined||bomdata===null?"":bomdata.length===0?<NoneData/>:<Table
columns={columns}

@ -554,6 +554,17 @@ class MessagChat extends Component{
{myuserl!==undefined?myuserl.name:""}与你的私信
</p>
{/*聊天页面*/}
<style>
{
`
.dialogPanel{
padding: 0px 20px;
height: 400px !important;
overflow-y: auto;
}
`
}
</style>
<div className="dialogPanel"
onScroll={this.contentViewScrolltop}
ref={(div) => {
@ -637,6 +648,18 @@ class MessagChat extends Component{
{/*右边头部*/}
<p className="pt30 pb30 pl30 edu-txt-left font-16 bor-bottom-greyE">私信列表</p>
<Spin size="large" className="myw100baifenbi" spinning={isSpins}>
<style>
{
`
.private-list{
min-height: 680px !important;
max-height: 680px !important;
overflow-y: auto;
overflow-x: hidden;
}
`
}
</style>
<div className="private-list" onScroll={this.contentViewScrolledit}>
{/*列表数据*/}
{

@ -341,6 +341,7 @@ class DetailCards extends Component{
}=this.state;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
// console.log("zzz"+this.props.MenuItemsindextype)
// console.log(this.props.detailInfoList&&this.props.detailInfoList.allow_visit)
return(
<div>
@ -547,13 +548,13 @@ class DetailCards 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={line.allow_visit===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==="暂未公开"?
line.allow_visit===false&&line.shixun_status==="暂未公开"?
<li className="fr status_li"><span className="fr color204">暂未公开</span></li>
:
<li className={showparagraph===false?"none":"fr status_li"}>

@ -736,18 +736,37 @@ submittojoinclass=(value)=>{
});
};
matchpaths=(url)=>{
const {match} = this.props;
if (url=== '/forums'&&match.path === '/forums') {
return true
} else if (url.startsWith('/shixuns')&&match.path.startsWith('/shixuns')) {
return true
}else if (url.startsWith('/paths')&&match.path.startsWith('/paths')) {
return true
} else if (url.startsWith('/courses')&&match.path.startsWith('/courses')) {
return true
}else if (url.startsWith('/competitions')&&match.path.startsWith('/crowdsourcing')) {
return true
}else if (url.startsWith('/crowdsourcing')&&match.path.startsWith('/crowdsourcing')) {
return true
}else if(url.startsWith('/moop_cases')&&match.path.startsWith('/moop_cases')){
return true
}else if(url.startsWith('/developer')&&match.path.startsWith('/developer')){
return true
}else {
return false
}
}
render() {
const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
const {match,} = this.props;
const {match} = this.props;
let {Addcoursestypes,
tojoinitemtype,
tojoinclasstitle,
Checkboxteacherchecked,
Checkboxstudentchecked,
Checkboxteachingchecked,
Checkboxteachertype,
Checkboxteachingtype,
code_notice,
checked_notice,
AccountProfiletype,
@ -792,91 +811,30 @@ submittojoinclass=(value)=>{
// console.log("mygetHelmetapi2");
// console.log(mygetHelmetapi2);
if(mygetHelmetapi2){
if(mygetHelmetapi2.navbar){
if(mygetHelmetapi2.navbar.length>0){
// console.log("mygetHelmetapi2.navbar.length>0====-=-=--=-=-=-=");
//
// console.log(match.path);
if(match.path==='/'){
if(headtypesonClickbool===false){
headtypes=undefined;
}else{
headtypes=headtypess;
}
}else {
for(var i=0;i<mygetHelmetapi2.navbar.length;i++){
if(match.path===mygetHelmetapi2.navbar[i].link){
headtypes=mygetHelmetapi2.navbar[i].link;
break;
}
}
}
if(mygetHelmetapi2) {
if (mygetHelmetapi2.navbar) {
if (mygetHelmetapi2.navbar.length > 0) {
// console.log("mygetHelmetapi2.navbar.length>0====-=-=--=-=-=-=");
//
// console.log(match.path);
if (match.path === '/') {
if (headtypesonClickbool === false) {
headtypes = undefined;
} else {
headtypes = headtypess;
}
} else {
for (var i = 0; i < mygetHelmetapi2.navbar.length; i++) {
if (match.path === mygetHelmetapi2.navbar[i].link) {
headtypes = mygetHelmetapi2.navbar[i].link;
break;
}
}
}
}else{
if (match.path === '/forums') {
headtypes = '/forums';
} else if (match.path.startsWith('/shixuns')) {
headtypes = '/shixuns';
}else if (match.path.startsWith('/paths')) {
headtypes = '/paths';
} else if (match.path.startsWith('/courses')) {
headtypes = '/courses';
}else if (match.path.startsWith('/competitions')) {
headtypes = '/competitions';
}else if (match.path.startsWith('/crowdsourcing')) {
headtypes = '/crowdsourcing';
}else if(match.path.startsWith('/moop_cases')){
headtypes = '/moop_cases';
}else if(match.path.startsWith('/developer')){
headtypes = '/developer'
}else {
headtypes = '/';
}
}
}else{
if (match.path === '/forums') {
headtypes = '/forums';
} else if (match.path.startsWith('/shixuns')) {
headtypes = '/shixuns';
}else if (match.path.startsWith('/paths')) {
headtypes = '/paths';
} else if (match.path.startsWith('/courses')) {
headtypes = '/courses';
}else if (match.path.startsWith('/competitions')) {
headtypes = '/competitions';
}else if (match.path.startsWith('/crowdsourcing')) {
headtypes = '/crowdsourcing';
}else if(match.path.startsWith('/moop_cases')){
headtypes = '/moop_cases';
}else if(match.path.startsWith('/developer')){
headtypes = '/developer'
}else {
headtypes = '/';
}
}
}else{
if (match.path === '/forums') {
headtypes = '/forums';
} else if (match.path.startsWith('/shixuns')) {
headtypes = '/shixuns';
}else if (match.path.startsWith('/paths')) {
headtypes = '/paths';
} else if (match.path.startsWith('/courses')) {
headtypes = '/courses';
}else if (match.path.startsWith('/competitions')) {
headtypes = '/competitions';
}else if (match.path.startsWith('/crowdsourcing')) {
headtypes = '/crowdsourcing';
}else if(match.path.startsWith('/moop_cases')){
headtypes = '/moop_cases';
}else if(match.path.startsWith('/developer')){
headtypes = '/developer'
}else {
headtypes = '/';
}
}
}
}
}
// console.log(mygetHelmetapi2);
// console.log("NewHeadermygetHelmetapi123123123123");
@ -907,6 +865,8 @@ submittojoinclass=(value)=>{
}
})
}
return (
<div className="newHeaders" id="nHeader" >
@ -969,7 +929,7 @@ submittojoinclass=(value)=>{
}
// console.log(item.hidden);
return(
<li key={key} onClick={()=>this.headtypesonClick(item.link,true)} className={`${headtypes===undefined?'pr':headtypes===item.link?'pr active':'pr'}`} style={item.hidden==false?{display: 'block'}:{display: 'none'}}>
<li key={key} onClick={()=>this.headtypesonClick(item.link,true)} className={`${this.matchpaths(item.link)===true?'pr active':'pr'}`} style={item.hidden==false?{display: 'block'}:{display: 'none'}}>
{
strbool===true?
<a href={item.link}>{item.name}</a>
@ -1109,6 +1069,8 @@ submittojoinclass=(value)=>{
<Link to={this.props.Headertop===undefined?"":'/courses'}>翻转课堂</Link>
</li>
{}
{console.log(activeShixuns)}
<li className={`${activeShixuns === true ? 'pr active' : 'pr'}`}>
<Link to="/shixuns">实训项目</Link>
{/*<img src={getImageUrl("images/educoder/hot-h.png")} className="nav-img">*/}
@ -1294,8 +1256,9 @@ submittojoinclass=(value)=>{
<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}</a></li>:""
}
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"":
pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:""
{this.props.user&&this.props.user.main_site===false?"":this.props.Headertop===undefined?"":<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>}
{this.props.user&&this.props.user.main_site===true?"":this.props.Headertop===undefined?"":
pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:""
}
{this.props.user&&this.props.user.main_site===true?<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>:""}
</ul>

@ -366,7 +366,7 @@ class TPMBanner extends Component {
Modalstype: true,
Modalstopval: "是否确认撤销发布?",
modalsMidval:"撤销发布后,学员将无法进行练习,若您新增关",
ModalsBottomval:"卡,学员需要重新体验课程",
ModalsBottomval:"卡,学员需要重新体验实训",
ModalCancel: this.ModalCancel,
ModalSave: this.ModalSave,
modalstyles:"848282"
@ -843,7 +843,7 @@ class TPMBanner extends Component {
<ul className="fl color-grey-c pathInfo">
<li>
<span>学习人数</span>
<span className="mt10">{shixunsDetails.stu_num}</span>
<span className="mt3">{shixunsDetails.stu_num}</span>
</li>
{/*<li>*/}
{/*<span>经验值</span>*/}
@ -851,7 +851,7 @@ class TPMBanner extends Component {
{/*</li>*/}
<li>
<span>难度级别</span>
<span className="shixunsdiffcult mt10">{shixunsDetails.diffcult}</span>
<span className="shixunsdiffcult mt3">{shixunsDetails.diffcult}</span>
</li>
</ul>
@ -1096,8 +1096,8 @@ class TPMBanner extends Component {
<Popover
content={
<pre className={"bannerpd201"}>
<div>申请公开成功后您的实训将会展示实训列表</div>
<div className={"wechatcenter mt10"}>您将获得关卡<span className={"FF6802"}>对应的经验值和金币</span> </div>
<div>平台审核完成后您的实训将会录入到平台的公共实训项目列表</div>
<div className={"wechatcenter mt10"}>您将获得实训<span className={"FF6802"}>对应的经验值和金币</span> </div>
<div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openshowpublic} >我知道了</Button></div>
</pre>
}
@ -1223,7 +1223,7 @@ class TPMBanner extends Component {
}
{this.props.identity < 5 && shixunsDetails.shixun_status != -1 && shixunsDetails.shixun_status != 0?
{this.props.identity < 8 && shixunsDetails.shixun_status != -1 && shixunsDetails.shixun_status != 0?
<div className="fr kaike kkbth mr20"
style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "flex"}}>
<Tooltip placement="bottom" title={"基于这个实训修改形成新的实训"}>

@ -72,11 +72,18 @@ export default class Shixuninformation extends Component {
componentDidMount() {
if (this.props.data) {
if (this.props.data.shixun) {
let time =this.props.data && this.props.data.shixun.opening_time;
let timetype=false;
if(!time){
timetype=false;
}else{
timetype=true;
}
this.setState({
can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
use_scope: this.props.data && this.props.data.shixun.use_scope,
opening_time: this.props.data && this.props.data.shixun.opening_time,
opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true,
opentime: timetype,
oldscope_partment: this.props.data && this.props.data.shixun.scope_partment,
})
}
@ -100,11 +107,18 @@ export default class Shixuninformation extends Component {
if (prevProps.data != this.props.data) {
if (this.props.data) {
if (this.props.data.shixun) {
let time =this.props.data && this.props.data.shixun.opening_time;
let timetype=false;
if(!time){
timetype=false;
}else{
timetype=true;
}
this.setState({
can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
use_scope: this.props.data && this.props.data.shixun.use_scope,
opening_time: this.props.data && this.props.data.shixun.opening_time,
opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true,
opentime: timetype,
oldscope_partment: this.props.data && this.props.data.shixun.scope_partment,
})
}
@ -257,9 +271,15 @@ export default class Shixuninformation extends Component {
}
setopentime = (e) => {
if(e.target.checked===false){
this.setState({
opening_time:null
})
}
this.setState({
opentime: e.target.checked
})
}
render() {

@ -418,12 +418,21 @@ class Shixuninformation extends Component {
selectscripts:response.data[0].id
})
this.get_mirror_script(response.data[0].id)
this.setState({
choice_main_type: value,
standard_scripts: response.data,
shixun_service_configs: newshixun_service_configsagin,
shixun_service_configlist: newshixun_service_configsagin,
})
if(e.props.mirror_name===null){
this.setState({
choice_main_type: value,
standard_scripts: response.data,
})
}else{
this.setState({
choice_main_type: value,
standard_scripts: response.data,
shixun_service_configs: newshixun_service_configsagin,
shixun_service_configlist: newshixun_service_configsagin,
})
}
}
}).catch((error) => {
@ -476,46 +485,52 @@ class Shixuninformation extends Component {
})
}
littleClass = (value,e) => {
let newshixun_service_configs = this.state.shixun_service_configs;
let newchoice_small_type = this.state.choice_small_type;
let list = []
list.push(this.state.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
}
let newshixun_service_configs = this.state.shixun_service_configs;
let newchoice_small_type = this.state.choice_small_type;
let list = []
list.push(this.state.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)
if(e.props.mirror_name===null){
this.setState({
choice_small_type: newchoice_small_type,
})
}else{
this.setState({
choice_small_type: newchoice_small_type,
shixun_service_configs: newshixun_service_configsagin,
shixun_service_configlist: newshixun_service_configsagin,
})
}
)
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,
})
}
SelectScput = (value, e) => {
@ -704,9 +719,6 @@ class Shixuninformation extends Component {
})
}
});
this.setState({
loading: false
})
}
Selectthestudent = (value) => {
@ -848,7 +860,7 @@ class Shixuninformation extends Component {
let itemtype=item.type_name.toLowerCase().indexOf('jupyter'.toLowerCase())
if(itemtype>-1) {
return (
<Option value={item.id} key={key} name={item.description}>
<Option value={item.id} key={key} name={item.description} mirror_name={item.mirror_name}>
<Tooltip placement="right" title={item.description === "" ? "无描述" : item.description}>
{item.type_name}
</Tooltip>
@ -902,7 +914,7 @@ class Shixuninformation extends Component {
{
this.props.data === undefined ? "" : this.props.data.shixun&&this.props.data.shixun.small_type.map((item, key) => {
return (
<Option value={item.id} key={key} name={item.description}>
<Option value={item.id} key={key} name={item.description} mirror_name={item.mirror_name}>
<Tooltip placement="right" title={item.description === "" ? "无描述" : item.description}>
{item.type_name}
</Tooltip>
@ -1037,7 +1049,7 @@ class Shixuninformation extends Component {
{ this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true?"": <span className="ant-form-text mt20">私密版本库
<Checkbox onChange={this.simionChange}
value={this.state.simichecked}>
checked={this.state.simichecked}>
{this.state.simichecked===false?"(若需要对学员隐藏部分版本库内容时,请选中;选中保存后表示启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库)":"已创建的私密版本库及其内容,将在“保存”时被删除"}</Checkbox>
</span>}

@ -57,14 +57,14 @@ export default class TPMsettings extends Component {
});
if(key==="3"&&this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter === true){
this.props.history.replace(`/shixuns/${this.props.match.params.shixunId}/challenges`);
window.location.href =`/shixuns/${this.props.match.params.shixunId}/challenges`;
}else{
if(key){
this.setState({
activeKeys:key
})
}else{
this.props.history.replace(`/shixuns/${this.props.match.params.shixunId}/challenges`);
window.location.href =`/shixuns/${this.props.match.params.shixunId}/challenges`;
}
}

@ -53,13 +53,8 @@ class TPMNav extends Component {
{/*jupyter*/}
{
this.props.is_jupyter===true?
(
is_teacher===true?
<Link to={`/shixuns/${shixunId}/dataset`}
className={`${match.url.indexOf('dataset') != -1 ? 'active' : ''} fl mr40`}>数据集</Link>
:""
)
:""
}
@ -80,12 +75,8 @@ class TPMNav extends Component {
<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>
:
is_teacher===true?
<Link to={`/shixuns/${shixunId}/audit_situation`}
className={`${match.url.indexOf('audit_situation') != -1 ? 'active' : ''} fl`}>审核情况</Link>
:
""
)

@ -97,6 +97,7 @@ class Newshixuns extends Component {
})
const mdContnet = this.contentMdRef.current.getValue().trim();
this.props.form.validateFieldsAndScroll((err, values) => {
debugger
if (!err) {
console.log('Received values of form: ', values);
@ -117,21 +118,20 @@ class Newshixuns extends Component {
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
} else {
this.setState({
loading: true
loading: false
})
}
}).catch((error) => {
this.setState({
loading: true
loading: false
})
})
}else{
this.setState({
loading: false
})
}
});
this.setState({
loading: false
})
};
Selectthestudent = (value) => {
this.props.form.setFieldsValue({
@ -456,14 +456,14 @@ class Newshixuns extends Component {
</div>
<div className="padding10-20 color-grey-3 clearfix">
<Form>
{this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.business===true?<Form.Item label="实训类型">
<Form.Item label="实训类型">
{getFieldDecorator('is_jupyter')(
<Radio.Group onChange={this.RadiovalueonChange}>
<Radio.Group onChange={this.RadiovalueonChange} value={this.state.Radiovalue}>
<Radio value="1">普通实训</Radio>
<Radio value="2">Jupyter实训</Radio>
{this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.business===true?<Radio value="2" >Jupyter实训</Radio>:""}
</Radio.Group>,
)}
</Form.Item>:""}
</Form.Item>
<Form.Item
label="名称"
className="mt15"

@ -190,6 +190,12 @@ class Challengesjupyter extends Component {
//管理员
const admin = this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
let mysidentity =false;
try {
mysidentity =this.props.identity < 5 &&ChallengesDataList&& ChallengesDataList.shixun_status< 3?true:false;
}catch (e) {
}
return (
<React.Fragment>
@ -258,7 +264,7 @@ class Challengesjupyter extends Component {
""
:
(
is_teacher===true?
admin===true||business===true||mysidentity===true?
<div className="sortinxdirection mt60">
<div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div>
@ -301,7 +307,7 @@ class Challengesjupyter extends Component {
}
</style>
{
is_teacher===true||admin===true||business===true||this.props.identity < 8?
admin===true||business===true||mysidentity===true?
<div className="mt35">
<div className="pb47">
{

@ -168,6 +168,8 @@ class InfosPath extends Component{
</Menu>
);
// console.log(this.props.user&&this.props.user.main_site)
return(
<div className="educontent">
<Spin size="large" spinning={isSpin}>
@ -327,7 +329,10 @@ class InfosPath extends Component{
<div className="square-list clearfix">
{/* 295 */}
{
page == 1 && is_current && !category ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:""
this.props.user&&this.props.user.main_site===true?page == 1 && is_current && !category ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:"":""
}
{
this.props.user&&this.props.user.main_site===false?this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?page == 1 && is_current && !category ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:"":"":""
}
{
(!data || (data && data.subjects.length==0)) && category && <NoneData></NoneData>

Loading…
Cancel
Save