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

dev_auth
杨树明 5 years ago
commit 5dd5721e66

@ -136,6 +136,33 @@ $(document).on('turbolinks:load', function(){
$('.sponsor-select').select2(selectOptions);
$('.allow-school-select').select2(selectOptions);
$('.manager-select').select2({
theme: 'bootstrap4',
placeholder: '请输入要添加的管理员姓名',
multiple: true,
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/admins/users',
dataType: 'json',
data: function(params){
return { keyword: params.term };
},
processResults: function(data){
return { results: data.users }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return $("<div class='row px-0'><span class='col-3'>" + item.real_name + "</span><span class='col-5 font-12'>" + item.school_name + "</span><span class='col-4 font-12'>" + item.hidden_phone + "</span></div>");
},
templateSelection: function(item){
if (item.id) {
}
return item.real_name || item.text;
}
});
// 排行榜
//链接

@ -0,0 +1,18 @@
$(document).on('turbolinks:load', function() {
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function(){
var $modal = $('.modal.admin-edit-subject-modal');
var $form = $modal.find('form.admin-edit-subject-form');
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
var url = $form.attr('action');
$.ajax({
method: 'PATCH',
dataType: 'script',
url: url,
data: $form.serialize()
});
});
})
});

@ -0,0 +1,107 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-subjects-index-page').length > 0) {
var $form = $('.subject-list-form');
// ************** 学校选择 *************
$form.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/api/schools/for_option.json',
dataType: 'json',
data: function(params){
return { keyword: params.term };
},
processResults: function(data){
return { results: data.schools }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return item.name;
},
templateSelection: function(item){
if (item.id) {
}
return item.name || item.text;
}
});
// 清空
$form.on('click', '.clear-btn', function(){
$form.find('select[name="status"]').val('');
$form.find('.school-select').val('').trigger('change');
$form.find('input[name="keyword"]').val('');
$form.find('#homepage_show').attr('checked', false);
$form.find('#excellent').attr('checked', false);
$form.find('input[type="submit"]').trigger('click');
})
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
// 定义状态切换监听事件
var defineStatusChangeFunc = function(doElement, undoElement, url, callback){
$('.subject-list-container').on('click', doElement, function(){
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
var subjectId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function(){
$.ajax({
url: '/admins/subjects/' + subjectId + url,
method: 'POST',
dataType: 'json',
success: function() {
show_success_flash();
$doAction.hide();
$undoAction.show();
if(callback && typeof callback === "function"){
callback(subjectId, url);
}
}
});
}
});
});
}
// 隐藏与取消隐藏
defineStatusChangeFunc('.hide-action', '.active-action', '/hide');
defineStatusChangeFunc('.active-action', '.hide-action', '/cancel_hide');
// 首页展示与取消首页展示
var homepageShowCallback = function(subjectId, url){
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
if(url === '/homepage_show'){
$subjectItem.find('.homepage-show-badge').show();
} else {
$subjectItem.find('.homepage-show-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage_show', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage_show', homepageShowCallback);
// 设为金课与取消金课
var excellentCallback = function(subjectId, url){
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
if(url === '/excellent'){
$subjectItem.find('.excellent-badge').show();
} else {
$subjectItem.find('.excellent-badge').hide();
}
}
defineStatusChangeFunc('.excellent-action', '.cancel-excellent-action', '/excellent', excellentCallback);
defineStatusChangeFunc('.cancel-excellent-action', '.excellent-action', '/cancel_excellent', excellentCallback);
}
});

