diff --git a/app/controllers/admins/school_base_statistics_controller.rb b/app/controllers/admins/school_base_statistics_controller.rb new file mode 100644 index 000000000..026fd9492 --- /dev/null +++ b/app/controllers/admins/school_base_statistics_controller.rb @@ -0,0 +1,17 @@ +class Admins::SchoolBaseStatisticsController < Admins::BaseController + + def index + params[:sort_by] = params[:sort_by].presence || :teacher_count + params[:sort_direction] = params[:sort_direction].presence || :desc + + total_count, statistics = Admins::SchoolBaseStatisticService.call(params) + + @statistics = paginate statistics, total_count: total_count + @params_page = params[:page] || 1 + + respond_to do |format| + format.html + format.js + end + end +end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index c514bc0ff..6f2a66631 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -38,10 +38,10 @@ class CoursesController < ApplicationController :transfer_to_course_group, :delete_from_course, :export_member_scores_excel, :search_users, :add_students_by_search, :get_historical_courses, :add_teacher_popup, :add_teacher, :export_couser_info, :export_member_act_score, - :update_informs, :new_informs, :delete_informs, :switch_to_student, :move_to_category] + :update_informs, :new_informs, :delete_informs, :switch_to_student, :move_to_category, + :update_task_position, :tasks_list] before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin, - :set_course_group, :create_group_by_importing_file, - :update_task_position, :tasks_list] + :set_course_group, :create_group_by_importing_file] before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group, :change_course_teacher, :course_group_list, :change_member_role,:inform_up, :inform_down, :teacher_application_review, :apply_teachers, :delete_course_teacher] diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index dd29d6b47..cebe2f61d 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1201,7 +1201,7 @@ class ExercisesController < ApplicationController # 分页 @page = params[:page] || 1 @limit = params[:limit] || 20 - @exercise_users_list = @exercise_users_list.page(@page).per(@limit) + @exercise_users_list = @exercise_users_list.preload(:exercise_user_scores, user: :user_extension).page(@page).per(@limit) else @exercise_users_list = [] diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 7473711a2..dd78299e4 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -19,10 +19,10 @@ class HomeworkCommonsController < ApplicationController :publish_homework, :end_homework, :set_public, :choose_category, :move_to_category, :choose_category, :create_subject_homework, :multi_destroy, :group_list, :homework_code_repeat, :code_review_results, :code_review_detail, :update_explanation, :update_settings, - :add_to_homework_bank, :publish_groups, :end_groups, :batch_comment] + :add_to_homework_bank, :publish_groups, :end_groups, :batch_comment, :alter_name] before_action :require_id_params, only: [:set_public, :multi_destroy, :publish_homework, :end_homework, :move_to_category, :add_to_homework_bank] - before_action :course_manager, only: [:alter_name] + # before_action :course_manager, only: [:alter_name] def index tip_exception("type参数有误") if params[:type] && ![1, 3, 4].include?(params[:type].to_i) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 88ed373d9..1039a648a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -27,6 +27,12 @@ module ApplicationHelper sanitize content, tags: tags, attributes: attributes end + # MD5加密 + def base64_encode(content) + return nil if content.blank? + Base64.encode64(content) + end + def graduation_navigation graduation graduation.class.to_s == "GraduationTopic" ? "毕设选题" : "毕设任务" end diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 1887aee5a..01b0bab61 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -688,7 +688,7 @@ module ExercisesHelper end #获取用户的相关信息 - def exercise_use_info(ex_user,user_status,exercise) + def exercise_use_info(ex_user,user_status,exercise,subject_question_ids) course = exercise.course current_user_group_id = "" current_user_group_name = "" @@ -712,11 +712,17 @@ module ExercisesHelper course_group = course.course_groups.by_group_ids(current_user_group_id) current_user_group_name = course_group.first.name if course_group.present? end - teacher_review = ex_user.subjective_score < 0.0 ? false : true + + if ex_user.subjective_score > 0.0 || ex_user.exercise_user_scores.size > 0 || + ExerciseAnswerComment.where(exercise_answer_id: ex_user.user.exercise_answers.where(exercise_question_id: subject_question_ids)).exists? + teacher_review = true + else + teacher_review = false + end if (user_status == 0 && commit_status == 1) || (user_status == 1 && ex_user_exercise_status == 3 && commit_status == 1) #老师都可以看,学生,需在试卷已提交,且已截止的情况下看 - ex_object_score = ex_user.objective_score < 0.0 ? 0.0 : ex_user.objective_score.round(1).to_s - ex_subject_score = ex_user.subjective_score < 0.0 ? nil : ex_user.subjective_score.round(1).to_s - score = ex_user.score.present? ? ex_user.score.round(1).to_s : 0.0.to_s + ex_object_score = ex_user.objective_score <= 0.0 ? 0 : ex_user.objective_score.round(1).to_s + ex_subject_score = ex_user.subjective_score < 0.0 ? nil : (ex_user.subjective_score > 0.0 ? ex_user.subjective_score.round(1).to_s : 0) + score = ex_user.score.present? && ex_user.score > 0.0 ? ex_user.score.round(1).to_s : 0.to_s else ex_object_score = nil ex_subject_score = nil diff --git a/app/models/exercise.rb b/app/models/exercise.rb index bf752fb92..5079d0ade 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -38,6 +38,10 @@ class Exercise < ApplicationRecord DEADLINE = 3 #已截止 ENDED = 4 #课堂已结束 + def subject_question_ids + exercise_questions.where(question_type: [4]).pluck(:id) + end + def question_scores exercise_questions.pluck(:question_score).sum end diff --git a/app/models/exercise_bank_choice.rb b/app/models/exercise_bank_choice.rb index 4a4c46251..70465a72e 100644 --- a/app/models/exercise_bank_choice.rb +++ b/app/models/exercise_bank_choice.rb @@ -5,6 +5,6 @@ class ExerciseBankChoice < ApplicationRecord scope :find_choice_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题 scope :left_choice_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题 - validates :choice_text, length: { maximum: 500, too_long: "不能超过500个字符" } + # validates :choice_text, length: { maximum: 500, too_long: "不能超过500个字符" } end \ No newline at end of file diff --git a/app/models/exercise_bank_question.rb b/app/models/exercise_bank_question.rb index 75d6bfedf..311c81491 100644 --- a/app/models/exercise_bank_question.rb +++ b/app/models/exercise_bank_question.rb @@ -11,7 +11,7 @@ class ExerciseBankQuestion < ApplicationRecord scope :left_question_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题 scope :find_objective_questions, -> {where("question_type != ?",4)} #查找全部客观题 - validates :question_title, length: { maximum: 1000, too_long: "不能超过1000个字符" } + # validates :question_title, length: { maximum: 1000, too_long: "不能超过1000个字符" } def question_type_name case self.question_type diff --git a/app/models/exercise_choice.rb b/app/models/exercise_choice.rb index 3cfd7a17c..617f5b453 100644 --- a/app/models/exercise_choice.rb +++ b/app/models/exercise_choice.rb @@ -7,6 +7,6 @@ class ExerciseChoice < ApplicationRecord scope :find_choice_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题 scope :left_choice_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题 - validates :choice_text, length: { maximum: 500, too_long: "不能超过500个字符" } + # validates :choice_text, length: { maximum: 500, too_long: "不能超过500个字符" } end \ No newline at end of file diff --git a/app/models/exercise_question.rb b/app/models/exercise_question.rb index 2b8d88c57..e34c316aa 100644 --- a/app/models/exercise_question.rb +++ b/app/models/exercise_question.rb @@ -16,7 +16,7 @@ class ExerciseQuestion < ApplicationRecord scope :left_question_choose, lambda {|k,v| where("#{k} > ?",v)} #根据传入的参数查找问题 scope :find_objective_questions, -> {where("question_type != ?",4)} #查找全部客观题 - validates :question_title, length: { maximum: 1000, too_long: "不能超过1000个字符" } + # validates :question_title, length: { maximum: 1000, too_long: "不能超过1000个字符" } def question_type_name diff --git a/app/services/admins/school_base_statistic_service.rb b/app/services/admins/school_base_statistic_service.rb new file mode 100644 index 000000000..6f3895c4c --- /dev/null +++ b/app/services/admins/school_base_statistic_service.rb @@ -0,0 +1,137 @@ +class Admins::SchoolBaseStatisticService < ApplicationService + include CustomSortable + + attr_reader :params + + sort_columns :student_count, :teacher_count, :course_count, :course_group_count, + :attachment_count, :video_count, :normal_work_count, :shixun_work_count, :evaluate_count, + :student_work_count, :exercise_count, default_direction: :desc + + def initialize(params) + @params = params + end + + def call + schools = School.group('schools.id') + + keyword = params[:keyword].try(:to_s).try(:strip) + if keyword.present? + schools = schools.where("schools.name LIKE :keyword OR schools.id LIKE :keyword", keyword: "%#{keyword}%") + end + + count = schools.count.count + # 根据排序字段进行查询 + schools = query_by_sort_column(schools, params[:sort_by]) + + schools = custom_sort(schools, params[:sort_by], params[:sort_direction]) + schools = schools.limit(page_size).offset(offset) + schools = package_other_data(schools) + [count, schools] + end + + def package_other_data(schools) + ids = schools.map(&:id) + + student_count = CourseMember.course_students.joins(course: :school).group(:school_id).where("role= 'STUDENT' AND courses.is_delete = false AND schools.id in (?)", ids).count("distinct user_id") + teachers = UserExtension.where(school_id: ids, identity: :teacher).group(:school_id) + teacher_count = teachers.count + courses = Course.where(is_delete: 0, school_id: ids).group(:school_id) + course_count= courses.count + course_group_count = courses.joins(:course_groups).count + attachment_count = courses.joins(:attachments).count + video_count = teachers.joins(user: :videos).where("videos.delete_state IS NOT NULL").count + + homeworks = HomeworkCommon.joins(:course).where(courses: { school_id: ids }).where("courses.is_delete = false") + shixun_work_count = homeworks.where(homework_type: 4).group(:school_id).count + normal_work_count = homeworks.where(homework_type: 1).group(:school_id).count + student_work_count = homeworks.joins(:student_works).group(:school_id).count + evaluate_count = EvaluateRecord.unscoped.joins('JOIN homework_commons_shixuns hcs ON hcs.shixun_id = evaluate_records.shixun_id + JOIN homework_commons hc ON hcs.homework_common_id = hc.id AND hc.homework_type = 4 + JOIN course_members ON course_members.user_id = evaluate_records.user_id + JOIN courses ON course_members.course_id = courses.id AND hc.course_id = courses.id') + .where(courses: { school_id: ids }) + .group(:school_id).count + exercise_count = Exercise.joins(:course).where(courses: { school_id: ids }).group(:school_id).count + + schools.map do |school| + { + id: school.id, + name: school.name, + teacher_count: teacher_count[school.id], + student_count: student_count[school.id], + course_count: course_count[school.id], + course_group_count: course_group_count[school.id], + attachment_count: attachment_count[school.id], + video_count: video_count[school.id], + normal_work_count: normal_work_count[school.id], + shixun_work_count: shixun_work_count[school.id], + student_work_count: student_work_count[school.id], + evaluate_count: evaluate_count[school.id], + exercise_count: exercise_count[school.id] + } + end + end + + private + def query_by_sort_column(schools, sort_by_column) + base_query_column = 'schools.id, schools.name' + + case sort_by_column.to_s + when 'teacher_count' then + schools.joins('LEFT JOIN user_extensions ue ON ue.school_id = schools.id AND ue.identity = 0') + .select("#{base_query_column}, COUNT(*) teacher_count") + when 'student_count' then + schools.joins("LEFT JOIN courses ue ON ue.school_id = schools.id AND ue.is_delete = FALSE + LEFT JOIN course_members ON course_members.course_id = ue.id AND course_members.role = 'STUDENT'") + .select("#{base_query_column}, COUNT(distinct user_id) student_count") + when 'course_count' then + schools.joins('LEFT JOIN courses ON courses.school_id = schools.id AND courses.is_delete = false') + .select("#{base_query_column}, COUNT(*) course_count") + when 'course_group_count' then + schools.joins("LEFT JOIN courses ON courses.school_id = schools.id AND courses.is_delete = false + LEFT JOIN course_groups ON course_groups.course_id = courses.id") + .select("#{base_query_column}, COUNT(*) course_group_count") + when 'attachment_count' then + schools.joins("LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0 + LEFT JOIN attachments ON attachments.container_type ='Course' AND attachments.container_id = cs.id") + .select("#{base_query_column}, COUNT(*) attachment_count") + when 'video_count' then + schools.joins("LEFT JOIN user_extensions ue ON ue.school_id = schools.id AND ue.identity = 0 + LEFT JOIN videos ON videos.user_id = ue.user_id AND videos.delete_state IS NOT NULL") + .select("#{base_query_column}, COUNT(*) video_count") + when 'normal_work_count' then + schools.joins("LEFT JOIN courses ON courses.school_id = schools.id + LEFT JOIN homework_commons ON homework_commons.course_id = courses.id AND homework_commons.homework_type = 0") + .select("#{base_query_column}, COUNT(*) normal_work_count") + when 'shixun_work_count' then + schools.joins("LEFT JOIN courses ON courses.school_id = schools.id + LEFT JOIN homework_commons ON homework_commons.course_id = courses.id AND homework_commons.homework_type = 4") + .select("#{base_query_column}, COUNT(*) shixun_work_count") + when 'student_work_count' then + schools.joins("LEFT JOIN courses ON courses.school_id = schools.id + LEFT JOIN homework_commons ON homework_commons.course_id = courses.id + LEFT JOIN student_works ON student_works.homework_common_id = homework_commons.id") + .select("#{base_query_column}, COUNT(*) student_work_count") + when 'evaluate_count' then + schools.joins(' + LEFT JOIN courses ON courses.school_id = schools.id AND courses.is_delete = false + LEFT JOIN course_members ON course_members.course_id = courses.id + LEFT JOIN evaluate_records ON course_members.user_id = evaluate_records.user_id + LEFT JOIN homework_commons_shixuns hcs ON hcs.shixun_id = evaluate_records.shixun_id + LEFT JOIN homework_commons hc ON hcs.homework_common_id = hc.id AND hc.homework_type = 4') + .select("#{base_query_column}, COUNT(*) evaluate_count") + when 'exercise_count' then + schools.joins('LEFT JOIN courses cs ON cs.school_id = schools.id AND cs.is_delete = 0 + LEFT JOIN exercises ON exercises.course_id = cs.id') + .select("#{base_query_column}, COUNT(*) exercise_count") + end + end + + def page_size + params[:per_page] || 20 + end + + def offset + (params[:page].to_i.zero? ? 0 : params[:page].to_i - 1) * page_size + end +end \ No newline at end of file diff --git a/app/views/admins/dashboards/index.html.erb b/app/views/admins/dashboards/index.html.erb index b463e5571..2cd7a583f 100644 --- a/app/views/admins/dashboards/index.html.erb +++ b/app/views/admins/dashboards/index.html.erb @@ -2,6 +2,9 @@ <% add_admin_breadcrumb('概览', admins_path) %> <% end %> +<% content_for(:head) do %> + +<% end %>
diff --git a/app/views/admins/school_base_statistics/_list.html.erb b/app/views/admins/school_base_statistics/_list.html.erb new file mode 100644 index 000000000..aab91f5c7 --- /dev/null +++ b/app/views/admins/school_base_statistics/_list.html.erb @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + <% if statistics.present? %> + <% statistics.each_with_index do |statistic, index| %> + + + + + + + + + + + + + + + + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
序号单位名称<%= sort_tag('注册教师', name: 'teacher_count', path: admins_school_base_statistics_path) %><%= sort_tag('注册学生', name: 'student_count', path: admins_school_base_statistics_path) %><%= sort_tag('教学课堂', name: 'course_count', path: admins_school_base_statistics_path) %><%= sort_tag('管理分班', name: 'course_group_count', path: admins_school_base_statistics_path) %><%= sort_tag('课件资源', name: 'attachment_count', path: admins_school_base_statistics_path) %><%= sort_tag('教学视频', name: 'video_count', path: admins_school_base_statistics_path) %><%= sort_tag('普通作业', name: 'normal_work_count', path: admins_school_base_statistics_path) %><%= sort_tag('实训作业', name: 'shixun_work_count', path: admins_school_base_statistics_path) %><%= sort_tag('作业文件', name: 'student_work_count', path: admins_school_base_statistics_path) %><%= sort_tag('评测次数', name: 'evaluate_count', path: admins_school_base_statistics_path) %><%= sort_tag('在线试卷', name: 'exercise_count', path: admins_school_base_statistics_path) %>
<%= list_index_no(@params_page.to_i, index) %> + <%= link_to statistic[:name], "/colleges/#{statistic[:id]}/statistics", + target: '_blank', data: { toggle: 'tooltip', title: '点击查看学校统计概况' } %> + <%= statistic[:teacher_count].to_i %><%= statistic[:student_count].to_i %><%= statistic[:course_count].to_i %><%= statistic[:course_group_count].to_i %><%= statistic[:attachment_count].to_i %><%= statistic[:video_count].to_i %><%= statistic[:normal_work_count].to_i %><%= statistic[:shixun_work_count].to_i %><%= statistic[:student_work_count].to_i %><%= statistic[:evaluate_count].to_i %><%= statistic[:exercise_count].to_i %>
+ +<%= render partial: 'admins/shared/paginate', locals: { objects: statistics } %> \ No newline at end of file diff --git a/app/views/admins/school_base_statistics/index.html.erb b/app/views/admins/school_base_statistics/index.html.erb new file mode 100644 index 000000000..a519f245f --- /dev/null +++ b/app/views/admins/school_base_statistics/index.html.erb @@ -0,0 +1,14 @@ +<% define_admin_breadcrumbs do %> + <% add_admin_breadcrumb('数据项列表', admins_school_base_statistics_path) %> +<% end %> + +
+ <%= form_tag(admins_school_base_statistics_path, method: :get, class: 'form-inline search-form', remote: true) do %> + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '学校名称搜索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> + <% end %> +
+ +
+ <%= render partial: 'admins/school_base_statistics/list', locals: { statistics: @statistics } %> +
\ No newline at end of file diff --git a/app/views/admins/school_base_statistics/index.js.erb b/app/views/admins/school_base_statistics/index.js.erb new file mode 100644 index 000000000..64df1e490 --- /dev/null +++ b/app/views/admins/school_base_statistics/index.js.erb @@ -0,0 +1 @@ +$(".school-base-statistic-list-container").html("<%= j(render partial: 'admins/school_base_statistics/list', locals: { statistics: @statistics }) %>") \ No newline at end of file diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index c7c487dcf..d77e4ed4e 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -17,7 +17,8 @@
  • <%= sidebar_item_group('#school-submenu', '学校统计', icon: 'area-chart') do %>
  • <%= sidebar_item(admins_daily_school_statistics_path, '统计总表', icon: 'bar-chart', controller: 'admins-daily_school_statistics') %>
  • -
  • <%= sidebar_item(admins_school_statistics_path, '数据变化报表', icon: 'line-chart', controller: 'admins-schools') %>
  • +
  • <%= sidebar_item(admins_school_statistics_path, '数据变化报表', icon: 'line-chart', controller: 'admins-school_statistics') %>
  • +
  • <%= sidebar_item(admins_school_base_statistics_path, '数据项列表', icon: 'eyedropper', controller: 'admins-school_base_statistics') %>
  • <% end %> diff --git a/app/views/exercises/_exercise_user.json.jbuilder b/app/views/exercises/_exercise_user.json.jbuilder index acaa07e98..4e567bdc3 100644 --- a/app/views/exercises/_exercise_user.json.jbuilder +++ b/app/views/exercises/_exercise_user.json.jbuilder @@ -1,4 +1,4 @@ -ex_user_info = exercise_use_info(exercise_user,user_status,exercise) +ex_user_info = exercise_use_info(exercise_user,user_status,exercise,subject_question_ids) json.user_id ex_user_info[:user_id] json.user_name ex_user_info[:user_name] diff --git a/app/views/exercises/exercise_lists.json.jbuilder b/app/views/exercises/exercise_lists.json.jbuilder index 5cbb63595..a5ad1f340 100644 --- a/app/views/exercises/exercise_lists.json.jbuilder +++ b/app/views/exercises/exercise_lists.json.jbuilder @@ -38,7 +38,8 @@ if @current_user_ex_answers.present? json.current_answer_user do json.partial! "exercises/exercise_user",locals: {exercise_user:@current_user_ex_answers.first, subjective_type:@subjective_type, user_status:@exercise_current_user_status, exercise:@exercise, - question_ids: @exercise.exercise_questions.pluck(:id)} + question_ids: @exercise.exercise_questions.pluck(:id), + subject_question_ids: @exercise.subject_question_ids} end end @@ -47,7 +48,8 @@ if @exercise_users_list.present? json.array! @exercise_users_list.each do |exercise_user| json.partial! "exercises/exercise_user",locals: {exercise_user:exercise_user, subjective_type:@subjective_type, user_status:@exercise_current_user_status, exercise:@exercise, - question_ids: @exercise.exercise_questions.pluck(:id)} + question_ids: @exercise.exercise_questions.pluck(:id), + subject_question_ids: @exercise.subject_question_ids} end end else diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index f61aaba4f..fed51db61 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -5,7 +5,7 @@ - + <%= yield :head %> <%= csrf_meta_tags %> <%= csp_meta_tag %> diff --git a/app/views/student_works/shixun_work_report.json.jbuilder b/app/views/student_works/shixun_work_report.json.jbuilder index c6596d1ee..9a3f8c59f 100644 --- a/app/views/student_works/shixun_work_report.json.jbuilder +++ b/app/views/student_works/shixun_work_report.json.jbuilder @@ -39,7 +39,7 @@ if @shixun json.challenge_id challenge.id challenge_score = @homework.challenge_score challenge.id json.game_score_full challenge_score - json.game_score @work.work_challenge_score game, challenge_score, challenge.id + json.game_score number_with_precision (@work.work_challenge_score game, challenge_score, challenge.id), precision: 1 challenge_comment = @work.shixun_work_comments.find_by(challenge_id: challenge.id) json.challenge_comment challenge_comment&.comment json.challenge_comment_hidden @user_course_identity < Course::STUDENT ? challenge_comment&.hidden_comment : nil diff --git a/app/views/users/videos/_video.json.jbuilder b/app/views/users/videos/_video.json.jbuilder index 5b0bc7a6e..ac030ce12 100644 --- a/app/views/users/videos/_video.json.jbuilder +++ b/app/views/users/videos/_video.json.jbuilder @@ -1,4 +1,6 @@ json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id, :transcoded +json.play_url base64_encode(video.play_url) +json.file_url base64_encode(video.file_url) json.play_duration video.video_play_duration json.published_at video.display_published_at json.created_at video.display_created_at diff --git a/config/routes.rb b/config/routes.rb index f858056a7..9a471fb7f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1173,6 +1173,8 @@ Rails.application.routes.draw do get :contrast, on: :collection end + resources :school_base_statistics, only: [:index] + resources :users, only: [:index, :edit, :update, :destroy] do member do post :reward_grade diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index afed0fa9d..c630abf7e 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -46,7 +46,7 @@ debugType = "admin"; // 老师 // debugType="teacher"; // 学生 -// debugType="student"; +//debugType="student"; diff --git a/public/react/src/context/TPIContextProvider.js b/public/react/src/context/TPIContextProvider.js index 4afd2c109..bdd15d914 100644 --- a/public/react/src/context/TPIContextProvider.js +++ b/public/react/src/context/TPIContextProvider.js @@ -108,13 +108,15 @@ class TPIContextProvider extends Component { }) } + componentWillMount () { + // 拦截判断是否离开当前页面 + } + componentWillUnmount() { this.costTimeInterval && window.clearInterval(this.costTimeInterval) } componentDidMount() { - window.$(window).unload( ()=>{ - console.log(12321) - }); + // TODO 登录状态的判断? // request @@ -136,12 +138,15 @@ class TPIContextProvider extends Component { } }, 1000) - // 页面离开时存下用户的任务耗时 - window.$(window).bind('beforeunload', function (e) { - console.log(111111) + // // 页面离开时存下用户的任务耗时 + window.$(window).bind('beforeunload',()=>{ this._updateCostTime(); }) + // window.$(window).unload( ()=>{ + // this._updateCostTime(); + + // }); // // 页面离开时存下用户的任务耗时 // window.$(window).unload( ()=>{ // this._updateCostTime(); diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index e53107c1c..a99b34cf3 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -1015,7 +1015,7 @@ class Fileslists extends Component{ :"":""} {this.props.isAdmin()?
  • - 移动到... + 移动到目录

    EduCoder支持所有第三方直播平台,特别推荐:

    -
      -
    • + { lives && lives.length > 0 ? @@ -79,4 +113,4 @@ class Live extends Component{ ) } } -export default Live; \ No newline at end of file +export default Live; diff --git a/public/react/src/modules/courses/Video/LiveItem.js b/public/react/src/modules/courses/Video/LiveItem.js index b54b0f03d..892028e01 100644 --- a/public/react/src/modules/courses/Video/LiveItem.js +++ b/public/react/src/modules/courses/Video/LiveItem.js @@ -24,7 +24,7 @@ class LiveItem extends Component{ visible:false } } - + deleteLive=(id)=>{ this.props.confirm({ content: '是否确认删除?', @@ -62,8 +62,9 @@ class LiveItem extends Component{ const { key, item , setLiveId } = this.props; const { visible } = this.state; - const wei_flag = item.platform && (item.platform === "威佰通"); - console.log(wei_flag && item.url); + const wei_flag = item.platform && (item.platform === "威佰通"||item.platform === "zoom"); + let platform=item&&item.platform?item.platform:"威佰通"; + console.log(wei_flag && item.url); return(
      -

      打开威佰通客户端,输入会议号即可进入直播

      +

      打开{platform}客户端,输入会议号即可进入直播

      会议号: @@ -136,7 +137,7 @@ class LiveItem extends Component{ item.url ? { - wei_flag ? + wei_flag ? 进入 : 进入 @@ -154,17 +155,17 @@ class LiveItem extends Component{ {`${item.author_name}`} - { item.platform && 直播平台:{item.platform} } - { item.live_time && 开播时间:{item.live_time}} + { item.platform && 直播平台:{item.platform} } + { item.live_time && 开播时间:{item.live_time}} { item.duration && 直播预计时长:{item.duration}分钟 } - + { item.op_auth ? setLiveId(item.id)}>编辑:"" } { - item.delete_auth ? + item.delete_auth ? this.deleteLive(item.id)}>删除 :"" } diff --git a/public/react/src/modules/courses/Video/LiveNew.js b/public/react/src/modules/courses/Video/LiveNew.js index e95400ed0..1fba31f97 100644 --- a/public/react/src/modules/courses/Video/LiveNew.js +++ b/public/react/src/modules/courses/Video/LiveNew.js @@ -9,7 +9,7 @@ import axios from 'axios'; const { TextArea } = Input; const { Option } = Select; -const array=['腾讯课堂','斗鱼直播','Bilibili','威佰通']; +const array=['腾讯课堂','斗鱼直播','Bilibili','威佰通','zoom']; function range(start, end) { const result = []; @@ -68,7 +68,7 @@ class LiveNew extends Component{ }) this.setState({ beginTime:result.data.live_time && moment(result.data.live_time,"YYYY-MM-DD HH:mm"), - wei_flag:result.data.platform && result.data.platform === "威佰通" + wei_flag:result.data.platform && (result.data.platform === "威佰通"||result.data.platform === "zoom") }) } }) @@ -181,7 +181,7 @@ class LiveNew extends Component{ } ChangePlatform=(e)=>{ - if(e === "威佰通"){ + if(e === "威佰通"||e==="zoom"){ this.setState({ wei_flag:true }) @@ -290,7 +290,7 @@ class LiveNew extends Component{