@ -66,9 +66,9 @@ function customConfirm(opts){
return $.confirm($.extend({}, defaultOpts, opts))
}
function show_success_flash(){
function show_success_flash(message){
$.notify({
message: '操作成功'
message: message || '操作成功'
},{
type: 'success'
});

@ -21,9 +21,12 @@
flex-direction: column;
&-logo {
padding-left: 5px;
overflow: hidden;
margin-bottom: 10px;
& > .logo-label {
display: none;
}
}
}
@ -54,7 +57,7 @@
-ms-transform: translateX(50%);
transform: translateX(50%);
}
ul ul a {
padding: 10px !important;
@ -76,6 +79,23 @@
display: flex;
flex-direction: row;
justify-content: space-between;
&-logo {
display: flex;
justify-content: space-between;
align-items: center;
& > img {
width: 40px;
height: auto;
}
& > .logo-label {
font-size: 18px;
color: darkgrey;
margin-left: 10px;
}
}
}
#sidebarCollapse {
@ -183,7 +203,7 @@
ul li a {
padding: 10px;
font-size: 0.85em;
i {
margin-right: 0;
display: block;
@ -194,7 +214,7 @@
& > ul > li > a > i {
font-size: 1.8em;
}
ul ul a {
padding: 10px !important;
}

@ -22,7 +22,7 @@ class Admins::CompetitionSettingsController < Admins::BaseController
def basic_form_params
params.permit(:identifier, :name, :sub_title, :start_time, :end_time, :mode,
:identifier, :bonus, :awards_count, :description, :course_id, :teach_start_time,
:teach_end_time, sponsor_schools: [], region_schools: [])
:teach_end_time, sponsor_schools: [], region_schools: [], manager_ids: [])
end
def nav_form_params

@ -0,0 +1,71 @@
class Admins::SubjectsController < Admins::BaseController
def index
default_sort('created_at', 'desc')
subjects = Admins::SubjectQuery.call(params)
@subjects = paginate subjects.includes(:repertoire, :subject_level_system, user: { user_extension: :school })
end
def edit
@subject = current_subject
end
def update
current_subject.update!(update_params)
flash[:success] = '保存成功'
redirect_to admins_subjects_path
end
def destroy
current_subject.destroy!
render_delete_success
end
# 隐藏
def hide
current_subject.update!(hidden: true)
render_ok
end
# 展示
def cancel_hide
current_subject.update!(hidden: false)
render_ok
end
# 设为主页展示
def homepage_show
current_subject.update!(homepage_show: true)
render_ok
end
# 取消主页展示
def cancel_homepage_show
current_subject.update!(homepage_show: false)
render_ok
end
# 设为金课
def excellent
current_subject.update!(excellent: true)
render_ok
end
# 取消金课
def cancel_excellent
current_subject.update!(excellent: false)
render_ok
end
private
def current_subject
@_current_subject ||= Subject.find(params[:id])
end
def update_params
params.require(:subject).permit(:repertoire_id, :subject_level_system_id, :student_count)
end
end

@ -5,6 +5,7 @@ class Competitions::CompetitionsController < Competitions::BaseController
before_action :allow_visit, except: [:index]
before_action :require_admin, only: [:update, :update_inform]
before_action :chart_visible, only: [:charts, :chart_rules]
before_action :check_manager_permission!, only: [:update_md_content]
def index
# 已上架 或者 即将上架
@ -144,7 +145,10 @@ class Competitions::CompetitionsController < Competitions::BaseController
end
def allow_visit
render_forbidden unless current_competition.published? || admin_or_business?
return if current_competition.published? || admin_or_business?
return if current_competition.nearly_published? && current_competition.manager?(current_user)
render_forbidden
end
def chart_visible
@ -152,6 +156,13 @@ class Competitions::CompetitionsController < Competitions::BaseController
render_forbidden unless (chart_module.present? && !chart_module.hidden) || admin_or_business?
end
def check_manager_permission!
return if current_user.admin_or_business?
return if current_competition.nearly_published? && current_competition.manager?(current_user)
render_forbidden
end
# 竞赛成绩导出
def chart_to_xlsx records, competition
@competition_head_cells = []

@ -28,7 +28,8 @@ class CoursesController < ApplicationController
:switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course,
:informs, :update_informs, :online_learning, :update_task_position, :tasks_list,
:join_excellent_course, :export_couser_info, :export_member_act_score, :new_informs,
:delete_informs, :change_member_role, :course_groups, :join_course_group]
:delete_informs, :change_member_role, :course_groups, :join_course_group, :statistics,
:work_score, :act_score]
before_action :user_course_identity, except: [:join_excellent_course, :index, :create, :new, :apply_to_join_course,
:search_course_list, :get_historical_course_students, :mine, :search_slim, :board_list]
before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate,
@ -47,6 +48,7 @@ class CoursesController < ApplicationController
before_action :validate_page_size, only: :mine
before_action :course_tasks, only: [:tasks_list, :update_task_position]
before_action :validate_inform_params, only: [:update_informs, :new_informs]
before_action :course_member_allowed, only: [:statistics, :work_score, :act_score]
if RUBY_PLATFORM =~ /linux/
require 'simple_xlsx_reader'
@ -227,6 +229,39 @@ class CoursesController < ApplicationController
end
end
def statistics
max_exp = User.where(id: @course.students.pluck(:user_id)).pluck(:experience).max
limit = params[:limit] || 5
@top_scores = course_statistics(@course, max_exp, limit)
end
def work_score
sort = params[:sort] || "desc"
group_ids = params[:group_ids].is_a?(Array) ? params[:group_ids] : params[:group_ids].split(",") if params[:group_ids]
@course_members = course_work_scores @course, sort, group_ids
if @user_course_identity == Course::STUDENT
user_ids = @course_members.map(&:user_id)
@rank = user_ids.index(current_user.id).to_i + 1
@course_members = @course_members.select{|member| member.user_id == current_user.id}
else
@course_members = paginate @course_members
end
end
def act_score
group_ids = params[:group_ids].is_a?(Array) ? params[:group_ids] : params[:group_ids].split(",") if params[:group_ids]
all_members = course_act_scores @course, group_ids
@course_members = all_members[0 .. 9]
if @user_course_identity == Course::STUDENT
user_ids = all_members.map(&:user_id)
rank = user_ids.index(current_user.id).to_i + 1
if rank > 10
current_member = all_members.select{|member| member.user_id == current_user.id}
@course_members << current_member
end
end
end
def join_excellent_course
tip_exception("您已是课堂成员") if current_user.member_of_course?(@course)
tip_exception("请通过邀请码加入课堂") unless @course.excellent
@ -1379,6 +1414,10 @@ class CoursesController < ApplicationController
end
end
def course_member_allowed
tip_exception(403, "..") if @user_course_identity > Course::STUDENT
end
def course_tasks
case params[:container_type]
when 'shixun_homework'
@ -1466,319 +1505,93 @@ class CoursesController < ApplicationController
act_scores
end
def course_info_to_xlsx course
#课堂信息
@course_info = []
course_info_title = "课堂信息概要"
course_id = course.id
course_name = course.name
course_list_name = course.course_list.present? ? course.course_list.name : "--"
course_assistants = course.teachers
course_assistants_count = course_assistants&.size
course_assistants_name = course_assistants_count > 0 ? course_assistants.map{|m| m.user.real_name}.join('、') : "--"
course_teacher_member = course.course_members.course_user_role(%i[CREATOR])
course_teacher = course_teacher_member.present? ? course_teacher_member.first.user.real_name : "--"
course_class_counts = course.course_groups_count
course_students_count = course.students.size
course_1 = ["课堂编号",course_id]
course_2 = ["课程名称",course_list_name]
course_3 = ["课堂名称",course_name]
course_4 = ["教师团队(#{course_assistants_count})", course_assistants_name]
course_5 = ["主讲教师", course_teacher]
course_6 = ["分班",course_class_counts]
course_7 = ["学生", course_students_count]
course_main_info = [course_1,course_2,course_3,course_4,course_5,course_6,course_7]
course_group_info_head = %w(序号 分班名称 邀请码 学生数量)
course_group_info_body = []
none_group_counts = course.none_group_count
#当有未分班时,应该也做个统计
if none_group_counts > 0
none_group_index = 2
no_group_array = [1,"未分班",course.invite_code,none_group_counts]
course_group_info_body.push(no_group_array)
else
none_group_index = 1
end
if course.course_groups.exists?
course.course_groups.each_with_index do |group, index|
group_index = (index+none_group_index)
group_name = group.name
group_code = group.invite_code
group_count = group.course_members_count
group_array = [group_index,group_name,group_code,group_count]
course_group_info_body.push(group_array)
end
end
course_group_info = [course_group_info_head,course_group_info_body]
@course_info += [course_info_title,course_main_info,course_group_info]
end
def act_score_to_xlsx all_members
#课堂活跃度
@user_activity_level = []
course_user_level = []
course_activity_title = "课堂活跃度统计"
user_cell_head = %w(排名 真实姓名 登录名 邮箱 学号 学校 分班 作业完成数(*10) 试卷完成数(*10) 问卷完成数(*7) 资源发布数(*5) 帖子发布数(*2) 帖子回复数(*1) 作业回复数(*1) 活跃度)
all_members.each do |u|
#用户的基本信息
user = u.user
user_login = user.login
user_name = user.real_name
user_mail = user.mail
user_stu_id = u.student_id.present? ? (u.student_id.to_s + "\t") : "--"
user_school = user.school_name
user_course_group = u.course_group_name
#课堂活跃度统计
user_homeworks_num = u.homework_num.to_i #完成的作业数
user_graduate_num = u.graduation_num.to_i #毕业任务完成数
user_exercise_num = u.exercise_num.to_i #根据试卷的id来查找
user_poll_num = u.poll_num.to_i #已完成问卷
user_file_num = u.resource_num.to_i
user_messages_num = u.message_num.to_i #帖子发布数
user_reply_num = u.message_reply_num.to_i #帖子回复数
user_work_reply_num = u.homework_journal_num.to_i #作业回复数的数量
c_works_num = (user_homeworks_num + user_graduate_num)*10
c_exercise_num = user_exercise_num*10
c_poll_num = user_poll_num*7
c_file_num = user_file_num*5
c_message_num = user_messages_num*2
c_reply_num = user_reply_num
user_activity_levels = c_works_num + c_exercise_num + c_poll_num + c_file_num + c_message_num + c_reply_num + user_work_reply_num
user_ac_level = {
u_1: user_name,
u_2: user_login,
u_2_1: user_mail,
u_3: user_stu_id,
u_4: user_school,
u_5: user_course_group,
u_6: c_works_num,
u_7: c_exercise_num,
u_8: c_poll_num,
u_9: c_file_num,
u_10: c_message_num,
u_11: c_reply_num,
u_12: user_work_reply_num,
u_13: user_activity_levels
}
course_user_level.push(user_ac_level)
#.课堂活跃度统计的集合
course_user_level = course_user_level.sort_by {|k| k[:u_13]}.reverse
@user_activity_level = [course_activity_title,user_cell_head,course_user_level]
end
end
def member_to_xlsx(course,all_members,homeworks,exercises,tasks)
#课堂的作业信息
shixun_homeworks = homeworks.search_homework_type(4) #全部实训作业
shixun_titles = shixun_homeworks.pluck(:name) + ["总得分"]
# 更新实训作业成绩
unless course.is_end
shixun_homeworks.includes(:homework_challenge_settings, :published_settings, :homework_commons_shixun).each do |homework|
homework.update_homework_work_score
end
end
shixun_homeworks = shixun_homeworks&.includes(score_student_works: :user)
common_homeworks = homeworks.search_homework_type(1) #全部普通作业
common_titles = common_homeworks.pluck(:name)+ ["总得分"]
common_homeworks = common_homeworks&.includes(score_student_works: :user)
group_homeworks = homeworks.search_homework_type(3) #全部分组作业
group_titles = group_homeworks.pluck(:name)+ ["总得分"]
group_homeworks = group_homeworks&.includes(score_student_works: :user)
task_titles = tasks.pluck(:name) + ["总得分"]
tasks = tasks&.includes(user: :user_extension, score_graduation_works: :user)
exercise_titles = exercises.pluck(:exercise_name) + ["总得分"]
exercises = exercises&.includes(user: :user_extension, score_exercise_users: :user)
total_user_score_array = [] #学生总成绩集合
all_members.each do |u|
#用户的基本信息
user = u.user
user_login = user.login
user_name = user.real_name
user_mail = user.mail
user_stu_id = user.student_id.present? ? (user.student_id.to_s + "\t") : "--"
user_school = user.school_name
user_course_group = u.course_group_name
user_info_array = [user_name,user_login,user_mail,user_stu_id,user_school,user_course_group] #用户的信息集合
user_work_scores = []
#学生总成绩
shixun_score = 0.0 # 实训作业的总分
common_score = 0.0 #普通作业的总分
group_score = 0.0 #分组作业的总分
task_score = 0.0 # 毕业任务的总得分
exercise_score = 0.0 #试卷的总得分
shixun_score_array = []
common_score_array = []
group_score_array = []
task_score_array = []
exercise_score_array = []
#实训作业
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 #当前用户的对该作业的回答
if user_student_work.nil?
h_score = 0.0 #该作业的得分为0
else
h_score = user_student_work.work_score.nil? ? 0.0 : user_student_work.work_score #用户对该作业的分数
end
shixun_score_array.push(h_score)
end
end
shixun_score += shixun_score_array.sum
shixun_score_array.push(shixun_score) #shixun_score_array的最后一行为总分
user_work_scores += user_info_array + shixun_score_array #单个用户的实训作业得分信息
#普通作业
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 #当前用户的对该作业的回答
if user_student_work_1.nil?
h_score_1 = 0.0 #该作业的得分为0
else
h_score_1 = user_student_work_1.work_score.nil? ? 0.0 : user_student_work_1.work_score #用户对该作业的分数
end
common_score_array.push(h_score_1)
end
end
common_score += common_score_array.sum
common_score_array.push(common_score) #shixun_score_array的最后一行为总分
user_work_scores += common_score_array #单个用户的普通作业得分信息
#分组作业
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 #当前用户的对该作业的回答
if user_student_work_3.nil?
h_score_3 = 0.0 #该作业的得分为0
else
h_score_3 = user_student_work_3.work_score.nil? ? 0.0 : user_student_work_3.work_score #用户对该作业的分数
end
group_score_array.push(h_score_3)
end
end
group_score += group_score_array.sum
group_score_array.push(group_score) #shixun_score_array的最后一行为总分
user_work_scores += group_score_array #单个用户的分组作业得分信息
#毕设作业
if tasks.size > 0
tasks.each do |task|
graduation_work = task.score_graduation_works.select{|work| work.user_id == user.id}.first
if graduation_work.nil?
t_score = 0.0
else
t_score = graduation_work.work_score.nil? ? 0.0 : graduation_work.work_score
end
task_score_array.push(t_score)
end
end
task_score += task_score_array.sum
task_score_array.push(task_score)
user_work_scores += task_score_array #单个用户的分组作业得分信息
#试卷
if exercises.size > 0
exercises.each do |ex|
exercise_work = ex.score_exercise_users.select{|work| work.user_id == user.id}.first
if exercise_work.nil?
e_score = 0.0
else
e_score = exercise_work.score.nil? ? 0.0 : exercise_work.score
end
exercise_score_array.push(e_score)
end
end
exercise_score += exercise_score_array.sum
exercise_score_array.push(exercise_score)
user_work_scores += exercise_score_array #单个用户的分组作业得分信息
total_user_scores = shixun_score + common_score + group_score + task_score + exercise_score
user_work_scores.push(total_user_scores) #个人的行内容添加总成绩
total_user_score_array.push(user_work_scores) # 全部成员的集合
end
#2.学生总成绩的集合
## 作业标题的集合
course_user_score_title = "学生总成绩"
score_title_cells = shixun_titles + common_titles + group_titles + task_titles + exercise_titles
score_title_counts = [shixun_titles.count,common_titles.count,group_titles.count,task_titles.count,exercise_titles.count]
score_cell_head = %w(序号 真实姓名 登录名 邮箱 学号 学校 分班) + score_title_cells + ["个人总成绩"]
@course_user_scores = [course_user_score_title,score_cell_head,score_title_counts,total_user_score_array]
#作业的全部集合
@shixun_work_arrays = []
@group_work_arrays = []
@common_work_arrays = []
@task_work_arrays = []
@exercise_work_arrays = []
count_1 = shixun_homeworks.size
count_2 = common_homeworks.size
count_3 = group_homeworks.size
count_4 = tasks.size
#实训作业
shixun_homeworks.each_with_index do |s,index|
all_student_works = s.score_student_works #该实训题的全部用户回答
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)
shixun_work_content = [shixun_work_display_name,@work_head_cells,@work_cells_column]
@shixun_work_arrays.push(shixun_work_content)
end
#普通作业
common_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works #当前用户的对该作业的回答
title_no = count_1 + 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)
work_content = [work_name,@work_head_cells,@work_cells_column]
@common_work_arrays.push(work_content)
title_no
end
#分组作业
group_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works #当前用户的对该作业的回答
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)
work_content = [work_name,@work_head_cells,@work_cells_column]
@group_work_arrays.push(work_content)
end
#毕设任务
tasks.each_with_index do |c,index|
all_student_works = c.score_graduation_works #当前用户的对该作业的回答
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)
work_content = [work_name,@head_cells_column,@task_cells_column]
@task_work_arrays.push(work_content)
end
#试卷的导出
exercises.each_with_index do |c,index|
all_student_works = c.score_exercise_users #当前用户的对该作业的回答
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)
work_content = [work_name,@table_columns,@user_columns]
@exercise_work_arrays.push(work_content)
end
def course_statistics course, max_exp, limit
max_rate = 20.0 / max_exp
sql_select = %Q{ SELECT a.*, (message_num*0.2 + message_reply_num*0.1 + resource_num*0.5 + homework_journal_num*0.1 + graduation_num +
homework_num + exercise_num + poll_num*0.7 + exercise_score * 0.7 + graduation_score * 0.7 + homework_score * 0.7 + exp*#{max_rate})
AS score from
(select cm.*, users.experience as exp,
(SELECT count(messages.id) FROM messages join boards on messages.board_id = boards.id WHERE boards.course_id = #{course.id}
AND messages.author_id = cm.user_id and messages.parent_id is null) AS message_num,
(SELECT count(messages.id) FROM messages join boards on messages.board_id = boards.id WHERE boards.course_id = #{course.id}
AND messages.author_id = cm.user_id and messages.parent_id is not null) AS message_reply_num,
(SELECT count(attachments.id) FROM attachments WHERE container_id = #{course.id} and container_type = "Course"
AND attachments.author_id = cm.user_id) AS resource_num,
(SELECT count(jfm.id) FROM journals_for_messages AS jfm, homework_commons hs WHERE jfm.jour_id = hs.id AND
jfm.user_id = cm.user_id and jfm.jour_type = "HomeworkCommon" and hs.course_id = #{course.id}) AS homework_journal_num,
(SELECT COUNT(gw.id) FROM graduation_works AS gw, graduation_tasks AS gt WHERE gw.graduation_task_id = gt.id AND
gt.course_id = #{course.id} AND gw.work_status != 0 AND gw.user_id = cm.user_id) AS graduation_num,
(SELECT IFNULL(sum(gw.work_score),0) FROM graduation_works AS gw, graduation_tasks AS gt WHERE gw.graduation_task_id = gt.id AND
gt.course_id = #{course.id} AND gw.work_status != 0 AND gw.user_id = cm.user_id) AS graduation_score,
(SELECT COUNT(ss.id) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND
hc.course_id = #{course.id} AND ss.work_status != 0 AND ss.user_id = cm.user_id) AS homework_num,
(SELECT IFNULL(sum(ss.work_score),0) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND
hc.course_id = #{course.id} AND ss.work_status != 0 AND ss.user_id = cm.user_id) AS homework_score,
(SELECT COUNT(eu.id) FROM exercise_users AS eu,exercises WHERE eu.exercise_id = exercises.id AND exercises.course_id = #{course.id}
AND eu.commit_status = 1 AND eu.user_id = cm.user_id) AS exercise_num,
(SELECT IFNULL(sum(eu.score),0) FROM exercise_users AS eu,exercises WHERE eu.exercise_id = exercises.id AND exercises.course_id = #{course.id}
AND eu.commit_status = 1 AND eu.user_id = cm.user_id) AS exercise_score,
(SELECT COUNT(pu.id) FROM poll_users AS pu, polls WHERE pu.poll_id = polls.id AND polls.course_id = #{course.id}
AND pu.commit_status = 1 AND pu.user_id = cm.user_id) AS poll_num
FROM course_members cm join users on cm.user_id = users.id
WHERE cm.role = 4 and cm.course_id = #{course.id}) a ORDER BY score desc limit #{limit};
}
CourseMember.find_by_sql(sql_select)
end
def course_work_scores course, sort, group_ids
sql_select = %Q{ SELECT a.*,
(exercise_score + graduation_score + common_score + practice_score + group_score) AS score from
(select cm.*,
(SELECT IFNULL(sum(gw.work_score),0) FROM graduation_works AS gw, graduation_tasks AS gt WHERE gw.graduation_task_id = gt.id AND
gt.course_id = #{course.id} AND gw.work_status != 0 AND gw.user_id = cm.user_id) AS graduation_score,
(SELECT IFNULL(sum(ss.work_score),0) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND
hc.course_id = #{course.id} AND ss.work_status != 0 AND ss.user_id = cm.user_id and hc.homework_type=1) AS common_score,
(SELECT IFNULL(sum(ss.work_score),0) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND
hc.course_id = #{course.id} AND ss.work_status != 0 AND ss.user_id = cm.user_id and hc.homework_type=3) AS group_score,
(SELECT IFNULL(sum(ss.work_score),0) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND
hc.course_id = #{course.id} AND ss.work_status != 0 AND ss.user_id = cm.user_id and hc.homework_type=4) AS practice_score,
(SELECT IFNULL(sum(eu.score),0) FROM exercise_users AS eu,exercises WHERE eu.exercise_id = exercises.id AND exercises.course_id = #{course.id}
AND eu.commit_status = 1 AND eu.user_id = cm.user_id) AS exercise_score
FROM course_members cm join users on cm.user_id = users.id
WHERE cm.role = 4 and cm.course_id = #{course.id}
}
sql_select += %Q{ and cm.course_group_id in (#{group_ids.join(",")}) } if group_ids.present?
sql_select += %Q{ ) a ORDER BY score #{sort}; }
course_members = CourseMember.find_by_sql(sql_select)
course_members
end
def course_act_scores course, group_ids
sql_select = %Q{ SELECT a.*,
(message_num*2 + message_reply_num + resource_num*5 + homework_journal_num + graduation_num*10 + homework_num*10 + exercise_num*10 + poll_num*7) AS score from
(select cm.*,
(SELECT count(messages.id) FROM messages join boards on messages.board_id = boards.id WHERE boards.course_id = #{course.id}
AND messages.author_id = cm.user_id and messages.parent_id is null) AS message_num,
(SELECT count(messages.id) FROM messages join boards on messages.board_id = boards.id WHERE boards.course_id = #{course.id}
AND messages.author_id = cm.user_id and messages.parent_id is not null) AS message_reply_num,
(SELECT count(attachments.id) FROM attachments WHERE container_id = #{course.id} and container_type = "Course"
AND attachments.author_id = cm.user_id) AS resource_num,
(SELECT count(jfm.id) FROM journals_for_messages AS jfm, homework_commons hs WHERE jfm.jour_id = hs.id AND
jfm.user_id = cm.user_id and jfm.jour_type = "HomeworkCommon" and hs.course_id = #{course.id}) AS homework_journal_num,
(SELECT COUNT(gw.id) FROM graduation_works AS gw, graduation_tasks AS gt WHERE gw.graduation_task_id = gt.id AND
gt.course_id = #{course.id} AND gw.work_status != 0 AND gw.user_id = cm.user_id) AS graduation_num,
(SELECT COUNT(ss.id) FROM student_works AS ss ,homework_commons AS hc WHERE ss.homework_common_id = hc.id AND
hc.course_id = #{course.id} AND ss.work_status != 0 AND ss.user_id = cm.user_id) AS homework_num,
(SELECT COUNT(eu.id) FROM exercise_users AS eu,exercises WHERE eu.exercise_id = exercises.id AND exercises.course_id = #{course.id}
AND eu.commit_status = 1 AND eu.user_id = cm.user_id) AS exercise_num,
(SELECT COUNT(pu.id) FROM poll_users AS pu, polls WHERE pu.poll_id = polls.id AND polls.course_id = #{course.id}
AND pu.commit_status = 1 AND pu.user_id = cm.user_id) AS poll_num
FROM course_members cm join users on cm.user_id = users.id
join user_extensions ue on ue.user_id = users.id
WHERE cm.role = 4 and cm.course_id = #{course.id}
}
sql_select += %Q{ and cm.course_group_id in (#{group_ids.join(",")}) } if group_ids.present?
sql_select += %Q{ ) a ORDER BY score desc; }
course_members = CourseMember.find_by_sql(sql_select)
course_members
end
end

@ -1241,6 +1241,8 @@ class ExercisesController < ApplicationController
#筛选/分类,排序
order = params[:order]
order_type = params[:order_type] || "desc"
if @exercise_users_list.present? && @exercise_users_list.size > 0
@exercise_users_count = @exercise_users_list.size #当前显示的全部成员数量
teacher_reviews = @exercise_users_list.exercise_review
@ -1280,11 +1282,11 @@ class ExercisesController < ApplicationController
exercise_user_joins = @exercise_users_list.joins(user: :user_extension)
if order == "student_id"
@exercise_users_list = exercise_user_joins.order("user_extensions.student_id DESC")
@exercise_users_list = exercise_user_joins.order("user_extensions.student_id #{order_type}")
elsif order == "score"
@exercise_users_list = exercise_user_joins.order("#{order} DESC")
@exercise_users_list = exercise_user_joins.order("#{order} #{order_type}")
else
@exercise_users_list = exercise_user_joins.order("end_at DESC, start_at DESC")
@exercise_users_list = exercise_user_joins.order("end_at #{order_type}, start_at #{order_type}")
end
@export_ex_users = @exercise_users_list
@ -1407,11 +1409,16 @@ class ExercisesController < ApplicationController
min_score = exercise_scores.min.present? ? exercise_scores.min : 0.0
max_score = exercise_scores.max.present? ? exercise_scores.max : 0.0
total_score = exercise_scores.sum.present? ? exercise_scores.sum : 0.0
average_score = @exercise_commit_user_counts > 0 ? (total_score / @exercise_commit_user_counts).round(1) : 0.0
fail_counts = exercise_scores.count{|a| a < 60.0}
pass_counts = exercise_scores.count{|a| a < 70.0 && a >= 60.0}
good_counts = exercise_scores.count{|a| a < 90.0 && a >= 70.0}
best_counts = exercise_scores.count{|a| a >= 90.0 && a <= 100.0}
average_score = @exercise_commit_user_counts > 0 ? (total_score.round(1) / @exercise_commit_user_counts).round(1) : 0.0
question_scores = @exercise.question_scores
fail_score = question_scores * 0.6.round(2)
pass_score = question_scores * 0.7.round(2)
good_score = question_scores * 0.9.round(2)
fail_counts = exercise_scores.count{|a| a < fail_score}
pass_counts = exercise_scores.count{|a| a < pass_score && a >= fail_score}
good_counts = exercise_scores.count{|a| a < good_score && a >= pass_score}
best_counts = exercise_scores.count{|a| a >= good_score && a <= question_scores}
end
@counts_array = {
:commit_percent => commit_percent,

@ -1068,7 +1068,7 @@ class PollsController < ApplicationController
#筛选/分类,排序
order = params[:order]
# b_sort = params[:sort] || "desc"
order_type = params[:order_type] || "desc"
choose_type = params[:commit_status]
group_id = params[:poll_group_id]
search_content = params[:search]
@ -1095,9 +1095,9 @@ class PollsController < ApplicationController
poll_users_joins = @poll_users_list.joins(user: :user_extension)
if order == "student_id"
@poll_users_list = poll_users_joins.order("user_extensions.student_id DESC")
@poll_users_list = poll_users_joins.order("user_extensions.student_id #{order_type}")
else
@poll_users_list = poll_users_joins.order("end_at DESC")
@poll_users_list = poll_users_joins.order("end_at #{order_type}")
end
@poll_users_size = @poll_users_list.count

@ -0,0 +1,11 @@
module Admins::SubjectsHelper
def display_subject_status(subject)
style =
case subject.status
when 0 then 'text-secondary'
when 1 then 'text-warning'
when 2 then 'text-success'
end
raw content_tag(:span, t("subject.status.#{subject.status}"), class: style)
end
end

@ -9,6 +9,323 @@ module ExportHelper
OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip"
MAX_PATH = 50
# 课堂成绩导出
def member_to_xlsx(course,all_members,homeworks,exercises,tasks)
#课堂的作业信息
shixun_homeworks = homeworks.search_homework_type(4) #全部实训作业
shixun_titles = shixun_homeworks.pluck(:name) + ["总得分"]
# 更新实训作业成绩
unless course.is_end
shixun_homeworks.includes(:homework_challenge_settings, :published_settings, :homework_commons_shixun).each do |homework|
homework.update_homework_work_score
end
end
shixun_homeworks = shixun_homeworks&.includes(score_student_works: :user)
common_homeworks = homeworks.search_homework_type(1) #全部普通作业
common_titles = common_homeworks.pluck(:name)+ ["总得分"]
common_homeworks = common_homeworks&.includes(score_student_works: :user)
group_homeworks = homeworks.search_homework_type(3) #全部分组作业
group_titles = group_homeworks.pluck(:name)+ ["总得分"]
group_homeworks = group_homeworks&.includes(score_student_works: :user)
task_titles = tasks.pluck(:name) + ["总得分"]
tasks = tasks&.includes(user: :user_extension, score_graduation_works: :user)
exercise_titles = exercises.pluck(:exercise_name) + ["总得分"]
exercises = exercises&.includes(user: :user_extension, score_exercise_users: :user)
total_user_score_array = [] #学生总成绩集合
all_members.each do |u|
#用户的基本信息
user = u.user
user_login = user.login
user_name = user.real_name
user_mail = user.mail
user_stu_id = user.student_id.present? ? (user.student_id.to_s + "\t") : "--"
user_school = user.school_name
user_course_group = u.course_group_name
user_info_array = [user_name,user_login,user_mail,user_stu_id,user_school,user_course_group] #用户的信息集合
user_work_scores = []
#学生总成绩
shixun_score = 0.0 # 实训作业的总分
common_score = 0.0 #普通作业的总分
group_score = 0.0 #分组作业的总分
task_score = 0.0 # 毕业任务的总得分
exercise_score = 0.0 #试卷的总得分
shixun_score_array = []
common_score_array = []
group_score_array = []
task_score_array = []
exercise_score_array = []
#实训作业
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 #当前用户的对该作业的回答
if user_student_work.nil?
h_score = 0.0 #该作业的得分为0
else
h_score = user_student_work.work_score.nil? ? 0.0 : user_student_work.work_score #用户对该作业的分数
end
shixun_score_array.push(h_score)
end
end
shixun_score += shixun_score_array.sum
shixun_score_array.push(shixun_score) #shixun_score_array的最后一行为总分
user_work_scores += user_info_array + shixun_score_array #单个用户的实训作业得分信息
#普通作业
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 #当前用户的对该作业的回答
if user_student_work_1.nil?
h_score_1 = 0.0 #该作业的得分为0
else
h_score_1 = user_student_work_1.work_score.nil? ? 0.0 : user_student_work_1.work_score #用户对该作业的分数
end
common_score_array.push(h_score_1)
end
end
common_score += common_score_array.sum
common_score_array.push(common_score) #shixun_score_array的最后一行为总分
user_work_scores += common_score_array #单个用户的普通作业得分信息
#分组作业
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 #当前用户的对该作业的回答
if user_student_work_3.nil?
h_score_3 = 0.0 #该作业的得分为0
else
h_score_3 = user_student_work_3.work_score.nil? ? 0.0 : user_student_work_3.work_score #用户对该作业的分数
end
group_score_array.push(h_score_3)
end
end
group_score += group_score_array.sum
group_score_array.push(group_score) #shixun_score_array的最后一行为总分
user_work_scores += group_score_array #单个用户的分组作业得分信息
#毕设作业
if tasks.size > 0
tasks.each do |task|
graduation_work = task.score_graduation_works.select{|work| work.user_id == user.id}.first
if graduation_work.nil?
t_score = 0.0
else
t_score = graduation_work.work_score.nil? ? 0.0 : graduation_work.work_score
end
task_score_array.push(t_score)
end
end
task_score += task_score_array.sum
task_score_array.push(task_score)
user_work_scores += task_score_array #单个用户的分组作业得分信息
#试卷
if exercises.size > 0
exercises.each do |ex|
exercise_work = ex.score_exercise_users.select{|work| work.user_id == user.id}.first
if exercise_work.nil?
e_score = 0.0
else
e_score = exercise_work.score.nil? ? 0.0 : exercise_work.score
end
exercise_score_array.push(e_score)
end
end
exercise_score += exercise_score_array.sum
exercise_score_array.push(exercise_score)
user_work_scores += exercise_score_array #单个用户的分组作业得分信息
total_user_scores = shixun_score + common_score + group_score + task_score + exercise_score
user_work_scores.push(total_user_scores) #个人的行内容添加总成绩
total_user_score_array.push(user_work_scores) # 全部成员的集合
end
#2.学生总成绩的集合
## 作业标题的集合
course_user_score_title = "学生总成绩"
score_title_cells = shixun_titles + common_titles + group_titles + task_titles + exercise_titles
score_title_counts = [shixun_titles.count,common_titles.count,group_titles.count,task_titles.count,exercise_titles.count]
score_cell_head = %w(序号 真实姓名 登录名 邮箱 学号 学校 分班) + score_title_cells + ["个人总成绩"]
@course_user_scores = [course_user_score_title,score_cell_head,score_title_counts,total_user_score_array]
#作业的全部集合
@shixun_work_arrays = []
@group_work_arrays = []
@common_work_arrays = []
@task_work_arrays = []
@exercise_work_arrays = []
count_1 = shixun_homeworks.size
count_2 = common_homeworks.size
count_3 = group_homeworks.size
count_4 = tasks.size
#实训作业
shixun_homeworks.each_with_index do |s,index|
all_student_works = s.score_student_works #该实训题的全部用户回答
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)
shixun_work_content = [shixun_work_display_name,@work_head_cells,@work_cells_column]
@shixun_work_arrays.push(shixun_work_content)
end
#普通作业
common_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works #当前用户的对该作业的回答
title_no = count_1 + 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)
work_content = [work_name,@work_head_cells,@work_cells_column]
@common_work_arrays.push(work_content)
title_no
end
#分组作业
group_homeworks.each_with_index do |c,index|
all_student_works = c.score_student_works #当前用户的对该作业的回答
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)
work_content = [work_name,@work_head_cells,@work_cells_column]
@group_work_arrays.push(work_content)
end
#毕设任务
tasks.each_with_index do |c,index|
all_student_works = c.score_graduation_works #当前用户的对该作业的回答
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)
work_content = [work_name,@head_cells_column,@task_cells_column]
@task_work_arrays.push(work_content)
end
#试卷的导出
exercises.each_with_index do |c,index|
all_student_works = c.score_exercise_users #当前用户的对该作业的回答
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)
work_content = [work_name,@table_columns,@user_columns]
@exercise_work_arrays.push(work_content)
end
end
#课堂活跃度
def act_score_to_xlsx all_members
@user_activity_level = []
course_user_level = []
course_activity_title = "课堂活跃度统计"
user_cell_head = %w(排名 真实姓名 登录名 邮箱 学号 学校 分班 作业完成数(*10) 试卷完成数(*10) 问卷完成数(*7) 资源发布数(*5) 帖子发布数(*2) 帖子回复数(*1) 作业回复数(*1) 活跃度)
all_members.each do |u|
#用户的基本信息
user = u.user
user_login = user.login
user_name = user.real_name
user_mail = user.mail
user_stu_id = u.student_id.present? ? (u.student_id.to_s + "\t") : "--"
user_school = user.school_name
user_course_group = u.course_group_name
#课堂活跃度统计
user_homeworks_num = u.homework_num.to_i #完成的作业数
user_graduate_num = u.graduation_num.to_i #毕业任务完成数
user_exercise_num = u.exercise_num.to_i #根据试卷的id来查找
user_poll_num = u.poll_num.to_i #已完成问卷
user_file_num = u.resource_num.to_i
user_messages_num = u.message_num.to_i #帖子发布数
user_reply_num = u.message_reply_num.to_i #帖子回复数
user_work_reply_num = u.homework_journal_num.to_i #作业回复数的数量
c_works_num = (user_homeworks_num + user_graduate_num)*10
c_exercise_num = user_exercise_num*10
c_poll_num = user_poll_num*7
c_file_num = user_file_num*5
c_message_num = user_messages_num*2
c_reply_num = user_reply_num
user_activity_levels = c_works_num + c_exercise_num + c_poll_num + c_file_num + c_message_num + c_reply_num + user_work_reply_num
user_ac_level = {
u_1: user_name,
u_2: user_login,
u_2_1: user_mail,
u_3: user_stu_id,
u_4: user_school,
u_5: user_course_group,
u_6: c_works_num,
u_7: c_exercise_num,
u_8: c_poll_num,
u_9: c_file_num,
u_10: c_message_num,
u_11: c_reply_num,
u_12: user_work_reply_num,
u_13: user_activity_levels
}
course_user_level.push(user_ac_level)
#.课堂活跃度统计的集合
course_user_level = course_user_level.sort_by {|k| k[:u_13]}.reverse
@user_activity_level = [course_activity_title,user_cell_head,course_user_level]
end
end
def course_info_to_xlsx course
#课堂信息
@course_info = []
course_info_title = "课堂信息概要"
course_id = course.id
course_name = course.name
course_list_name = course.course_list.present? ? course.course_list.name : "--"
course_assistants = course.teachers
course_assistants_count = course_assistants&.size
course_assistants_name = course_assistants_count > 0 ? course_assistants.map{|m| m.user.real_name}.join('、') : "--"
course_teacher_member = course.course_members.course_user_role(%i[CREATOR])
course_teacher = course_teacher_member.present? ? course_teacher_member.first.user.real_name : "--"
course_class_counts = course.course_groups_count
course_students_count = course.students.size
course_1 = ["课堂编号",course_id]
course_2 = ["课程名称",course_list_name]
course_3 = ["课堂名称",course_name]
course_4 = ["教师团队(#{course_assistants_count})", course_assistants_name]
course_5 = ["主讲教师", course_teacher]
course_6 = ["分班",course_class_counts]
course_7 = ["学生", course_students_count]
course_main_info = [course_1,course_2,course_3,course_4,course_5,course_6,course_7]
course_group_info_head = %w(序号 分班名称 邀请码 学生数量)
course_group_info_body = []
none_group_counts = course.none_group_count
#当有未分班时,应该也做个统计
if none_group_counts > 0
none_group_index = 2
no_group_array = [1,"未分班",course.invite_code,none_group_counts]
course_group_info_body.push(no_group_array)
else
none_group_index = 1
end
if course.course_groups.exists?
course.course_groups.each_with_index do |group, index|
group_index = (index+none_group_index)
group_name = group.name
group_code = group.invite_code
group_count = group.course_members_count
group_array = [group_index,group_name,group_code,group_count]
course_group_info_body.push(group_array)
end
end
course_group_info = [course_group_info_head,course_group_info_body]
@course_info += [course_info_title,course_main_info,course_group_info]
end
# 作业导出为xlsxhomework_type 1普通作业 2编程作业弃用 3分组作业 4实训作业
def student_work_to_xlsx(works,homework)
@work_head_cells = []
@ -112,7 +429,7 @@ module ExportHelper
@work_cells_column.push(row_cells_column)
end
else #实训题
shixun = homework.shixuns.first
shixun = homework.shixuns.take
shixun_head_cells = %w(完成情况 通关时间 学员在EduCoder做实训花费的时间 总评测次数 获得经验值 关卡得分)
eff_boolean = homework.work_efficiency
if eff_boolean
@ -123,9 +440,12 @@ module ExportHelper
if allow_late_boolean #允许迟交
eff_score_cell.push("迟交扣分")
end
shixun_time_cells = %w(最终成绩 更新时间 作业发布到学员完成作业所耗的时间 评语)
shixun_time_cells = %w(最终成绩 更新时间 作业发布到学员完成作业所耗的时间 总评语)
for i in 1 .. shixun.challenges.size
shixun_time_cells << "#{i}关评语"
end
@work_head_cells = (head_cells_format + shixun_head_cells + eff_score_cell + shixun_time_cells).reject(&:blank?)
works.includes(:student_works_scores, user: :user_extension, myshixun: :games).each_with_index do |w, index|
works.includes(:shixun_work_comments, :student_works_scores, user: :user_extension, myshixun: :games).each_with_index do |w, index|
myshixun = w.try(:myshixun)
w_user = w.user
w_1 = (index + 1)
@ -165,21 +485,20 @@ module ExportHelper
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_comments = w.student_works_scores
if teacher_comments.present?
w_18 = ""
teacher_comments.each do |t|
user_name = t.user&.real_name
user_time = format_time(t.updated_at)
user_score = t&.score
user_comment = t.comment.present? ? t.comment : "--"
comment_title = "#{user_name} #{user_time.to_s} #{user_score.to_s}\n#{user_comment}\n\n"
w_18 = w_18 + comment_title
end
teacher_comment = w.shixun_work_comments.select{|comment| comment.challenge_id == 0}.first
if teacher_comment.present?
w_18 = "学生可见:\n #{teacher_comment.comment.to_s} \n\n 老师可见:\n#{teacher_comment.hidden_comment.to_s}"
else
w_18 = "--"
end
row_cells_column = [w_1,w_2,w_3,w_3_1,w_4,w_5,w_6,w_7,w_8,w_9,w_10,w_11,w_12,w_13,w_14,w_15,w_16,w_17,w_18]
# 关卡评语
shixun.challenges.pluck(:id).each do |challenge_id|
challenge_comment = w.shixun_work_comments.select{|comment| comment.challenge_id == challenge_id}.first
row_cells_column << (challenge_comment.present? ? "学生可见:\n #{challenge_comment.comment.to_s} \n\n 老师可见:\n#{challenge_comment.hidden_comment.to_s}" : "--")
end
row_cells_column = row_cells_column.reject(&:blank?)
@work_cells_column.push(row_cells_column)
end

@ -126,7 +126,7 @@ module StudentWorksHelper
if game.status == 2
"评测通过"
else
"共有#{game.challenge.challenge_chooses.count}组测试集,其中有#{game.challenge.challenge_chooses.count-game.choose_correct_num}组测试结果不匹配"
"共有#{game.challenge.challenge_chooses.count}组测试集,其中有#{game.challenge.challenge_chooses.count-game.choose_correct_num(output.query_index)}组测试结果不匹配"
end
end
end

@ -6,24 +6,21 @@ class SyncTrustieJob < ApplicationJob
def perform(type, count)
Rails.logger.info("#######_________response__sync__start__#########")
configs_content = Rails.application.config_for(:configuration)
token = configs_content["sync_token"]
token_url = configs_content["sync_url"]
url = "#{token_url}/api/v1/homes/sync_count"
token = EduSetting.get('trustie_api_token')
api_host = EduSetting.get('trustie_api_url')
url = "#{api_host}/api/v1/homes/sync_count"
sync_json = {
"token": token,
"type": type,
"number": count
}
uri = URI.parse(url)
http = Net::HTTP.new(uri.hostname, uri.port)
if token_url.include?("https://")
http.use_ssl = true
if api_host
http = Net::HTTP.new(uri.hostname, uri.port)
http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'})
Rails.logger.info("#######_________response__sync__end_____#########")
end
response = http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'})
Rails.logger.info("#######_________response__sync__end_____#########{response.body}")
end
end
end

@ -14,7 +14,13 @@ module CustomSortable
return relations unless self.class.check_sort_parameter_validate(sort_by.to_s, sort_direction.to_s)
order_method = self.class.sort_options[:reorder] ? :reorder : :order
relations.send(order_method, "#{sort_by} #{sort_direction}")
default_table = self.class.sort_options[:default_table]
if default_table.present?
relations.send(order_method, "#{default_table}.#{sort_by} #{sort_direction}")
else
relations.send(order_method, "#{sort_by} #{sort_direction}")
end
end
module ClassMethods
@ -23,6 +29,7 @@ module CustomSortable
@_sort_options[:default_by] = opts[:default_by].to_s
@_sort_options[:default_direction] = opts[:default_direction].to_s
@_sort_options[:reorder] = opts[:reorder]
@_sort_options[:default_table] = opts[:default_table]
@_sort_columns = columns.map(&:to_s)
end

@ -12,4 +12,8 @@ class ApplicationRecord < ActiveRecord::Base
def display_extra_data(key)
_extra_data&.[](key)
end
def allow_sync_to_trustie?
Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net'
end
end

@ -26,6 +26,9 @@ class Competition < ApplicationRecord
has_many :sponsor_schools, -> { where(source: :sponsor) }, class_name: 'CompetitionSchool' # 主办方
has_many :region_schools, -> { where(source: :region) }, class_name: 'CompetitionSchool' # 开放范围
has_many :competition_managers, dependent: :destroy
has_many :managers, through: :competition_managers, source: :user
after_create :create_competition_modules
def mode_type
@ -75,6 +78,11 @@ class Competition < ApplicationRecord
status?
end
# 即将发布
def nearly_published?
!published? && published_at.present?
end
# 是否为个人赛
def personal?
competition_staffs.sum(:maximum).to_i == 1 || (competition_staffs.nil? && max_num == 1)
@ -134,6 +142,10 @@ class Competition < ApplicationRecord
# competition_awards.pluck(:num)&.sum > 0 ? competition_awards.pluck(:num)&.sum : 20
# end
def manager?(user)
user && competition_managers.exists?(user_id: user.id)
end
private
def get_module_name type

@ -0,0 +1,4 @@
class CompetitionManager < ApplicationRecord
belongs_to :user
belongs_to :competition
end

@ -196,7 +196,7 @@ class Course < ApplicationRecord
end
def all_course_module_types
%w[activity announcement online_learning shixun_homework common_homework group_homework exercise attachment course_group graduation poll board]
%w[activity announcement online_learning shixun_homework common_homework group_homework exercise attachment course_group graduation poll board statistics]
end
def get_course_module_by_type(type)
@ -386,6 +386,7 @@ class Course < ApplicationRecord
when 'attachment' then '资源'
when 'board' then '讨论'
when 'course_group' then '分班'
when 'statistics' then '统计'
else ''
end
end
@ -404,6 +405,7 @@ class Course < ApplicationRecord
when 'attachment' then 10
when 'board' then 11
when 'course_group' then 12
when 'statistics' then 13
else 100
end
end

@ -37,6 +37,9 @@ class Exercise < ApplicationRecord
DEADLINE = 3 #已截止
ENDED = 4 #课堂已结束
def question_scores
exercise_questions.pluck(:question_score).sum
end
def create_exercise_list
str = ""

@ -8,7 +8,9 @@ class Project < ApplicationRecord
has_many :issues
has_many :user_grades, dependent: :destroy
after_create :sync_project_trustie #同步到trustie
after_create do
SyncTrustieJob.perform_later("project", 1) if allow_sync_to_trustie?
end #同步到trustie
# 创建者
def creator
@ -23,7 +25,4 @@ class Project < ApplicationRecord
members.exists?(user_id: user.id)
end
def sync_project_trustie
SyncTrustieJob.perform_later("project", 1)
end
end

@ -19,7 +19,9 @@ class School < ApplicationRecord
has_many :apply_add_departments, dependent: :destroy
has_many :user_extensions, dependent: :nullify
after_create :sync_school_trustie #同步到trustie
after_create do
SyncTrustieJob.perform_later("school", 1) if allow_sync_to_trustie? #同步到trustie
end
# 学校管理员
def manager?(user)
@ -41,8 +43,4 @@ class School < ApplicationRecord
def manage_permission?(user)
manager?(user) || major_manager?(user) || course_manager?(user)
end
def sync_school_trustie
SyncTrustieJob.perform_later("school", 1)
end
end

@ -75,7 +75,11 @@ class Shixun < ApplicationRecord
scope :field_for_recommend, lambda{ select([:id, :name, :identifier, :myshixuns_count]) }
scope :find_by_ids,lambda{|k| where(id:k)}
after_create :send_tiding, :sync_shixun_trustie #同步到trustie
after_create :send_tiding
#同步到trustie
after_create do
SyncTrustieJob.perform_later("practical_training_project", 1) if allow_sync_to_trustie?
end
# REDO: 
def propaedeutics
@ -290,10 +294,6 @@ class Shixun < ApplicationRecord
subjects.where(hidden: 0).uniq
end
def sync_shixun_trustie
SyncTrustieJob.perform_later("practical_training_project", 1)
end
private
def send_tiding

@ -5,8 +5,9 @@ class Subject < ApplicationRecord
include Searchable::Subject
#status :0 编辑中 1 审核中 2 发布
belongs_to :repertoire
belongs_to :repertoire, optional: true
belongs_to :user
belongs_to :subject_level_system, optional: true
has_many :stages, -> { order("stages.position ASC") }, dependent: :destroy

@ -0,0 +1,5 @@
class SubjectLevelSystem < ApplicationRecord
default_scope { order(level: :asc) }
has_many :subjects, dependent: :nullify
end

@ -156,7 +156,9 @@ class User < ApplicationRecord
delegate :gender, :department_id, :school_id, :location, :location_city, :technical_title, to: :user_extension, allow_nil: true
before_save :update_hashed_password
after_create :sync_user_trustie #同步到trustie
after_create do
SyncTrustieJob.perform_later("user", 1) if allow_sync_to_trustie?
end
#
# validations
@ -314,10 +316,6 @@ class User < ApplicationRecord
shixun.shixun_members.exists?(role: 2, user_id: id)
end
def sync_user_trustie
SyncTrustieJob.perform_later("user", 1)
end
# TPI的创建者
def creator_of_game?(game)
id == game.user_id

@ -0,0 +1,45 @@
class Admins::SubjectQuery < ApplicationQuery
include CustomSortable
attr_reader :params
sort_columns :created_at, default_by: :created_at, default_direction: :desc, default_table: 'subjects'
def initialize(params)
@params = params
end
def call
subjects = Subject.all
# 状态过滤
status =
case params[:status].to_s.strip
when 'pending' then 0
when 'applying' then 1
when 'published' then 2
end
subjects = subjects.where(status: status) if status
# 创建者单位
if params[:school_id].present?
subjects = subjects.joins(user: :user_extension).where(user_extensions: { school_id: params[:school_id] })
end
# 首页展示、金课
%i[homepage_show excellent].each do |column|
if params[column].present? && params[column].to_s == 'true'
subjects = subjects.where(column => true)
end
end
# 关键字
keyword = params[:keyword].to_s.strip
if keyword
sql = 'CONCAT(lastname, firstname) LIKE :keyword OR subjects.name LIKE :keyword'
subjects = subjects.joins(:user).where(sql, keyword: "%#{keyword}%")
end
custom_sort(subjects, params[:sort_by], params[:sort_direction])
end
end

@ -34,6 +34,18 @@ class Admins::CompetitionBasicSettingService < ApplicationService
setting.save!
end
# 管理员设置
params[:manager_ids] = Array.wrap(params[:manager_ids]).map(&:to_i)
old_manager_ids = competition.competition_managers.pluck(:user_id)
new_manager_ids = params[:manager_ids] - old_manager_ids
delete_manager_ids = old_manager_ids - params[:manager_ids]
CompetitionManager.bulk_insert(*%i[user_id competition_id created_at updated_at]) do |worker|
new_manager_ids.each do |manager_id|
worker.add(user_id: manager_id, competition_id: competition.id)
end
end
competition.competition_managers.where(user_id: delete_manager_ids).delete_all
# 主办方设置
params[:sponsor_schools] = Array.wrap(params[:sponsor_schools]).map(&:to_i)
new_sponsor_school_ids = competition.sponsor_schools.pluck(:school_id)

@ -10,13 +10,15 @@ class Admins::CompetitionStageCreateService < ApplicationService
ActiveRecord::Base.transaction do
stage = CompetitionStage.create!(competition_id: competition.id, name: params[:stage_name], score_rate: (params[:score_rate].to_i / 100).round(2))
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
entry: section["entry"], score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
unless params[:stage].blank?
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
entry: section["entry"], score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
end
end
end

@ -13,13 +13,15 @@ class Admins::CompetitionStageUpdateService < ApplicationService
stage.competition_stage_sections.destroy_all
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
entry: section["entry"], score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
unless params[:stage].blank?
params[:stage].each do |section|
stage_section = CompetitionStageSection.create!(competition_id: competition.id, competition_stage_id: stage.id,
start_time: section["start_time"], end_time: section["end_time"],
entry: section["entry"], score_source: section["score_source"])
section["identifiers"].each do |identifier|
CompetitionEntry.create!(competition_stage_section_id: stage_section.id, competition_stage_id: stage.id,
shixun_identifier: identifier)
end
end
end

@ -93,6 +93,16 @@
</div>
</div>
<div class="row align-items-center d-flex mb-2">
<div class="col-1 text-right">
管理员
</div>
<div class="col-5 text-left sponsorPanel">
<% manager_data = @competition.managers.map { |u| [u.name, u.id] } %>
<%= select_tag :manager_ids, options_for_select(manager_data, @competition.managers.map(&:id)), class: 'form-control manager-select', multiple: true %>
</div>
</div>
<div class="row align-items-center d-flex mb-2">
<div class="col-1 text-right">
主办方
@ -360,7 +370,7 @@
</div><span class=" mt-2">%</span>
<div class="flex-1">
<a href="javascript:void(0)" class="btn btn-outline-primary export-action ml20 add-task-sub">新增子阶段</a>
<% if stage.max_end_time > Time.now %>
<% if stage.max_end_time && stage.max_end_time > Time.now %>
<%= agree_link '发送短信提醒', send_message_admins_competition_competition_stage_path(@competition, stage, element: ".send-message-#{stage.id}"),
class: 'btn btn-outline-primary ml20', 'data-confirm': '确认执行发送短信操作?' %>
<% end %>
@ -492,6 +502,7 @@
</div>
<% end %>
<% end %>
<div class="error my-2 danger text-danger"></div>
</div>
</div>
</div>

@ -36,12 +36,14 @@
<%= javascript_void_link '添加管理员', class: 'action', data: { laboratory_id: laboratory.id, toggle: 'modal', target: '.admin-add-laboratory-user-modal' } %>
<% end %>
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<%= link_to '轮播图', admins_laboratory_carousels_path(laboratory), class: 'dropdown-item' %>
<div class="d-inline">
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<%= link_to '轮播图', admins_laboratory_carousels_path(laboratory), class: 'dropdown-item' %>
<% if school.present? && laboratory.id != 1 %>
<%= delete_link '删除', admins_laboratory_path(laboratory, element: ".laboratory-item-#{laboratory.id}"), class: 'dropdown-item delete-laboratory-action' %>
<% end %>
<% if school.present? && laboratory.id != 1 %>
<%= delete_link '删除', admins_laboratory_path(laboratory, element: ".laboratory-item-#{laboratory.id}"), class: 'dropdown-item delete-laboratory-action' %>
<% end %>
</div>
</div>
</td>

@ -1,9 +1,10 @@
<% sidebar_collapse = request.cookies['admin_sidebar_collapse'].to_s == 'true' %>
<nav id="sidebar" class="<%= sidebar_collapse ? 'active' : '' %>" data-current-controller="<%= admin_sidebar_controller %>">
<div class="sidebar-header">
<a href="/" class="sidebar-header-logo" data-toggle="tooltip" title="返回主站">
<%= image_tag('logo.png') %>
</a>
<div class="sidebar-header-logo">
<img class="rounded-circle" src="/images/<%= url_to_avatar(current_user) %>" />
<span class="logo-label">后台管理</span>
</div>
<div id="sidebarCollapse" class="navbar-btn <%= sidebar_collapse ? 'active' : '' %>">
<i class="fa fa-chevron-left fold" data-toggle="tooltip" data-placement="right" data-boundary="window" title="收起"></i>
<i class="fa fa-bars unfold" data-toggle="tooltip" data-placement="right" data-boundary="window" title="展开"></i>
@ -29,6 +30,12 @@
<% end %>
</li>
<li>
<%= sidebar_item_group('#subject-submenu', '实践课程', icon: 'th-list') do %>
<li><%= sidebar_item(admins_subjects_path, '课程列表', icon: 'cog', controller: 'admins-subjects') %></li>
<% end %>
</li>
<li>
<%= sidebar_item_group('#schools-submenu', '单位管理', icon: 'building') do %>
<li><%= sidebar_item(admins_schools_path, '单位列表', icon: 'university', controller: 'admins-schools') %></li>

@ -17,7 +17,7 @@
<span class="input-group-text">文件</span>
</div>
<div class="custom-file">
<input type="file" name="file" class="upload-file-input" id="upload-file-input">
<input type="file" name="file" class="upload-file-input" accept="<%= accept ||= '*' %>" id="upload-file-input">
<label class="custom-file-label file-names" for="upload-file-input">选择文件</label>
</div>
</div>

@ -0,0 +1,2 @@
$('.admin-modal-container').html("<%= j( render partial: 'admins/subjects/shared/edit_subject_modal', locals: { subject: @subject } ) %>");
$('.modal.admin-edit-subject-modal').modal('show');

@ -0,0 +1,39 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('课程配置') %>
<% end %>
<div class="box search-form-container subject-list-form">
<%= form_tag(admins_subjects_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<div class="form-group mr-1">
<label for="status">状态:</label>
<% status_options = [['全部', ''], ['编辑中', 'pending'], ['审核中', 'applying'], ['已发布', 'published']] %>
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
</div>
<div class="form-group col-12 col-md-3">
<label for="school_name">单位:</label>
<%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %>
</div>
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课程名称检索') %>
<div class="form-check mr-2">
<%= hidden_field_tag(:homepage_show, false, id:'') %>
<%= check_box_tag(:homepage_show, true, params[:homepage_show].to_s == 'true', class: 'form-check-input') %>
<label class="form-check-label" for="homepage_show">只看首页展示</label>
</div>
<div class="form-check mr-2">
<%= hidden_field_tag(:excellent, false, id:'') %>
<%= check_box_tag(:excellent, true, params[:excellent].to_s == 'true', class: 'form-check-input') %>
<label class="form-check-label" for="excellent">只看金课</label>
</div>
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
<% end %>
</div>
<div class="box subject-list-container">
<%= render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } %>
</div>

@ -0,0 +1 @@
$('.subject-list-container').html("<%= j( render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } ) %>");

@ -0,0 +1,33 @@
<div class="modal fade admin-edit-subject-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">编辑课程信息</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<%= simple_form_for([:admins, subject], html: { class: 'admin-edit-subject-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %>
<%= f.input :repertoire_id, label: '技术体系:' do %>
<% repertoire_options = Repertoire.order('CONVERT(name USING gbk) COLLATE gbk_chinese_ci ASC').map{|r| [r.name, r.id]} %>
<%= f.select :repertoire_id, [['请选择', '']] + repertoire_options, {}, class: 'form-control' %>
<% end %>
<%= f.input :subject_level_system_id, label: '等级体系:' do %>
<% level_options = SubjectLevelSystem.all.map{|r| [r.name, r.id]} %>
<%= f.select :subject_level_system_id, [['请选择', '']] + level_options, {}, class: 'form-control' %>
<% end %>
<%= f.input :student_count, as: :integer, label: '开课人数:' %>
<div class="error text-danger"></div>
<% end %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary submit-btn">确认</button>
</div>
</div>
</div>
</div>

@ -0,0 +1,73 @@
<table class="table table-hover text-center subject-list-table">
<thead class="thead-light">
<tr>
<th width="14%" class="text-left">名称</th>
<th width="6%">阶段数</th>
<th width="6%">实训数</th>
<th width="8%">技术体系</th>
<th width="8%">等级体系</th>
<th width="8%">封面</th>
<th width="7%">创建者</th>
<th width="10%">单位</th>
<th width="8%">开课人数</th>
<th width="10%"><%= sort_tag('创建时间', name: 'created_at', path: admins_subjects_path) %></th>
<th width="7%">状态</th>
<th width="15%">操作</th>
</tr>
</thead>
<tbody>
<% if subjects.present? %>
<% subjects.each do |subject| %>
<tr class="subject-item-<%= subject.id %>">
<td class="text-left">
<%= link_to(subject.name, subject_path(subject), target: '_blank') %>
<span class="badge badge-pill badge-success homepage-show-badge" style="<%= subject.homepage_show? ? '' : 'display:none' %>">首页</span>
<span class="badge badge-pill badge-info excellent-badge" style="<%= subject.excellent? ? '' : 'display:none' %>">金课</span>
</td>
<td><%= subject.stages_count %></td>
<td><%= subject.shixuns_count %></td>
<td><%= display_text subject.repertoire&.name %></td>
<td><%= display_text subject.subject_level_system&.name %></td>
<td>
<% image_exists = Util::FileManage.exists?(subject) %>
<%= image_tag(image_exists ? Util::FileManage.source_disk_file_url(subject) : '', height: 40, class: "w-100 preview-image subject-image-#{subject.id}", style: image_exists ? '' : 'display:none') %>
<%= javascript_void_link image_exists ? '重新上传' : '上传图片', class: 'action upload-image-action', data: { source_id: subject.id, source_type: 'Subject', toggle: 'modal', target: '.admin-upload-file-modal' } %>
</td>
<td><%= subject.user.real_name %></td>
<td><%= subject.user.school_name %></td>
<td><%= subject.student_count %></td>
<td><%= subject.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
<td>
<%= display_subject_status(subject) %>
</td>
<td class="action-container">
<%= link_to('编辑', edit_admins_subject_path(subject), remote: true, class: 'edit-action') %>
<%= javascript_void_link('隐藏', class: 'hide-action', data: { id: subject.id }, style: subject.hidden? ? 'display:none' : '') %>
<%= javascript_void_link('取消隐藏', class: 'active-action', data: { id: subject.id }, style: subject.hidden? ? '' : 'display:none') %>
<div class="d-inline">
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<% if subject.published? %>
<%= javascript_void_link('首页展示', class: 'dropdown-item homepage-show-action', data: { id: subject.id }, style: subject.homepage_show? ? 'display:none' : '') %>
<%= javascript_void_link('取消首页展示', class: 'dropdown-item homepage-hide-action', data: { id: subject.id }, style: subject.homepage_show? ? '' : 'display:none') %>
<%= javascript_void_link('选为金课', class: 'dropdown-item excellent-action', data: { id: subject.id }, style: subject.excellent? ? 'display:none' : '') %>
<%= javascript_void_link('取消金课', class: 'dropdown-item cancel-excellent-action', data: { id: subject.id }, style: subject.excellent? ? '' : 'display:none') %>
<% end %>
<%= delete_link '删除', admins_subject_path(subject, element: ".subject-item-#{subject.id}"), class: 'dropdown-item delete-subject-action' %>
</div>
</div>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>
<%= render partial: 'admins/shared/paginate', locals: { objects: subjects } %>
<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片', accept: 'image/*' } %>

@ -43,13 +43,15 @@
<%= javascript_void_link '加锁', class: 'action lock-action', data: { id: user.id }, style: user.locked? || user.registered? ? 'display: none;' : '' %>
<% end %>
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<%= javascript_void_link('奖励', class: 'dropdown-item reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<div class="d-inline">
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
<div class="dropdown-menu more-action-dropdown">
<%= javascript_void_link('奖励', class: 'dropdown-item reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<%= javascript_void_link '恢复禁密账号', class: 'dropdown-item reset-login-times-action', data: { id: user.id } %>
<%= javascript_void_link '恢复禁密账号', class: 'dropdown-item reset-login-times-action', data: { id: user.id } %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'dropdown-item delete-user-action' %>
<%= delete_link '删除', admins_user_path(user, element: ".user-item-#{user.id}"), class: 'dropdown-item delete-user-action' %>
</div>
</div>
</td>
</tr>

@ -30,3 +30,7 @@ if @competition.mode == 2
json.member_of_course @user.member_of_course?(@competition.competition_mode_setting&.course)
end
json.permission do
json.editable @user.admin_or_business? || (@competition.nearly_published? && @competition.manager?(@user))
end

@ -27,5 +27,9 @@ json.competitions do
# json.end_time section.display_end_time
# end
# end
json.permission do
json.editable current_user.admin_or_business? || (competition.nearly_published? && competition.manager?(current_user))
end
end
end

@ -0,0 +1,7 @@
json.course_members @course_members.each do |member|
user = member.user
json.user_login user.login
json.user_name user.real_name
# json.course_group member.course_group_name
json.total_score member.score
end

@ -0,0 +1,6 @@
json.top_scores @top_scores.each do |cm_score|
user = cm_score.user
json.user_name user.real_name
json.user_login user.login
json.avatar_url url_to_avatar(user)
end

@ -0,0 +1,13 @@
json.course_members @course_members.each do |member|
user = member.user
json.user_login user.login
json.user_name user.real_name
json.course_group member.course_group_name
json.common_score member.common_score
json.group_score member.group_score
json.practice_score member.practice_score
json.exercise_score member.exercise_score
json.graduation_score member.graduation_score
json.total_score member.score
json.rank @rank if @user_course_identity == Course::STUDENT
end

@ -0,0 +1,6 @@
'zh-CN':
subject:
status:
'0': 编辑中
'1': 审核中
'2': 已发布

@ -375,6 +375,9 @@ Rails.application.routes.draw do
post 'update_task_position'
get 'course_groups'
post 'join_course_group'
get 'work_score'
get 'act_score'
get 'statistics'
end
collection do
@ -1048,6 +1051,17 @@ Rails.application.routes.draw do
resources :weapp_adverts, only: [:index, :create, :update, :destroy] do
post :drag, on: :collection
end
resources :subjects, only: [:index, :edit, :update, :destroy] do
member do
post :hide
post :cancel_hide
post :homepage_show
post :cancel_homepage_show
post :excellent
post :cancel_excellent
end
end
end
namespace :cooperative do

@ -0,0 +1,10 @@
class CreateCompetitionManagers < ActiveRecord::Migration[5.2]
def change
create_table :competition_managers do |t|
t.references :user
t.references :competition
t.timestamps
end
end
end

@ -0,0 +1,7 @@
class AddStatisticsToCourseModule < ActiveRecord::Migration[5.2]
def change
Course.includes(:course_modules).all.each do |course|
CourseModule.create!(course_id: course.id, module_type: "statistics", hidden:0, module_name: "统计", position: course.course_modules.pluck(:position).max + 1)
end
end
end

@ -0,0 +1,8 @@
class InitTrustieConfig < ActiveRecord::Migration[5.2]
def change
hash = {"trustie_api_token" => "", "trustie_api_url" => ""}
hash.each { |key, value|
EduSetting.find_or_create_by(name: key, value: value)
}
end
end

@ -83,7 +83,7 @@ namespace :poll_publish do
end
task :end => :environment do
puts "--------------------------------poll_publish end start"
#1.统一设置的截止
polls = Poll.includes(:poll_users).where("polls_status = 2 AND end_time <=?",Time.now + 900)
polls.each do |poll|
@ -92,6 +92,7 @@ namespace :poll_publish do
end
#2.分班设置的截止
# polls = Poll.includes(:poll_users).where("polls_status = 2 AND unified_setting = false AND end_time > ?",Time.now + 900)
# poll_ids = polls.blank? ? "(-1)" : "(" + polls.map(&:id).join(",") + ")"
# polls_group_settings = PollGroupSetting.where("end_time <= '#{Time.now}' and poll_id in #{poll_ids}")

File diff suppressed because one or more lines are too long

@ -26136,12 +26136,16 @@ input.form-control {
/* line 23, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header-logo {
padding-left: 5px;
overflow: hidden;
margin-bottom: 10px;
}
/* line 30, app/assets/stylesheets/admins/sidebar.scss */
/* line 27, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header-logo > .logo-label {
display: none;
}
/* line 33, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a {
padding: 10px;
text-align: center;
@ -26152,12 +26156,12 @@ input.form-control {
justify-content: center;
}
/* line 37, app/assets/stylesheets/admins/sidebar.scss */
/* line 40, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a span {
display: none;
}
/* line 39, app/assets/stylesheets/admins/sidebar.scss */
/* line 42, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a i {
margin-right: 0;
display: block;
@ -26167,7 +26171,7 @@ input.form-control {
height: 20px;
}
/* line 49, app/assets/stylesheets/admins/sidebar.scss */
/* line 52, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .dropdown-toggle::after {
top: auto;
bottom: 10px;
@ -26176,17 +26180,17 @@ input.form-control {
transform: translateX(50%);
}
/* line 58, app/assets/stylesheets/admins/sidebar.scss */
/* line 61, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a {
padding: 10px !important;
}
/* line 61, app/assets/stylesheets/admins/sidebar.scss */
/* line 64, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a span {
display: none;
}
/* line 63, app/assets/stylesheets/admins/sidebar.scss */
/* line 66, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a i {
margin-left: 0px;
display: block;
@ -26195,7 +26199,7 @@ input.form-control {
height: 10px;
}
/* line 73, app/assets/stylesheets/admins/sidebar.scss */
/* line 76, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header {
padding: 20px;
background: #272822;
@ -26208,7 +26212,30 @@ input.form-control {
justify-content: space-between;
}
/* line 81, app/assets/stylesheets/admins/sidebar.scss */
/* line 83, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo {
display: -webkit-box;
display: flex;
-webkit-box-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
align-items: center;
}
/* line 88, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo > img {
width: 40px;
height: auto;
}
/* line 93, app/assets/stylesheets/admins/sidebar.scss */
#sidebar .sidebar-header-logo > .logo-label {
font-size: 18px;
color: darkgrey;
margin-left: 10px;
}
/* line 101, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse {
display: -webkit-box;
display: flex;
@ -26220,7 +26247,7 @@ input.form-control {
text-align: right;
}
/* line 88, app/assets/stylesheets/admins/sidebar.scss */
/* line 108, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse.active {
width: 40px;
height: 30px;
@ -26229,27 +26256,27 @@ input.form-control {
border-radius: 3px;
}
/* line 95, app/assets/stylesheets/admins/sidebar.scss */
/* line 115, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse.active i.fold {
display: none;
}
/* line 96, app/assets/stylesheets/admins/sidebar.scss */
/* line 116, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse.active i.unfold {
display: block;
}
/* line 99, app/assets/stylesheets/admins/sidebar.scss */
/* line 119, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse i.fold {
display: block;
}
/* line 102, app/assets/stylesheets/admins/sidebar.scss */
/* line 122, app/assets/stylesheets/admins/sidebar.scss */
#sidebar #sidebarCollapse i.unfold {
display: none;
}
/* line 105, app/assets/stylesheets/admins/sidebar.scss */
/* line 125, app/assets/stylesheets/admins/sidebar.scss */
#sidebar a, #sidebar a:hover, #sidebar a:focus {
color: inherit;
text-decoration: none;
@ -26257,25 +26284,25 @@ input.form-control {
transition: all 0.3s;
}
/* line 111, app/assets/stylesheets/admins/sidebar.scss */
/* line 131, app/assets/stylesheets/admins/sidebar.scss */
#sidebar > ul > li > a > i {
width: 14px;
height: 14px;
}
/* line 117, app/assets/stylesheets/admins/sidebar.scss */
/* line 137, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul.components {
padding: 20px 0;
border-bottom: 1px solid #3f3f3f;
}
/* line 122, app/assets/stylesheets/admins/sidebar.scss */
/* line 142, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul p {
color: #fff;
padding: 10px;
}
/* line 127, app/assets/stylesheets/admins/sidebar.scss */
/* line 147, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul li > a {
padding: 10px;
font-size: 1em;
@ -26283,25 +26310,25 @@ input.form-control {
text-align: left;
}
/* line 133, app/assets/stylesheets/admins/sidebar.scss */
/* line 153, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul li > a i {
margin-right: 10px;
font-size: 1em;
margin-bottom: 5px;
}
/* line 141, app/assets/stylesheets/admins/sidebar.scss */
/* line 161, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul li a:hover, #sidebar ul li a.active {
color: #fff;
background: #276891;
}
/* line 147, app/assets/stylesheets/admins/sidebar.scss */
/* line 167, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul li.active > a, #sidebar ul a[aria-expanded="true"] {
color: #fff;
}
/* line 152, app/assets/stylesheets/admins/sidebar.scss */
/* line 172, app/assets/stylesheets/admins/sidebar.scss */
#sidebar ul ul a {
font-size: 0.9em !important;
padding-left: 30px !important;
@ -26309,7 +26336,7 @@ input.form-control {
}
@media (max-width: 768px) {
/* line 162, app/assets/stylesheets/admins/sidebar.scss */
/* line 182, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active {
padding: 10px 5px;
min-width: 40px;
@ -26319,39 +26346,39 @@ input.form-control {
-webkit-transform: none;
transform: none;
}
/* line 170, app/assets/stylesheets/admins/sidebar.scss */
/* line 190, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header {
padding: 0px;
}
/* line 173, app/assets/stylesheets/admins/sidebar.scss */
/* line 193, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header .sidebar-header-logo {
display: none;
}
/* line 177, app/assets/stylesheets/admins/sidebar.scss */
/* line 197, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active .sidebar-header #sidebarCollapse {
width: 30px;
height: 20px;
}
/* line 183, app/assets/stylesheets/admins/sidebar.scss */
/* line 203, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a {
padding: 10px;
font-size: 0.85em;
}
/* line 187, app/assets/stylesheets/admins/sidebar.scss */
/* line 207, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul li a i {
margin-right: 0;
display: block;
margin-bottom: 5px;
}
/* line 194, app/assets/stylesheets/admins/sidebar.scss */
/* line 214, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active > ul > li > a > i {
font-size: 1.8em;
}
/* line 198, app/assets/stylesheets/admins/sidebar.scss */
/* line 218, app/assets/stylesheets/admins/sidebar.scss */
#sidebar.active ul ul a {
padding: 10px !important;
}
/* line 207, app/assets/stylesheets/admins/sidebar.scss */
/* line 227, app/assets/stylesheets/admins/sidebar.scss */
.dropdown-toggle::after {
top: auto;
bottom: 10px;

@ -29898,9 +29898,9 @@ function customConfirm(opts){
return $.confirm($.extend({}, defaultOpts, opts))
}
function show_success_flash(){
function show_success_flash(message){
$.notify({
message: '操作成功'
message: message || '操作成功'
},{
type: 'success'
});
@ -136184,6 +136184,33 @@ $(document).on('turbolinks:load', function(){
$('.sponsor-select').select2(selectOptions);
$('.allow-school-select').select2(selectOptions);
$('.manager-select').select2({
theme: 'bootstrap4',
placeholder: '请输入要添加的管理员姓名',
multiple: true,
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/admins/users',
dataType: 'json',
data: function(params){
return { keyword: params.term };
},
processResults: function(data){
return { results: data.users }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return $("<div class='row px-0'><span class='col-3'>" + item.real_name + "</span><span class='col-5 font-12'>" + item.school_name + "</span><span class='col-4 font-12'>" + item.hidden_phone + "</span></div>");
},
templateSelection: function(item){
if (item.id) {
}
return item.real_name || item.text;
}
});
// 排行榜
//链接
@ -137762,6 +137789,24 @@ $(document).on('turbolinks:load', function() {
});
})
});
$(document).on('turbolinks:load', function() {
$('.admin-modal-container').on('show.bs.modal', '.modal.admin-edit-subject-modal', function(){
var $modal = $('.modal.admin-edit-subject-modal');
var $form = $modal.find('form.admin-edit-subject-form');
$modal.on('click', '.submit-btn', function(){
$form.find('.error').html('');
var url = $form.attr('action');
$.ajax({
method: 'PATCH',
dataType: 'script',
url: url,
data: $form.serialize()
});
});
})
});
$(document).on('turbolinks:load', function() {
var $modal = $('.modal.admin-import-course-member-modal');
if ($modal.length > 0) {
@ -138451,6 +138496,113 @@ $(document).on('turbolinks:load', function() {
}
})
;
$(document).on('turbolinks:load', function() {
if ($('body.admins-subjects-index-page').length > 0) {
var $form = $('.subject-list-form');
// ************** 学校选择 *************
$form.find('.school-select').select2({
theme: 'bootstrap4',
placeholder: '请选择创建者单位',
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/api/schools/for_option.json',
dataType: 'json',
data: function(params){
return { keyword: params.term };
},
processResults: function(data){
return { results: data.schools }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return item.name;
},
templateSelection: function(item){
if (item.id) {
}
return item.name || item.text;
}
});
// 清空
$form.on('click', '.clear-btn', function(){
$form.find('select[name="status"]').val('');
$form.find('.school-select').val('').trigger('change');
$form.find('input[name="keyword"]').val('');
$form.find('#homepage_show').attr('checked', false);
$form.find('#excellent').attr('checked', false);
$form.find('input[type="submit"]').trigger('click');
})
// 上传图片
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
var $imageElement = $('.subject-image-' + data.source_id);
$imageElement.attr('src', data.url);
$imageElement.show();
$imageElement.next().html('重新上传');
})
// 定义状态切换监听事件
var defineStatusChangeFunc = function(doElement, undoElement, url, callback){
$('.subject-list-container').on('click', doElement, function(){
var $doAction = $(this);
var $undoAction = $doAction.siblings(undoElement);
var subjectId = $doAction.data('id');
customConfirm({
content: '确认进行该操作吗?',
ok: function(){
$.ajax({
url: '/admins/subjects/' + subjectId + url,
method: 'POST',
dataType: 'json',
success: function() {
show_success_flash();
$doAction.hide();
$undoAction.show();
if(callback && typeof callback === "function"){
callback(subjectId, url);
}
}
});
}
});
});
}
// 隐藏与取消隐藏
defineStatusChangeFunc('.hide-action', '.active-action', '/hide');
defineStatusChangeFunc('.active-action', '.hide-action', '/cancel_hide');
// 首页展示与取消首页展示
var homepageShowCallback = function(subjectId, url){
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
if(url === '/homepage_show'){
$subjectItem.find('.homepage-show-badge').show();
} else {
$subjectItem.find('.homepage-show-badge').hide();
}
}
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage_show', homepageShowCallback);
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage_show', homepageShowCallback);
// 设为金课与取消金课
var excellentCallback = function(subjectId, url){
var $subjectItem = $('.subject-list-container').find('.subject-item-' + subjectId);
if(url === '/excellent'){
$subjectItem.find('.excellent-badge').show();
} else {
$subjectItem.find('.excellent-badge').hide();
}
}
defineStatusChangeFunc('.excellent-action', '.cancel-excellent-action', '/excellent', excellentCallback);
defineStatusChangeFunc('.cancel-excellent-action', '.excellent-action', '/cancel_excellent', excellentCallback);
}
});
$(document).on('turbolinks:load', function() {
if ($('body.admins-user-statistics-index-page').length > 0) {
var $form = $('.user-statistic-list-form');

File diff suppressed because one or more lines are too long

@ -1079,14 +1079,14 @@
<div class="name">下降</div>
<div class="code-name">&amp;#xe669;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe800;</span>
<div class="name">复制</div>
<div class="code-name">&amp;#xe800;</div>
<li class="dib">
<span class="icon iconfont">&#xe800;</span>
<div class="name">复制</div>
<div class="code-name">&amp;#xe800;</div>
</li>
<li class="dib">
<li class="dib">
<span class="icon iconfont">&#xe7f9;</span>
<div class="name">更多</div>
<div class="code-name">&amp;#xe7f9;</div>
@ -1212,6 +1212,12 @@
<div class="code-name">&amp;#xe604;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6d3;</span>
<div class="name">主页</div>
<div class="code-name">&amp;#xe6d3;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6a3;</span>
<div class="name">yunweijiankong</div>
@ -1302,6 +1308,12 @@
<div class="code-name">&amp;#xe6b6;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6bf;</span>
<div class="name">统计</div>
<div class="code-name">&amp;#xe6bf;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6b8;</span>
<div class="name">menu_3voucher</div>
@ -1343,31 +1355,31 @@
<div class="name">nenghaofenxi@1x</div>
<div class="code-name">&amp;#xe6be;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6c1;</span>
<div class="name">detection@1x</div>
<div class="code-name">&amp;#xe6c1;</div>
<li class="dib">
<span class="icon iconfont">&#xe6c1;</span>
<div class="name">detection@1x</div>
<div class="code-name">&amp;#xe6c1;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6c2;</span>
<div class="name">community@1x</div>
<div class="code-name">&amp;#xe6c2;</div>
<li class="dib">
<span class="icon iconfont">&#xe6c2;</span>
<div class="name">community@1x</div>
<div class="code-name">&amp;#xe6c2;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6c3;</span>
<div class="name">hosting@1x</div>
<div class="code-name">&amp;#xe6c3;</div>
<li class="dib">
<span class="icon iconfont">&#xe6c3;</span>
<div class="name">hosting@1x</div>
<div class="code-name">&amp;#xe6c3;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6c4;</span>
<div class="name">project@1x</div>
<div class="code-name">&amp;#xe6c4;</div>
<li class="dib">
<span class="icon iconfont">&#xe6c4;</span>
<div class="name">project@1x</div>
<div class="code-name">&amp;#xe6c4;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
@ -2992,17 +3004,17 @@
<div class="code-name">.icon-xiajiang
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-fuzhi1"></span>
<div class="name">
复制
</div>
<div class="code-name">.icon-fuzhi1
</div>
</li>
<li class="dib">
<li class="dib">
<span class="icon iconfont icon-fuzhi1"></span>
<div class="name">
复制
</div>
<div class="code-name">.icon-fuzhi1
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-gengduo1"></span>
<div class="name">
更多
@ -3191,6 +3203,15 @@
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-zhuye"></span>
<div class="name">
主页
</div>
<div class="code-name">.icon-zhuye
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-yunweijiankong"></span>
<div class="name">
@ -3326,6 +3347,15 @@
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-tongji"></span>
<div class="name">
统计
</div>
<div class="code-name">.icon-tongji
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-menu_voucher"></span>
<div class="name">
@ -3388,43 +3418,43 @@
<div class="code-name">.icon-nenghaofenxix
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-detectionx"></span>
<div class="name">
detection@1x
</div>
<div class="code-name">.icon-detectionx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-communityx"></span>
<div class="name">
community@1x
</div>
<div class="code-name">.icon-communityx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-hostingx2"></span>
<div class="name">
hosting@1x
</div>
<div class="code-name">.icon-hostingx2
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-projectx"></span>
<div class="name">
project@1x
</div>
<div class="code-name">.icon-projectx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-detectionx"></span>
<div class="name">
detection@1x
</div>
<div class="code-name">.icon-detectionx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-communityx"></span>
<div class="name">
community@1x
</div>
<div class="code-name">.icon-communityx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-hostingx2"></span>
<div class="name">
hosting@1x
</div>
<div class="code-name">.icon-hostingx2
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-projectx"></span>
<div class="name">
project@1x
</div>
<div class="code-name">.icon-projectx
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
@ -4853,16 +4883,16 @@
<div class="name">下降</div>
<div class="code-name">#icon-xiajiang</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-fuzhi1"></use>
</svg>
<div class="name">复制</div>
<div class="code-name">#icon-fuzhi1</div>
</li>
<li class="dib">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-fuzhi1"></use>
</svg>
<div class="name">复制</div>
<div class="code-name">#icon-fuzhi1</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-gengduo1"></use>
</svg>
@ -5030,6 +5060,14 @@
<div class="code-name">#icon-tianjiadaohang</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhuye"></use>
</svg>
<div class="name">主页</div>
<div class="code-name">#icon-zhuye</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-yunweijiankong"></use>
@ -5150,6 +5188,14 @@
<div class="code-name">#icon-xuexizhongxin</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-tongji"></use>
</svg>
<div class="name">统计</div>
<div class="code-name">#icon-tongji</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-menu_voucher"></use>
@ -5205,38 +5251,38 @@
<div class="name">nenghaofenxi@1x</div>
<div class="code-name">#icon-nenghaofenxix</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-detectionx"></use>
</svg>
<div class="name">detection@1x</div>
<div class="code-name">#icon-detectionx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-communityx"></use>
</svg>
<div class="name">community@1x</div>
<div class="code-name">#icon-communityx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-hostingx2"></use>
</svg>
<div class="name">hosting@1x</div>
<div class="code-name">#icon-hostingx2</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-projectx"></use>
</svg>
<div class="name">project@1x</div>
<div class="code-name">#icon-projectx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-detectionx"></use>
</svg>
<div class="name">detection@1x</div>
<div class="code-name">#icon-detectionx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-communityx"></use>
</svg>
<div class="name">community@1x</div>
<div class="code-name">#icon-communityx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-hostingx2"></use>
</svg>
<div class="name">hosting@1x</div>
<div class="code-name">#icon-hostingx2</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-projectx"></use>
</svg>
<div class="name">project@1x</div>
<div class="code-name">#icon-projectx</div>
</li>
</ul>
<div class="article markdown">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1384,6 +1384,13 @@
"unicode": "e604",
"unicode_decimal": 58884
},
{
"icon_id": "8361866",
"name": "主页",
"font_class": "zhuye",
"unicode": "e6d3",
"unicode_decimal": 59091
},
{
"icon_id": "9219273",
"name": "yunweijiankong",
@ -1489,6 +1496,13 @@
"unicode": "e6b6",
"unicode_decimal": 59062
},
{
"icon_id": "10527626",
"name": "统计",
"font_class": "tongji",
"unicode": "e6bf",
"unicode_decimal": 59071
},
{
"icon_id": "10610051",
"name": "menu_3voucher",

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 303 KiB

After

Width:  |  Height:  |  Size: 306 KiB

@ -951,9 +951,8 @@ class Registration extends React.Component {
{
type === 4 || type === 5 ?
<RegistrationSearch {...this.props} {...this.state}
count={count}
RegistrationSearchvalue={(value) => this.RegistrationSearchvalue(value)}></RegistrationSearch>
<RegistrationSearch {...this.props} {...this.state} count={count}
RegistrationSearchvalue={(value) => this.RegistrationSearchvalue(value)}></RegistrationSearch>
: ""
}
{/*<Registrationitem></Registrationitem>*/}

@ -63,7 +63,9 @@ class RegistrationSearch extends React.Component {
lineHeight: " 24px"
}}>战队总数<span
style={{color: "#459BE5", fontSize: "16px"}}>{this.props.count}</span><span
style={{marginLeft: "5px",}}></span></p>
style={{marginLeft: "5px", marginRight: "15px",}}></span> <span
style={{color: "#459BE5"}}>{this.props.members_count}</span><span
style={{marginLeft: "5px"}}></span></p>
</div>
)
}

@ -53,14 +53,6 @@ class CompetitionsIndex extends Component{
this.getdata(e.key,page)
};
setcompetitonurl=(url)=>{
if(url!=null){
// this.props.history.push(url);
window.location.href=url;
}
}
PaginationCourse=(pageNumber)=>{
let {category}=this.state;
this.setState({
@ -68,6 +60,7 @@ class CompetitionsIndex extends Component{
})
this.getdata(category,pageNumber);
}
render() {
let {datas,page,count}=this.state;
@ -124,14 +117,14 @@ class CompetitionsIndex extends Component{
size="large"
dataSource={datas&&datas}
renderItem={(item,key) => (
<a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
<a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"?item.permission.editable==true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
item.permission.editable==true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
>
<div className={"CompetitionsList"} >
{item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
item.permission.editable==true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
{/*<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>*/}
{/*{item.description===null||item.description===undefined||item.description===""?<style>*/}
{/*{*/}
@ -180,9 +173,9 @@ class CompetitionsIndex extends Component{
>
<List.Item.Meta
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
item.permission.editable==true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a target="_blank" className={"competitionstitles"}
href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? item.permission.editable==true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/}
{/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/}

@ -268,7 +268,7 @@ class CompetitionCommon extends Component{
<Row className={"CompetitionCommonbanner"}>
{data.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
data&&data.permission.editable===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
<img className={"Commonimg"}
src={data.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):data.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):data.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} />
<Col span={15} className={"Commonimgbox"}>
@ -334,7 +334,7 @@ class CompetitionCommon extends Component{
<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
已结束
</Button>:data.enroll_end===true?<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
报名截止
{data.competition_status==="nearly_published"?"未发布":"报名截止"}
</Button>:
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
{data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}></a>}

@ -19,13 +19,13 @@ class CompetitionContents extends Component{
}
render() {
let{mdContentdata}=this.props;
let{mdContentdata,data}=this.props;
//mdhash滚动
this.props.MdifHasAnchorJustScorll();
return (
<div className={"fr"}>
{this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?this.props.has_url===false?<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>
{data&&data.permission.editable===true?this.props.Competitionedittype===false?this.props.has_url===false?<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>
编辑
</Button>:"":"":""}
<div className={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?"mt50 mb100 ":"mb100 "}>

@ -115,8 +115,8 @@ class CompetitionContents extends Component{
},
];
const data = [];
let {chart_rules,chartdata}=this.props;
const datas = [];
let {chart_rules,chartdata,data}=this.props;
let {personal}=this.state;
chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<3?"":chartdata.teams.map((item,key)=>{
@ -130,7 +130,7 @@ class CompetitionContents extends Component{
score:item.score,
user_login:item.user_login
}
data.push(list)
datas.push(list)
}
})
@ -139,7 +139,7 @@ class CompetitionContents extends Component{
//console.log(chartdata&&chartdata.teams)
return (
<div>
{chart_rules===undefined?"":<Tabs onChange={(e)=>this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?this.props.has_url===false?operations:"":"":""}>
{chart_rules===undefined?"":<Tabs onChange={(e)=>this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={data&&data.permission.editable===true?this.props.Competitionedittype===false?this.props.has_url===false?operations:"":"":""}>
{chart_rules.stages.map((item,key)=>{
return(
<TabPane tab={item.name} key={item.id===null?0:item.id}>
@ -343,7 +343,7 @@ class CompetitionContents extends Component{
`
}
</style>
{chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<4?"":<Table className="Competitiontransparent" columns={columns} dataSource={data} showHeader={false} pagination={false}/>}
{chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<4?"":<Table className="Competitiontransparent" columns={columns} dataSource={datas} showHeader={false} pagination={false}/>}
</Row>

@ -925,6 +925,14 @@ class CoursesIndex extends Component{
}
></Route>
{/*课堂统计列表2019.10.29 */}
<Route path="/courses/:coursesId/statistics"
render={
(props) => (<ListPageIndex {...this.props} {...props} {...this.state} />)
}
></Route>
{/*/!*实训作业and课堂详情页*!/*/}
<Route path="/courses/:coursesId"
render={

@ -40,11 +40,18 @@ const CourseGroupList= Loadable({
});
const Eduinforms= Loadable({
loader: () => import('./gradinforms/Eduinforms.js'),
loader: () => import('./gradinforms/Eduinforms'),
loading: Loading,
});
//2019.10.29 统计
const Statistics=Loadable({
loader: () => import('./statistics/Statistics'),
loading: Loading,
});
const Elearning= Loadable({
loader: () => import('./elearning/Elearning.js'),
loader: () => import('./elearning/Elearning'),
loading: Loading,
});
//
@ -268,6 +275,15 @@ class ListPageIndex extends Component{
}
></Route>
{/*课堂统计列表2019.10.29 */}
<Route path="/courses/:coursesId/statistics"
render={
(props) => (<Statistics {...this.props} {...props} {...this.state} />)
}
></Route>
{/*公告栏列表*/}
<Route path="/courses/:coursesId/informs"

@ -27,6 +27,7 @@ const CommonWorkSetting = Loadable({
loader: () => import('./CommonWorkSetting'),
loading:Loading,
})
//普通作业列表
const CommonWorkList = Loadable({
loader: () => import('./CommonWorkList'),
loading:Loading,

@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip,Spin, Pagination} from "antd";
import {Link} from 'react-router-dom';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import { WordsBtn, ConditionToolTip, queryString,getImageUrl, on, off, NoneData} from 'educoder';
import {WordsBtn, ConditionToolTip, queryString, getImageUrl, on, off, NoneData, sortDirections} from 'educoder';
import axios from 'axios';
import Modals from '../../modals/Modals';
import CoursesListType from '../coursesPublic/CoursesListType';
@ -88,7 +88,7 @@ function buildColumns(that, student_works, studentData) {
// width: '110px',
render: (text, record) => (
<div style={{
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
@ -97,7 +97,7 @@ function buildColumns(that, student_works, studentData) {
}} title={text && text.length > 5 ? text : ''}>
{/* <Tooltip placement="bottom" title={text}>
</Tooltip> */}
{record.is_leader ?
{record.is_leader ?
<div style={{ display: 'flex', 'flex-direction': 'column', 'align-items': 'center'}}>
<div >{text}</div>
<LeaderIcon></LeaderIcon>
@ -112,12 +112,13 @@ function buildColumns(that, student_works, studentData) {
title: '学号',
dataIndex: 'student_id',
key: 'student_id',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
<a href="javascript:;"
title={text && text.length > 12 ? text : ''}
style={{color:'#9A9A9A', 'text-overflow': 'ellipsis', 'white-space': 'nowrap', 'width': '98px', display: 'block', overflow: 'hidden'
<a href="javascript:;"
title={text && text.length > 12 ? text : ''}
style={{color:'#9A9A9A', 'text-overflow': 'ellipsis', 'white-space': 'nowrap', 'width': '98px', display: 'block', overflow: 'hidden'
, margin: '0 auto', cursor: 'default'}}
>{record.student_id}</a>
</span>
@ -131,9 +132,8 @@ function buildColumns(that, student_works, studentData) {
title: '分班',
key: 'group_name',
dataIndex: 'group_name',
render: (text, record) => (
<span>
<span>
<a href="javascript:;" style={{color:'#9A9A9A', cursor: 'default'}}>{record.group_name}</a>
</span>
),
@ -162,9 +162,10 @@ function buildColumns(that, student_works, studentData) {
render: (project_info, record) => (
<span>
{project_info && project_info.name && <a href={project_info.id == -1 ? 'javascript:void(0)' : `/projects/${project_info.id}`}
target={ project_info.id == -1 ? '' : "_blank" }
className="overflowHidden1" style={{color:'#4CACFF', width: that.state.anonymous_comment ? '80px' : '130px', margin: '0 auto', display: 'block'}} title={project_info.name}
{project_info && project_info.name &&
<a href={project_info.id == -1 ? 'javascript:void(0)' : `/projects/${project_info.id}`}
target={ project_info.id == -1 ? '' : "_blank" }
className="overflowHidden1" style={{color:'#4CACFF', width: that.state.anonymous_comment ? '80px' : '130px', margin: '0 auto', display: 'block'}} title={project_info.name}
>{project_info.name}</a>}
</span>
),
@ -201,13 +202,15 @@ function buildColumns(that, student_works, studentData) {
title: '更新时间',
dataIndex: 'update_time',
key: 'update_time',
sorter: true,
defaultSortOrder: 'descend',
sortDirections: sortDirections,
render: (update_time, record) => (
<span>
<a href="javascript:;" style={{color:'#989898', cursor: 'default'}}>{update_time ? moment(update_time).format('YYYY-MM-DD HH:mm') : '--'}</a>
</span>
),
}])
}])
if (!niPingAndIsStudent) {
columns.push({
width: 70,
@ -216,7 +219,7 @@ function buildColumns(that, student_works, studentData) {
dataIndex: 'teacher_score',
render: (teacher_score, record) => (
<Tooltip title={ getScoreTip(teacher_score, teacher_score) }>
<span>
{ renderScore(teacher_score) }
@ -233,7 +236,7 @@ function buildColumns(that, student_works, studentData) {
/**
* 2名助教进行了评分
平均分85.0
*
*
*/
render: (teaching_asistant_score, record) => (
<span>
@ -251,12 +254,11 @@ function buildColumns(that, student_works, studentData) {
),
})
}
if (that.state.anonymous_comment) {
/**
开启了匿评的才显示此列悬浮TIP示例
/**
开启了匿评的才显示此列悬浮TIP示例
3名学生进行了匿评
有效平均分80.0
*/
@ -266,7 +268,7 @@ function buildColumns(that, student_works, studentData) {
title: <div style={{color: 'rgba(0,0,0,.85)'}}>匿评评分</div>,
key: 'student_score',
dataIndex: 'student_score',
render: (student_score, record) => (
<span>
<Tooltip title={
@ -282,18 +284,18 @@ function buildColumns(that, student_works, studentData) {
</span>
),
})
}
}
if (that.state.anonymous_appeal) {
columns.push({
width: 70,
title: '匿评申诉',
key: 'appeal_all_count',
dataIndex: 'appeal_all_count',
render: (appeal_all_count, record) => (
<span>
{ !!appeal_all_count &&
{!!appeal_all_count &&
<Tooltip placement="bottom" title={`共有${appeal_all_count}条匿评申诉,${record.appeal_deal_count}条待处理`}>
<span style={{ minWidth: '30px', display: 'inline-block', textAlign: 'center' }}>
{`${record.appeal_deal_count}/${appeal_all_count}`}
@ -306,10 +308,12 @@ function buildColumns(that, student_works, studentData) {
}
if (!niPingAndIsStudent) {
columns.push({
width: 70,
width: '113px',
title: '最终成绩',
key: 'work_score',
dataIndex: 'work_score',
sorter: true,
sortDirections: sortDirections,
render: (work_score, record) => {
return (
<span>
@ -317,8 +321,8 @@ function buildColumns(that, student_works, studentData) {
getScoreTip(work_score,
<div>
<div>{`${record.user_name}${record.user_login}`}</div>
{ record.ultimate_score ?
<div>最终调整成绩{record.work_score}</div> :
{record.ultimate_score ?
<div>最终调整成绩{record.work_score}</div> :
<div>
{ record.final_score && <div>作业评分{record.final_score}</div> }
{ record.late_penalty >= 0 && <div>迟交扣分{record.late_penalty}</div>}
@ -326,7 +330,7 @@ function buildColumns(that, student_works, studentData) {
{ record.appeal_penalty >= 0 && <div>违规匿评扣分{record.appeal_penalty}</div>}
<div>最终成绩{record.work_score}</div>
</div> }
</div>)
</div>)
}>
{ renderScore(work_score) }
</Tooltip>
@ -355,7 +359,7 @@ function buildColumns(that, student_works, studentData) {
{/* toWorkDetailPage */}
{/* /courses/"+courseId+"/common_homeworks/"+workId+ '/' + record.id +"/appraise */}
<a style={{color:'#4CACFF', marginLeft: '4px'}} href={"javascript:void(0)"} onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)} >{ isAdmin ? '评阅': '查看'}</a>
</div>
),
@ -388,7 +392,7 @@ class CommonWorkList extends Component{
task_status: [],
teacher_comment: [],
course_group_info: [],
arg_work_status: [],
arg_work_status: [],
arg_teacher_comment: [],
arg_course_group: [],
order: 'update_time',
@ -396,6 +400,7 @@ class CommonWorkList extends Component{
isSpin:true,
left_time: {},
category: {},
b_order: 'desc',
}
}
onTablePagination = (page) => {
@ -412,6 +417,7 @@ class CommonWorkList extends Component{
}
componentDidMount() {
console.log("CommonWorkList 分班list 开始加载");
this.fetchList()
on('commonwork_fetch_all', this.fetchAllListener)
$("html").animate({ scrollTop: $('html').scrollTop() - 100 });
@ -423,14 +429,14 @@ class CommonWorkList extends Component{
}
componentWillUnmount() {
off('commonwork_fetch_all', this.fetchAllListener)
off('commonwork_fetch_all', this.fetchAllListener)
}
fetchAllListener = () => {
this.fetchList()
}
_getRequestParams() {
const { search, arg_work_status, arg_teacher_comment, arg_course_group, order, page, arg_member_work } = this.state
const {search, arg_work_status, arg_teacher_comment, arg_course_group, order, page, arg_member_work, b_order} = this.state
return {
page,
search,
@ -439,7 +445,7 @@ class CommonWorkList extends Component{
teacher_comment: arg_teacher_comment.length == 0 ? '' : arg_teacher_comment[0],
order,
limit: PAGE_SIZE,
b_order: orderMap[order],
b_order: b_order,
group_id:arg_course_group,
member_work: arg_member_work
}
@ -472,7 +478,6 @@ class CommonWorkList extends Component{
})
}
teacherCommentOptionChange = (values, isAllChecked) => {
this.setState({arg_teacher_comment: isAllChecked ? [] : values, page: 1}, () => {
@ -494,8 +499,12 @@ class CommonWorkList extends Component{
this.fetchList()
})
}
funorder = (order) => {
this.setState({ order }, () => {
funorder = (order, b_order) => {
this.setState({
order: order
,
b_order: b_order
}, () => {
this.fetchList()
})
}
@ -547,6 +556,64 @@ class CommonWorkList extends Component{
}
//普通作业tbale 列表塞选数据
table1handleChange = (pagination, filters, sorter) => {
//"ascend" 升序
//"descend" 降序
if (JSON.stringify(sorter) === "{}") {
//没有选择
} else {
// 时间
try {
if (sorter.columnKey === "update_time") {
let myyslorder = "";
if (sorter.order === "ascend") {
myyslorder = "asc";
} else if (sorter.order === "descend") {
myyslorder = "desc";
}
this.funorder("update_time", myyslorder);
}
} catch (e) {
}
//成绩
try {
if (sorter.columnKey === "work_score") {
let myyslorder = "";
if (sorter.order === "ascend") {
myyslorder = "asc";
} else if (sorter.order === "descend") {
myyslorder = "desc";
}
this.funorder("work_score", myyslorder)
}
} catch (e) {
}
//学号
try {
if (sorter.columnKey === "student_id") {
let myyslorder = "";
if (sorter.order === "ascend") {
myyslorder = "asc";
} else if (sorter.order === "descend") {
myyslorder = "desc";
}
this.funorder("student_id", myyslorder)
}
} catch (e) {
}
}
}
render(){
const { getFieldDecorator } = this.props.form;
const dateFormat = 'YYYY-MM-DD HH:mm';
@ -559,10 +626,10 @@ class CommonWorkList extends Component{
modulationModalVisible, work_statuses,
id, user_name, user_login, student_id, group_name, work_status, update_time, teacher_score, teaching_asistant_score, student_score,
ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,
ultimate_score, work_score, student_comment_count, appeal_all_count, appeal_deal_count,
late_penalty, absence_penalty, appeal_penalty
,end_immediately ,publish_immediately
, end_immediately, publish_immediately
, homework_id, visible, work_group, project_info, is_leader
} =this.state;
@ -642,7 +709,7 @@ class CommonWorkList extends Component{
}
const hasData = this.state.homework_status && this.state.homework_status.indexOf("未发布") == -1 // student_works && !!student_works.length && page == 1 &&
// console.log(StudentData)
// console.log(student_works)
return(
@ -651,7 +718,7 @@ class CommonWorkList extends Component{
ref="checkCodeModal"
{...this.props}
></CheckCodeModal>
<AccessoryModal
{...this.props}
modalname={"补交附件"}
@ -673,9 +740,9 @@ class CommonWorkList extends Component{
Cancel={this.cancelModulationModel}
Saves={(value,num)=>this.saveModulationModal(value,num)}
/>
{/* 内容区 */}
{/* 内容区 */}
<style>{`
.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
text-align: center;
@ -728,58 +795,12 @@ class CommonWorkList extends Component{
</React.Fragment>
}
</span>}
{/* { isAdminOrStudent && student_works && !!student_works.length && <div className="fr color-grey-6 edu-menu-panel">
<p style={{color: '#989898'}} className="color-grey-6"><a data-remote="true" className="font-12">
{order==="update_time"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}</a><i
className="iconfont icon-xiajiantou ml5 font-12 color-grey-6"></i></p>
<ul className="edu-menu-list" style={{ textAlign: 'center'}}>
<li onClick={(e)=>this.funorder("update_time")} ><a data-remote="true" className={order==="update_time"?"color-blue":""}>更新时间</a>
</li>
<li onClick={(e)=>this.funorder("work_score" )} ><a data-remote="true" className={order==="work_score"?"color-blue":""}>最终成绩</a>
</li>
<li onClick={(e)=>this.funorder("student_id" )} ><a data-remote="true" className={order==="student_id"?"color-blue":""}>学生学号</a>
</li>
</ul>
</div> } */}
{
isAdminOrStudent && student_works && !!student_works.length &&
<div className="fr">
<li className="drop_down">
<span className="color-grey-9 font-12">
{order==="update_time"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}
</span><i className="iconfont icon-xiajiantou font-12 ml2 color-grey-6"></i>
<ul className="drop_down_normal">
<li className={''} onClick={()=>this.funorder("update_time")}>更新时间</li>
<li className={''} onClick={()=>this.funorder("work_score")}>最终成绩</li>
<li className={''} onClick={()=>this.funorder("student_id")}>学生学号</li>
</ul>
</li>
</div>
}
</div>
</div> }
{/*
"commit_count": 10, //已交数(学生身份)
"uncommit_count": 12, //未交数(学生身份)
"left_time": { //学生身份剩余的时间和状态
"status": "剩余补交时间",
"time": "24 天 24分 23秒"
},
*/}
{/* { isStudent && <div id="graduation_work_list" style={{padding:'10px 30px 10px 40px'}}>
<div className="clearfix">
<span className="fl color-grey-6 font-12">
<span className="color-orange-tip">{commit_count}</span> {uncommit_count}
<span className="color-orange-tip">{left_time.time}</span>
</span>
</div>
</div> } */}
<style>{`
.workListContent .ant-table-thead > tr > th {
border-bottom: none;
@ -791,11 +812,12 @@ class CommonWorkList extends Component{
`}</style>
{ isStudent &&StudentData===undefined?"":StudentData===undefined?"":
<Table
className="studentTable"
dataSource={StudentData}
columns={columns}
pagination={false}
showHeader={ !student_works || student_works.length == 0}
className="studentTable"
dataSource={StudentData}
onChange={this.table1handleChange}
columns={columns}
pagination={false}
showHeader={ !student_works || student_works.length == 0}
/>
}
@ -817,28 +839,22 @@ class CommonWorkList extends Component{
<Spin size="large" spinning={this.state.isSpin}>
<div id="forum_list" className="forum_table">
<div className="mh650 edu-back-white">
<NoneData></NoneData>
</div>
</div>
</Spin>
:
<React.Fragment>
{/* pagination={work_count > PAGE_SIZE ? { //分页
total: work_count, //数据总数量
pageSize: PAGE_SIZE, //显示几条一页
current: page,
} : false}
onChange={this.onTablePagination}
*/}
<Table
className="stageTable"
dataSource={student_works}
columns={columns}
showQuickJumper
pagination={false}
loading={loadingstate}
<Table
className="stageTable"
dataSource={student_works}
columns={columns}
showQuickJumper
pagination={false}
onChange={this.table1handleChange}
loading={loadingstate}
/>
</React.Fragment>
@ -846,7 +862,7 @@ class CommonWorkList extends Component{
</div>
</div>
{work_count > PAGE_SIZE && <Pagination
{work_count > PAGE_SIZE && <Pagination
style={{ textAlign: 'center', marginBottom: '20px' }}
showQuickJumper pageSize={PAGE_SIZE} onChange={this.onTablePagination} current={page} total={work_count} />}
@ -859,4 +875,4 @@ class CommonWorkList extends Component{
}
const CommonWorkListForm = Form.create({ name: 'commonworkListForm' })(CommonWorkList);
export default CommonWorkListForm;
export default CommonWorkListForm;

@ -1017,6 +1017,7 @@ class Coursesleftnav extends Component{
return(
<div key={key} >
<a>
{item.type!="statistics"?
<li title={item.name.length<7?"":item.name} onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<a onClick={(e)=>this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
@ -1030,7 +1031,8 @@ class Coursesleftnav extends Component{
item.type==="poll"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-wenjuan mr10 fl":"iconfont icon-wenjuan mr10 fl"}></i>:
item.type==="attachment"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-ziyuan mr10 fl":"iconfont icon-ziyuan mr10 fl"} ></i>:
item.type==="board"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-taolun mr10 fl":"iconfont icon-taolun mr10 fl"} ></i>:
item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>:""
item.type==="course_group"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-fenban mr10 fl":"iconfont icon-fenban mr10 fl"} ></i>:
item.type==="statistics"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-tongji mr10 fl":"iconfont icon-tongji mr10 fl"} ></i>:""
}
{/*||this.props.location.pathname===this.state.url&&key===this.state.indexs*/}
@ -1049,7 +1051,7 @@ class Coursesleftnav extends Component{
</Popover>:""}
</a>
</li>
</li>:""}
{/*下拉列表*/}
@ -1153,6 +1155,7 @@ class Coursesleftnav extends Component{
<div key={key}>
{/*<Tooltip placement="bottom" title={"点击空白处展开二级菜单,点击模块名字跳转到对应模块"}>*/}
<a >
{item.type!="statistics"?
<li className={this.props.mainurl===item.category_url&&this.props.location.pathname===item.category_url?"liactive":"clearfix active"}
onClick={(e)=>this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)}
title={item.name.length<7?"":item.name}
@ -1176,7 +1179,7 @@ class Coursesleftnav extends Component{
<span className={this.props.location.pathname===item.category_url?"color-blue fr mr20 font-14":"fr mr20 color999 font-14"}>{item.task_count===0?"":item.task_count}</span>
</a>
</li>
</li>:""}
</a>
<ul style={{display:key===this.props.indexs?"":"none"}} class="droppableul">

@ -20,7 +20,7 @@ import '../poll/pollStyle.css'
import moment from 'moment';
import 'moment/locale/zh-cn';
import './yslexercisetable.css';
import {getImageUrl, toPath} from 'educoder';
import {getImageUrl, toPath, sortDirections} from 'educoder';
import CheckBoxGroup from "../../page/component/CheckBoxGroup";
import NoneData from '../../../modules/courses/coursesPublic/NoneData'
const Search = Input.Search;
@ -110,6 +110,8 @@ class Studentshavecompletedthelist extends Component {
align: 'center',
className: "edu-txt-center font-14 maxnamewidth175",
width:'175px',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span className="maxnamewidth175" style={{
width:'175px',
@ -200,6 +202,9 @@ class Studentshavecompletedthelist extends Component {
align: 'center',
className: "edu-txt-center font-14",
width:'175px',
sorter: true,
defaultSortOrder: 'descend',
sortDirections: sortDirections,
render: (text, record) => (
<span style={{
width:'175px',
@ -294,6 +299,8 @@ class Studentshavecompletedthelist extends Component {
key: 'efficiencyscore',
align: 'center',
className: "edu-txt-center font-14",
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
{record.efficiencyscore === "--" ?
@ -877,6 +884,8 @@ class Studentshavecompletedthelist extends Component {
key: 'stduynumber',
align: 'center',
className: "edu-txt-center font-14",
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
{record.stduynumber === "--" ?
@ -930,6 +939,9 @@ class Studentshavecompletedthelist extends Component {
key: 'updatetime',
align: 'center',
className: "edu-txt-center font-14",
sorter: true,
defaultSortOrder: 'descend',
sortDirections: sortDirections,
render: (text, record) => (
<span>
{record.updatetime==="--"?
@ -978,6 +990,8 @@ class Studentshavecompletedthelist extends Component {
key: 'efficiencyscore',
align: 'center',
className: "edu-txt-center font-14",
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
{record.efficiencyscore === "--" ?
@ -1052,6 +1066,7 @@ class Studentshavecompletedthelist extends Component {
key: 'name',
align: 'center',
className: "edu-txt-center font-14",
render: (text, record) => (
<span>
{record.name==="--"?
@ -1068,6 +1083,8 @@ class Studentshavecompletedthelist extends Component {
key: 'stduynumber',
align: 'center',
className: "edu-txt-center font-14",
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
{record.stduynumber === "--" ?
@ -1121,6 +1138,8 @@ class Studentshavecompletedthelist extends Component {
key: 'updatetime',
align: 'center',
className: "edu-txt-center font-14",
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
{record.updatetime==="--"?
@ -1169,6 +1188,8 @@ class Studentshavecompletedthelist extends Component {
key: 'efficiencyscore',
align: 'center',
className: "edu-txt-center font-14",
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
{record.efficiencyscore === "--" ?
@ -1219,8 +1240,9 @@ class Studentshavecompletedthelist extends Component {
</span>
)
},
],
],//columnsystwo 也会被columnsys当作参数接收
exercise_status:0,
order_type: "desc",
}
// console.log("Studentshavecompletedthelist");
// console.log(props.current_status);
@ -1244,7 +1266,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, pageNumber, 20);
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, pageNumber, 20, this.state.order_type);
}
paginationonChanges = (pageNumber) => {
@ -1261,7 +1283,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdata(this.state.order, null, null, null, null, pageNumber, this.state.limit)
this.Searchdata(this.state.order, null, null, null, null, pageNumber, this.state.limit, this.state.order_type);
}
@ -1459,9 +1481,9 @@ class Studentshavecompletedthelist extends Component {
thiss.Generatenewdatasy(response.data.exercise_users, response);
}
}).catch((error) => {
console.log(error);
console.log("其实数据加载失败了");
console.log("1111");
// console.log(error);
// console.log("其实数据加载失败了");
// console.log("1111");
});
@ -1613,60 +1635,8 @@ class Studentshavecompletedthelist extends Component {
}
//排序
funorder = (e) => {
if (e === "end_at") {
// 时间
// 时间排序是从小到大
if (this.state.loadingstate === true) {
this.setState({
order: "end_at",
})
} else {
this.setState({
order: "end_at",
loadingstate: true,
})
}
this.Searchdata(e, null, null, null, null, this.state.page, this.state.limit)
}
if (e === "score") {
// 成绩
//成绩排序是从大到小
if (this.state.loadingstate === true) {
this.setState({
order: "score",
})
} else {
this.setState({
order: "score",
loadingstate: true,
})
}
this.Searchdata(e, null, null, null, null, this.state.page, this.state.limit)
}
if (e === "student_id") {
//学号
//学号排序是从大到小
if (this.state.loadingstate === true) {
this.setState({
order: "student_id",
})
} else {
this.setState({
order: "student_id",
loadingstate: true
})
}
this.Searchdata(e, null, null, null, null, this.state.page, this.state.limit)
}
}
Searchdata = (order, commit_status, review, exercise_group_id, search, page, limit) => {
Searchdata = (order, commit_status, review, exercise_group_id, search, page, limit, order_type) => {
var exercise_id = this.props.match.params.Id;
// console.log(731); // 764 935
var url = `/exercises/${exercise_id}/exercise_lists.json`;
@ -1678,6 +1648,7 @@ class Studentshavecompletedthelist extends Component {
search: "",
page: page,
limit: limit,
order_type: order_type,
}
axios.get(url, {
params: params
@ -2050,7 +2021,7 @@ class Studentshavecompletedthelist extends Component {
})
}
Searchdatasys = (order, commit_status, review, exercise_group_id, search, page, limit) => {
Searchdatasys = (order, commit_status, review, exercise_group_id, search, page, limit, order_type) => {
var exercise_id = this.props.match.params.Id;
var url = `/exercises/${exercise_id}/exercise_lists.json`;
axios.get((url), {
@ -2062,6 +2033,7 @@ class Studentshavecompletedthelist extends Component {
search: search,
page: page,
limit: limit,
order_type: order_type
}
}).then((response) => {
// console.log("528");
@ -2098,7 +2070,7 @@ class Studentshavecompletedthelist extends Component {
page:1,
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, null, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, null, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
}
// notlimiteds = () => {
// this.setState({
@ -2125,7 +2097,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, undefined, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, undefined, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
}
checkeboxstwo = (checkedValues, data) => {
// console.log(checkedValues)
@ -2146,7 +2118,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
} else if (checkedValues.length === data.length) {
if (this.state.loadingstate === false) {
this.setState({
@ -2163,10 +2135,10 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
} else {
// console.log(checkedValues);
this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, checkedValues, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
if (this.state.loadingstate === false) {
this.setState({
loadingstate: true,
@ -2196,7 +2168,7 @@ class Studentshavecompletedthelist extends Component {
course_groups: null,
unlimitedtwo: 0
})
this.Searchdatasys(this.state.order, this.state.commit_status, this.state.review, undefined, this.state.searchtext, null, null)
this.Searchdatasys(this.state.order, this.state.commit_status, this.state.review, undefined, this.state.searchtext, null, null, this.state.order_type)
}
checkeboxs = (checkedValues, data) => {
@ -2225,7 +2197,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
} else if (checkedValues.length === data.length) {
if (this.state.loadingstate === false) {
this.setState({
@ -2242,7 +2214,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
} else {
// console.log(checkedValues);
if (this.state.loadingstate === false) {
@ -2260,7 +2232,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
}
}
@ -2283,7 +2255,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, undefined, this.state.searchtext, 1, this.state.limit)
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, undefined, this.state.searchtext, 1, this.state.limit, this.state.order_type)
}
funtaskstatustwo = (checkedValues, data) => {
@ -2305,7 +2277,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit)
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.order_type)
} else if (checkedValues.length === data.length) {
if (this.state.loadingstate === false) {
this.setState({
@ -2322,7 +2294,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit)
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.order_type)
} else {
// console.log(checkedValues);
if (this.state.loadingstate === false) {
@ -2343,7 +2315,7 @@ class Studentshavecompletedthelist extends Component {
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit)
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.order_type)
this.props.setcourse_groupysls(checkedValues)
}
@ -2364,7 +2336,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.order_type);
}
};
//搜索学生按钮输入 老师
@ -2381,7 +2353,7 @@ class Studentshavecompletedthelist extends Component {
})
}
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, value, 1, this.state.limit);
this.Searchdatasys(this.state.order, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, value, 1, this.state.limit, this.state.order_type);
// this.Startsorting(this.state.order,this.state.checkedValuesine,this.state.checkedValuesineinfo,value);
// console.log(value)
@ -2416,60 +2388,175 @@ class Studentshavecompletedthelist extends Component {
};
//排序
funordersy = (e) => {
console.log(this.state.course_groupyslstwo);
debugger
if (e === "end_at") {
// 时间
// 时间排序是从小到大
if (this.state.loadingstate === false) {
this.setState({
order: "end_at",
loadingstate: true,
})
} else {
this.setState({
order: "end_at",
})
//老师试卷table 列表塞选数据
table1handleChange = (pagination, filters, sorter) => {
//"ascend" 升序
//"descend" 降序
if (JSON.stringify(sorter) === "{}") {
//没有选择
} else {
try {
//时间排序
if (sorter.columnKey === "updatetime") {
if (sorter.order === "ascend") {
//升序
this.setState({
order: "end_at",
loadingstate: true,
order_type: "asc"
})
this.Searchdatasys("end_at", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
order: "end_at",
loadingstate: true,
order_type: "desc"
})
this.Searchdatasys("end_at", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc");
}
}
} catch (e) {
}
this.Searchdatasys(e, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page,this.state.limit);
}
try {
//学生学号排序
if (sorter.columnKey === "stduynumber") {
if (sorter.order === "ascend") {
//升序
this.setState({
order: "student_id",
loadingstate: true,
order_type: "asc"
})
this.Searchdatasys("student_id", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
order: "student_id",
loadingstate: true,
order_type: "desc"
})
this.Searchdatasys("student_id", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc");
if (e === "score") {
// 成绩
//成绩排序是从大到小
if (this.state.loadingstate === false) {
this.setState({
order: "score",
loadingstate: true,
})
} else {
this.setState({
order: "score",
})
}
}
} catch (e) {
}
try {
//成绩排序排序
if (sorter.columnKey === "efficiencyscore") {
if (sorter.order === "ascend") {
//升序
this.setState({
order: "score",
loadingstate: true,
order_type: "asc"
})
this.Searchdatasys("score", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
order: "score",
loadingstate: true,
order_type: "desc"
})
this.Searchdatasys("score", this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc");
}
}
} catch (e) {
}
this.Searchdatasys(e, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page,this.state.limit);
}
}
//学生问卷table 列表塞选数据
table1handleChangestuden = (pagination, filters, sorter) => {
if (JSON.stringify(sorter) === "{}") {
//没有选择
} else {
try {
//时间排序
if (sorter.columnKey === "updatetime") {
if (sorter.order === "ascend") {
//升序
this.setState({
order: "end_at",
loadingstate: true,
order_type: "asc"
})
this.Searchdata("end_at", null, null, null, null, this.state.page, this.state.limit, "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
order: "end_at",
loadingstate: true,
order_type: "desc"
})
this.Searchdata("end_at", null, null, null, null, this.state.page, this.state.limit, "desc");
}
}
} catch (e) {
}
try {
//学生学号排序
if (sorter.columnKey === "stduynumber") {
if (sorter.order === "ascend") {
//升序
this.setState({
order: "student_id",
loadingstate: true,
order_type: "asc"
})
this.Searchdata("student_id", null, null, null, null, this.state.page, this.state.limit, "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
order: "student_id",
loadingstate: true,
order_type: "desc"
})
this.Searchdata("student_id", null, null, null, null, this.state.page, this.state.limit, "desc");
}
}
} catch (e) {
if (e === "student_id") {
//学号
//学号排序是从大到小
if (this.state.loadingstate === false) {
this.setState({
order: "student_id",
loadingstate: true,
})
} else {
this.setState({
order: "student_id",
})
}
this.Searchdatasys(e, this.state.course_groupyslstwo, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page,this.state.limit);
try {
//成绩排序排序
if (sorter.columnKey === "efficiencyscore") {
if (sorter.order === "ascend") {
//升序
this.setState({
order: "score",
loadingstate: true,
order_type: "asc"
})
this.Searchdata("score", null, null, null, null, this.state.page, this.state.limit, "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
order: "score",
loadingstate: true,
order_type: "desc"
})
this.Searchdata("score", null, null, null, null, this.state.page, this.state.limit, "desc");
}
}
} catch (e) {
}
}
}
setExerciseReviewAndAnswer = () => {
@ -2635,23 +2722,6 @@ class Studentshavecompletedthelist extends Component {
style={{color: '#FF6800'}}>{Teacherliststudentlist === undefined ? "0" : Teacherliststudentlist.exercise_types.total_users}</span><span
className="color-orange-tip"></span>{Teacherliststudentlist === undefined ? "0" : Teacherliststudentlist.exercise_types.exercise_all_users} </span>
<div className="fr color-grey-6 edu-menu-panel">
<ul>
<li className="edu-position edu-position-hidebox">
<a className="font-12">
{order === "end_at" ? "时间" : order === "score" ? "成绩" : order === "student_id" ? "学号" : ""}排序</a>
<i className="iconfont icon-xiajiantou ml5 font-12"></i>
<ul className="edu-position-hide undis mt10">
<li><a onClick={(e) => this.funordersy("end_at")} data-remote="true"
className=" font-12" style={{textAlign: "center "}}>提交时间</a></li>
<li><a onClick={(e) => this.funordersy("score")} data-remote="true"
className=" font-12" style={{textAlign: "center "}}>最终成绩</a></li>
<li><a onClick={(e) => this.funordersy("student_id")} data-remote="true"
className=" font-12" style={{textAlign: "center "}}>学生学号</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
@ -2666,7 +2736,7 @@ class Studentshavecompletedthelist extends Component {
.ysltableows2 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
mysjysltable1 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
.mysjysltable1 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
`}</style>
@ -2676,6 +2746,7 @@ class Studentshavecompletedthelist extends Component {
columns={columnsys}
className="mysjysltable1"
pagination={false}
onChange={this.table1handleChange}
loading={loadingstate}
// onChange={this.TablePaginationsy}
/>}
@ -2776,7 +2847,7 @@ class Studentshavecompletedthelist extends Component {
.ysltableows2 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
mysjysltable2 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
.mysjysltable2 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
`}</style>
@ -2832,7 +2903,7 @@ class Studentshavecompletedthelist extends Component {
.ysltableows .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
mysjysltable3 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
.mysjysltable3 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
`
@ -2882,26 +2953,8 @@ class Studentshavecompletedthelist extends Component {
<span
style={{color: '#FF6800'}}> {Teacherliststudentlist === undefined ? "0" : Teacherliststudentlist.exercise_types.exercise_end_time}</span>}
</span>
<div className="fr color-grey-6 edu-menu-panel">
<ul>
<li className="edu-position edu-position-hidebox">
<a className="font-12 ">
{order === "end_at" ? "时间" : order === "score" ? "成绩" : order === "student_id" ? "学号" : ""}排序</a>
<i className="iconfont icon-xiajiantou ml5 font-12 color-grey-6"></i>
<ul className="edu-position-hide undis mt10">
<li><a onClick={(e) => this.funorder("end_at")} data-remote="true"
className=" font-12" style={{textAlign: "center "}}>提交时间</a>
</li>
<li><a onClick={(e) => this.funorder("score")} data-remote="true"
className=" font-12" style={{textAlign: "center "}}>最终成绩</a>
</li>
<li><a onClick={(e) => this.funorder("student_id")} data-remote="true"
className=" font-12" style={{textAlign: "center "}}>学生学号</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
@ -2926,7 +2979,7 @@ class Studentshavecompletedthelist extends Component {
.ysltableowss .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
mysjysltable4 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
.mysjysltable4 .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
padding: 9px;
}
`}</style>
@ -2936,6 +2989,7 @@ class Studentshavecompletedthelist extends Component {
columns={columns}
pagination={false}
className="mysjysltable4"
onChange={this.table1handleChangestuden}
loading={loadingstate}
/>}</div>
</div>
@ -2973,4 +3027,4 @@ class Studentshavecompletedthelist extends Component {
// subjective 主要是用于判断答题列表页是否存在 主观题 一栏的
// 客观题没有判断。当主观题存在时,就会有客观题出现,否则只有总成绩
// 当subjective 等于1时就出现3列客观题主观题最终成绩。当subjective等于0时你就只出现最终成绩一列就行了
export default Studentshavecompletedthelist;
export default Studentshavecompletedthelist;

@ -515,7 +515,7 @@ class GraduationTaskDetail extends Component{
</div>
</div>
<Switch {...this.props}>
{/*//毕设任务列表*/}
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/detail/:task_Id/list"
render={
(props) => (<GraduationTaskslist {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} setend_time={(time)=>this.setend_time(time)} tab={`list`}/>)

@ -1,7 +1,7 @@
import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Pagination, Table, Divider, Tag,Tooltip} from "antd";
import {Link} from 'react-router-dom';
import { getImageUrl , NoneData } from 'educoder';
import {getImageUrl, NoneData, sortDirections} from 'educoder';
import axios from 'axios';
import moment from 'moment';
import HomeworkModal from "../../coursesPublic/HomeworkModal";
@ -19,7 +19,7 @@ const Search = Input.Search;
const qs = require('qs');
//毕设任务列表
class GraduationTaskssettinglist extends Component{
constructor(props){
@ -57,7 +57,7 @@ class GraduationTaskssettinglist extends Component{
componentDidMount(){
let tab = this.props.tab;
this.props.setTab && this.props.setTab(tab);
let{teacher_comment,task_status,course_group,cross_comment,order,b_order,search}=this.state;
this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page);
@ -65,8 +65,8 @@ class GraduationTaskssettinglist extends Component{
try{
this.props.triggerRef(this)
}catch(e){
}
}
}
goback=()=>{
@ -160,12 +160,68 @@ class GraduationTaskssettinglist extends Component{
})
}
TablePagination=(e)=>{
TablePagination = (pagination, filters, sorter) => {
// console.log(e.current);
// this.setState({
// page:e.current
// })
if (JSON.stringify(sorter) === "{}") {
//没有选择
} else {
//stduynumber 学号
try {
//学生学号排序
if (sorter.columnKey === "stduynumber") {
let orderlumn = "";
if (sorter.order === "ascend") {
//升序
orderlumn = "asc";
} else if (sorter.order === "descend") {
//降序
orderlumn = "desc";
}
this.funorder("student_id", orderlumn)
}
} catch (e) {
this.setState({
page:e.current
})
}
//turnovertime 时间
try {
//学生学号排序
if (sorter.columnKey === "turnovertime") {
let orderlumn = "";
if (sorter.order === "ascend") {
//升序
orderlumn = "asc";
} else if (sorter.order === "descend") {
//降序
orderlumn = "desc";
}
this.funorder("update_time", orderlumn);
}
} catch (e) {
}
//finalscore 成绩
try {
//学生学号排序
if (sorter.columnKey === "finalscore") {
let orderlumn = "";
if (sorter.order === "ascend") {
//升序
orderlumn = "asc";
} else if (sorter.order === "descend") {
//降序
orderlumn = "desc";
}
this.funorder("work_score", orderlumn);
}
} catch (e) {
}
}
}
funteachercomment=(list,key)=> {
@ -234,47 +290,14 @@ class GraduationTaskssettinglist extends Component{
}
funorder=(value)=>{
funorder = (value, newb_order) => {
let {teacher_comment, task_status, course_group, cross_comment, b_order, search,order} = this.state;
let newb_order;
if(order===value){
if(b_order==="desc"){
this.setState({
order:value,
b_order:"asc"
})
newb_order="asc";
}else{
this.setState({
order:value,
b_order:"desc"
})
newb_order="desc";
}
}else{
if(b_order==="desc"){
this.setState({
order:value,
b_order:"desc"
})
newb_order="desc";
}else{
this.setState({
order:value,
b_order:"asc"
})
newb_order="asc";
}
}
this.setState({
loadingstate:true
})
this.setState({
order: value,
b_order: newb_order,
loadingstate: true
})
this.seacthdata(teacher_comment, task_status, course_group, cross_comment, value, newb_order, search,this.state.page);
}
@ -747,6 +770,8 @@ class GraduationTaskssettinglist extends Component{
dataIndex: 'stduynumber',
key: 'stduynumber',
className:'edu-txt-center',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
<div style={{color:'#9A9A9A'}} className={"studentnumber"} title={record.stduynumber}>{record.stduynumber}</div>
@ -798,6 +823,9 @@ class GraduationTaskssettinglist extends Component{
dataIndex: 'turnovertime',
key: 'turnovertime',
className:'edu-txt-center',
sorter: true,
defaultSortOrder: 'descend',
sortDirections: sortDirections,
render: (text, record) => (
<span>
<a style={{color:'#989898'}}>
@ -839,6 +867,8 @@ class GraduationTaskssettinglist extends Component{
key: 'finalscore',
dataIndex: 'finalscore',
className:'edu-txt-center',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
<Tooltip placement="right" title={record.finalscore.work_score==="--"?"未评阅": <pre>
@ -1220,20 +1250,7 @@ class GraduationTaskssettinglist extends Component{
{this.props.isAdmin()===true?<span className="fl color-grey-6 font-12">
<span className="color-orange-tip">{taskslistdata&&taskslistdata.work_count}</span>
个检索结果{taskslistdata&&taskslistdata.all_work_count} 学生</span>:""}
{this.props.isAdmin()===true?<div className="fr color-grey-6 edu-menu-panel">
<p>
<a data-remote="true" class="color-grey-6 font-12">
{order==="update_time"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}排序</a>
<i className="iconfont icon-xiajiantou ml5 font-12 color-grey-6"></i></p>
<ul className="edu-menu-list edu-menu-lists" style={{width: '87px'}}>
<li onClick={(e)=>this.funorder("update_time")}><a data-remote="true">更新时间</a>
</li>
<li onClick={(e)=>this.funorder("work_score" )}><a data-remote="true">最终成绩</a>
</li>
<li onClick={(e)=>this.funorder("student_id" )}><a data-remote="true">学生学号</a>
</li>
</ul>
</div>:""}
</div>
{this.props.isStudent()===true?
@ -1409,27 +1426,6 @@ class GraduationTaskssettinglist extends Component{
<div id="graduation_work_list" style={{ padding: '18px 40px 10px',height: '56px'}}>
{this.props.isAdmin()===true?
<div className="clearfix">
<span className="fl color-grey-6 font-12">
<span className="color-orange-tip">{taskslistdata&&taskslistdata.work_count}</span>
个检索结果{taskslistdata&&taskslistdata.work_count} 学生
</span>
<div className="fr color-grey-6 edu-menu-panel">
<p><a data-remote="true">
{order==="update_time"?"时间":order==="work_score"?"成绩":order==="student_id"?"学号":""}排序</a><i
className="iconfont icon-xiajiantou ml5 font-12 color-grey-6"></i></p>
<ul className="edu-menu-list">
<li onClick={(e)=>this.funorder("update_time")} className={order==="update_time"?"none":""}><a data-remote="true">时间</a>
</li>
<li onClick={(e)=>this.funorder("work_score" )} className={order==="work_score"?"none":""}><a data-remote="true">成绩</a>
</li>
<li onClick={(e)=>this.funorder("student_id" )} className={order==="student_id"?"none":""}><a data-remote="true">学号</a>
</li>
</ul>
</div>
</div>
:""}
{this.props.isStudent()===true?
<div className="clearfix">
<span className="mr15 color-grey9">
@ -1511,4 +1507,4 @@ class GraduationTaskssettinglist extends Component{
}
}
export default GraduationTaskssettinglist;
export default GraduationTaskssettinglist;

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import {Checkbox,Input,Table, Pagination} from "antd";
import { WordsBtn } from 'educoder'
import {WordsBtn, sortDirections} from 'educoder'
import moment from 'moment';
import CheckAllGroup from '../common/button/CheckAllGroup'
import NoneData from "../coursesPublic/NoneData"
@ -49,7 +49,8 @@ class PollDetailTabFirst extends Component{
poll_types:undefined,
course_groups:undefined,
options_Class:[],
poll_end_at:""
poll_end_at: "",
order_type: "desc"
}
}
// 搜索框搜索
@ -59,16 +60,16 @@ class PollDetailTabFirst extends Component{
})
}
searchInfo=()=>{
let{order,search,commit_status,poll_group_id,page}=this.state
this.getTableList(order,search,commit_status,poll_group_id,page);
let {order, search, commit_status, poll_group_id, page, order_type} = this.state
this.getTableList(order, search, commit_status, poll_group_id, page, order_type);
}
// 获取接口数据
getTableList=(order,search,commit_status,poll_group_id,page)=>{
getTableList = (order, search, commit_status, poll_group_id, page, order_type) => {
let pollId=this.props.match.params.pollId;
let courseid=this.props.match.params.coursesId;
let url=`/polls/${pollId}/poll_lists.json`;
axios.get((url),{
params:{
limit:this.state.limit,
@ -76,7 +77,8 @@ class PollDetailTabFirst extends Component{
search:search,
commit_status:commit_status,
poll_group_id:poll_group_id,
page:page
page: page,
order_type: order_type
}
}).then((result)=>{
if(result){
@ -128,8 +130,8 @@ class PollDetailTabFirst extends Component{
}
componentDidMount(){
let {order,search,commit_status,poll_group_id,page}=this.state;
this.getTableList(order,search,commit_status,poll_group_id,page);
let {order, search, commit_status, poll_group_id, page, order_type} = this.state;
this.getTableList(order, search, commit_status, poll_group_id, page, order_type);
}
// 翻页
@ -137,17 +139,17 @@ class PollDetailTabFirst extends Component{
this.setState({
page:pageNumber
})
let {order,search,commit_status,poll_group_id}=this.state;
this.getTableList(order,search,commit_status,poll_group_id,pageNumber);
let {order, search, commit_status, poll_group_id, order_type} = this.state;
this.getTableList(order, search, commit_status, poll_group_id, pageNumber, order_type);
}
//排序
changeOrder=(order)=>{
changeOrder = (order, order_type) => {
this.setState({
order:order
})
let {search,commit_status,poll_group_id,page}=this.state;
this.getTableList(order,search,commit_status,poll_group_id,page);
this.getTableList(order, search, commit_status, poll_group_id, page, order_type);
}
//选择分班情况
classOptionsChange = (values,all) => {
@ -155,8 +157,8 @@ class PollDetailTabFirst extends Component{
this.setState({
poll_group_id:status
})
let {order,search,commit_status,page}=this.state;
this.getTableList(order,search,commit_status,status,page);
let {order, search, commit_status, page, order_type} = this.state;
this.getTableList(order, search, commit_status, status, page, order_type);
}
//选择提交状态
statusOptionChange=(values,all)=>{
@ -164,10 +166,69 @@ class PollDetailTabFirst extends Component{
this.setState({
commit_status:status
})
let {order,search,poll_group_id,page}=this.state;
this.getTableList(order,search,status,poll_group_id,page);
}
let {order, search, poll_group_id, page, order_type} = this.state;
this.getTableList(order, search, status, poll_group_id, page, order_type);
}
//问卷table 列表塞选数据
table1handleChange = (pagination, filters, sorter) => {
//"ascend" 升序
//"descend" 降序
if (JSON.stringify(sorter) === "{}") {
//没有选择
} else {
try {
//学生学号排序
if (sorter.columnKey === "StudentNo") {
if (sorter.order === "ascend") {
//升序
this.setState({
order_type: "asc",
order: "student_id",
loadingstate: true,
});
this.changeOrder("student_id", "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
order_type: "desc",
order: "student_id",
loadingstate: true,
})
this.changeOrder("student_id", "desc");
}
}
} catch (e) {
}
try {
//提交时间排序
if (sorter.columnKey === "time") {
if (sorter.order === "ascend") {
//升序
this.setState({
order_type: "asc",
order: "end_at",
loadingstate: true,
})
this.changeOrder("end_at", "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
order_type: "desc",
order: "end_at",
loadingstate: true,
})
this.changeOrder("end_at", "desc");
}
}
} catch (e) {
}
}
}
render(){
let {order,search,data,page,limit,course_groups,poll_types,options_Class,dataInfo,poll_end_at}=this.state;
const isAdmin =this.props.isAdmin();
@ -197,6 +258,8 @@ class PollDetailTabFirst extends Component{
dataIndex: 'StudentNo',
key: 'StudentNo',
className:"edu-txt-center",
sorter: true,
sortDirections: sortDirections,
render:(StudentNo,item,index)=>{
return(
item.StudentNo ? <span>{item.StudentNo}</span> : "--"
@ -227,9 +290,12 @@ class PollDetailTabFirst extends Component{
}, {
title: '提交时间',
dataIndex: 'time',
key: 'time',
key: 'time',
className:"edu-txt-center",
width:160,
sorter: true,
defaultSortOrder: 'descend',
sortDirections: sortDirections,
render:(time,item,index)=>{
return(
item.time == null ? <span className="color-grey-9">--</span> : moment(item.time).format('YYYY-MM-DD HH:mm')
@ -289,13 +355,13 @@ class PollDetailTabFirst extends Component{
</div>
</div>
{
course_groups && course_groups.length > 1 ?
course_groups && course_groups.length > 1 ?
<div className="mt15">
<CheckAllGroup options={options_Class} label={'分班情况:'} onChange={this.classOptionsChange}></CheckAllGroup>
</div>
:""
}
</div>:""
}
@ -304,38 +370,39 @@ class PollDetailTabFirst extends Component{
isAdmin ? <span className="fl color-grey-3 font-12"><span className="color-orange-tip">{poll_types && poll_types.total_users}</span>{poll_types && poll_types.poll_users_count} </span> :""
}
{
isStudent ?
isStudent ?
<span className="fl color-grey-3 font-12">
{poll_types && poll_types.answer_users===undefined?"":<span className="mr15"><span className="color-orange-tip">{poll_types && poll_types.answer_users}</span> </span>}
{poll_types && poll_types.unanswer_users===undefined?"":<span className="mr15">{poll_types && poll_types.unanswer_users} 未交</span>}
{
poll_end_at != "0" ?
<span className="color-grey-9"> 剩余提交时间<span className="color-orange-tip">{poll_end_at}</span></span>
:""
: ""
}
</span>
:""
}
{
isAdmin &&
<div className="fr">
<li className="drop_down">
<span className="color-grey-9 font-12">{order=="end_at"?"提交时间":"学生学号"}</span><i className="iconfont icon-xiajiantou font-12 ml2 color-grey-6"></i>
<ul className="drop_down_normal">
<li onClick={()=>this.changeOrder("end_at")}>提交时间</li>
<li onClick={()=>this.changeOrder("student_id")}>学生学号</li>
</ul>
</li>
</div>
: ""
}
{/*{*/}
{/* isAdmin && */}
{/* <div className="fr">*/}
{/* <li className="drop_down">*/}
{/* <span className="color-grey-9 font-12">{order=="end_at"?"提交时间":"学生学号"}</span><i className="iconfont icon-xiajiantou font-12 ml2 color-grey-6"></i>*/}
{/* <ul className="drop_down_normal">*/}
{/* <li onClick={()=>this.changeOrder("end_at")}>提交时间</li>*/}
{/* <li onClick={()=>this.changeOrder("student_id")}>学生学号</li>*/}
{/* </ul>*/}
{/* </li>*/}
{/* </div>*/}
{/*}*/}
</div>}
<div className="edu-table edu-back-white minH-560">
{
data && data.length>0 ?<Table columns={columns} dataSource={data} pagination={false}></Table> :<NoneData></NoneData>
data && data.length > 0 ? <Table columns={columns} dataSource={data} pagination={false}
onChange={this.table1handleChange}></Table> : <NoneData></NoneData>
}
</div>
{
poll_types && poll_types.total_users && poll_types.total_users > limit ?
poll_types && poll_types.total_users && poll_types.total_users > limit ?
<div className="edu-txt-center mt30 mb50">
<Pagination showQuickJumper current={page} onChange={this.changePage} pageSize={limit} total={poll_types.total_users}></Pagination>
</div>:""
@ -344,4 +411,4 @@ class PollDetailTabFirst extends Component{
)
}
}
export default PollDetailTabFirst;
export default PollDetailTabFirst;

@ -1,6 +1,6 @@
import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn, ActionBtn} from 'educoder';
import {WordsBtn, ActionBtn, sortDirections} from 'educoder';
import {
Form,
Select,
@ -818,6 +818,7 @@ class Listofworksstudentone extends Component {
},
],
b_order: "desc",
myorders: "desc",
allow_late: false,
checkedValuesine: undefined,
checkedValuesineinfo: [],
@ -872,6 +873,8 @@ class Listofworksstudentone extends Component {
key: 'stduynumber',
align: "center",
className: 'font-14 maxnamewidth110',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span className="maxnamewidth110">
{record.stduynumber === undefined ?
@ -1091,6 +1094,9 @@ class Listofworksstudentone extends Component {
key: 'finalscore',
align: 'center',
className: 'font-14',
sorter: true,
sortDirections: sortDirections,
defaultSortOrder: 'descend',
render: (text, record) => (
<span>
{
@ -1204,6 +1210,8 @@ class Listofworksstudentone extends Component {
key: 'stduynumber',
align: "center",
className: 'font-14 maxnamewidth110',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span className="maxnamewidth110">
{record.stduynumber === undefined ?
@ -1416,6 +1424,9 @@ class Listofworksstudentone extends Component {
key: 'finalscore',
align: 'center',
className: 'font-14',
sorter: true,
sortDirections: sortDirections,
defaultSortOrder: 'descend',
render: (text, record) => (
<span>
{
@ -1530,6 +1541,7 @@ class Listofworksstudentone extends Component {
// }
//
// }
componentDidMount() {
// console.log("componentDidMount ");
// console.log("调用子组件 ");
@ -1548,6 +1560,68 @@ class Listofworksstudentone extends Component {
// this.Gettitleinformation(homeworkid);
this.Getalistofworks(homeworkid, false);
}
//实训作业tbale 列表塞选数据
table1handleChange = (pagination, filters, sorter) => {
//"ascend" 升序
//"descend" 降序
if (JSON.stringify(sorter) === "{}") {
//没有选择
} else {
// console.log(sorter);
try {
//学生学号排序
if (sorter.columnKey === "stduynumber") {
if (sorter.order === "ascend") {
//升序
this.setState({
myorders: "asc",
orders: "student_id",
loadingstate: true,
});
this.Startsortingt("student_id", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
myorders: "desc",
orders: "student_id",
loadingstate: true,
})
this.Startsortingt("student_id", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc");
}
}
} catch (e) {
}
try {
//学生成绩排序
if (sorter.columnKey === "finalscore") {
if (sorter.order === "ascend") {
//升序
this.setState({
myorders: "asc",
orders: "work_score",
loadingstate: true,
})
this.Startsortingt("work_score", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "asc");
} else if (sorter.order === "descend") {
//降序
this.setState({
myorders: "desc",
orders: "work_score",
loadingstate: true,
})
this.Startsortingt("work_score", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, "desc");
}
}
} catch (e) {
}
}
}
/////////老师操作
// tearchar=()=>{
// var homeworkid = this.props.match.params.homeworkid;
@ -2275,7 +2349,7 @@ class Listofworksstudentone extends Component {
//开始排序操作
Startsortingt = (ordervlue, checkedValuesine, checkedValuesineinfo, searchtext, page, limit) => {
Startsortingt = (ordervlue, checkedValuesine, checkedValuesineinfo, searchtext, page, limit, myorders) => {
//要提交的作品状态checkedValuesine
//要提交的分班状态checkedValuesineinfo
//searchtext 输入的姓名和学号
@ -2285,10 +2359,18 @@ class Listofworksstudentone extends Component {
var homeworkid = this.props.match.params.homeworkid;
let urll = `/homework_commons/${homeworkid}/works_list.json?`;
var order = "asc";
if (ordervlue === "update_time") {
order = "desc";
var order = this.state.order;
try {
if (myorders === null || myorders === undefined) {
} else {
order = myorders;
}
} catch (e) {
}
var checkedValuesines = checkedValuesine;
var checkedValuesineinfos = checkedValuesineinfo;
var searchtexts = searchtext
@ -2591,7 +2673,7 @@ class Listofworksstudentone extends Component {
loadingstate: true,
page: 1,
})
this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.myorders);
} else if (checkedValues.length === data.length) {
this.setState({
unlimited: 0,
@ -2599,7 +2681,7 @@ class Listofworksstudentone extends Component {
loadingstate: true,
page: 1,
})
this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.myorders);
} else {
// console.log(checkedValues);
this.setState({
@ -2608,7 +2690,7 @@ class Listofworksstudentone extends Component {
loadingstate: true,
page: 1,
})
this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Startsortingt(this.state.orders, checkedValues, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.myorders);
}
}
@ -2625,7 +2707,7 @@ class Listofworksstudentone extends Component {
loadingstate: true,
page: 1,
})
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, checkedValues, this.state.searchtext, 1, this.state.limit);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.myorders);
} else if (checkedValues.length === data.length) {
this.setState({
unlimitedtwo: 1,
@ -2634,7 +2716,7 @@ class Listofworksstudentone extends Component {
loadingstate: true,
page: 1,
})
this.Startsortingt(this.state.orders, this.state.checcourse_groupyslstwokedValuesine, checkedValues, this.state.searchtext, 1, this.state.limit);
this.Startsortingt(this.state.orders, this.state.checcourse_groupyslstwokedValuesine, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.myorders);
} else {
this.setState({
checkedValuesineinfo: checkedValues,
@ -2643,7 +2725,7 @@ class Listofworksstudentone extends Component {
loadingstate: true,
page: 1,
})
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, checkedValues, this.state.searchtext, 1, this.state.limit);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, checkedValues, this.state.searchtext, 1, this.state.limit, this.state.myorders);
}
@ -2676,7 +2758,7 @@ class Listofworksstudentone extends Component {
page: 1,
limit: 20,
})
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, value, 1, 20);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, value, 1, 20, this.state.myorders);
// console.log(value)
@ -2692,43 +2774,10 @@ class Listofworksstudentone extends Component {
page: 1,
limit: 20,
})
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, 20);
}
}
//排序
funordert = (e) => {
if (e === "update_time") {
// 时间
// 时间排序是从小到大
this.setState({
orders: "update_time",
loadingstate: true,
})
this.Startsortingt("update_time", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit);
}
if (e === "work_score") {
// 成绩
//成绩排序是从大到小
this.setState({
orders: "work_score",
loadingstate: true,
})
this.Startsortingt("work_score", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit);
}
if (e === "student_id") {
//学号
//学号排序是从大到小
this.setState({
orders: "student_id",
loadingstate: true,
})
this.Startsortingt("student_id", this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, 20, this.state.myorders);
}
}
// 调分
// 查看学员实训信息
@ -2771,7 +2820,7 @@ class Listofworksstudentone extends Component {
.then((response) => {
if (response.data.status == '0') {
this.setState({visible: false});
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, this.state.page, this.state.limit, this.state.myorders);
this.props.showNotification(`调分成功`);
}
})
@ -2958,7 +3007,7 @@ class Listofworksstudentone extends Component {
loadingstate: true,
page: 1,
})
this.Startsortingt(this.state.orders, [], this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
this.Startsortingt(this.state.orders, [], this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit, this.state.myorders);
}
notlimitedst = () => {
@ -2969,7 +3018,7 @@ class Listofworksstudentone extends Component {
course_groupysls: undefined,
loadingstate: true,
})
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, [], this.state.searchtext, 1, this.state.limit);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, [], this.state.searchtext, 1, this.state.limit, this.state.myorders);
}
//立即截止确定按钮
coursetaskend = () => {
@ -3050,8 +3099,7 @@ class Listofworksstudentone extends Component {
page: pageNumber,
loadingstate: true,
})
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, pageNumber, this.state.limit);
this.Startsortingt(this.state.orders, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, pageNumber, this.state.limit, this.state.myorders);
}
setComputeTimet = () => {
@ -3454,24 +3502,6 @@ class Listofworksstudentone extends Component {
`
}
</style>
<div className="fr edu-menu-panel">
<ul>
<li className="edu-position edu-position-hidebox">
<a className="font-12">
{orders === "update_time" ? "时间" : orders === "work_score" ? "成绩" : orders === "student_id" ? "学号" : ""}排序</a>
<i className="iconfont icon-xiajiantou ml5 font-12 "></i>
<ul className="edu-position-hide undis mt10">
<li><a onClick={(e) => this.funordert("update_time")} data-remote="true"
className=" font-12" style={{textAlign: "center"}}>更新时间</a></li>
<li><a onClick={(e) => this.funordert("work_score")} data-remote="true"
className=" font-12" style={{textAlign: "center"}}>当前成绩</a></li>
<li><a onClick={(e) => this.funordert("student_id")} data-remote="true"
className=" font-12" style={{textAlign: "center"}}>学生学号</a></li>
</ul>
</li>
</ul>
</div>
</div>
@ -3514,6 +3544,7 @@ class Listofworksstudentone extends Component {
dataSource={datajs}
columns={columns}
pagination={false}
onChange={this.table1handleChange}
loading={loadingstate}
/>}
</div>
@ -4010,4 +4041,4 @@ class Listofworksstudentone extends Component {
}
}
export default Listofworksstudentone;
export default Listofworksstudentone;

@ -1,6 +1,6 @@
import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn,ActionBtn} from 'educoder';
import {WordsBtn, ActionBtn, sortDirections} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal";
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
@ -43,7 +43,7 @@ const qs = require('qs');
//课堂作业设置
//作品列表(教师)
//代码查重
class ShixunStudentWork extends Component {
constructor(props) {
super(props);
@ -341,48 +341,15 @@ class ShixunStudentWork extends Component {
this.getcode_review_results(order,b_order,page,limit,group_infolist,search)
}
funorder=(value)=>{
funorder = (value, myyslorder) => {
let {order,b_order,page,limit,group_infolist,search} = this.state;
let newb_order;
if(order===value){
if(b_order==="desc"){
this.setState({
order:value,
b_order:"asc"
})
newb_order="asc";
}else{
this.setState({
order:value,
b_order:"desc"
})
newb_order="desc";
}
}else{
if(b_order==="desc"){
this.setState({
order:value,
b_order:"desc"
})
newb_order="desc";
}else{
this.setState({
order:value,
b_order:"asc"
})
newb_order="asc";
}
}
this.setState({
loadingstate:true,
order: value,
b_order: myyslorder
})
this.getcode_review_results(value,newb_order,page,limit,group_infolist,search)
this.getcode_review_results(value, myyslorder, page, limit, group_infolist, search)
}
groupgroup=(checkedValues)=>{
@ -668,7 +635,56 @@ class ShixunStudentWork extends Component {
DownloadType:false,
DownloadMessageval:undefined
})
};
//代码查重tbale 列表塞选数据
table1handleChange = (pagination, filters, sorter) => {
//"ascend" 升序
//"descend" 降序
if (JSON.stringify(sorter) === "{}") {
//没有选择
} else {
// console.log(sorter);
try {
//学生学号排序
if (sorter.columnKey === "stduynumber") {
var myyslorder = "";
if (sorter.order === "ascend") {
//升序
myyslorder = "asc";
} else if (sorter.order === "descend") {
//降序
myyslorder = "desc";
}
this.funorder("student_id", myyslorder);
}
} catch (e) {
}
try {
//相似度排序
if (sorter.columnKey === "classroom") {
var myyslorder = "";
if (sorter.order === "ascend") {
//升序
myyslorder = "asc";
} else if (sorter.order === "descend") {
//降序
myyslorder = "desc";
}
this.funorder("code_rate", myyslorder);
}
} catch (e) {
}
}
}
render() {
let {
data,
@ -708,6 +724,8 @@ class ShixunStudentWork extends Component {
title: '学号',
dataIndex: 'stduynumber',
key: 'stduynumber',
sorter: true,
sortDirections: sortDirections,
render: (text, record) => (
<span>
<a style={{"color": '#9A9A9A', "text-align": "center"}}>{record.stduynumber}</a>
@ -718,6 +736,9 @@ class ShixunStudentWork extends Component {
title: '相似度',
key: 'classroom',
dataIndex: 'classroom',
sorter: true,
defaultSortOrder: 'descend',
sortDirections: sortDirections,
render: (text, record) => (
<span>
<a style={{"color": record.classroom>=90?'#FF6800':"#747A7F", "text-align": "center"}}>{isNaN(record.classroom)?"--":record.classroom}%</a>
@ -929,24 +950,7 @@ class ShixunStudentWork extends Component {
{data&&data.copy_reviews_count}</span>
个疑似抄袭作品{data&&data.all_reviews_count}作品 </span>
<div className="fr color-grey-6 edu-menu-panel" style={{color: '#989898'}}>
<p>
<a data-remote="true" className={"color-grey-9 font-12"}>
{order === "code_rate" ? "相似度" : order === "student_id" ? "学号" : ""}
</a>
<i className="iconfont icon-xiajiantou ml5 font-12 color-grey-6"></i>
</p>
<ul className="edu-menu-list" style={{"width": "80px"}}>
<li onClick={(e) => this.funorder("code_rate")}>
<a className={"color-grey-9 font-12"} style={{"text-align": "center "}}>相似度</a>
</li>
<li onClick={(e) => this.funorder("student_id")}>
<a className={"color-grey-9 font-12"} style={{"text-align": "center "}}>学号</a>
</li>
</ul>
</div>
</div>
@ -968,6 +972,7 @@ class ShixunStudentWork extends Component {
</div>:<Table
dataSource={datalist}
columns={columns}
onChange={this.table1handleChange}
pagination={false}
/>}
@ -1047,4 +1052,4 @@ export default ShixunStudentWork;
// data={ jobsettingsdata&& jobsettingsdata.data}
// />}
{/* </div>*/}
{/*</div>*/}
{/*</div>*/}

@ -704,24 +704,24 @@ class Trainingjobsetting extends Component {
//数据表创建
onChangedatasheet = (e, index) => {
var challenge_settings = this.state.challenge_settings;
var bool= false;
var bool = false;
for (var i = 0; i < challenge_settings.length; i++) {
if (i === index) {
if (challenge_settings[i].checked === true) {
challenge_settings[i].checked = false
bool=false;
bool = false;
} else {
challenge_settings[i].checked = true
bool=true;
bool = true;
}
}
}
for (var i = 0; i < challenge_settings.length; i++) {
if(bool=== true){
if (bool === true) {
if (i < index) {
challenge_settings[i].checked = true
challenge_settings[i].checked = true
}
}else{
} else {
if (i > index) {
challenge_settings[i].checked = false
}
@ -2085,7 +2085,7 @@ class Trainingjobsetting extends Component {
const dataformat = 'YYYY-MM-DD HH:mm';
let {flagPageEdit,testscripttiptype,publish_timebool,end_timebool,late_timesbool,work_efficiencys,flagPageEdits,flagPageEditstwo,flagPageEditsbox,whethertopay,handclass,flagPageEditsthrees, flagPageEditsfor,rules,rulest,unifiedsetting,group_settings, course_group,unit_e_tip, borreds,borredss,unit_p_tip, end_time, late_time, score_open, publish_time, starttimetype, modalsType, modalsTopval, loadtype, modalSave, endtimetype, latetimetype, allowlate, latepenaltytype, jobsettingsdata, endOpen, mystyle, mystyles} = this.state;
let {flagPageEdit, testscripttiptype, publish_timebool, end_timebool, late_timesbool, work_efficiencys, flagPageEdits, flagPageEditstwo, flagPageEditsbox, whethertopay, handclass, flagPageEditsthrees, flagPageEditsfor, rules, rulest, unifiedsetting, group_settings, course_group, unit_e_tip, borreds, borredss, unit_p_tip, end_time, late_time, score_open, publish_time, starttimetype, modalsType, modalsTopval, loadtype, modalSave, endtimetype, latetimetype, allowlate, latepenaltytype, jobsettingsdata, endOpen, mystyle, mystyles} = this.state;
// console.log(publish_timebool);
// console.log(!flagPageEditstwo);
const radioStyle = {
@ -2511,7 +2511,7 @@ class Trainingjobsetting extends Component {
</span>
</div>
<p className="ml20 mt15 c_grey font-13 " style={{color:"#666666"}}> 关卡名称<span
className="color-grey-c font-14 ml10">(需要学生完成的任务请选中,暂不支持跳关选择)</span></p>
className="color-grey-c font-14 ml10">(需要学生完成的任务请选中,暂不支持跳关选择)</span></p>
<div className="ml40 mt15" >
{this.state.challenge_settings === undefined ? "" : this.state.challenge_settings.map((object, index) => {
return (

@ -0,0 +1,67 @@
.height-60{
line-height: 60px;
height:60px;
background:rgba(255,208,88,1);
border-radius:4px 4px 0px 0px;
}
.height-40{
line-height: 40px;
height:40px;
background:rgba(224,229,234,1);
border-radius:4px 0px 0px 0px;
}
.height-20{
line-height: 20px;
height:20px;
background:rgba(229,168,102,1);
border-radius:0px 4px 0px 0px;
}
.Statisticscenter{
text-align: center;
}
.Statisticscenter div:nth-child(1){
margin-top: 5px;
font-size:12px;
color:rgba(51,51,51,1);
}
.Statisticscenter div:nth-child(2){
margin-top: 5px;
font-size: 12px;
color: rgba(153,153,153,1);
}
.rankingss {
text-align: center;
margin-top: 40px;
}
.rankingss a img {
width: 60px;
height: 60px;
border-radius: 50%;
box-shadow: 0px 0px 12px rgba(0,0,0,0.2);
}
.huangguans{
position: absolute;
top: -30px;
left: 72px;
}
.relatives{
position: relative;
}
.statisticsTabs{
padding: 30px;
padding-top: 0px;
}
.statisticsTabs .ant-tabs-tab{
height: 80px;
text-align: center;
line-height: 61px;
font-size: 16px;
color: rgba(80,145,255,1);
}

@ -0,0 +1,324 @@
import React,{ Component } from "react";
import {Table, Pagination,Tooltip,Spin, Row, Col ,Tabs} from "antd";
import { WordsBtn,on, off, trigger ,getImageUrl} from 'educoder';
import {BrowserRouter as Router,Route,Switch,Link} from 'react-router-dom';
import axios from'axios';
import './Statistics.css';
const { TabPane } = Tabs;
class Statistics extends Component{
constructor(props){
super(props);
this.state={
nd1:60,
nd2:40,
nd3:20,
data:undefined,
bomdata:undefined,
topisSpin:true,
bomisSpin:true,
sort:'desc',
course_groups:[],
page:1
}
}
componentDidMount() {
let {page,group_ids,sort}=this.state;
let courseId=this.props.match.params.coursesId;
let url=`/courses/${courseId}/statistics.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
data:result.data.top_scores,
topisSpin:false
})
}
}).catch((error) => {
console.log(error);
this.setState({
topisSpin:false,
})
})
let courseurl=`/courses/${courseId}/all_course_groups.json`;
axios.get(courseurl).then((result) => {
if (result) {
this.setState({
course_groups:result.data.course_groups
})
let list=result.data.course_groups;
if(list.length>0){
this.setState({
group_ids:[list[0].id],
})
this.getwork_scoredata(page,[list[0].id],sort);
}
}
}).catch((error) => {
console.log(error);
})
}
getwork_scoredata=(page,group_ids,sort)=>{
let courseId=this.props.match.params.coursesId;
let url=`/courses/${courseId}/work_score.json`;
let data={
limit:20,
page:page,
group_ids:group_ids,
sort:sort
}
axios.get(url,{params:
data
}).then((result) => {
if (result) {
this.setState({
bomdata:result.data.course_members,
bomisSpin:false
})
}
}).catch((error) => {
console.log(error);
this.setState({
bomisSpin:false,
})
})
}
callback=(key)=>{
console.log(key);
}
render(){
let {nd1,nd2,nd3,data,bomdata,course_groups}=this.state;
let course_grouptype=false
if(this.props&&this.props.course_modules!=undefined){
{this.props&&this.props.course_modules.map((item,key)=>{
if(item.type==="course_group"){
course_grouptype=true
}
})}
}
// const columns = [
// {
// title: 'Name',
// dataIndex: 'name',
// sorter: true,
// render: name => `${name.first} ${name.last}`,
// width: '20%',
// },
// {
// title: 'Gender',
// dataIndex: 'gender',
// filters: course_groups,
// width: '20%',
// },
// {
// title: 'Email',
// dataIndex: 'email',
// },
// ];
// console.log(bomdata)
//common_score: 0
// course_group: "威风威风急急急"
// exercise_score: "0.0"
// graduation_score: 0
// group_score: 0
// practice_score: 3232
// total_score: 3232
// user_login: "p40793521"
// user_name: "李明霞"
return(
<React.Fragment >
<div>
<div className="edu-back-white">
<Spin size="large" spinning={this.state.topisSpin}>
<p className="clearfix padding30">
<Row gutter={24}>
<Col>
明星学员
</Col>
</Row>
<Row type="flex" justify="center" align="bottom">
{data&&data.map((item,key)=>{
if(key===3){
return(
<Col span={3}>
<li className="pr rankingss">
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)}/>
</a>
</li>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===1){
return(
<Col span={5}>
<li className="pr rankingss">
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)} className={"mb10"}/>
</a>
</li>
<Col className={`height-${nd2}`}>
</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===0){
return(
<Col span={5} className={"relatives"}>
<li className="pr rankingss">
<img src="https://test-newweb.educoder.net/images/educoder/huangguan.png" className="huangguans mb5" />
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)} className={"mb10 mt5"}/>
</a>
</li>
<Col className={`height-${nd1}`}>
</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===2){
return(
<Col span={5}>
<li className="pr rankingss">
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)} className={"mb10"}/>
</a>
</li>
<Col className={`height-${nd3}`}>
</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===4){
return(
<Col span={3}>
<li className="pr rankingss">
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)}/>
</a>
</li>
</Col>
)
}
})}
</Row>
<Row className="mt10" type="flex" justify="center" align="bottom">
{data&&data.map((item,key)=>{
if(key===3){
return(
<Col span={3} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>4th</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===1){
return(
<Col span={5} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>2th</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===0){
return(
<Col span={5} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>1th</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===2){
return(
<Col span={5} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>3th</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===4){
return(
<Col span={3} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>5th</Col>
</Col>
)
}
})}
</Row>
</p>
</Spin>
</div>
<div className="mt20 edu-back-white">
<Spin size="large" spinning={this.state.bomisSpin}>
<Tabs className="statisticsTabs" defaultActiveKey="1" onChange={this.callback}>
<TabPane tab="学习成绩" key="1" className={"statisticsTabs1"}>
{/*<Table*/}
{/*columns={columns}*/}
{/*dataSource={bomdata}*/}
{/*onChange={this.handleTableChange}*/}
{/*/>*/}
</TabPane>
<TabPane tab="课堂活跃度" key="2">
Content of Tab Pane 2
</TabPane>
</Tabs>
</Spin>
</div>
</div>
</React.Fragment>
)
}
}
export default Statistics;

@ -1079,14 +1079,14 @@
<div class="name">下降</div>
<div class="code-name">&amp;#xe669;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe800;</span>
<div class="name">复制</div>
<div class="code-name">&amp;#xe800;</div>
<li class="dib">
<span class="icon iconfont">&#xe800;</span>
<div class="name">复制</div>
<div class="code-name">&amp;#xe800;</div>
</li>
<li class="dib">
<li class="dib">
<span class="icon iconfont">&#xe7f9;</span>
<div class="name">更多</div>
<div class="code-name">&amp;#xe7f9;</div>
@ -1212,6 +1212,12 @@
<div class="code-name">&amp;#xe604;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6d3;</span>
<div class="name">主页</div>
<div class="code-name">&amp;#xe6d3;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6a3;</span>
<div class="name">yunweijiankong</div>
@ -1302,6 +1308,12 @@
<div class="code-name">&amp;#xe6b6;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6bf;</span>
<div class="name">统计</div>
<div class="code-name">&amp;#xe6bf;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6b8;</span>
<div class="name">menu_3voucher</div>
@ -1343,31 +1355,31 @@
<div class="name">nenghaofenxi@1x</div>
<div class="code-name">&amp;#xe6be;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6c1;</span>
<div class="name">detection@1x</div>
<div class="code-name">&amp;#xe6c1;</div>
<li class="dib">
<span class="icon iconfont">&#xe6c1;</span>
<div class="name">detection@1x</div>
<div class="code-name">&amp;#xe6c1;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6c2;</span>
<div class="name">community@1x</div>
<div class="code-name">&amp;#xe6c2;</div>
<li class="dib">
<span class="icon iconfont">&#xe6c2;</span>
<div class="name">community@1x</div>
<div class="code-name">&amp;#xe6c2;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6c3;</span>
<div class="name">hosting@1x</div>
<div class="code-name">&amp;#xe6c3;</div>
<li class="dib">
<span class="icon iconfont">&#xe6c3;</span>
<div class="name">hosting@1x</div>
<div class="code-name">&amp;#xe6c3;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6c4;</span>
<div class="name">project@1x</div>
<div class="code-name">&amp;#xe6c4;</div>
<li class="dib">
<span class="icon iconfont">&#xe6c4;</span>
<div class="name">project@1x</div>
<div class="code-name">&amp;#xe6c4;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
@ -2992,17 +3004,17 @@
<div class="code-name">.icon-xiajiang
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-fuzhi1"></span>
<div class="name">
复制
</div>
<div class="code-name">.icon-fuzhi1
</div>
</li>
<li class="dib">
<li class="dib">
<span class="icon iconfont icon-fuzhi1"></span>
<div class="name">
复制
</div>
<div class="code-name">.icon-fuzhi1
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-gengduo1"></span>
<div class="name">
更多
@ -3191,6 +3203,15 @@
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-zhuye"></span>
<div class="name">
主页
</div>
<div class="code-name">.icon-zhuye
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-yunweijiankong"></span>
<div class="name">
@ -3326,6 +3347,15 @@
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-tongji"></span>
<div class="name">
统计
</div>
<div class="code-name">.icon-tongji
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-menu_voucher"></span>
<div class="name">
@ -3388,43 +3418,43 @@
<div class="code-name">.icon-nenghaofenxix
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-detectionx"></span>
<div class="name">
detection@1x
</div>
<div class="code-name">.icon-detectionx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-communityx"></span>
<div class="name">
community@1x
</div>
<div class="code-name">.icon-communityx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-hostingx2"></span>
<div class="name">
hosting@1x
</div>
<div class="code-name">.icon-hostingx2
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-projectx"></span>
<div class="name">
project@1x
</div>
<div class="code-name">.icon-projectx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-detectionx"></span>
<div class="name">
detection@1x
</div>
<div class="code-name">.icon-detectionx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-communityx"></span>
<div class="name">
community@1x
</div>
<div class="code-name">.icon-communityx
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-hostingx2"></span>
<div class="name">
hosting@1x
</div>
<div class="code-name">.icon-hostingx2
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-projectx"></span>
<div class="name">
project@1x
</div>
<div class="code-name">.icon-projectx
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
@ -4853,16 +4883,16 @@
<div class="name">下降</div>
<div class="code-name">#icon-xiajiang</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-fuzhi1"></use>
</svg>
<div class="name">复制</div>
<div class="code-name">#icon-fuzhi1</div>
</li>
<li class="dib">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-fuzhi1"></use>
</svg>
<div class="name">复制</div>
<div class="code-name">#icon-fuzhi1</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-gengduo1"></use>
</svg>
@ -5030,6 +5060,14 @@
<div class="code-name">#icon-tianjiadaohang</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhuye"></use>
</svg>
<div class="name">主页</div>
<div class="code-name">#icon-zhuye</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-yunweijiankong"></use>
@ -5150,6 +5188,14 @@
<div class="code-name">#icon-xuexizhongxin</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-tongji"></use>
</svg>
<div class="name">统计</div>
<div class="code-name">#icon-tongji</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-menu_voucher"></use>
@ -5205,38 +5251,38 @@
<div class="name">nenghaofenxi@1x</div>
<div class="code-name">#icon-nenghaofenxix</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-detectionx"></use>
</svg>
<div class="name">detection@1x</div>
<div class="code-name">#icon-detectionx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-communityx"></use>
</svg>
<div class="name">community@1x</div>
<div class="code-name">#icon-communityx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-hostingx2"></use>
</svg>
<div class="name">hosting@1x</div>
<div class="code-name">#icon-hostingx2</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-projectx"></use>
</svg>
<div class="name">project@1x</div>
<div class="code-name">#icon-projectx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-detectionx"></use>
</svg>
<div class="name">detection@1x</div>
<div class="code-name">#icon-detectionx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-communityx"></use>
</svg>
<div class="name">community@1x</div>
<div class="code-name">#icon-communityx</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-hostingx2"></use>
</svg>
<div class="name">hosting@1x</div>
<div class="code-name">#icon-hostingx2</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-projectx"></use>
</svg>
<div class="name">project@1x</div>
<div class="code-name">#icon-projectx</div>
</li>
</ul>
<div class="article markdown">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1384,6 +1384,13 @@
"unicode": "e604",
"unicode_decimal": 58884
},
{
"icon_id": "8361866",
"name": "主页",
"font_class": "zhuye",
"unicode": "e6d3",
"unicode_decimal": 59091
},
{
"icon_id": "9219273",
"name": "yunweijiankong",
@ -1489,6 +1496,13 @@
"unicode": "e6b6",
"unicode_decimal": 59062
},
{
"icon_id": "10527626",
"name": "统计",
"font_class": "tongji",
"unicode": "e6bf",
"unicode_decimal": 59071
},
{
"icon_id": "10610051",
"name": "menu_3voucher",

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 303 KiB

After

Width:  |  Height:  |  Size: 306 KiB

Loading…
Cancel
Save