diff --git a/Gemfile b/Gemfile index 7f2c08a0d..7a37b7c44 100644 --- a/Gemfile +++ b/Gemfile @@ -97,6 +97,8 @@ gem 'searchkick' gem 'aasm' gem 'enumerize' +gem 'diffy' + # oauth2 gem 'omniauth', '~> 1.9.0' gem 'omniauth-oauth2', '~> 1.6.0' diff --git a/Gemfile.lock b/Gemfile.lock index 19a413f2f..4b7902353 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -98,6 +98,7 @@ GEM connection_pool (2.2.2) crass (1.0.4) diff-lcs (1.3) + diffy (3.3.0) elasticsearch (7.2.0) elasticsearch-api (= 7.2.0) elasticsearch-transport (= 7.2.0) @@ -374,6 +375,7 @@ DEPENDENCIES byebug capybara (>= 2.15, < 4.0) chromedriver-helper + diffy enumerize faraday (~> 0.15.4) font-awesome-sass (= 4.7.0) diff --git a/app/assets/javascripts/admins/carousels/index.js b/app/assets/javascripts/admins/carousels/index.js new file mode 100644 index 000000000..0f279f17e --- /dev/null +++ b/app/assets/javascripts/admins/carousels/index.js @@ -0,0 +1,125 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-carousels-index-page').length > 0) { + // ------------ 保存链接 ----------- + $('.carousels-card').on('click', '.save-data-btn', function(){ + var $link = $(this); + var id = $link.data('id'); + var link = $('.custom-carousel-item-' + id).find('.link-input').val(); + var name = $('.custom-carousel-item-' + id).find('.name-input').val(); + if(!name || name.length == 0){ + $.notify({ message: '名称不能为空' },{ type: 'danger' }); + return; + } + $link.attr('disabled', true); + + $.ajax({ + url: '/admins/carousels/' + id, + method: 'PATCH', + dataType: 'json', + data: { link: link, name: name }, + success: function(data){ + $.notify({ message: '操作成功' }); + }, + error: ajaxErrorNotifyHandler, + complete: function(){ + $link.removeAttr('disabled'); + } + }) + }); + // -------------- 是否在首页展示 -------------- + $('.carousels-card').on('change', '.online-check-box', function(){ + var $checkbox = $(this); + var id = $checkbox.data('id'); + var checked = $checkbox.is(':checked'); + $checkbox.attr('disabled', true); + + $.ajax({ + url: '/admins/carousels/' + id, + method: 'PATCH', + dataType: 'json', + data: { status: checked }, + success: function(data){ + $.notify({ message: '保存成功' }); + var box = $('.custom-carousel-item-' + id).find('.drag'); + if(checked){ + box.removeClass('not_active'); + }else{ + box.addClass('not_active'); + } + }, + error: ajaxErrorNotifyHandler, + complete: function(){ + $checkbox.removeAttr('disabled'); + } + }) + }); + + // ------------ 拖拽 ------------- + var onDropFunc = function(el, _target, _source, sibling){ + var moveId = $(el).data('id'); + var insertId = $(sibling).data('id') || ''; + + $.ajax({ + url: '/admins/carousels/drag', + method: 'POST', + dataType: 'json', + data: { move_id: moveId, after_id: insertId }, + success: function(data){ + $('#carousels-container .custom-carousel-item-no').each(function(index, ele){ + $(ele).html(index + 1); + }) + }, + error: function(res){ + var data = res.responseJSON; + $.notify({message: '移动失败,原因:' + data.message}, {type: 'danger'}); + } + }) + }; + var ele1 = document.getElementById('carousels-container'); + dragula([ele1], { mirrorContainer: ele1 }).on('drop', onDropFunc); + + + // ----------- 新增 -------------- + var $createModal = $('.modal.admin-add-carousel-modal'); + var $createForm = $createModal.find('form.admin-add-carousel-form'); + + $createForm.validate({ + errorElement: 'span', + errorClass: 'danger text-danger', + rules: { + "portal_image[image]": { + required: true + }, + "portal_image[name]": { + required: true + }, + } + }); + + $createModal.on('show.bs.modal', function(event){ + resetFileInputFunc($createModal.find('.img-file-input')); + $createModal.find('.file-names').html('选择文件'); + }); + + $createModal.on('click', '.submit-btn', function() { + $createForm.find('.error').html(''); + + if ($createForm.valid()) { + $createForm.submit(); + } else { + $createForm.find('.error').html('请选择图片'); + } + }); + $createModal.on('change', '.img-file-input', function(){ + var file = $(this)[0].files[0]; + $createModal.find('.file-names').html(file ? file.name : '请选择文件'); + }) + + // -------------- 重新上传图片 -------------- + //replace_image_url + $('.modal.admin-upload-file-modal').on('upload:success', function(e, data){ + var $carouselItem = $('.custom-carousel-item-' + data.source_id); + $carouselItem.find('.custom-carousel-item-img img').attr('src', data.url); + }) + } +}) \ No newline at end of file diff --git a/app/assets/javascripts/admins/laboratories/edit.js b/app/assets/javascripts/admins/laboratories/edit.js new file mode 100644 index 000000000..63b26bbe0 --- /dev/null +++ b/app/assets/javascripts/admins/laboratories/edit.js @@ -0,0 +1,86 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-laboratory-settings-show-page, body.admins-laboratory-settings-update-page').length > 0) { + var $container = $('.edit-laboratory-setting-container'); + var $form = $container.find('.edit_laboratory'); + + $('.logo-item-left').on("change", 'input[type="file"]', function () { + var $fileInput = $(this); + var file = this.files[0]; + var imageType = /image.*/; + if (file && file.type.match(imageType)) { + var reader = new FileReader(); + reader.onload = function () { + var $box = $fileInput.parent(); + $box.find('img').attr('src', reader.result).css('display', 'block'); + $box.addClass('has-img'); + }; + reader.readAsDataURL(file); + } else { + } + }); + + createMDEditor('laboratory-footer-editor', { height: 200, placeholder: '请输入备案信息' }); + + $form.validate({ + errorElement: 'span', + errorClass: 'danger text-danger', + errorPlacement:function(error,element){ + if(element.parent().hasClass("input-group")){ + element.parent().after(error); + }else{ + element.after(error) + } + }, + rules: { + identifier: { + required: true, + checkSite: true + }, + name: { + required: true + } + } + }); + $.validator.addMethod("checkSite",function(value,element,params){ + var checkSite = /^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/; + return this.optional(element)||(checkSite.test(value + '.educoder.com')); + },"域名不合法!"); + + $form.on('click', '.submit-btn', function(){ + $form.find('.submit-btn').attr('disabled', 'disabled'); + $form.find('.error').html(''); + var valid = $form.valid(); + + $('input[name="navbar[][name]"]').each(function(_, e){ + var $ele = $(e); + if($ele.val() === undefined || $ele.val().length === 0){ + $ele.addClass('danger text-danger'); + valid = false; + } else { + $ele.removeClass('danger text-danger'); + } + }); + + if(!valid) return; + $.ajax({ + method: 'PATCH', + dataType: 'json', + url: $form.attr('action'), + data: new FormData($form[0]), + processData: false, + contentType: false, + success: function(data){ + $.notify({ message: '保存成功' }); + window.location.reload(); + }, + error: function(res){ + var data = res.responseJSON; + $form.find('.error').html(data.message); + }, + complete: function(){ + $form.find('.submit-btn').attr('disabled', false); + } + }); + }) + } +}); \ No newline at end of file diff --git a/app/assets/javascripts/admins/laboratories/index.js b/app/assets/javascripts/admins/laboratories/index.js new file mode 100644 index 000000000..abb7cb72d --- /dev/null +++ b/app/assets/javascripts/admins/laboratories/index.js @@ -0,0 +1,164 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-laboratories-index-page').length > 0) { + var $searchContainer = $('.laboratory-list-form'); + var $searchForm = $searchContainer.find('form.search-form'); + var $list = $('.laboratory-list-container'); + + // ============== 新建 =============== + var $modal = $('.modal.admin-create-laboratory-modal'); + var $form = $modal.find('form.admin-create-laboratory-form'); + var $schoolSelect = $modal.find('.school-select'); + + $form.validate({ + errorElement: 'span', + errorClass: 'danger text-danger', + rules: { + school_id: { + required: true + } + }, + messages: { + school_id: { + required: '请选择所属单位' + } + } + }); + + // modal ready fire + $modal.on('show.bs.modal', function () { + $schoolSelect.select2('val', ' '); + }); + + // ************** 学校选择 ************* + var matcherFunc = function(params, data){ + if ($.trim(params.term) === '') { + return data; + } + if (typeof data.text === 'undefined') { + return null; + } + + if (data.name && data.name.indexOf(params.term) > -1) { + var modifiedData = $.extend({}, data, true); + return modifiedData; + } + + // Return `null` if the term should not be displayed + return null; + }; + + var defineSchoolSelect = function(schools) { + $schoolSelect.select2({ + theme: 'bootstrap4', + placeholder: '请选择单位', + minimumInputLength: 1, + data: schools, + templateResult: function (item) { + if(!item.id || item.id === '') return item.text; + return item.name; + }, + templateSelection: function(item){ + if (item.id) { + $('#school_id').val(item.id); + } + return item.name || item.text; + }, + matcher: matcherFunc + }); + } + + $.ajax({ + url: '/api/schools/for_option.json', + dataType: 'json', + type: 'GET', + success: function(data) { + defineSchoolSelect(data.schools); + } + }); + + $modal.on('click', '.submit-btn', function(){ + $form.find('.error').html(''); + + if ($form.valid()) { + var url = $form.data('url'); + + $.ajax({ + method: 'POST', + dataType: 'json', + url: url, + data: $form.serialize(), + success: function(){ + $.notify({ message: '创建成功' }); + $modal.modal('hide'); + + setTimeout(function(){ + window.location.reload(); + }, 500); + }, + error: function(res){ + var data = res.responseJSON; + $form.find('.error').html(data.message); + } + }); + } + }); + + // ============= 添加管理员 ============== + var $addMemberModal = $('.admin-add-laboratory-user-modal'); + var $addMemberForm = $addMemberModal.find('.admin-add-laboratory-user-form'); + var $memberSelect = $addMemberModal.find('.laboratory-user-select'); + var $laboratoryIdInput = $addMemberForm.find('input[name="laboratory_id"]') + + $addMemberModal.on('show.bs.modal', function(event){ + var $link = $(event.relatedTarget); + var laboratoryId = $link.data('laboratory-id'); + $laboratoryIdInput.val(laboratoryId); + + $memberSelect.select2('val', ' '); + }); + + $memberSelect.select2({ + theme: 'bootstrap4', + placeholder: '请输入要添加的管理员姓名', + multiple: true, + minimumInputLength: 1, + ajax: { + delay: 500, + url: '/admins/users', + dataType: 'json', + data: function(params){ + return { name: params.term }; + }, + processResults: function(data){ + return { results: data.users } + } + }, + templateResult: function (item) { + if(!item.id || item.id === '') return item.text; + return item.real_name; + }, + templateSelection: function(item){ + if (item.id) { + } + return item.real_name || item.text; + } + }); + + $addMemberModal.on('click', '.submit-btn', function(){ + $addMemberForm.find('.error').html(''); + + var laboratoryId = $laboratoryIdInput.val(); + var memberIds = $memberSelect.val(); + if (laboratoryId && memberIds && memberIds.length > 0) { + $.ajax({ + method: 'POST', + dataType: 'script', + url: '/admins/laboratories/' + laboratoryId + '/laboratory_user', + data: { user_ids: memberIds } + }); + } else { + $addMemberModal.modal('hide'); + } + }); + } +}); \ No newline at end of file diff --git a/app/assets/javascripts/bootstrap.viewer.js b/app/assets/javascripts/bootstrap.viewer.js index 4c6aa549a..611cab704 100755 --- a/app/assets/javascripts/bootstrap.viewer.js +++ b/app/assets/javascripts/bootstrap.viewer.js @@ -22,9 +22,9 @@ $.fn.bootstrapViewer = function (options) { ' diff --git a/app/views/colleges/_teacher_rank.html.erb b/app/views/colleges/_teacher_rank.html.erb index 66b46ba74..426b9792c 100644 --- a/app/views/colleges/_teacher_rank.html.erb +++ b/app/views/colleges/_teacher_rank.html.erb @@ -1,12 +1,7 @@ <% if @teachers.present? %> <% @teachers.each_with_index do |teacher, index| %> - - <% if index < 3 %> - - <% else %> - <%= index + 1 %> - <% end %> + <%= index + 1 %> <%= teacher['real_name'] %> <%= teacher['course_count'] %> <%= teacher['shixun_work_count'] %> diff --git a/app/views/courses/course_groups.json.jbuilder b/app/views/courses/course_groups.json.jbuilder new file mode 100644 index 000000000..48a5922a6 --- /dev/null +++ b/app/views/courses/course_groups.json.jbuilder @@ -0,0 +1,11 @@ +json.course_groups @course_groups.each do |group| + json.(group, :id, :course_members_count, :name) + json.invite_code group.invite_code if @user_course_identity < Course::STUDENT + json.member_manager member_manager(group, @teachers) if @user_course_identity < Course::NORMAL +end + +if @user_course_identity == Course::STUDENT + json.current_group_id @current_group_id +end +json.none_group_member_count @course.none_group_count +json.group_count @all_group_count \ No newline at end of file diff --git a/app/views/courses/online_learning.json.jbuilder b/app/views/courses/online_learning.json.jbuilder index b48cd9e23..d6b3db136 100644 --- a/app/views/courses/online_learning.json.jbuilder +++ b/app/views/courses/online_learning.json.jbuilder @@ -1,5 +1,5 @@ json.stages @stages do |stage| - json.partial! 'stages/stage', locals: {stage: stage, user:@user, subject:@subject} + json.partial! 'stages/stage', locals: {stage: stage, user: @user, subject: @subject, myshixuns: @myshixuns} end # json.description @subject&.description @@ -7,6 +7,6 @@ end json.start_learning @start_learning json.subject_id @subject.id -json.learned @start_learning ? @course.my_subject_progress : 0 +json.learned @start_learning ? @course.my_subject_progress(@myshixuns) : 0 -json.last_shixun @start_learning ? last_subject_shixun(@user.id, @course) : "" \ No newline at end of file +json.last_shixun @start_learning ? last_subject_shixun(@course, @myshixuns) : "" \ No newline at end of file diff --git a/app/views/courses/students.json.jbuilder b/app/views/courses/students.json.jbuilder index a7585672f..0b5d7fe71 100644 --- a/app/views/courses/students.json.jbuilder +++ b/app/views/courses/students.json.jbuilder @@ -1,12 +1,17 @@ json.students do json.array! @students do |student| json.user_id student.user_id - json.login student.user.try(:login) + # json.login student.user.try(:login) json.name student.user.try(:real_name) json.name_link user_path(student.user) json.student_id student.user.try(:student_id) json.course_group_name student.course_group.try(:name) json.course_member_id student.id + if @user_course_identity < Course::ASSISTANT_PROFESSOR && !params[:course_group_id].present? + json.member_roles student.user.course_role(@course) + end + json.user_phone student.user.hidden_phone + json.user_mail student.user.hidden_mail end end json.students_count @students_count diff --git a/app/views/courses/teachers.json.jbuilder b/app/views/courses/teachers.json.jbuilder index 040ffb2aa..19a92790d 100644 --- a/app/views/courses/teachers.json.jbuilder +++ b/app/views/courses/teachers.json.jbuilder @@ -16,6 +16,9 @@ json.teacher_list do end json.graduation_group teacher.graduation_group.try(:name) json.graduation_group_id teacher.graduation_group.try(:id) + if @user_course_identity < Course::ASSISTANT_PROFESSOR + json.member_roles teacher.user.course_role(@course) + end end end json.teacher_list_size @teacher_list_size diff --git a/app/views/courses/top_banner.json.jbuilder b/app/views/courses/top_banner.json.jbuilder index 916fccb05..877ffcdf1 100644 --- a/app/views/courses/top_banner.json.jbuilder +++ b/app/views/courses/top_banner.json.jbuilder @@ -24,5 +24,4 @@ json.course_identity @user_course_identity json.excellent @course.excellent if @course.is_end == 0 json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i -end - +end \ No newline at end of file diff --git a/app/views/ecs/course_achievement_methods/show.json.jbuilder b/app/views/ecs/course_achievement_methods/show.json.jbuilder index 9105c9615..77d1ce5a7 100644 --- a/app/views/ecs/course_achievement_methods/show.json.jbuilder +++ b/app/views/ecs/course_achievement_methods/show.json.jbuilder @@ -1,3 +1,32 @@ json.course_targets @course_targets, partial: 'ecs/course_targets/shared/ec_course_target_with_achievement_methods', as: :ec_course_target +json.course_targets do + json.array! @course_targets do |course_target| + json.extract! course_target, :id, :position, :content + + json.course_achievement_methods do + json.array! course_target.ec_course_achievement_methods do |achievement_method| + evaluation = achievement_method.ec_course_evaluation + json.extract! achievement_method, :id, :score, :percentage + + json.course_evaluation do + json.partial! 'ecs/course_evaluations/shared/ec_course_evaluation_only', ec_course_evaluation: evaluation + end + + json.course_evaluation_relates do + json.array! achievement_method.ec_achievement_evaluation_relates do |relate| + json.extract! relate, :id, :position, :ec_course_evaluation_subitem_id + + subitem = relate.ec_course_evaluation_subitem + if evaluation.is_course_type? + json.name subitem&.name + else + json.name subitem&.name ? "#{evaluation.name}(#{relate.position}):#{subitem&.name}" : "#{evaluation.name}(#{relate.position})" + end + end + end + end + end + end +end \ No newline at end of file diff --git a/app/views/ecs/course_evaluations/slimmer.json.jbuilder b/app/views/ecs/course_evaluations/slimmer.json.jbuilder index 6e0faef3e..1f4dc0cc0 100644 --- a/app/views/ecs/course_evaluations/slimmer.json.jbuilder +++ b/app/views/ecs/course_evaluations/slimmer.json.jbuilder @@ -1 +1,7 @@ -json.course_evaluations @course_evaluations, partial: 'ecs/course_evaluations/shared/ec_course_evaluation_slim', as: :ec_course_evaluation +json.course_evaluations do + json.array! @course_evaluations do |course_evaluation| + json.partial! 'ecs/course_evaluations/shared/ec_course_evaluation_slim', ec_course_evaluation: course_evaluation + + json.evaluation_relates course_evaluation.evaluation_relates + end +end \ No newline at end of file diff --git a/app/views/ecs/course_managers/create.json.jbuilder b/app/views/ecs/course_managers/create.json.jbuilder deleted file mode 100644 index ff7ff01e5..000000000 --- a/app/views/ecs/course_managers/create.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.partial! 'ecs/shared/user', user: @user diff --git a/app/views/ecs/course_targets/with_achievement_methods.json.jbuilder b/app/views/ecs/course_targets/with_achievement_methods.json.jbuilder new file mode 100644 index 000000000..210151499 --- /dev/null +++ b/app/views/ecs/course_targets/with_achievement_methods.json.jbuilder @@ -0,0 +1,29 @@ +json.course_targets do + json.array! @course_targets do |course_target| + json.extract! course_target, :id, :position, :content + + json.course_achievement_methods do + json.array! course_target.ec_course_achievement_methods do |achievement_method| + evaluation = achievement_method.ec_course_evaluation + json.extract! achievement_method, :id, :score, :percentage + + json.course_evaluation do + json.partial! 'ecs/course_evaluations/shared/ec_course_evaluation_only', ec_course_evaluation: evaluation + end + + json.course_evaluation_relates do + json.array! achievement_method.ec_achievement_evaluation_relates do |relate| + json.extract! relate, :id, :position, :ec_course_evaluation_subitem_id + + subitem = relate.ec_course_evaluation_subitem + if evaluation.is_course_type? + json.name subitem&.name + else + json.name subitem&.name ? "#{evaluation.name}(#{relate.position}):#{subitem&.name}" : "#{evaluation.name}(#{relate.position})" + end + end + end + end + end + end +end \ No newline at end of file diff --git a/app/views/ecs/requirement_support_objectives/show.json.jbuilder b/app/views/ecs/requirement_support_objectives/show.json.jbuilder index 642a5f10c..da33ec741 100644 --- a/app/views/ecs/requirement_support_objectives/show.json.jbuilder +++ b/app/views/ecs/requirement_support_objectives/show.json.jbuilder @@ -1,4 +1,4 @@ json.graduation_requirements @graduation_requirements, partial: 'ecs/ec_graduation_requirements/shared/ec_graduation_requirement', as: :ec_graduation_requirement -json.training_subitems @training_subitems, partial: 'ecs/ec_training_subitems/shared/ec_training_subitem', as: :ec_training_subitem +json.training_subitems @training_subitems, partial: 'ecs/ec_training_objectives/shared/ec_training_subitem', as: :ec_training_subitem json.requirement_support_objectives @requirement_support_objectives, partial: 'ecs/requirement_support_objectives/shared/requirement_support_objective', as: :requirement_support_objective diff --git a/app/views/ecs/subitem_support_standards/show.json.jbuilder b/app/views/ecs/subitem_support_standards/show.json.jbuilder index a92fe7000..ca4bd59f2 100644 --- a/app/views/ecs/subitem_support_standards/show.json.jbuilder +++ b/app/views/ecs/subitem_support_standards/show.json.jbuilder @@ -1,4 +1,9 @@ json.graduation_standards @graduation_standards, partial: 'ecs/shared/ec_graduation_standard', as: :ec_graduation_standard -json.graduation_subitems @graduation_subitems, partial: 'ecs/shared/ec_graduation_subitem', as: :ec_graduation_subitem +json.graduation_subitems do + json.array! @graduation_subitems do |graduation_subitem| + json.partial! 'ecs/shared/ec_graduation_subitem', ec_graduation_subitem: graduation_subitem + json.graduation_requirement_position graduation_subitem.ec_graduation_requirement.position + end +end json.subitem_support_standards @subitem_support_standards, partial: 'ecs/subitem_support_standards/shared/subitem_support_standard', as: :subitem_support_standard diff --git a/app/views/exercises/_exercise_user.json.jbuilder b/app/views/exercises/_exercise_user.json.jbuilder index d41fb9e20..5f00bbd70 100644 --- a/app/views/exercises/_exercise_user.json.jbuilder +++ b/app/views/exercises/_exercise_user.json.jbuilder @@ -8,6 +8,7 @@ json.user_group_name ex_user_info[:user_group_name] json.student_id ex_user_info[:student_id] json.commit_status ex_user_info[:commit_status] json.end_at ex_user_info[:end_at] +json.commit_method exercise_user&.commit_method.to_i if subjective_type == 1 json.objective_score ex_user_info[:ex_object_score] json.subjective_score ex_user_info[:ex_subject_score] diff --git a/app/views/exercises/_user_exercise_info.json.jbuilder b/app/views/exercises/_user_exercise_info.json.jbuilder index 0d21cc593..bdac3a985 100644 --- a/app/views/exercises/_user_exercise_info.json.jbuilder +++ b/app/views/exercises/_user_exercise_info.json.jbuilder @@ -9,6 +9,7 @@ json.exercise_answer_user do json.user_id ex_answerer.id json.login ex_answerer.login if exercise_user.present? + json.commit_method exercise_user&.commit_method.to_i json.start_at exercise_user.start_at json.score exercise_user.score.present? ? exercise_user.score.round(1).to_s : "0.0" end diff --git a/app/views/exercises/common_header.json.jbuilder b/app/views/exercises/common_header.json.jbuilder index 5d33aca66..d43d7c3f8 100644 --- a/app/views/exercises/common_header.json.jbuilder +++ b/app/views/exercises/common_header.json.jbuilder @@ -1,6 +1,6 @@ json.course_is_end @course.is_end # true表示已结束,false表示未结束 json.extract! @exercise, :id,:exercise_name,:exercise_description,:show_statistic -json.time @user_left_time +json.time (@user_left_time.to_i / 60) json.exercise_status @ex_status diff --git a/app/views/exercises/publish_groups.json.jbuilder b/app/views/exercises/publish_groups.json.jbuilder new file mode 100644 index 000000000..72cefdd1a --- /dev/null +++ b/app/views/exercises/publish_groups.json.jbuilder @@ -0,0 +1,6 @@ +json.course_groups @course_groups do |group| + json.id group.id + json.name group.name + json.end_time @group_settings.select{|group_setting| group_setting.course_group_id == group.id}.first&.end_time +end +json.end_time @exercise.end_time \ No newline at end of file diff --git a/app/views/graduation_tasks/_public_navigation.json.jbuilder b/app/views/graduation_tasks/_public_navigation.json.jbuilder index 00280c31b..992d03fd8 100644 --- a/app/views/graduation_tasks/_public_navigation.json.jbuilder +++ b/app/views/graduation_tasks/_public_navigation.json.jbuilder @@ -2,4 +2,5 @@ json.partial! "graduation_topics/show_navigation", locals: {course: course, grad json.task_status task_curr_status(graduation, course)[:status] json.task_name graduation.name json.task_id graduation.id -json.status graduation.status \ No newline at end of file +json.status graduation.status +json.end_time graduation.end_time \ No newline at end of file diff --git a/app/views/graduation_tasks/cross_comment_setting.json.jbuilder b/app/views/graduation_tasks/cross_comment_setting.json.jbuilder new file mode 100644 index 000000000..f63bc28cc --- /dev/null +++ b/app/views/graduation_tasks/cross_comment_setting.json.jbuilder @@ -0,0 +1,30 @@ +json.work_users @work_list do |work| + json.work_id work.id + json.user_name work.user&.real_name + json.student_id work.user&.student_id + json.course_group_name @students.select{|member| member.user_id == work.user_id}.first.try(:course_group_name) + if @comment_status.to_i == 2 + json.cross_teachers work.work_cross_teachers + json.cross_teacher_ids work.work_cross_teacher_ids + elsif @comment_status.to_i == 4 + json.cross_groups work.work_cross_groups + json.cross_group_ids work.work_cross_group_ids + end +end + +json.user_count @user_count + +json.course_groups @course_groups do |group| + json.(group, :id, :name) +end + +if @comment_status.to_i == 2 + json.teachers @course.teachers.includes(:user) do |teacher| + json.user_id teacher.user_id + json.user_name teacher.user&.real_name + end +elsif @comment_status.to_i == 4 + json.graduation_groups @course.graduation_groups do |group| + json.(group, :id, :name) + end +end \ No newline at end of file diff --git a/app/views/graduation_tasks/index.json.jbuilder b/app/views/graduation_tasks/index.json.jbuilder index a6540555d..ce9ea0259 100644 --- a/app/views/graduation_tasks/index.json.jbuilder +++ b/app/views/graduation_tasks/index.json.jbuilder @@ -11,6 +11,7 @@ json.tasks @tasks.each do |task| task_curr_status = task_curr_status(task, @course) json.status task_curr_status[:status] json.status_time task_curr_status[:time] + json.author task.user.real_name unless task_curr_status[:status].include?("未发布") json.commit_count grduationwork_count task, 1 diff --git a/app/views/graduation_tasks/tasks_list.json.jbuilder b/app/views/graduation_tasks/tasks_list.json.jbuilder index 5a2d7e08a..dc09d759e 100644 --- a/app/views/graduation_tasks/tasks_list.json.jbuilder +++ b/app/views/graduation_tasks/tasks_list.json.jbuilder @@ -2,6 +2,7 @@ json.partial! "public_navigation", locals: {graduation: @task, course: @course} json.user_course_identity @user_course_identity json.course_group_count @course.course_groups_count json.cross_comment @task.cross_comment +json.comment_status @task.comment_status # 课程发布才有数据 if @task.published? || @user_course_identity < Course::STUDENT # 老师身份才有的分类信息 @@ -48,6 +49,7 @@ if @task.published? || @user_course_identity < Course::STUDENT json.class_grouping_name @students.select{|student| student.user_id == work.user_id}.first.try(:course_group_name) json.ultimate_score work.ultimate_score if @task.have_grouping? + json.is_leader work.user_id == work.commit_user_id json.grouping_name work.grouping_name if @task.base_on_project json.project_info project_info work, @current_user, @user_course_identity diff --git a/app/views/graduation_works/edit.json.jbuilder b/app/views/graduation_works/edit.json.jbuilder index 254579473..30ffd6720 100644 --- a/app/views/graduation_works/edit.json.jbuilder +++ b/app/views/graduation_works/edit.json.jbuilder @@ -10,9 +10,14 @@ json.attachments @work.attachments do |atta| json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: @work.delete_atta(atta)} end -json.members @work_members do |member| - json.user_id member.user_id - json.user_name member.user.real_name - json.group_name member.course_group_name - json.student_id member.user.student_id +if @task.task_type == 2 + json.is_leader_work @work.user_id == @commit_user_id + json.members @work_members do |member| + json.user_id member.user_id + json.is_leader_work @work.user_id == @commit_user_id + json.user_name member.user.real_name + json.group_name member.course_group_name + json.student_id member.user.student_id + json.is_leader member.user_id == @commit_user_id + end end \ No newline at end of file diff --git a/app/views/graduation_works/show.json.jbuilder b/app/views/graduation_works/show.json.jbuilder index efe0f52cc..669adfbe9 100644 --- a/app/views/graduation_works/show.json.jbuilder +++ b/app/views/graduation_works/show.json.jbuilder @@ -2,9 +2,12 @@ json.partial! "graduation_tasks/public_navigation", locals: {course: @course, gr json.task_type @task.task_type json.(@work, :description, :commit_time, :update_time) +json.is_leader_work @work.user_id == @work.commit_user_id if @task.task_type == 2 + json.author_name @work.user.real_name json.is_author @is_author -json.update_user_name @work.commit_user.try(:real_name) +json.commit_user_name @work.commit_user.try(:real_name) +json.update_user_name @work.update_user.try(:real_name) json.task_status @task.status #6.12 -hs json.status task_curr_status(@task, @course)[:status] json.update_atta (!@course.is_end && @task.end_time < Time.now && @task.allow_late && (@task.late_time.nil? || @task.late_time > Time.now) && @is_author) @@ -17,9 +20,11 @@ if @task.task_type == 2 && @task.base_on_project json.project_info project_info @work, @current_user, @user_course_identity end -json.work_members @work_members.each do |member| - json.user_name member.user.real_name - json.user_login member.user.login +json.work_members @work_members.each do |work| + json.user_name work.user.real_name + json.user_login work.user.login + json.work_id work.id + json.is_leader work.user_id == work.commit_user_id end diff --git a/app/views/homework_commons/publish_groups.json.jbuilder b/app/views/homework_commons/publish_groups.json.jbuilder index 67722bb04..f3a99dbca 100644 --- a/app/views/homework_commons/publish_groups.json.jbuilder +++ b/app/views/homework_commons/publish_groups.json.jbuilder @@ -1,4 +1,6 @@ json.course_groups @course_groups do |group| json.id group.id json.name group.name -end \ No newline at end of file + json.end_time @group_settings.select{|group_setting| group_setting.course_group_id == group.id}.first&.end_time +end +json.end_time @homework.end_time \ No newline at end of file diff --git a/app/views/polls/publish_groups.json.jbuilder b/app/views/polls/publish_groups.json.jbuilder new file mode 100644 index 000000000..f63a2ea90 --- /dev/null +++ b/app/views/polls/publish_groups.json.jbuilder @@ -0,0 +1,6 @@ +json.course_groups @course_groups do |group| + json.id group.id + json.name group.name + json.end_time @group_settings.select{|group_setting| group_setting.course_group_id == group.id}.first&.end_time +end +json.end_time @poll.end_time \ No newline at end of file diff --git a/app/views/settings/show.json.jbuilder b/app/views/settings/show.json.jbuilder new file mode 100644 index 000000000..0765e303b --- /dev/null +++ b/app/views/settings/show.json.jbuilder @@ -0,0 +1,12 @@ +json.setting do + setting = @laboratory.laboratory_setting + + json.name setting.name || default_setting.name + json.nav_logo_url setting.nav_logo_url || default_setting.nav_logo_url + json.login_logo_url setting.login_logo_url || default_setting.login_logo_url + json.tab_logo_url setting.tab_logo_url || default_setting.tab_logo_url + + json.navbar setting.navbar || default_setting.navbar + + json.footer setting.footer || default_setting.footer +end \ No newline at end of file diff --git a/app/views/shixun_lists/index.json.jbuilder b/app/views/shixun_lists/index.json.jbuilder index 79ce4b09c..08baeabf9 100644 --- a/app/views/shixun_lists/index.json.jbuilder +++ b/app/views/shixun_lists/index.json.jbuilder @@ -11,12 +11,12 @@ json.shixun_list do atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ highlights[:description]&.first&.sub!(reg, '') - highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:description]&.map{|des| des.gsub(atta_reg, '')} highlights[:content]&.first&.sub!(reg, '') - highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:content]&.map{|des| des.gsub(atta_reg, '')} json.title highlights.delete(:name)&.join('...') || obj.searchable_title - json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.sub!(atta_reg, '') + json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.gsub(atta_reg, '') json.content highlights json.level level_to_s(obj.trainee) diff --git a/app/views/shixuns/send_to_course.json.jbuilder b/app/views/shixuns/send_to_course.json.jbuilder index b2e30f985..13b221d75 100644 --- a/app/views/shixuns/send_to_course.json.jbuilder +++ b/app/views/shixuns/send_to_course.json.jbuilder @@ -1,3 +1,4 @@ json.status 1 json.message "发送成功" -json.course_id @course.id \ No newline at end of file +json.course_id @course.id +json.first_category_url module_url(@course.none_hidden_course_modules.first, @course) \ No newline at end of file diff --git a/app/views/stages/_stage.json.jbuilder b/app/views/stages/_stage.json.jbuilder index db00ad844..e5d2be82d 100644 --- a/app/views/stages/_stage.json.jbuilder +++ b/app/views/stages/_stage.json.jbuilder @@ -15,7 +15,7 @@ json.shixuns_list do json.shixun_name shixun.name json.shixun_hidden shixun.hidden json.identifier shixun.identifier - json.complete_status stage_myshixun_status(shixun, user) + json.complete_status stage_myshixun_status(myshixuns.select{|ms| ms.shixun_id == shixun.id}.first) json.shixun_status stage_shixun_status(subject.status, shixun.status, shixun.hidden) end end \ No newline at end of file diff --git a/app/views/stages/index.json.jbuilder b/app/views/stages/index.json.jbuilder index d186088c4..b7c61d9cf 100644 --- a/app/views/stages/index.json.jbuilder +++ b/app/views/stages/index.json.jbuilder @@ -1,3 +1,3 @@ json.stages @stages do |stage| - json.partial! 'stage', locals: {stage: stage, user:@user, subject:@subject} + json.partial! 'stage', locals: {stage: stage, user: @user, subject: @subject, myshixuns: @myshixuns} end \ No newline at end of file diff --git a/app/views/subject_lists/index.json.jbuilder b/app/views/subject_lists/index.json.jbuilder new file mode 100644 index 000000000..63ee6dcbc --- /dev/null +++ b/app/views/subject_lists/index.json.jbuilder @@ -0,0 +1,22 @@ +json.subjects_count @results.total_count + +json.subject_list do + json.array! @results.with_highlights(multiple: true) do |obj, highlights| + json.merge! obj.to_searchable_json + + # 去除开头标点符号 + reg = /^[,。?:;‘’!“”—……、]/ + # 附件的替换 + atta_reg = /!\[.*\]\(\/api\/attachments\/\d+\)/ + + highlights[:description]&.first&.sub!(reg, '') + highlights[:description]&.map{|des| des.gsub(atta_reg, '')} + highlights[:content]&.first&.sub!(reg, '') + highlights[:content]&.map{|des| des.gsub(atta_reg, '')} + + json.title highlights.delete(:name)&.join('...') || obj.searchable_title + json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.gsub(atta_reg, '') + + json.content highlights + end +end \ No newline at end of file diff --git a/app/views/templates/show.json.jbuilder b/app/views/templates/show.json.jbuilder new file mode 100644 index 000000000..cff89037b --- /dev/null +++ b/app/views/templates/show.json.jbuilder @@ -0,0 +1,3 @@ +json.template do + json.partial! 'attachments/attachment_simple', attachment: @template.attachments.last +end \ No newline at end of file diff --git a/app/views/users/accounts/show.json.jbuilder b/app/views/users/accounts/show.json.jbuilder index 6b28bda55..ec81cc6bf 100644 --- a/app/views/users/accounts/show.json.jbuilder +++ b/app/views/users/accounts/show.json.jbuilder @@ -1,5 +1,7 @@ -json.extract! observed_user, :id, :nickname, :phone, :mail, :show_realname +json.extract! observed_user, :id, :nickname, :show_realname +json.phone observed_user.hidden_phone +json.mail observed_user.hidden_mail json.avatar_url url_to_avatar(observed_user) user = ActiveDecorator::Decorator.instance.decorate(observed_user) json.name user.name diff --git a/config/admins/sidebar.yml b/config/admins/sidebar.yml index 30af794b7..9da34a014 100644 --- a/config/admins/sidebar.yml +++ b/config/admins/sidebar.yml @@ -1 +1,2 @@ -admins-mirror_scripts: 'admins-mirror_repositories' \ No newline at end of file +admins-mirror_scripts: 'admins-mirror_repositories' +admins-laboratory_settings: 'admins-laboratories' \ No newline at end of file diff --git a/config/initializers/util_wechat_init.rb b/config/initializers/wechat_init.rb similarity index 79% rename from config/initializers/util_wechat_init.rb rename to config/initializers/wechat_init.rb index cb39afcaf..946e5f638 100644 --- a/config/initializers/util_wechat_init.rb +++ b/config/initializers/wechat_init.rb @@ -12,5 +12,5 @@ rescue => ex wechat_config = {} end -Util::Wechat.appid = wechat_config['appid'] -Util::Wechat.secret = wechat_config['secret'] +Wechat::OfficialAccount.appid = wechat_config['appid'] +Wechat::OfficialAccount.secret = wechat_config['secret'] diff --git a/config/locales/laboratories/zh-CN.yml b/config/locales/laboratories/zh-CN.yml new file mode 100644 index 000000000..42127f0a1 --- /dev/null +++ b/config/locales/laboratories/zh-CN.yml @@ -0,0 +1,7 @@ +zh-CN: + activerecord: + models: + laboratory: '' + attributes: + laboratory: + identifier: '二级域名' \ No newline at end of file diff --git a/config/locales/tidings/zh-CN.yml b/config/locales/tidings/zh-CN.yml index 557f3f79b..f484efdc1 100644 --- a/config/locales/tidings/zh-CN.yml +++ b/config/locales/tidings/zh-CN.yml @@ -58,8 +58,8 @@ "2_end": "你提交的试用授权申请,审核未通过
原因:%{reason}" Apply_end: "提交了试用授权申请" Course_end: "你创建了课堂:%s" - Course: - Delete_end: "你删除了课堂:%s" + DeleteCourse_end: "你删除了课堂:%s" + DeleteCourseMember_end: "%s 将你从课堂中删除了:%s" Shixun_end: "你创建了实训:%s" Subject_end: "你创建了实践课程:%s" ArchiveCourse_end: "你的课堂已经归档:%s" @@ -185,13 +185,13 @@ NearlyEnd_end: "作业的提交截止时间快到啦:%{name}" AppealNearlyEnd_end: "作品的匿评申诉时间快到啦:%{name}" EvaluationNearlyEnd_end: "作业的匿评截止时间快到啦:%{name}" - StudentWork: - true_end: "提交了作品:%s" - false_end: "重新提交了作品,建议您重新评阅:%s" + StudentWork_end: "提交了作品:%s" + ResubmitStudentWork_end: "重新提交了作品,建议您重新评阅作品:%s" StudentWorksScore: 1_end: "评阅了你的作品:%s" 2_end: "评阅了你的作品:%s" 3_end: "有人匿评了你的作品:%s" + AdjustScore_end: "调整了你的作品得分:%s" ChallengeWorkScore_end: "调整了你的作品分数:%s" StudentWorksScoresAppeal: UserAppealResult: diff --git a/config/routes.rb b/config/routes.rb index 1c765bc7b..056fb324c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -176,6 +176,7 @@ Rails.application.routes.draw do end end + resources :subject_lists resources :shixun_lists resources :shixuns, param: :identifier do @@ -332,6 +333,7 @@ Rails.application.routes.draw do post 'join_graduation_group' post 'set_course_group' post 'change_course_admin' + post 'change_member_role' post 'change_course_teacher' post 'delete_course_teacher' post 'teacher_application_review' @@ -370,6 +372,8 @@ Rails.application.routes.draw do post 'join_excellent_course' get 'tasks_list' post 'update_task_position' + get 'course_groups' + post 'join_course_group' end collection do @@ -541,6 +545,7 @@ Rails.application.routes.draw do post 'relate_project' get 'cancel_relate_project' post 'revise_attachment' + delete 'delete_work' end member do @@ -558,6 +563,9 @@ Rails.application.routes.draw do post 'update_settings' get 'tasks_list' get :show_comment + get :cross_comment_setting + post :assign_works + post :commit_comment_setting end collection do @@ -581,6 +589,7 @@ Rails.application.routes.draw do post :cancel_publish #撤销发布 get :cancel_publish_modal #撤销发布的弹窗 get :common_header + get :publish_groups end resources :poll_questions,only:[:new,:create] end @@ -612,6 +621,7 @@ Rails.application.routes.draw do get :exercise_result post :cancel_exercise get :begin_commit #提交前的弹窗 + get :publish_groups end resources :exercise_questions,only:[:new,:create,:index] end @@ -793,6 +803,7 @@ Rails.application.routes.draw do end resources :libraries, only: [:index, :show, :create, :update, :destroy] + resources :library_tags, only: [:index] scope module: :projects do resources :project_applies, only: [:create] @@ -814,6 +825,8 @@ Rails.application.routes.draw do post :feedback end end + resource :template, only: [:show] + resource :setting, only: [:show] end namespace :admins do @@ -943,7 +956,7 @@ Rails.application.routes.draw do resources :choose_mirror_repositories, only: [:new, :create] resources :schools, only: [:index, :destroy] resources :departments, only: [:index, :create, :edit, :update, :destroy] do - resource :department_member, only: [:create, :update, :destroy] + resource :department_member, only: [:create, :destroy] post :merge, on: :collection end resources :myshixuns, only: [:index] @@ -958,6 +971,13 @@ Rails.application.routes.draw do post :drag, on: :collection post :replace_image_url, on: :member end + resources :carousels, only: [:index, :create, :update, :destroy] do + post :drag, on: :collection + end + resources :laboratories, only: [:index, :create, :destroy] do + resource :laboratory_setting, only: [:show, :update] + resource :laboratory_user, only: [:create, :destroy] + end end resources :colleges, only: [] do diff --git a/db/migrate/20190903022313_add_graduation_work_id_to_group_assignations.rb b/db/migrate/20190903022313_add_graduation_work_id_to_group_assignations.rb new file mode 100644 index 000000000..e1db275fb --- /dev/null +++ b/db/migrate/20190903022313_add_graduation_work_id_to_group_assignations.rb @@ -0,0 +1,7 @@ +class AddGraduationWorkIdToGroupAssignations < ActiveRecord::Migration[5.2] + def change + add_column :graduation_task_group_assignations, :graduation_work_id, :integer, default: 0 + + add_index :graduation_task_group_assignations, :graduation_work_id + end +end diff --git a/db/migrate/20190903025159_add_temporary_to_graduation.rb b/db/migrate/20190903025159_add_temporary_to_graduation.rb new file mode 100644 index 000000000..adf7e1aa3 --- /dev/null +++ b/db/migrate/20190903025159_add_temporary_to_graduation.rb @@ -0,0 +1,6 @@ +class AddTemporaryToGraduation < ActiveRecord::Migration[5.2] + def change + add_column :graduation_task_group_assignations, :temporary, :integer, default: 0 + add_column :graduation_work_comment_assignations, :temporary, :integer, default: 0 + end +end diff --git a/db/migrate/20190917024120_migrate_graduation_task_comment_status.rb b/db/migrate/20190917024120_migrate_graduation_task_comment_status.rb new file mode 100644 index 000000000..3b3a3fccc --- /dev/null +++ b/db/migrate/20190917024120_migrate_graduation_task_comment_status.rb @@ -0,0 +1,5 @@ +class MigrateGraduationTaskCommentStatus < ActiveRecord::Migration[5.2] + def change + GraduationTask.where(cross_comment: true, comment_status: 0).update_all(comment_status: 2) + end +end diff --git a/db/migrate/20190923094220_add_update_user_id_to_graduation_works.rb b/db/migrate/20190923094220_add_update_user_id_to_graduation_works.rb new file mode 100644 index 000000000..718c6adde --- /dev/null +++ b/db/migrate/20190923094220_add_update_user_id_to_graduation_works.rb @@ -0,0 +1,6 @@ +class AddUpdateUserIdToGraduationWorks < ActiveRecord::Migration[5.2] + def change + add_column :graduation_works, :update_user_id, :integer + GraduationWork.update_all("update_user_id = commit_user_id") + end +end diff --git a/db/migrate/20190926024819_add_library_tag_data.rb b/db/migrate/20190926024819_add_library_tag_data.rb new file mode 100644 index 000000000..b2b40bbf5 --- /dev/null +++ b/db/migrate/20190926024819_add_library_tag_data.rb @@ -0,0 +1,9 @@ +class AddLibraryTagData < ActiveRecord::Migration[5.2] + def up + execute 'INSERT INTO library_tags(id, name) VALUES(4, "高校案例")' + end + + def down + execute 'DELETE FROM library_tags WHERE id = 4 and name = "高校案例"' + end +end diff --git a/db/migrate/20190927091948_change_user_p02389416_exercise.rb b/db/migrate/20190927091948_change_user_p02389416_exercise.rb new file mode 100644 index 000000000..c4026f75b --- /dev/null +++ b/db/migrate/20190927091948_change_user_p02389416_exercise.rb @@ -0,0 +1,33 @@ +class ChangeUserP02389416Exercise < ActiveRecord::Migration[5.2] + def change + puts "====> start_to_create user exercise_answer" + + #分别为第8,11,14,15,16,20,21,26 + # 分数分别为:2分,2分,5分,2分,2分,2分,2分,2分 合计19分 + question_ids = [37411,37414,37417,37418,37419,37423,37424,37429] + choice_ids = [117788,117797,117806,117809,117811,117816,117818,117828] + question_scores = [2,2,5,2,2,2,2,2] + question_ids.each_with_index do |q, index| + ex_exercise_user = ExerciseAnswer.where(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index]) + if ex_exercise_user.exists? + ex_exercise_user.first.update_attribute(:score,question_scores[index]) + else + ExerciseAnswer.create(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index], score: question_scores[index]) + end + end + ex_user = ExerciseUser.where(user_id: 45442, exercise_id: 2561)&.first + if ex_user.present? + if ex_user.score > 65 || ex_user.objective_score > 65 + ex_user.update_attributes(score: 65, objective_score: 65) + else + obj_score = ex_user.objective_score.to_i + 19 + total_score = ex_user.score.to_i + 19 + + ex_user.update_attributes(score: total_score, objective_score: obj_score) + end + + end + + puts "====> end_to_create user exercise_answer" + end +end diff --git a/db/migrate/20190930020534_migrate_forum_name.rb b/db/migrate/20190930020534_migrate_forum_name.rb new file mode 100644 index 000000000..102d8c9a0 --- /dev/null +++ b/db/migrate/20190930020534_migrate_forum_name.rb @@ -0,0 +1,9 @@ +class MigrateForumName < ActiveRecord::Migration[5.2] + def change + forum = Forum.find_by(id: 16) + if forum.present? + forum.update_attributes(name: "通知公告") + forum.memos.destroy_all + end + end +end diff --git a/db/migrate/20190930032241_create_diff_records.rb b/db/migrate/20190930032241_create_diff_records.rb new file mode 100644 index 000000000..3e02e0a2b --- /dev/null +++ b/db/migrate/20190930032241_create_diff_records.rb @@ -0,0 +1,11 @@ +class CreateDiffRecords < ActiveRecord::Migration[5.2] + def change + create_table :diff_records do |t| + t.references :user + t.references :container, polymorphic: true + t.string :column_name + + t.timestamps + end + end +end diff --git a/db/migrate/20190930032255_create_diff_record_contents.rb b/db/migrate/20190930032255_create_diff_record_contents.rb new file mode 100644 index 000000000..f3d56b8b2 --- /dev/null +++ b/db/migrate/20190930032255_create_diff_record_contents.rb @@ -0,0 +1,9 @@ +class CreateDiffRecordContents < ActiveRecord::Migration[5.2] + def change + create_table :diff_record_contents do |t| + t.references :diff_record + + t.text :content + end + end +end diff --git a/db/migrate/20191007010405_resort_portal_image_data.rb b/db/migrate/20191007010405_resort_portal_image_data.rb new file mode 100644 index 000000000..665b48466 --- /dev/null +++ b/db/migrate/20191007010405_resort_portal_image_data.rb @@ -0,0 +1,7 @@ +class ResortPortalImageData < ActiveRecord::Migration[5.2] + def change + PortalImage.order(position: :asc).each_with_index do |image, index| + image.update!(position: index + 1) + end + end +end diff --git a/db/migrate/20191010011844_create_laboratories.rb b/db/migrate/20191010011844_create_laboratories.rb new file mode 100644 index 000000000..3dfb442f0 --- /dev/null +++ b/db/migrate/20191010011844_create_laboratories.rb @@ -0,0 +1,12 @@ +class CreateLaboratories < ActiveRecord::Migration[5.2] + def change + create_table :laboratories do |t| + t.references :school + t.string :identifier + + t.timestamps + + t.index :identifier, unique: true + end + end +end diff --git a/db/migrate/20191010012226_create_laboratory_users.rb b/db/migrate/20191010012226_create_laboratory_users.rb new file mode 100644 index 000000000..1b7ae762d --- /dev/null +++ b/db/migrate/20191010012226_create_laboratory_users.rb @@ -0,0 +1,8 @@ +class CreateLaboratoryUsers < ActiveRecord::Migration[5.2] + def change + create_table :laboratory_users do |t| + t.references :laboratory + t.references :user + end + end +end diff --git a/db/migrate/20191010063403_create_laboratory_settings.rb b/db/migrate/20191010063403_create_laboratory_settings.rb new file mode 100644 index 000000000..7f0a5f015 --- /dev/null +++ b/db/migrate/20191010063403_create_laboratory_settings.rb @@ -0,0 +1,9 @@ +class CreateLaboratorySettings < ActiveRecord::Migration[5.2] + def change + create_table :laboratory_settings do |t| + t.references :laboratory + + t.text :config + end + end +end diff --git a/db/migrate/20191011025619_init_edu_coder_laboratory.rb b/db/migrate/20191011025619_init_edu_coder_laboratory.rb new file mode 100644 index 000000000..831ca3985 --- /dev/null +++ b/db/migrate/20191011025619_init_edu_coder_laboratory.rb @@ -0,0 +1,22 @@ +class InitEduCoderLaboratory < ActiveRecord::Migration[5.2] + def change + ActiveRecord::Base.transaction do + laboratory = Laboratory.create!(id: 1, identifier: 'www') + setting = laboratory.build_laboratory_setting + footer = %Q{ + + } + config = setting.class.default_config.merge(name: 'EduCoder', footer: footer) + setting.config = config + setting.save! + end + end +end diff --git a/db/migrate/20191011030441_add_commit_method_to_exercise_user.rb b/db/migrate/20191011030441_add_commit_method_to_exercise_user.rb new file mode 100644 index 000000000..060e5eb5f --- /dev/null +++ b/db/migrate/20191011030441_add_commit_method_to_exercise_user.rb @@ -0,0 +1,5 @@ +class AddCommitMethodToExerciseUser < ActiveRecord::Migration[5.2] + def change + add_column :exercise_users, :commit_method, :integer, :default => 0 + end +end diff --git a/lib/tasks/graduation_task.rake b/lib/tasks/graduation_task.rake index 58f7764d0..4d8bf80b8 100644 --- a/lib/tasks/graduation_task.rake +++ b/lib/tasks/graduation_task.rake @@ -43,6 +43,7 @@ namespace :graduation_task do task :cross_comment_start => :environment do tasks = GraduationTask.where("cross_comment = 1 and comment_time is not null and comment_time <= '#{Time.now}' and status = 2") tasks.each do |task| + # 改成设置时都实时分配 if task.comment_status == 4 GraduationTaskCrossCommentJob.perform_later(task.id) end diff --git a/public/assets/.sprockets-manifest-4627fa5586ef7fed55ca286af7c028e9.json b/public/assets/.sprockets-manifest-4627fa5586ef7fed55ca286af7c028e9.json index a61e9dd26..b8b49cc9d 100644 --- a/public/assets/.sprockets-manifest-4627fa5586ef7fed55ca286af7c028e9.json +++ b/public/assets/.sprockets-manifest-4627fa5586ef7fed55ca286af7c028e9.json @@ -1 +1 @@ -{"files":{"admin-cd9ca8bacc973ce2dbace30c97f6c40bc08e2c2ee44972f668e738e1902c0121.js":{"logical_path":"admin.js","mtime":"2019-09-11T16:20:07+08:00","size":4350881,"digest":"cd9ca8bacc973ce2dbace30c97f6c40bc08e2c2ee44972f668e738e1902c0121","integrity":"sha256-zZyousyXPOLbrOMMl/bEC8COLC7kSXL2aOc44ZAsASE="},"admin-a1b3356efe50ff4717cf22475639b5333c5354ba03fd107c9b7a8d4ae76f47aa.css":{"logical_path":"admin.css","mtime":"2019-09-11T16:20:07+08:00","size":773445,"digest":"a1b3356efe50ff4717cf22475639b5333c5354ba03fd107c9b7a8d4ae76f47aa","integrity":"sha256-obM1bv5Q/0cXzyJHVjm1MzxTVLoD/RB8m3qNSudvR6o="},"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot":{"logical_path":"font-awesome/fontawesome-webfont.eot","mtime":"2019-08-14T17:22:43+08:00","size":165742,"digest":"7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979","integrity":"sha256-e/yrbbmdXPvxcFygU23ceFhUMsxfpBu9etDwCQM7KXk="},"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2":{"logical_path":"font-awesome/fontawesome-webfont.woff2","mtime":"2019-08-14T17:22:43+08:00","size":77160,"digest":"2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe","integrity":"sha256-Kt78vAQefRj88tQXh53FoJmXqmTWdbejxLbOM9oT8/4="},"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff":{"logical_path":"font-awesome/fontawesome-webfont.woff","mtime":"2019-08-14T17:22:43+08:00","size":98024,"digest":"ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07","integrity":"sha256-ugxZ3rVFD1y0Gz+TYJ7i0NmVQVh33foiPoqKdTNHTwc="},"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf":{"logical_path":"font-awesome/fontawesome-webfont.ttf","mtime":"2019-08-14T17:22:43+08:00","size":165548,"digest":"aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8","integrity":"sha256-qljzPyOaD7AvXHpsRcBD16msmgkzNYBmlOzW1O3A1qg="},"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg":{"logical_path":"font-awesome/fontawesome-webfont.svg","mtime":"2019-08-14T17:22:43+08:00","size":444379,"digest":"ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4","integrity":"sha256-rWFXkmwWIrpOHQPUePFUE2hSS/xG9R5C/g2UX37zI+Q="},"college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js":{"logical_path":"college.js","mtime":"2019-09-21T15:26:10+08:00","size":3352744,"digest":"18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287","integrity":"sha256-GPXoQAMxY06JijWswhh4FcCWwl4Kt0q6NBrpFhZs0oc="},"college-944d4273f62c7538368b9017fdd3387b5e3bea31a87873770eb231324546d4d9.css":{"logical_path":"college.css","mtime":"2019-09-11T16:20:07+08:00","size":546841,"digest":"944d4273f62c7538368b9017fdd3387b5e3bea31a87873770eb231324546d4d9","integrity":"sha256-lE1Cc/YsdTg2i5AX/dM4e1476jGoeHN3DrIxMkVG1Nk="},"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png":{"logical_path":"logo.png","mtime":"2019-09-03T08:55:53+08:00","size":2816,"digest":"7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423","integrity":"sha256-f/ESVocJv5f5iY/ockm3qPIA/x9I1TfYWvhyFfGHBCM="},"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js":{"logical_path":"application.js","mtime":"2019-09-21T15:26:10+08:00","size":600706,"digest":"9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb","integrity":"sha256-nPvD15JZmh0N5ce4QgnhwrLmAzbw8B4Z8FgWY5GHCPs="},"application-5eb87c6e13676d0183317debce17fade27e68c4acee28c419438da15d53c94f2.css":{"logical_path":"application.css","mtime":"2019-09-11T16:20:07+08:00","size":1844002,"digest":"5eb87c6e13676d0183317debce17fade27e68c4acee28c419438da15d53c94f2","integrity":"sha256-Xrh8bhNnbQGDMX3rzhf63ifmjErO4oxBlDjaFdU8lPI="},"admin-c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4.js":{"logical_path":"admin.js","mtime":"2019-09-21T15:28:08+08:00","size":4382031,"digest":"c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4","integrity":"sha256-yeXr5hkVSFUOJ1FBluoSXPu0AoIOwSWgyaz5nS03j+Q="},"admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css":{"logical_path":"admin.css","mtime":"2019-09-21T14:49:04+08:00","size":840093,"digest":"59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38","integrity":"sha256-WcWfjK6L70qDWShsmFRYEQydA+oSFRZZXJiJQ/RxfDg="},"college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css":{"logical_path":"college.css","mtime":"2019-09-16T13:56:09+08:00","size":579109,"digest":"38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437","integrity":"sha256-OPlT1rpbhdP6tjyzwrvw0FfMxkVNB8+q+sOwbaN7hDc="},"application-646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3.css":{"logical_path":"application.css","mtime":"2019-09-21T14:49:04+08:00","size":1988767,"digest":"646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3","integrity":"sha256-ZGsRWKTowfE+aE1v6QJavHX407pSVuRAgCwDmCIzdPM="}},"assets":{"admin.js":"admin-c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4.js","admin.css":"admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css","font-awesome/fontawesome-webfont.eot":"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot","font-awesome/fontawesome-webfont.woff2":"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2","font-awesome/fontawesome-webfont.woff":"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff","font-awesome/fontawesome-webfont.ttf":"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf","font-awesome/fontawesome-webfont.svg":"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg","college.js":"college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js","college.css":"college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css","logo.png":"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png","application.js":"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js","application.css":"application-646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3.css"}} \ No newline at end of file +{"files":{"admin-cd9ca8bacc973ce2dbace30c97f6c40bc08e2c2ee44972f668e738e1902c0121.js":{"logical_path":"admin.js","mtime":"2019-09-11T16:20:07+08:00","size":4350881,"digest":"cd9ca8bacc973ce2dbace30c97f6c40bc08e2c2ee44972f668e738e1902c0121","integrity":"sha256-zZyousyXPOLbrOMMl/bEC8COLC7kSXL2aOc44ZAsASE="},"admin-a1b3356efe50ff4717cf22475639b5333c5354ba03fd107c9b7a8d4ae76f47aa.css":{"logical_path":"admin.css","mtime":"2019-09-11T16:20:07+08:00","size":773445,"digest":"a1b3356efe50ff4717cf22475639b5333c5354ba03fd107c9b7a8d4ae76f47aa","integrity":"sha256-obM1bv5Q/0cXzyJHVjm1MzxTVLoD/RB8m3qNSudvR6o="},"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot":{"logical_path":"font-awesome/fontawesome-webfont.eot","mtime":"2019-08-14T17:22:43+08:00","size":165742,"digest":"7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979","integrity":"sha256-e/yrbbmdXPvxcFygU23ceFhUMsxfpBu9etDwCQM7KXk="},"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2":{"logical_path":"font-awesome/fontawesome-webfont.woff2","mtime":"2019-08-14T17:22:43+08:00","size":77160,"digest":"2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe","integrity":"sha256-Kt78vAQefRj88tQXh53FoJmXqmTWdbejxLbOM9oT8/4="},"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff":{"logical_path":"font-awesome/fontawesome-webfont.woff","mtime":"2019-08-14T17:22:43+08:00","size":98024,"digest":"ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07","integrity":"sha256-ugxZ3rVFD1y0Gz+TYJ7i0NmVQVh33foiPoqKdTNHTwc="},"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf":{"logical_path":"font-awesome/fontawesome-webfont.ttf","mtime":"2019-08-14T17:22:43+08:00","size":165548,"digest":"aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8","integrity":"sha256-qljzPyOaD7AvXHpsRcBD16msmgkzNYBmlOzW1O3A1qg="},"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg":{"logical_path":"font-awesome/fontawesome-webfont.svg","mtime":"2019-08-14T17:22:43+08:00","size":444379,"digest":"ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4","integrity":"sha256-rWFXkmwWIrpOHQPUePFUE2hSS/xG9R5C/g2UX37zI+Q="},"college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js":{"logical_path":"college.js","mtime":"2019-09-26T14:40:40+08:00","size":3352744,"digest":"18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287","integrity":"sha256-GPXoQAMxY06JijWswhh4FcCWwl4Kt0q6NBrpFhZs0oc="},"college-944d4273f62c7538368b9017fdd3387b5e3bea31a87873770eb231324546d4d9.css":{"logical_path":"college.css","mtime":"2019-09-11T16:20:07+08:00","size":546841,"digest":"944d4273f62c7538368b9017fdd3387b5e3bea31a87873770eb231324546d4d9","integrity":"sha256-lE1Cc/YsdTg2i5AX/dM4e1476jGoeHN3DrIxMkVG1Nk="},"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png":{"logical_path":"logo.png","mtime":"2019-09-03T08:55:53+08:00","size":2816,"digest":"7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423","integrity":"sha256-f/ESVocJv5f5iY/ockm3qPIA/x9I1TfYWvhyFfGHBCM="},"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js":{"logical_path":"application.js","mtime":"2019-09-26T14:40:40+08:00","size":600706,"digest":"9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb","integrity":"sha256-nPvD15JZmh0N5ce4QgnhwrLmAzbw8B4Z8FgWY5GHCPs="},"application-5eb87c6e13676d0183317debce17fade27e68c4acee28c419438da15d53c94f2.css":{"logical_path":"application.css","mtime":"2019-09-11T16:20:07+08:00","size":1844002,"digest":"5eb87c6e13676d0183317debce17fade27e68c4acee28c419438da15d53c94f2","integrity":"sha256-Xrh8bhNnbQGDMX3rzhf63ifmjErO4oxBlDjaFdU8lPI="},"admin-c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4.js":{"logical_path":"admin.js","mtime":"2019-09-21T15:28:08+08:00","size":4382031,"digest":"c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4","integrity":"sha256-yeXr5hkVSFUOJ1FBluoSXPu0AoIOwSWgyaz5nS03j+Q="},"admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css":{"logical_path":"admin.css","mtime":"2019-09-21T14:49:04+08:00","size":840093,"digest":"59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38","integrity":"sha256-WcWfjK6L70qDWShsmFRYEQydA+oSFRZZXJiJQ/RxfDg="},"college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css":{"logical_path":"college.css","mtime":"2019-09-16T13:56:09+08:00","size":579109,"digest":"38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437","integrity":"sha256-OPlT1rpbhdP6tjyzwrvw0FfMxkVNB8+q+sOwbaN7hDc="},"application-646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3.css":{"logical_path":"application.css","mtime":"2019-09-21T14:49:04+08:00","size":1988767,"digest":"646b1158a4e8c1f13e684d6fe9025abc75f8d3ba5256e440802c0398223374f3","integrity":"sha256-ZGsRWKTowfE+aE1v6QJavHX407pSVuRAgCwDmCIzdPM="},"admin-a47e37c0ec7cf5f22380249776d1e82d65b6b6aa272ed7389185aa200fa40751.js":{"logical_path":"admin.js","mtime":"2019-09-25T15:33:05+08:00","size":4383107,"digest":"a47e37c0ec7cf5f22380249776d1e82d65b6b6aa272ed7389185aa200fa40751","integrity":"sha256-pH43wOx89fIjgCSXdtHoLWW2tqonLtc4kYWqIA+kB1E="},"admin-432c4eac09b036c57ff1e88d902b8aa7df81164e4b419bac557cf1366c1d3ad9.js":{"logical_path":"admin.js","mtime":"2019-09-25T15:35:20+08:00","size":4383103,"digest":"432c4eac09b036c57ff1e88d902b8aa7df81164e4b419bac557cf1366c1d3ad9","integrity":"sha256-QyxOrAmwNsV/8eiNkCuKp9+BFk5LQZusVXzxNmwdOtk="},"admin-978e5ce607f77c26814a174f480da79ac246c2201868ef84654aa03bb6727b5a.js":{"logical_path":"admin.js","mtime":"2019-09-30T14:43:41+08:00","size":4387200,"digest":"978e5ce607f77c26814a174f480da79ac246c2201868ef84654aa03bb6727b5a","integrity":"sha256-l45c5gf3fCaBShdPSA2nmsJGwiAYaO+EZUqgO7Zye1o="},"admin-896281f4731722b0c084dbb1af21d0f34a5bc142d58aff57b391864ab71ddca7.css":{"logical_path":"admin.css","mtime":"2019-09-30T14:43:41+08:00","size":842269,"digest":"896281f4731722b0c084dbb1af21d0f34a5bc142d58aff57b391864ab71ddca7","integrity":"sha256-iWKB9HMXIrDAhNuxryHQ80pbwULViv9Xs5GGSrcd3Kc="},"application-97f313e9bb7d25476649f7d7215959cf421480fd0a3785d1956953bf94a1e8bd.css":{"logical_path":"application.css","mtime":"2019-09-30T14:43:41+08:00","size":1993118,"digest":"97f313e9bb7d25476649f7d7215959cf421480fd0a3785d1956953bf94a1e8bd","integrity":"sha256-l/MT6bt9JUdmSffXIVlZz0IUgP0KN4XRlWlTv5Sh6L0="},"admin-2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888.js":{"logical_path":"admin.js","mtime":"2019-10-11T14:38:33+08:00","size":4394616,"digest":"2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888","integrity":"sha256-LNsjRC+nNQJThbiPKQDfBP7zi2FTAEGm2+N17w8K6Ig="},"admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css":{"logical_path":"admin.css","mtime":"2019-10-10T17:12:05+08:00","size":846514,"digest":"2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc","integrity":"sha256-LChUuaAhWN7VqAmq9xRKhjCxA1SrTlb+zE3/zHE3lsw="},"application-50059ae929866043b47015128702fcfba53d32a2df148e64e1d961c10651c6af.css":{"logical_path":"application.css","mtime":"2019-10-10T17:12:05+08:00","size":2001607,"digest":"50059ae929866043b47015128702fcfba53d32a2df148e64e1d961c10651c6af","integrity":"sha256-UAWa6SmGYEO0cBUShwL8+6U9MqLfFI5k4dlhwQZRxq8="}},"assets":{"admin.js":"admin-2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888.js","admin.css":"admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css","font-awesome/fontawesome-webfont.eot":"font-awesome/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot","font-awesome/fontawesome-webfont.woff2":"font-awesome/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2","font-awesome/fontawesome-webfont.woff":"font-awesome/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff","font-awesome/fontawesome-webfont.ttf":"font-awesome/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf","font-awesome/fontawesome-webfont.svg":"font-awesome/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg","college.js":"college-18f5e8400331634e898a35acc2187815c096c25e0ab74aba341ae916166cd287.js","college.css":"college-38f953d6ba5b85d3fab63cb3c2bbf0d057ccc6454d07cfaafac3b06da37b8437.css","logo.png":"logo-7ff112568709bf97f9898fe87249b7a8f200ff1f48d537d85af87215f1870423.png","application.js":"application-9cfbc3d792599a1d0de5c7b84209e1c2b2e60336f0f01e19f0581663918708fb.js","application.css":"application-50059ae929866043b47015128702fcfba53d32a2df148e64e1d961c10651c6af.css"}} \ No newline at end of file diff --git a/public/assets/admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css b/public/assets/admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css similarity index 99% rename from public/assets/admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css rename to public/assets/admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css index 7f47cf542..5b6bef77a 100644 --- a/public/assets/admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css +++ b/public/assets/admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css @@ -24946,6 +24946,78 @@ input.form-control { margin-right: 5px; } +/* line 4, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item > .drag { + cursor: move; + background: #fff; + box-shadow: 1px 2px 5px 3px #f0f0f0; +} + +/* line 10, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item-no { + font-size: 28px; + text-align: center; +} + +/* line 15, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item-img { + cursor: pointer; + width: 100%; + height: 60px; +} + +/* line 20, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item-img > img { + display: block; + width: 100%; + height: 60px; + background: #F5F5F5; +} + +/* line 28, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item .not_active { + background: #F0F0F0; +} + +/* line 32, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item .delete-btn { + font-size: 20px; + color: red; + cursor: pointer; +} + +/* line 38, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item .save-url-btn { + cursor: pointer; +} + +/* line 42, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item .operate-box { + display: -webkit-box; + display: flex; + -webkit-box-pack: justify; + justify-content: space-between; + -webkit-box-align: center; + align-items: center; +} + +/* line 48, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item .online-check-box { + font-size: 20px; +} + +/* line 52, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item .name-input { + -webkit-box-flex: 1; + flex: 1; +} + +/* line 55, app/assets/stylesheets/admins/carousels.scss */ +.admins-carousels-index-page .carousels-card .custom-carousel-item .link-input { + -webkit-box-flex: 3; + flex: 3; +} + /* line 1, app/assets/stylesheets/admins/common.scss */ .admin-body-container { padding: 20px; @@ -25202,6 +25274,114 @@ input.form-control { color: #6c757d; } +/* line 4, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratories-index-page .laboratory-list-table .member-container .laboratory-user { + display: -webkit-box; + display: flex; + -webkit-box-pack: center; + justify-content: center; + flex-wrap: wrap; +} + +/* line 9, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratories-index-page .laboratory-list-table .member-container .laboratory-user .laboratory-user-item { + display: -webkit-box; + display: flex; + -webkit-box-align: center; + align-items: center; + height: 22px; + line-height: 22px; + padding: 2px 5px; + margin: 2px 2px; + border: 1px solid #91D5FF; + background-color: #E6F7FF; + color: #91D5FF; + border-radius: 4px; +} + +/* line 27, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item { + display: -webkit-box; + display: flex; +} + +/* line 30, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-img, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-img { + display: block; + width: 80px; + height: 80px; +} + +/* line 36, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-upload, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-upload { + cursor: pointer; + position: absolute; + top: 0; + width: 80px; + height: 80px; + background: #F5F5F5; + border: 1px solid #E5E5E5; +} + +/* line 45, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-upload::before, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-upload::before { + content: ''; + position: absolute; + top: 27px; + left: 39px; + width: 2px; + height: 26px; + background: #E5E5E5; +} + +/* line 55, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-upload::after, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-upload::after { + content: ''; + position: absolute; + top: 39px; + left: 27px; + width: 26px; + height: 2px; + background: #E5E5E5; +} + +/* line 66, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-left, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-left { + position: relative; + width: 80px; + height: 80px; +} + +/* line 72, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-left.has-img .logo-item-upload, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-left.has-img .logo-item-upload { + display: none; +} + +/* line 77, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-left.has-img:hover .logo-item-upload, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-left.has-img:hover .logo-item-upload { + display: block; + background: rgba(145, 145, 145, 0.8); +} + +/* line 85, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-right, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-right { + display: -webkit-box; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + flex-direction: column; + -webkit-box-pack: justify; + justify-content: space-between; + color: #777777; + font-size: 12px; +} + +/* line 93, app/assets/stylesheets/admins/laboratories.scss */ +.admins-laboratory-settings-show-page .edit-laboratory-setting-container .logo-item-title, .admins-laboratory-settings-update-page .edit-laboratory-setting-container .logo-item-title { + color: #23272B; + font-size: 14px; +} + /* line 4, app/assets/stylesheets/admins/library_applies.scss */ .admins-library-applies-index-page .library-applies-list-container span.apply-status-agreed { color: #28a745; diff --git a/public/assets/admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css.gz b/public/assets/admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css.gz similarity index 78% rename from public/assets/admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css.gz rename to public/assets/admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css.gz index a19afd2c4..bfac93da9 100644 Binary files a/public/assets/admin-59c59f8cae8bef4a8359286c985458110c9d03ea121516595c988943f4717c38.css.gz and b/public/assets/admin-2c2854b9a02158ded5a809aaf7144a8630b10354ab4e56fecc4dffcc713796cc.css.gz differ diff --git a/public/assets/admin-c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4.js b/public/assets/admin-2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888.js similarity index 99% rename from public/assets/admin-c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4.js rename to public/assets/admin-2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888.js index ce87b3e0e..6203a3ce8 100644 --- a/public/assets/admin-c9e5ebe6191548550e27514196ea125cfbb402820ec125a0c9acf99d2d378fe4.js +++ b/public/assets/admin-2cdb23442fa735025385b88f2900df04fef38b61530041a6dbe375ef0f0ae888.js @@ -27586,9 +27586,9 @@ $.fn.bootstrapViewer = function (options) { ' -
diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index f9f80a9da..70cc43f4c 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -299,7 +299,6 @@ class CoursesIndex extends Component{ this.historyArray = [window.location.pathname]; this.props.history.listen( location => { - console.log(location); this.historyArray.unshift(window.location.pathname); this.historyArray.length = 2; //Do your stuff here @@ -662,6 +661,11 @@ class CoursesIndex extends Component{ (props) => () } > + () + } + > {/* 普通作业 */} () } > + () + } + > { + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + // if(this.props.checkIfProfileCompleted()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.props.showProfileCompleteDialog() + // return + // } + if(list.is_history_file===false){ // this.props.DownloadFileA(list.title,list.url) //window.location.href=list.url; @@ -217,7 +232,7 @@ class Fileslistitem extends Component{ { this.props.isNotMember===true? discussMessage.is_lock === true ? - {discussMessage.title} + {discussMessage.title} :this.showfiles(discussMessage)} title={discussMessage.title} @@ -227,7 +242,7 @@ class Fileslistitem extends Component{ { discussMessage.is_lock === true ? - + :"" @@ -314,7 +329,19 @@ class Fileslistitem extends Component{

-

资源描述 :{discussMessage.description===null?"暂无描述":discussMessage.description}
+ + 资源描述 :{discussMessage.description===null?"暂无描述":discussMessage.description} {/**/} {/*/!**!/*/} {/**/} diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index c52f3753a..1fea29f84 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -113,31 +113,36 @@ class Fileslists extends Component{ updadatalist=(id)=>{ // this.seactall(id) - let coursesId=this.props.match.params.coursesId; - let url="/courses/"+coursesId+"/attahcment_category_list.json"; - axios.get(url, { - }).then((response) => { - if(response!=undefined){ - - if(response.data&&response.data) { - if (response.data.status != 401) { - let list = response.data.course_modules; - let course_second_categoriess; - list.map((item, key) => { - course_second_categoriess = item.course_second_categories - }) - - this.setState({ - course_modules: response.data, - has_course_groups: response.data.has_course_groups, - course_second_categories: course_second_categoriess - }) + if(this.props.user&&this.props.user.login=== ""||this.props.user&&this.props.user.login=== null||this.props.user&&this.props.user.login=== undefined){ + + }else{ + let coursesId=this.props.match.params.coursesId; + let url="/courses/"+coursesId+"/attahcment_category_list.json"; + axios.get(url, { + }).then((response) => { + if(response!=undefined){ + + if(response.data&&response.data) { + if (response.data.status != 401) { + let list = response.data.course_modules; + let course_second_categoriess; + list.map((item, key) => { + course_second_categoriess = item.course_second_categories + }) + + this.setState({ + course_modules: response.data, + has_course_groups: response.data.has_course_groups, + course_second_categories: course_second_categoriess + }) + } } + } - } + }) + } - }) } updatafiled=()=>{ if(this.props.match.params.main_id){ @@ -588,7 +593,7 @@ class Fileslists extends Component{ modalname:"立即发布", visible:true, typs:"start", - Topval:"学生将能立即查看和下载发布资源", + Topval:"学生将能立即收到资源", // Botvalleft:"暂不发布", // Botval:`本操作只对"未发布"的分班有效`, // starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), diff --git a/public/react/src/modules/courses/boards/BoardsListItem.js b/public/react/src/modules/courses/boards/BoardsListItem.js index 5abb25adb..2b9c05126 100644 --- a/public/react/src/modules/courses/boards/BoardsListItem.js +++ b/public/react/src/modules/courses/boards/BoardsListItem.js @@ -1,115 +1,130 @@ -import React,{ Component } from "react"; -import {Tooltip} from 'antd' -import moment from 'moment' -import { getUrl, WordsBtn } from 'educoder' -class BoardsListItem extends Component{ - constructor(props){ - super(props); - this.state = { - - } - } - onTitleClick = (discussMessage) => { - const isAdminOrStudent = this.props.isAdminOrStudent(); - if (!isAdminOrStudent && discussMessage.is_public == false) { - // 没有权限访问 - return; - } - const cid = this.props.match.params.coursesId - const board_id = this.props.match.params.boardId - this.props.toDetailPage(cid, board_id, discussMessage.id) - } - render(){ - let { addGroup } = this.state; - const isAdmin = this.props.isAdmin() - const isAdminOrStudent = this.props.isAdminOrStudent() - const { checkBox, discussMessage, onSticky, onItemClick, current_user } = this.props; - if (!discussMessage || !discussMessage.author) { - return ''; - } - let canNotLink = !isAdminOrStudent && discussMessage.is_public == false - - return( -
- - { checkBox } - - {/* /images/avatars/User/1?1529221779 */} - 1?1529221779 - -
onItemClick(discussMessage)}> -
- {} : () => this.onTitleClick(discussMessage)} - title={`${discussMessage.subject.length > 40 ? discussMessage.subject : ''}`} - >{discussMessage.subject} - { !!discussMessage.sticky && 置顶 } - { - - discussMessage.is_public == false ? ( - - ) : "" - } -
- -
-

- - {discussMessage.author.name} - - { discussMessage.total_replies_count != 0 && {discussMessage.total_replies_count} 回复 } - { discussMessage.praises_count != 0 && {discussMessage.praises_count} 点赞 } - { discussMessage.visits != 0 && {discussMessage.visits} 浏览 } - - {moment(discussMessage.created_on).fromNow()} - -

-
- {(isAdmin || discussMessage.author.login == current_user.login) && - { this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} }>编辑 } - - { isAdmin && { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();}}> - { discussMessage.sticky ? '取消置顶' : '置顶' } } -
- - - - - - {/* { (isAdmin || discussMessage.author.login == current_user.login) && - - } */} - - -
-
- ) - } -} +import React,{ Component } from "react"; +import {Tooltip} from 'antd' +import moment from 'moment' +import { getUrl, WordsBtn } from 'educoder' +class BoardsListItem extends Component{ + constructor(props){ + super(props); + this.state = { + + } + } + onTitleClick = (discussMessage) => { + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + // if(this.props.checkIfProfileCompleted()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.props.showProfileCompleteDialog() + // return + // } + + const isAdminOrStudent = this.props.isAdminOrStudent(); + if (!isAdminOrStudent && discussMessage.is_public == false) { + // 没有权限访问 + return; + } + const cid = this.props.match.params.coursesId + const board_id = this.props.match.params.boardId + this.props.toDetailPage(cid, board_id, discussMessage.id) + } + render(){ + let { addGroup } = this.state; + const isAdmin = this.props.isAdmin() + const isAdminOrStudent = this.props.isAdminOrStudent() + const { checkBox, discussMessage, onSticky, onItemClick, current_user } = this.props; + if (!discussMessage || !discussMessage.author) { + return ''; + } + let canNotLink = !isAdminOrStudent && discussMessage.is_public == false + + return( +
+ + { checkBox } + + {/* /images/avatars/User/1?1529221779 */} + 1?1529221779 + +
onItemClick(discussMessage)}> +
+ {canNotLink?{discussMessage.subject}: {} : () => this.onTitleClick(discussMessage)} + >{discussMessage.subject}} + { !!discussMessage.sticky && 置顶 } + { + + discussMessage.is_public == false ? ( + + ) : "" + } +
+ +
+

+ + {discussMessage.author.name} + + { discussMessage.total_replies_count != 0 && {discussMessage.total_replies_count} 回复 } + { discussMessage.praises_count != 0 && {discussMessage.praises_count} 点赞 } + { discussMessage.visits != 0 && {discussMessage.visits} 浏览 } + + {moment(discussMessage.created_on).fromNow()} + +

+
+ {(isAdmin || discussMessage.author.login == current_user.login) && + { this.props.toEditPage(this.props.match.params.coursesId, this.props.match.params.boardId, discussMessage.id )} }>编辑 } + + { isAdmin && { debugger; onSticky(discussMessage); e.cancelBubble = true; e.stopPropagation();}}> + { discussMessage.sticky ? '取消置顶' : '置顶' } } +
+ + + + + + {/* { (isAdmin || discussMessage.author.login == current_user.login) && + + } */} + + +
+
+ ) + } +} export default BoardsListItem; \ No newline at end of file diff --git a/public/react/src/modules/courses/boards/index.js b/public/react/src/modules/courses/boards/index.js index 6d1c402ce..b1ada5bb5 100644 --- a/public/react/src/modules/courses/boards/index.js +++ b/public/react/src/modules/courses/boards/index.js @@ -116,6 +116,7 @@ class Boards extends Component{ this.setState({ isSpin:true }) + this.clearAllCheck() this.fetchAll(null, 1) } } diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js index 8985aa07e..7ba231b99 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js @@ -308,15 +308,11 @@ class CommonWorkDetailIndex extends Component{ onClick={() => this.setState({moduleName: '参考答案'})} className={`${childModuleName == '参考答案' ? 'active' : '' } `} to={`/courses/${courseId}/${moduleEngName}/${workId}/answer`}>参考答案} - - {this.props.isAdmin() ? this.setState({moduleName: '设置'})} className={`${childModuleName == '设置' ? 'active' : '' } `} - style={{paddingLeft:'38px'}} - to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>设置: - "" - } + style={{paddingLeft:this.props.isAdmin()?'38px':'20px'}} + to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"} {/* { this.props.tabRightComponents } */} diff --git a/public/react/src/modules/courses/busyWork/CommonWorkItem.js b/public/react/src/modules/courses/busyWork/CommonWorkItem.js index 122ed12d2..75676557a 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkItem.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkItem.js @@ -16,7 +16,23 @@ class CommonWorkItem extends Component{ } } onItemClick = (item) => { - const isStudent = this.props.isStudent() + + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + // if(this.props.checkIfProfileCompleted()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.props.showProfileCompleteDialog() + // return + // } + + const isStudent = this.props.isStudent() if (isStudent) { this.props.toWorkQuestionPage(this.props.match.params, item.homework_id) } else { @@ -128,6 +144,9 @@ class CommonWorkItem extends Component{ text-overflow: ellipsis; white-space: nowrap; } + a:hover{ + color: #4cacff; + } ` } @@ -142,17 +161,21 @@ class CommonWorkItem extends Component{ mainList && isAdmin && } +
this.props.onItemClick(Object.assign({}, item, {id: item.homework_id})) }>

- {} : () => this.onItemClick(item)} - >{item.name} - + {canNotLink? + {item.name} + : {} : () => this.onItemClick(item)} + title={item.name} + >{item.name}} {/* 只有非课堂成员且作业是私有的情况下才会为true */} { item.private_icon===true ? - ( + ( ) : "" } @@ -182,7 +205,7 @@ class CommonWorkItem extends Component{ {item.uncommit_count===undefined?"":{item.uncommit_count} 未交} { item.status_time!="" && - 发布设置 { !startEditFlag && isAdmin ? - { this.setState({startEditFlag: true}) }}> - + { this.setState({startEditFlag: true}) }}> + 编辑设置 + {/**/} :"" } @@ -1054,7 +1060,7 @@ class CommonWorkSetting extends Component{ {/* */} - + 截止时间: {/* */} - + 开启时间: - - + + */} - + 匿评数量: - + 缺评扣分: - + 结束时间: {/* */} - + 违规匿评扣分: - +

- + 普通模式(选中,则取各助教最终评分的平均分) diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index c52350c78..81851d2f2 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -323,7 +323,7 @@ class NewWorkForm extends Component{ const courseId = this.state.course_id || this.props.match.params.coursesId ; this.isEdit = this.isEdit || this.props.match.url.indexOf('/edit') != -1 - if ((this.isEdit) && !this.state.description) { + if ((this.isEdit) && !this.state.description && this.state.description != '') { return '' } const uploadProps = { diff --git a/public/react/src/modules/courses/busyWork/common.js b/public/react/src/modules/courses/busyWork/common.js index 7f54a0623..b1828997b 100644 --- a/public/react/src/modules/courses/busyWork/common.js +++ b/public/react/src/modules/courses/busyWork/common.js @@ -1,184 +1,184 @@ -import React, { Component } from 'react'; -export const STATUS_UN_PUBLISH = "未发布" -// homework_status: ["提交中", "未开启补交"] -export const STATUS_SUBMIT = "提交中" -// export const STATUS_UN_PUBLISH = "未发布" - -// homework_status: ["提交中"] 未发布 未开启补交 - - -export function RouteHOC(options = {}) { - return function wrap(WrappedComponent) { - return class Wrapper extends Component { - constructor(props) { - super(props); - - this.state = { - - } - } - toCreateProject = () => { - let url = '/projects/new' - if (window.location.port == 3007) { - // window.location.href - url = '/testbdweb.educoder.net/projects/new' - } - window.open( - url, - '_blank' // <- This is what makes it open in a new window. - ); - } - // common_homework group_homework - // 是否是分组作业 - isGroup = () => { - return window.location.pathname.indexOf('group_homeworks') != -1 - } - getModuleName = (isChinese) => { - const isGroup = this.isGroup() - if (isChinese) { - let chName = isGroup ? '分组作业' : '普通作业' - return chName; - } - const secondName = isGroup ? 'group_homeworks' : 'common_homeworks' - return secondName; - } - getModuleType = () => { - const isGroup = this.isGroup() - return isGroup ? 3 : 1 - } - toDetailPage = (_courseId, workId, topicId) => { - if (typeof _courseId == "object") { - const topicId = _courseId.topicId - const workId = _courseId.workId - const courseId = _courseId.coursesId - this.props.history.push(`/courses/${courseId}/boards/${workId}/messages/${topicId}`) - } else { - this.props.history.push(`/courses/${_courseId}/boards/${workId}/messages/${topicId}`) - } - - } - toEditPage = (_courseId, _workId) => { - const secondName = this.getModuleName() - if (typeof _courseId == "object") { - const workId = _courseId.workId - const courseId = _courseId.coursesId - this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/edit`) - } else { - this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/edit`) - } - } - toWorkDetailPage = (_courseId, _workId, _studentWorkId) => { - const secondName = this.getModuleName() - if (typeof _courseId == "object") { - const workId = _courseId.workId - const courseId = _courseId.coursesId - const studentWorkId = _courseId.studentWorkId - this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/${_studentWorkId || studentWorkId}/appraise`) - } else { - this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/${_studentWorkId}/appraise`) - } - } - toNewPage = (courseId) => { - const secondName = this.getModuleName() - this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.category_id}/new`) - } - toListPage = (_courseId, _workId) => { - const secondName = this.getModuleName() - if (typeof _courseId == "object") { - const workId = _courseId.workId - const courseId = _courseId.coursesId - this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}`) - } else { - this.props.history.push(`/courses/${_courseId}/${secondName}${_workId ? '/' + _workId : ''}`) - } - } - - - toWorkPostPage = (_courseId, _workId, isEdit, _studentWorkId) => { - const secondName = this.getModuleName() - if (typeof _courseId == "object") { - const workId = _courseId.workId - const courseId = _courseId.coursesId - const studentWorkId = _courseId.studentWorkId - this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/${isEdit? `${_studentWorkId || studentWorkId}/post_edit` : 'post'}`) - } else { - this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/${isEdit? `${_studentWorkId}/post_edit` : 'post'}`) - } - } - toWorkListPage = (_courseId, _workId) => { - const secondName = this.getModuleName() - if (typeof _courseId == "object") { - const workId = _courseId.workId - const courseId = _courseId.coursesId - this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/list`) - } else { - this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/list`) - } - } - toWorkAnswerPage = (_courseId, _workId) => { - const secondName = this.getModuleName() - if (typeof _courseId == "object") { - const workId = _courseId.workId - const courseId = _courseId.coursesId - this.props.history.push(`/courses/${courseId}/${secondName}/${workId}/answer`) - } else { - this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/answer`) - } - } - - toWorkQuestionPage = (_courseId, _workId) => { - const secondName = this.getModuleName() - if (typeof _courseId == "object") { - const workId = _workId || _courseId.workId - const courseId = _courseId.coursesId - this.props.history.push(`/courses/${courseId}/${secondName}/${workId}/question`) - } else { - this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/question`) - } - } - - toWorkSettingPage = (_courseId, _workId) => { - const secondName = this.getModuleName() - if (typeof _courseId == "object") { - const workId = _courseId.workId - const courseId = _courseId.coursesId - this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/setting`) - } else { - this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/setting`) - } - } - - - - render() { - const { snackbarOpen} = this.state; - return ( - - - - - - ) - } - } - } +import React, { Component } from 'react'; +export const STATUS_UN_PUBLISH = "未发布" +// homework_status: ["提交中", "未开启补交"] +export const STATUS_SUBMIT = "提交中" +// export const STATUS_UN_PUBLISH = "未发布" + +// homework_status: ["提交中"] 未发布 未开启补交 + + +export function RouteHOC(options = {}) { + return function wrap(WrappedComponent) { + return class Wrapper extends Component { + constructor(props) { + super(props); + + this.state = { + + } + } + toCreateProject = () => { + let url = '/projects/new' + if (window.location.port == 3007) { + // window.location.href + url = '/testbdweb.educoder.net/projects/new' + } + window.open( + url, + '_blank' // <- This is what makes it open in a new window. + ); + } + // common_homework group_homework + // 是否是分组作业 + isGroup = () => { + return window.location.pathname.indexOf('group_homeworks') != -1 + } + getModuleName = (isChinese) => { + const isGroup = this.isGroup() + if (isChinese) { + let chName = isGroup ? '分组作业' : '普通作业' + return chName; + } + const secondName = isGroup ? 'group_homeworks' : 'common_homeworks' + return secondName; + } + getModuleType = () => { + const isGroup = this.isGroup() + return isGroup ? 3 : 1 + } + toDetailPage = (_courseId, workId, topicId) => { + if (typeof _courseId == "object") { + const topicId = _courseId.topicId + const workId = _courseId.workId + const courseId = _courseId.coursesId + this.props.history.push(`/courses/${courseId}/boards/${workId}/messages/${topicId}`) + } else { + this.props.history.push(`/courses/${_courseId}/boards/${workId}/messages/${topicId}`) + } + + } + toEditPage = (_courseId, _workId) => { + const secondName = this.getModuleName() + if (typeof _courseId == "object") { + const workId = _courseId.workId + const courseId = _courseId.coursesId + this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/edit`) + } else { + this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/edit`) + } + } + toWorkDetailPage = (_courseId, _workId, _studentWorkId) => { + const secondName = this.getModuleName() + if (typeof _courseId == "object") { + const workId = _courseId.workId + const courseId = _courseId.coursesId + const studentWorkId = _courseId.studentWorkId + window.open(`/courses/${courseId}/${secondName}/${_workId || workId}/${_studentWorkId || studentWorkId}/appraise`); + } else { + window.open(`/courses/${_courseId}/${secondName}/${_workId}/${_studentWorkId}/appraise`); + } + } + toNewPage = (courseId) => { + const secondName = this.getModuleName() + this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.category_id}/new`) + } + toListPage = (_courseId, _workId) => { + const secondName = this.getModuleName() + if (typeof _courseId == "object") { + const workId = _courseId.workId + const courseId = _courseId.coursesId + this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}`) + } else { + this.props.history.push(`/courses/${_courseId}/${secondName}${_workId ? '/' + _workId : ''}`) + } + } + + + toWorkPostPage = (_courseId, _workId, isEdit, _studentWorkId) => { + const secondName = this.getModuleName() + if (typeof _courseId == "object") { + const workId = _courseId.workId + const courseId = _courseId.coursesId + const studentWorkId = _courseId.studentWorkId + this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/${isEdit? `${_studentWorkId || studentWorkId}/post_edit` : 'post'}`) + } else { + this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/${isEdit? `${_studentWorkId}/post_edit` : 'post'}`) + } + } + toWorkListPage = (_courseId, _workId) => { + const secondName = this.getModuleName() + if (typeof _courseId == "object") { + const workId = _courseId.workId + const courseId = _courseId.coursesId + this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/list`) + } else { + this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/list`) + } + } + toWorkAnswerPage = (_courseId, _workId) => { + const secondName = this.getModuleName() + if (typeof _courseId == "object") { + const workId = _courseId.workId + const courseId = _courseId.coursesId + this.props.history.push(`/courses/${courseId}/${secondName}/${workId}/answer`) + } else { + this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/answer`) + } + } + + toWorkQuestionPage = (_courseId, _workId) => { + const secondName = this.getModuleName() + if (typeof _courseId == "object") { + const workId = _workId || _courseId.workId + const courseId = _courseId.coursesId + this.props.history.push(`/courses/${courseId}/${secondName}/${workId}/question`) + } else { + this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/question`) + } + } + + toWorkSettingPage = (_courseId, _workId) => { + const secondName = this.getModuleName() + if (typeof _courseId == "object") { + const workId = _courseId.workId + const courseId = _courseId.coursesId + this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/setting`) + } else { + this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/setting`) + } + } + + + + render() { + const { snackbarOpen} = this.state; + return ( + + + + + + ) + } + } + } } \ No newline at end of file diff --git a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js index 68a16d89e..82f1f8d2e 100644 --- a/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js +++ b/public/react/src/modules/courses/busyWork/common/WorkDetailPageHeader.js @@ -144,13 +144,11 @@ class WorkDetailPageHeader extends Component{ {view_answer == true && 参考答案} - {this.props.isAdmin()? + 设置: - "" - } + style={{paddingLeft:this.props.isAdmin()?'38px':'20px'}} + to={`/courses/${courseId}/${moduleEngName}/${workId}/setting`}>{this.props.isAdmin()?"设置":"得分规则"} { this.props.tabRightComponents } diff --git a/public/react/src/modules/courses/busyWork/commonWork.js b/public/react/src/modules/courses/busyWork/commonWork.js index f8042d476..f6a989354 100644 --- a/public/react/src/modules/courses/busyWork/commonWork.js +++ b/public/react/src/modules/courses/busyWork/commonWork.js @@ -33,6 +33,7 @@ class commonWork extends Component{ modalsBottomval:"", modalCancel:"", mainList:undefined, + selectedKeys: 'all', order:"", page:1, search:"", @@ -77,7 +78,9 @@ class commonWork extends Component{ componentDidUpdate(prevProps, prevState) { if (prevProps.match.path != this.props.match.path) { this.clearSelection() - this._getList() + this.setState({ selectedKeys: 'all', order: '' }, () => { + this._getList() + }) } } @@ -143,6 +146,7 @@ class commonWork extends Component{ this.clearSelection() this.setState({ order:e.key==="all"?"":e.key, + selectedKeys: e.key, page:1, isSpin:true, checkBoxValues:[], @@ -403,7 +407,7 @@ class commonWork extends Component{ } secondRowBotton={
- + 全部 {isAdmin && 未发布} 提交中 diff --git a/public/react/src/modules/courses/common/ModalWrapper.js b/public/react/src/modules/courses/common/ModalWrapper.js index e92a508d6..8b7e87692 100644 --- a/public/react/src/modules/courses/common/ModalWrapper.js +++ b/public/react/src/modules/courses/common/ModalWrapper.js @@ -1,5 +1,5 @@ import React,{ Component } from "react"; -import { Modal,Input, Checkbox} from "antd"; +import { Modal,Input, Checkbox, Spin} from "antd"; import '../css/members.css' class ModalWrapper extends Component{ @@ -23,7 +23,7 @@ class ModalWrapper extends Component{ } render(){ let {flag, visible}=this.state - let { onOk, cancelText, okText, title, width, className, bottomRender}=this.props; + let { onOk, cancelText, okText, title, width, className, bottomRender, loading}=this.props; return( :"" } +
{this.props.children} {this.props.checkBoxValuestype===true?
@@ -59,6 +60,7 @@ class ModalWrapper extends Component{
{ bottomRender }
+
) } diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 437471436..ce891bced 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -55,9 +55,13 @@ class CoursesBanner extends Component { } } componentDidMount() { - this.onloadupdatabanner() on('updatabanner', this.updatabanner) + if(this.props.match.path==="/courses/:coursesId"){ + if(this.props.user!=undefined){ + this.props.history.push(this.props.user.first_category_url) + } + } axios.interceptors.response.use((response) => { if (response != undefined) if (response && response.data.status === 410) { @@ -69,9 +73,17 @@ class CoursesBanner extends Component { } return response; }, (error) => { - }); } + componentDidUpdate(prevProps) { + if(prevProps.user!=this.props.user){ + if(this.props.match.path==="/courses/:coursesId"){ + if(this.props.user!=undefined){ + this.props.history.push(this.props.user.first_category_url) + } + } + } + } componentWillUnmount() { off('updatabanner', this.updatabanner) } diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 35b06f305..e47f83c1f 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -57,6 +57,7 @@ class Coursesleftnav extends Component{ positiontype:undefined, toopvisible:false, toopvisibleindex:undefined, + toopvisibleindexs:undefined, sandiantypes:undefined, antIcon:false, chapterupdate:false, @@ -181,7 +182,7 @@ class Coursesleftnav extends Component{ on('editshixunname',this.editshixunchild) on('editshixunmainname',this.editshixunmainname) - this.props.updataleftNavfun(); + // this.props.updataleftNavfun(); // this.props.getleftNavid && this.props.getleftNavid("shixun_homework"); // const position =parseInt(this.props.match.params.position); @@ -239,50 +240,52 @@ class Coursesleftnav extends Component{ setnavid=(e,key,id,type,url)=>{ // this.props.getleftNavid && this.props.getleftNavid(key,type); - let {selectnavid,navid}=this.state; - - if(navidtype===true&&selectnavid===false){ - - if(navid===key){ - this.setState({ - navid:"", - selectnavid:false, - newselectnavid:id - }) - }else{ - this.setState({ - navid:key, - positiontype:type, - selectnavid:false, - newselectnavid:id - }) - } - }else{ - // console.log(navidtype) - // console.log(selectnavid) - this.setState({ - navid:"", - selectnavid:false, - newselectnavid:id - }) - } - this.props.updataleftNavfun(); - this.props.history.replace( url ); - e.stopPropagation();//阻止冒泡 + // let {selectnavid,navid}=this.state; + // + // if(navidtype===true&&selectnavid===false){ + // + // if(navid===key){ + // this.setState({ + // navid:"", + // selectnavid:false, + // newselectnavid:id + // }) + // }else{ + // this.setState({ + // navid:key, + // positiontype:type, + // selectnavid:false, + // newselectnavid:id + // }) + // } + // }else{ + // // console.log(navidtype) + // // console.log(selectnavid) + // this.setState({ + // navid:"", + // selectnavid:false, + // newselectnavid:id + // }) + // } + // + // this.props.updataleftNavfun(); + // this.props.history.replace( url ); + // e.stopPropagation();//阻止冒泡 + this.selectnavid(e,key,id,type,url) } selectnavid=(e,key,id,type,urls,index)=>{ let {url}=this.state; if(urls!=url){ - + this.props.updataleftNavfun(); this.props.history.replace(urls); - this.props.updataleftNavfun(); }else{ if (key === this.props.indexs) { this.props.unlocationNavfun(undefined) } else { + this.props.updataleftNavfun(); this.props.unlocationNavfun(key) this.props.history.replace(urls); } @@ -304,14 +307,19 @@ class Coursesleftnav extends Component{ url:urls, indexs:index }) + this.props.updataleftNavfun(); this.props.history.replace(urls); - this.props.updataleftNavfun(); + } twosandianshow=(e,key,type)=>{ + // console.log("twosandianshow"); + // console.log(key); + // console.log(type); this.setState({ + toopvisibleindexs:key, twosandiantype:key, toopvisible:false, toopvisibleindex:undefined, @@ -319,11 +327,29 @@ class Coursesleftnav extends Component{ }) e.stopPropagation();//阻止冒泡 } - + twosandianshowys=(e,key,type)=>{ + // console.log("twosandianshow"); + // console.log(key); + // console.log(type); + this.setState({ + toopvisibleindexs:key, + }) + e.stopPropagation();//阻止冒泡 + } + twosandianshowyss=(e,key,type)=>{ + // console.log("twosandianshow"); + // console.log(key); + // console.log(type); + this.setState({ + toopvisibleindexs:undefined, + }) + e.stopPropagation();//阻止冒泡 + } twosandianhide=(e,index,type)=>{ // console.log(index) this.setState({ + toopvisibleindexs:undefined, twosandiantype:undefined, twosandiantypenum:undefined, toopvisible:true, @@ -333,6 +359,13 @@ class Coursesleftnav extends Component{ e.stopPropagation();//阻止冒泡 } + twosandianhideys=(e,index,type)=>{ + // console.log(index) + this.setState({ + toopvisibleindexs:undefined, + }) + e.stopPropagation();//阻止冒泡 + } //置顶 editSetup=(e,id)=>{ @@ -721,24 +754,27 @@ class Coursesleftnav extends Component{ e.stopPropagation();//阻止冒泡 } - showsandians=(e,key,urls,num)=> { + showsandians=(e,key,urls,num,id,type,index)=> { let {url}=this.state; if (key === this.props.indexs) { this.props.unlocationNavfun(undefined) this.props.history.replace(urls); } else { + this.props.updataleftNavfun(); this.props.unlocationNavfun(key) this.props.history.replace(urls); } if(urls!=url){ + this.props.updataleftNavfun(); this.props.history.replace(urls); } - // if(this.props.indexs===undefined){ - // - // }else{ - // - // } + this.setState({ + selectnavid:true, + newselectnavid:id, + url:urls, + indexs:index + }) } maincontent=(item,key)=>{ @@ -814,6 +850,7 @@ class Coursesleftnav extends Component{ ModalSave, loadtype, twosandiantypes, + toopvisibleindexs }=this.state; let {course_modules,hidden_modules,is_teacher} =this.props; @@ -930,8 +967,8 @@ class Coursesleftnav extends Component{ return(
-
  • this.showsandians(e,key,item.category_url,1)} className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}> - this.showsandians(e,key,item.category_url,1)} 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"}> +
  • this.showsandians(e,key,item.category_url,1,item.id,item.type)} className={this.props.mainurl===item.category_url?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}> + 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"}> { item.type==="announcement"?: item.type==="online_learning"?: @@ -976,7 +1013,7 @@ class Coursesleftnav extends Component{ ref={provided.innerRef} {...provided.droppableProps} className={"droppableul"} - style={{display: this.props.mainurl===item.category_url&&key===this.props.indexs?"":"none"}} + style={{display: key===this.props.indexs?"":"none"}} > {item.second_category===undefined?"":item.second_category.map((iem,index)=>{ if(item.type==="course_group"){ @@ -986,6 +1023,8 @@ class Coursesleftnav extends Component{ } } } + // console.log(iem.category_name); + // console.log(iem.category_name.length); return( {(provided, snapshot) => ( {/*"/courses/"+this.props.match.params.coursesId+"/"+item.type+"/"+iem.category_type+"/"+iem.category_id*/} - -
  • this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} onMouseLeave={(e)=>this.twosandianhide(e,index,item.type)} onMouseEnter={(e)=>this.twosandianshow(e,index,item.type)} + +
  • this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} onMouseLeave={(e)=>this.twosandianhide(e,index,item.type)} onMouseEnter={(e)=>this.twosandianshow(e,index,item.type)} key={index} ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps} - title={iem.category_name.length<10?"":iem.category_name} + // title={iem.category_name.length<10?"":iem.category_name} > - - {iem.category_name} + this.twosandianshowys(e,index,item.type)}>{iem.category_name} + {iem.category_count===0?"":iem.category_count} {item.type===twosandiantypes&&twosandiantype===index? iem.category_id===0?"": iem.category_type==="graduation_topics"||iem.category_type==="graduation_tasks"? - {iem.category_count===0?"":iem.category_count} - : + ( + iem.category_name&&iem.category_name.length<13? + {iem.category_count===0?"":iem.category_count} + : + + {iem.category_count===0?"":iem.category_count} + + ) + : + ( + iem.category_name&&iem.category_name.length<13? + this.twosandianshowyss(e)}> + + + : + + this.twosandianshowyss(e)}> - :""} + + + ) + :""} - {provided.placeholder} +
  • + )} @@ -1044,7 +1103,7 @@ class Coursesleftnav extends Component{
    {/**/} -
  • this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)} title={item.name.length<7?"":item.name} > @@ -1069,11 +1128,8 @@ class Coursesleftnav extends Component{
  • - {/*
    */} - {/*下拉列表*/} - {/* className={this.props.location.pathname===item.category_url||this.props.location.pathname===this.state.url&&key===this.state.indexs?"":""}*/} -
      +
        { item.second_category===undefined?"":item.second_category.map((iem,index)=>{ @@ -1084,17 +1140,35 @@ class Coursesleftnav extends Component{ } } } + // console.log(iem.category_name); + // console.log(iem.category_name.length);一开始是10 显示是13 return( -
      • - this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} > - - {/*{iem.category_name}*/} - {iem.category_name} - - {iem.category_count===0?"":iem.category_count} - + {/*title={iem.category_name.length<10?"":iem.category_name}*/} + +
      • + { + iem.category_name&&iem.category_name.length<13? + this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} > + {/*{iem.category_name}*/} + {/*{iem.category_name.length<10?"":*/} + {/* iem.category_name}*/} + {iem.category_name} + {iem.category_count===0?"":iem.category_count} + + : + + this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} > + {/*{iem.category_name}*/} + {/*{iem.category_name.length<10?"":*/} + {/* iem.category_name}*/} + {iem.category_name} + {iem.category_count===0?"":iem.category_count} + + + }
      • + ) }) @@ -1115,72 +1189,3 @@ class Coursesleftnav extends Component{ export default Coursesleftnav; -// -// sandianshow=(e,key)=>{ -// this.setState({ -// sandiantype:key -// }) -// e.stopPropagation();//阻止冒泡 -// } -// hidesandian=(e,key)=>{ -// this.setState({ -// sandiantypes:undefined -// }) -// e.stopPropagation();//阻止冒泡 -// } -// sandianshow=(e,key)=>{ -// this.setState({ -// sandiantype:key -// }) -// e.stopPropagation();//阻止冒泡 -// } - - -// sandianhide=(e)=>{ -// this.setState({ -// sandiantype:undefined, -// -// }) -// e.stopPropagation();//阻止冒泡 -// } -// twosandianshows=(e,key,type)=>{ -// -// this.setState({ -// twosandiantypenum:key, -// toopvisible:false, -// toopvisibleindex:undefined, -// twosandiantypes:type -// }) -// e.stopPropagation();//阻止冒泡 -// } -// twoMouseLeave=(e)=>{ -// this.setState({ -// toopvisible:false, -// }) -// e.stopPropagation();//阻止冒泡 -// } - - -{/*{ is_teacher===true?*/} -{/*
        */} -{/*
      • */} -{/* */} -{/* */} -{/*
        确定
        */} -{/*
        */} -{/*
      • */} -{/*
        :""}*/} - - -{/*{ is_teacher===true?
        */} -{/* */} -{/* {hidden_modules.length===0?"":hidden_modules.map((list,key)=>{*/} -{/* return(*/} -{/*
      • */} -{/* */} -{/* {list.name}*/} -{/*
      • */} -{/* )*/} -{/* })}*/} -{/*
        */} -{/*
        :""}*/} \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/AppraiseModal.js b/public/react/src/modules/courses/coursesPublic/AppraiseModal.js index 120e57b2b..a943e9655 100644 --- a/public/react/src/modules/courses/coursesPublic/AppraiseModal.js +++ b/public/react/src/modules/courses/coursesPublic/AppraiseModal.js @@ -153,7 +153,7 @@ class AppraiseModal extends Component{

        - 可见:(学生可查看老师的评阅内容) + 可见(学生可查看老师的评阅内容)

        {/**/} {/*可见 (学生查看老师的评阅内容)*/} @@ -167,7 +167,7 @@ class AppraiseModal extends Component{ />

        - 不可见:(仅对课堂老师可见) + 不可见(仅对课堂老师可见)

        原因不能为空
        -
      • + + + +
      • { + getdatalist=(page,type,newstatus,keyword,order,diff,limit,pagetype,sort)=>{ this.setState({ isspinning:true }) let status=this.props.statustype===undefined?newstatus:'published'; - let url="/shixun_lists.json" + let url; + if(this.props.type==='shixuns'){ + url="/shixun_lists.json"; + }else{ + url="/subject_lists.json"; + } axios.get(url,{params:{ page, type, @@ -39,20 +50,21 @@ class NewShixunModel extends Component{ keyword, order, diff, - limit + limit, + sort }}).then((response) => { if(response.data){ if(pagetype===undefined){ this.setState({ - shixun_list:response.data.shixun_list, - shixuns_count:response.data.shixuns_count, + shixun_list:response.data.shixun_list===undefined?response.data.subject_list:response.data.shixun_list, + shixuns_count:response.data.shixuns_count===undefined?response.data.subjects_count:response.data.shixuns_count, Grouplist:[], isspinning:false }) }else if(pagetype==="pagetype"){ this.setState({ - shixun_list:response.data.shixun_list, - shixuns_count:response.data.shixuns_count, + shixun_list:response.data.shixun_list===undefined?response.data.subject_list:response.data.shixun_list, + shixuns_count:response.data.shixuns_count===undefined?response.data.subjects_count:response.data.shixuns_count, isspinning:false }) } @@ -127,8 +139,13 @@ class NewShixunModel extends Component{ newallGrouplist.push({page:pageNumber,list:[]}) } - let{type,status,keyword,order,diff,limit}=this.state; - this.getdatalist(pageNumber,type,status,keyword,order,diff,limit,"pagetype") + let{type,status,keyword,order,diff,limit,sort}=this.state; + if(this.props.type==='shixuns'){ + this.getdatalist(pageNumber,type,status,keyword,order,diff,limit,"pagetype") + }else{ + this.getdatalist(pageNumber,type,undefined,keyword,order,undefined,limit,"pagetype",sort); + } + this.setState({ page:pageNumber, allGrouplist:newallGrouplist @@ -142,8 +159,14 @@ class NewShixunModel extends Component{ keyword:undefined, page:1 }) - let{status,order,diff,limit}=this.state; - this.getdatalist(1,value,status,undefined,order,diff,limit) + let{status,order,diff,limit,sort}=this.state; + if(this.props.type==='shixuns'){ + this.getdatalist(1,value,status,undefined,order,diff,limit) + }else{ + this.getdatalist(1,value,undefined,undefined,order,undefined,limit,undefined,sort) + } + + } updatedlist=(order)=>{ @@ -205,7 +228,7 @@ class NewShixunModel extends Component{ this.setState({ hometypepvisible:false }) - this.showNotification("请先选择实训") + this.showNotification(this.props.type==='shixuns'?"请先选择实训":"请先选择课程") return } @@ -231,33 +254,64 @@ class NewShixunModel extends Component{ this.props.pathShixun(Grouplist) return; } - let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json"; - axios.post(url, { - category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), - shixun_ids:Grouplist, - } - ).then((response) => { - if(response.data.status===-1){ - // this.props.showNotification(response.data.message) - - }else{ - // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) - this.showNotification("操作成功") - this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order); - this.props.hideNewShixunModelType() - - } - this.setState({ - hometypepvisible:false + if(this.props.type==='shixuns'){ + let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json"; + axios.post(url, { + category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), + shixun_ids:Grouplist, + } + ).then((response) => { + if(response.data.status===-1){ + // this.props.showNotification(response.data.message) + + }else{ + // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + this.showNotification("操作成功") + this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order); + this.props.hideNewShixunModelType() + this.props.updataleftNavfun() + } + this.setState({ + hometypepvisible:false + }) + // category_id: 3 + // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] + }).catch((error) => { + console.log(error) + this.setState({ + hometypepvisible:false + }) }) - // category_id: 3 - // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] - }).catch((error) => { - console.log(error) - this.setState({ - hometypepvisible:false + }else{ + let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json"; + axios.post(url, { + category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), + subject_ids:Grouplist, + } + ).then((response) => { + if(response.data.status===-1){ + // this.props.showNotification(response.data.message) + + }else{ + // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + this.showNotification("操作成功") + this.props.homeworkupdatalists(this.props.Coursename,this.props.page,this.props.order); + this.props.hideNewShixunModelType() + this.props.updataleftNavfun() + } + this.setState({ + hometypepvisible:false + }) + // category_id: 3 + // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] + }).catch((error) => { + console.log(error) + this.setState({ + hometypepvisible:false + }) }) - }) + } + } poststatus=(status)=>{ @@ -268,9 +322,37 @@ class NewShixunModel extends Component{ this.getdatalist(page,type,status,keyword,order,diff,limit) } + updatepathlist=(sorts,orders)=>{ + let{page,type,keyword,order,diff,limit,status,sort}=this.state; + let seartorders; + if(sort===sorts){ + if(orders==="desc"){ + this.setState({ + sort:sorts, + order:"asc" + }) + seartorders="asc" + }else{ + this.setState({ + sort:sorts, + order:"desc" + }) + seartorders="desc" + } + }else{ + this.setState({ + sort:sorts, + order:"desc" + }) + seartorders=orders + } + + this.getdatalist(page,type,undefined,keyword,seartorders,undefined,limit,undefined,sorts) + + } render() { - let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order}=this.state; + let {diff,Grouplist,status,shixun_list,shixuns_count,page,type,order,sort}=this.state; // let {visible,patheditarry}=this.props; // console.log(Grouplist) // console.log(allGrouplist) @@ -331,7 +413,7 @@ class NewShixunModel extends Component{ ); - + console.log(shixun_list) return(
        @@ -355,7 +437,7 @@ class NewShixunModel extends Component{ closable={true} destroyOnClose={true} onClose={()=>this.props.hideNewShixunModelType()} - visible={this.props.NewShixunModelType} + visible={this.props.type==='shixuns'?this.props.NewShixunModelType:this.props.shixunpath} height={'100%'} > @@ -380,7 +462,7 @@ class NewShixunModel extends Component{ 搜索} onInput={(e)=>this.setdatafunsval(e)} @@ -391,34 +473,50 @@ class NewShixunModel extends Component{
        - 已选 {Grouplist.length} 个实训 - {shixuns_count===undefined?"":shixuns_count} 个实训 + 已选 {Grouplist.length} 个{this.props.type==='shixuns'?'实训':'课程'} + {shixuns_count===undefined?"":shixuns_count} 个{this.props.type==='shixuns'?'实训':'课程'} - + {this.props.type==='shixuns'?"": + this.updatepathlist("shixuns_count",order)}>实训数 + + + + + } + + {this.props.type==='shixuns'?"": + this.updatepathlist("myshixuns_count",order)}>学习人数 + + + + + } + + {this.props.type==='shixuns'? this.updatedlist(order)}>学习人数 - + :""} - {this.props.statustype===undefined? + {this.props.type==='shixuns'?this.props.statustype===undefined? {status==='all'?"发布状态":status==='published'?"已发布":status==="unpublished"?"未发布":""} - :""} + :"":""} - + {this.props.type==='shixuns'? {diff===0?"难度":diff===1?"初级":diff===2?"中级":diff===3?"高级":diff===4?"顶级":""} - + :""}
        {/*this.props.hideNewShixunModelType()}>返回*/} - this.belongto("mine")}>我的实训 - this.belongto("all")}>全部实训 + this.belongto("mine")}>我的{this.props.type==='shixuns'?'实训':"课程"} + this.belongto("all")}>全部{this.props.type==='shixuns'?'实训':"课程"}
        @@ -438,7 +536,7 @@ class NewShixunModel extends Component{ className="fl task-hide edu-txt-left mt3" name="shixun_homework[]" > - @@ -461,7 +559,7 @@ class NewShixunModel extends Component{ {JSON.stringify(item.description) == "{}"?"":
        } - {item.challenge_names.length===0?"":
        + {item.challenge_names===undefined?"":item.challenge_names.length===0?"":
        {item.challenge_names.map((item,key)=>{ return( 第{key+1}关:{item} @@ -490,15 +588,21 @@ class NewShixunModel extends Component{ } `} - + {this.props.type==='shixuns'? {item.author_name} {item.author_school_name} 难度系数:{item.level} 学习人数:{item.study_count} - - + : + + {item.author_name} + {item.author_school_name} + 学习人数:{item.myshixuns_count} + 章节:{item.stage_count} + 实训:{item.shixuns_count} + }
        - {item.subjects.length===0?"":this.ItsCourse(item.subjects)}> + {item.subjects===undefined?"":item.subjects.length===0?"":this.ItsCourse(item.subjects)}> 所属课程 diff --git a/public/react/src/modules/courses/coursesPublic/ShixunChooseModal.js b/public/react/src/modules/courses/coursesPublic/ShixunChooseModal.js index f4f00e5e0..4c360c82a 100644 --- a/public/react/src/modules/courses/coursesPublic/ShixunChooseModal.js +++ b/public/react/src/modules/courses/coursesPublic/ShixunChooseModal.js @@ -101,6 +101,7 @@ class ShixunChooseModal extends Component{ return( shixunmodal===true?
        - 上次学至{last_shixun} + 上次学习内容{last_shixun}
        diff --git a/public/react/src/modules/courses/elearning/YslDetailCards.js b/public/react/src/modules/courses/elearning/YslDetailCards.js index 4b295f118..3c6b5daff 100644 --- a/public/react/src/modules/courses/elearning/YslDetailCards.js +++ b/public/react/src/modules/courses/elearning/YslDetailCards.js @@ -94,10 +94,10 @@ class YslDetailCards extends Component{ startshixunCombattype:true, }) } else { - console.log("开始学习了"); + // console.log("开始学习了"); window.open("/tasks/" + response.data.game_identifier,'_blank'); //这个是传过来 调用刷新 - this.props.Myreload(); + this.props.getPathCardsList(); // window.location.href = path // let path="/tasks/"+response.data.game_identifier; // this.props.history.push(path); @@ -109,6 +109,7 @@ class YslDetailCards extends Component{ }; componentDidMount(){ + // console.log("YslDetailCards start"); let pathid=this.props.match.params.coursesId; this.setState({ pathid:pathid @@ -116,6 +117,11 @@ class YslDetailCards extends Component{ } + Pathlisteditundefined=()=>{ + this.setState({ + pathlistedit:undefined + }) + }; hidestartshixunsreplace=(url)=>{ this.setState({ isSpin:true, @@ -521,6 +527,7 @@ class YslDetailCards extends Component{ ysldetailcards={"ysldetailcards"} pathid={subject_id} coursesId={pathid} + Pathlisteditundefined={this.Pathlisteditundefined} > :"" } diff --git a/public/react/src/modules/courses/exercise/Exercise.js b/public/react/src/modules/courses/exercise/Exercise.js index 65377bb19..20213c931 100644 --- a/public/react/src/modules/courses/exercise/Exercise.js +++ b/public/react/src/modules/courses/exercise/Exercise.js @@ -119,12 +119,13 @@ class Exercise extends Component{ changeType=(e)=>{ this.setState({ - type:e.key, + type:e.key==="0"?undefined:e.key, + page:1, checkAllValue:false, checkBoxValues:[] }) let{StudentList_value,page,limit}=this.state; - this.InitList(e.key==="0"?undefined:e.key,StudentList_value,page,limit) + this.InitList(e.key==="0"?undefined:e.key,StudentList_value,1,limit) } //切换分页 diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index f61a7852b..ef500ba0b 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -51,6 +51,26 @@ class ExerciseListItem extends Component{ Loadtype:false }) } + + toDetailPage=(url)=>{ + + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + // if(this.props.checkIfProfileCompleted()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.props.showProfileCompleteDialog() + // return + // } + + this.props.history.push(url); + } render(){ let{item,checkBox,index}=this.props; let {coursesId,Id}=this.props.match.params @@ -96,25 +116,25 @@ class ExerciseListItem extends Component{ {/*{item.exercise_name}*/} { - this.props.isAdmin()? {item.exercise_name}:"" + onClick={()=>this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>{item.exercise_name}:"" } { this.props.isStudent()? - {item.exercise_name}:"" + this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>{item.exercise_name}:"" } { this.props.isNotMember()? item.lock_status === 0 ? - {item.exercise_name} - : {item.exercise_name}:"" + {item.exercise_name} + : this.toDetailPage(`/courses/${coursesId}/exercises/${item.id}/student_exercise_list?tab=0`)}>{item.exercise_name}:"" } { item.lock_status === 0 ? - + :"" @@ -150,13 +170,13 @@ class ExerciseListItem extends Component{ { item.exercise_status ===2? - {item.exercise_left_time} + {"提交剩余时间:"+item.exercise_left_time} :"" } - { - item.exercise_status ===3? + { + item.exercise_left_time===null?"":item.exercise_status ===3? - {item.exercise_left_time} + {"截止剩余时间:"+item.exercise_left_time} :"" } {/*{*/} @@ -193,7 +213,7 @@ class ExerciseListItem extends Component{ IsStudent &&
        {item.current_status ===0&&item.exercise_status>1?
      • 继续答题
      • : - item.current_status ===1&&item.exercise_status>1?
      • 查看答题
      • : + item.current_status ===1&&item.exercise_status>1?
      • 查看答题
      • : item.current_status ===2&&item.exercise_status>1?
      • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
      • :""}
    } diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index f45de9b64..75da4f2fe 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -96,8 +96,8 @@ class ExerciseReviewAndAnswer extends Component{ //window.addEventListener('scroll', this.handleScroll); } - remainTime=()=>{ - let { time } = this.state; + remainTime=(time)=>{ + // let { time } = this.state; let h=moment(parseInt(time)*1000).hour()-8; let m=moment(parseInt(time)*1000).minutes(); let s=moment(parseInt(time)*1000).seconds(); @@ -127,22 +127,31 @@ class ExerciseReviewAndAnswer extends Component{ } //自动交卷 autoCommitExercise=()=>{ - let eId=this.props.match.params.Id; - let url=`/exercises/${eId}/commit_exercise.json`; - axios.post(url).then((result)=>{ - if(result){ - this.setState({ - Modalstype:true, - Modalstopval:'答题结束了,系统已自动提交试卷', - modalsBottomval:"不能再修改答题", - ModalCancel:undefined, - ModalSave:this.sureCommit, - Loadtype:true - }) - } - }).catch((error)=>{ - console.log(error); - }) + let eId=this.props.match.params.Id; + let url=`/exercises/${eId}/commit_exercise.json`; + axios.post(url,{ + commit_method:2 + }).then((result)=>{ + if(result){ + if(result.data.status===0){ + this.setState({ + Modalstype:true, + Modalstopval:'答题结束了,系统已自动提交试卷', + modalsBottomval:"不能再修改答题", + ModalCancel:undefined, + ModalSave:this.sureCommit, + Loadtype:true + }) + this.props.showNotification(`${result.data.message}`); + } + + if(result.data.status===-2){ + this.remainTime(parseInt(result.data.message)) + } + } + }).catch((error)=>{ + console.log(error); + }) } sureCommit=()=>{ @@ -235,7 +244,7 @@ class ExerciseReviewAndAnswer extends Component{ isSpin:false }) if(result.data.exercise.left_time != null){ - this.remainTime(); + this.remainTime(result.data.exercise.left_time); } } }).catch((error)=>{ @@ -485,7 +494,9 @@ class ExerciseReviewAndAnswer extends Component{ //交卷 let eId=this.props.match.params.Id; let url=`/exercises/${eId}/commit_exercise.json`; - axios.post(url).then((result)=>{ + axios.post(url,{ + commit_method:1 + }).then((result)=>{ if(result){ this.setState({ Modalstype:false, diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index 96cc17ca8..7b3732c9f 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -93,13 +93,28 @@ class Exercisesetting extends Component{ //加载 componentDidMount=()=>{ this.getSettingInfo(); + // window.addEventListener('click', this.handleClick); try { this.props.triggerRef(this); }catch (e) { } + + if(this.props.Commonheadofthetestpaper!=undefined){ + this.editSetting() + } + + if(this.props.isAdmin() === false){ + this.cancelEdit() + } } + componentDidUpdate = (prevProps) => { + if(prevProps.Commonheadofthetestpaper!= this.props.Commonheadofthetestpaper){ + this.editSetting() + } + } + _getRequestParams() { const { order, exercise_group_id,searchtext, page ,limit} = this.state return { @@ -607,10 +622,11 @@ class Exercisesetting extends Component{ 发布设置 { !flagPageEdit&&this.props.isAdmin()===true ? - - - - + + 编辑设置 + {/**/} + {/**/} + {/**/} :"" } diff --git a/public/react/src/modules/courses/exercise/Exercisetablesmubu.js b/public/react/src/modules/courses/exercise/Exercisetablesmubu.js index d2d6103b8..501a7ebf5 100644 --- a/public/react/src/modules/courses/exercise/Exercisetablesmubu.js +++ b/public/react/src/modules/courses/exercise/Exercisetablesmubu.js @@ -96,7 +96,7 @@ class Exercisetablesmubus extends Component { '0%': '#29BD8B', '100%': '#29BD8B', }} - percent={record.max_score*100} showInfo={false}/>
    {record.max_score*100}%
    } + percent={(record.max_score*100).toFixed()} showInfo={false}/>
    {(record.max_score*100).toFixed()}%
    } ), }]; diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index 6fdde6aeb..438c07aeb 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -823,6 +823,7 @@ class Studentshavecompletedthelist extends Component { -- : {record.operating} } @@ -1020,6 +1021,7 @@ class Studentshavecompletedthelist extends Component { >-- : {record.finalscore} } @@ -1210,6 +1212,7 @@ class Studentshavecompletedthelist extends Component { >-- : {record.finalscore} } @@ -1278,20 +1281,6 @@ class Studentshavecompletedthelist extends Component { }catch (e) { } - try { - if(this.props.Commonheadofthetestpaper.exercise_status !== undefined){ - this.setState({ - exercise_status:this.props.Commonheadofthetestpaper.exercise_status, - }) - }else{ - this.setState({ - exercise_status:0, - }) - } - }catch (e) { - - } - } componentWillReceiveProps = (nextProps) => { @@ -1330,7 +1319,7 @@ class Studentshavecompletedthelist extends Component { }) if (response.data.current_answer_user === undefined || response.data.current_answer_user === null) { // 学生未截止 - + // console.log("试卷学生未截止"); this.Generatenewdatas(response.data.exercise_users); if (response.data.exercise_types.subjective === 0) { if (this.state.noclassroom === undefined || this.state.noclassroom === "" || this.state.noclassroom === null) { @@ -1377,6 +1366,7 @@ class Studentshavecompletedthelist extends Component { } } else { //学生已截止 + // console.log("试卷学生已截止"); if (response.data.exercise_types.subjective === 0) { if (this.state.loadingstate === false) { var arr =[]; @@ -1458,7 +1448,7 @@ class Studentshavecompletedthelist extends Component { else if (response.data.exercise_types.user_permission === 0) { // console.log(response.data.exercise_users) // console.log(response) - + // console.log("试卷老师加载中"); if (thiss.state.loadingstate === false) { thiss.setState({ loadingstate: true, @@ -1469,7 +1459,9 @@ class Studentshavecompletedthelist extends Component { thiss.Generatenewdatasy(response.data.exercise_users, response); } }).catch((error) => { - console.log(error) + console.log(error); + console.log("其实数据加载失败了"); + console.log("1111"); }); @@ -2490,16 +2482,22 @@ class Studentshavecompletedthelist extends Component { let {data, datas, page, columns, course_groupyslsthree, columnstwo, styletable,exercise_status, course_groupyslstwodatas, limit, course_groupysls, course_groupyslstwodata, course_groupyslstwo, teacherlists, Teacherliststudentlist, order, columnss, course_groupsdatas, course_groups, Evaluationarray, unlimited, unlimiteds, unlimitedtwo, teacherlist, searchtext, loadingstate, review, nocomment, commented, unsubmitted, submitted, columnsys, exercise_users,mylistansum} = this.state; // console.log("Studentshavecompletedthelist"); // console.log(this.props.current_status); + // console.log("获取到的数据"); + // console.log(datas); + // console.log(data); + // console.log("this.props.Commonheadofthetestpaper.exercise_status"); + // console.log(this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status); + // console.log(exercise_status); return ( isAdmin === true ? (
    {/*老师*/} { - exercise_status===0 || exercise_status===1 ? + this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status===0 || this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status===1 ?
    @@ -2598,9 +2596,9 @@ class Studentshavecompletedthelist extends Component { {course_groups === undefined ? "" : course_groups === null ? "" : course_groups.length < 2 ? "" : JSON.stringify(course_groups) === "[]" ? "" :
  • - 分班情况: - this.funtaskstatustwos()}>不限 @@ -2714,9 +2712,9 @@ class Studentshavecompletedthelist extends Component { Teacherliststudentlist === undefined || Teacherliststudentlist.current_answer_user === undefined || Teacherliststudentlist.current_answer_user === null ?
    + style={{"margin": "0 auto", "padding-bottom": "100px", minWidth: " 1200px"}}> { - exercise_status === 0 || exercise_status === 1 ? + this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status === 0 || this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status === 1 ?
    @@ -2794,10 +2792,10 @@ class Studentshavecompletedthelist extends Component {
    { - exercise_status === 0 || exercise_status === 1 ? + this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status === 0 || this.props.Commonheadofthetestpaper&&this.props.Commonheadofthetestpaper.exercise_status === 1 ?
    diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index ba3cee3d3..d878eb872 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -436,22 +436,22 @@ class Testpapersettinghomepage extends Component{ /> { // 教师列表 - parseInt(tab[0])==0 && this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper}> + parseInt(tab[0])==0 ? this.setcourse_groupysls(value)} current_status = {this.state.current_status} Commonheadofthetestpaper={this.state.Commonheadofthetestpaper}>:"" } {/*统计结果*/} { - parseInt(tab[0])==1 && + parseInt(tab[0])==1 ? :"" } { - parseInt(tab[0])==2 && + parseInt(tab[0])==2 ? :"" } { - parseInt(tab[0])==3 && + parseInt(tab[0])==3 ? :"" }
    diff --git a/public/react/src/modules/courses/graduation/style.css b/public/react/src/modules/courses/graduation/style.css index c704a9c93..cf438a6a4 100644 --- a/public/react/src/modules/courses/graduation/style.css +++ b/public/react/src/modules/courses/graduation/style.css @@ -43,3 +43,14 @@ .TopicDetailTable .bottomBody li{border-bottom: 1px solid #eee;clear: both;} .TopicDetailTable .bottomBody li:last-child{border-bottom: none;} +.acrossSureBtn{ + width: 40px; + height: 24px; + line-height: 18px; + /* border: 1px solid rgba(76,172,255,1); */ + /* color: #4CACFF!important; */ + float: left; + /* border-radius: 4px; */ + text-align: center; +} + diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index ef16e06a4..39a2f0876 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -133,6 +133,26 @@ class GraduateTaskItem extends Component{ setupdate=()=>{ this.props.funlist } + + toDetailPage=(url)=>{ + + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + // if(this.props.checkIfProfileCompleted()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.props.showProfileCompleteDialog() + // return + // } + + this.props.history.push(url); + } render(){ let { Modalstype, @@ -215,20 +235,20 @@ class GraduateTaskItem extends Component{
    { - this.props.isAdmin?this.toDetailPage("/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")} title={discussMessage.name} - className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" + className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" } { - this.props.isStudent? this.toDetailPage("/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/detail/"+taskid+"/list")} title={discussMessage.name} - className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" + className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" } { this.props.isNotMember===true?this.props.discussMessage.private_icon===true? - {discussMessage.name} - :{discussMessage.name} + :this.toDetailPage("/courses/"+coursesId+"/graduation_tasks/"+categoryid+"/"+taskid+"/list")} title={discussMessage.name} className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" } @@ -236,7 +256,7 @@ class GraduateTaskItem extends Component{ { this.props.discussMessage.private_icon===true? - + : @@ -252,12 +272,12 @@ class GraduateTaskItem extends Component{

    {/* {discussMessage.author.name} */} - + { discussMessage.author && {discussMessage.author} } {discussMessage.commit_count===undefined?"":{discussMessage.commit_count} 已交} {discussMessage.uncommit_count===undefined?"":{discussMessage.uncommit_count} 未交} {/*{discussMessage.replies_count} 3 未评*/} - - {discussMessage.status_time} + + {discussMessage.task_status===1&&discussMessage.status_time!=""&&discussMessage.status_time!=null?"提交剩余时间:"+discussMessage.status_time:discussMessage.task_status===2&&discussMessage.status_time!=""&&discussMessage.status_time!=null?"补交剩余时间:"+discussMessage.status_time:discussMessage.task_status===3&&discussMessage.status_time!=""&&discussMessage.status_time!=null?"交叉评阅剩余时间:"+discussMessage.status_time:discussMessage.status_time} {/* { discussMessage.replies_count != 0 && {discussMessage.replies_count} 回复 } @@ -326,7 +346,7 @@ class GraduateTaskItem extends Component{ {item==="查看作品"? - 查看作品 + 查看作品 :""} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationAcross.js b/public/react/src/modules/courses/graduation/tasks/GraduationAcross.js new file mode 100644 index 000000000..18dac8041 --- /dev/null +++ b/public/react/src/modules/courses/graduation/tasks/GraduationAcross.js @@ -0,0 +1,556 @@ +import React, { Component } from 'react'; + +import { Modal , Radio , Table , Pagination , Select ,Divider ,Icon , Input,Checkbox } from "antd"; +import {Link} from 'react-router-dom' +import axios from 'axios'; + +import '../style.css' + + +const RadioGroup = Radio.Group; + +const { Option } = Select; +const $ = window.$; + +const bindTableColumn=(that)=>{ + let { course_groups }=that.state + const filter=course_groups && course_groups.map((i,key)=>{ + let list={ + value: i.id, + text: i.name + } + return list; + }) + const columns = [ + { + title: '序号', + dataIndex: 'index', + key: 'index', + width:"50px", + className:"edu-txt-center", + render: (id, student, index) => { + return (that.state.page - 1) * that.state.limit + index + 1 + } + }, + { + title: '姓名', + dataIndex: 'user_name', + key: 'user_name', + render: (user_name, line, index) => { + return( + {user_name} + ) + } + },{ + title: '学号', + dataIndex: 'student_id', + key: 'student_id', + render: (student_id, line, index) => { + return( + {student_id} + ) + } + },{ + title: '分班', + dataIndex: 'course_group_name', + key: 'course_group_name', + filters:filter, + render: (course_group_name, line, index) => { + return( + {course_group_name} + ) + } + } + ]; + if(that.state.comment_status == 2){ + columns.push({ + title: '交叉评阅老师', + dataIndex: 'cross_teachers', + key: 'cross_teachers', + width:"200px", + render: (cross_teachers, line, index) => { + return( + {cross_teachers} + ) + } + }) + }else{ + columns.push({ + title: '答辩组', + dataIndex: 'cross_groups', + key: 'cross_groups', + width:"200px", + render: (cross_groups, line, index) => { + return( + {cross_groups} + ) + } + }) + } + + if(course_groups&&course_groups.length===0){ + columns.some((item,key)=> { + if (item.title === "分班") { + columns.splice(key, 1) + return true + } + } + ) + } + return columns; +} +class GraduationAcross extends Component{ + constructor(props){ + super(props); + this.state={ + comment_status:2, + page:1, + limit:7, + group_ids:undefined, + users:undefined, + user_count:undefined, + graduation_groups:undefined, + course_groups:undefined, + teachers:undefined, + tableLoading:false, + chooseCount:0, + chooseId:undefined, + AcrossTeamIds:undefined, + searchValue:undefined, + showflag:false + } + } + + + + // 根据分班筛选 + filterByGroup=(value,record)=>{ + console.log(value); + console.log(record) + } + + // 切换分配方式 + funcommentstatus = (e) =>{ + this.setState({ + comment_status:e.target.value, + chooseCount:0, + chooseId:[], + AcrossTeamIds:undefined, + searchValue:undefined, + showflag:false, + page:1 + }) + let { group_ids }=this.state; + this.getList(1,group_ids,e.target.value); + } + + componentDidMount =()=>{ + let { comment_status }=this.props; + let { page,group_ids }=this.state; + this.setState({ + comment_status + }) + + this.getList(page,group_ids,comment_status); + + window.addEventListener('click', this.clickOther) + } + + clickOther = (e) =>{ + if(e.target && e.target.matches('#acrossContent') || e.target.matches(".ant-modal-body") + || e.target.matches(".acrossfoot") || e.target.matches(".acrossHead") || e.target.matches ('.ant-radio-wrapper') || + e.target.matches("th") || e.target.matches("td")) { + this.setState({ + showflag:false + }) + } + } + + componentWillUnmount() { + window.removeEventListener('click', this.clickOther); + } + + getList=(page,group_ids,comment_status)=>{ + let { limit }=this.state; + let { task_Id }=this.props; + this.setState({ + tableLoading:true + }) + let url=`/graduation_tasks/${task_Id}/cross_comment_setting.json`; + axios.get((url),{params:{ + page,limit,group_ids,comment_status + }}).then((result)=>{ + if(result){ + this.setState({ + users:result.data.work_users && result.data.work_users.map((item,key)=>{ + let list = { + key:item.work_id, + course_group_name:item.course_group_name, + cross_teachers: item.cross_teachers, + student_id:item.student_id, + user_name:item.user_name, + work_id:item.work_id, + cross_groups:item.cross_groups + } + return list; + }), + user_count:result.data.user_count, + graduation_groups:result.data.graduation_groups, + course_groups:result.data.course_groups, + teachers:result.data.teachers, + tableLoading:false, + // AcrossTeamIds:result.data + }) + } + }).catch((error)=>{ + this.setState({ + tableLoading:false + }) + console.log(error); + }) + } + + // 切换分页 + onPageChange=(page)=>{ + this.setState({ + page, + showflag:false + }) + let{group_ids,comment_status}=this.state; + this.getList(page,group_ids,comment_status); + } + + // 下拉切换 + changeSelect = (AcrossTeamIds) =>{ + console.log(AcrossTeamIds) + this.setState({ + AcrossTeamIds + }) + } + + // 重置 + clearSelect =()=>{ + this.setState({ + AcrossTeamIds:undefined, + searchValue:undefined + }) + } + + // 确定分配 + sureAcross=()=>{ + let { AcrossTeamIds , chooseId , group_ids , comment_status,page }=this.state; + let { task_Id }=this.props; + + let type = comment_status == 2 ? "user_ids" : "graduation_group_ids"; + + let url=`/graduation_tasks/${task_Id}/assign_works.json`; + if(!AcrossTeamIds || (AcrossTeamIds && AcrossTeamIds.length==0)){ + this.props.showNotification(`请先选择${ comment_status == 2 ? "老师": "答辩组" }!`); + return; + } + if(!chooseId || (chooseId && chooseId.length==0)){ + this.props.showNotification("请先选择毕设作品!"); + return; + } + axios.post((url),{ + [type]:AcrossTeamIds, + work_ids:chooseId + }).then((result)=>{ + if(result){ + this.props.showNotification(result.data.message); + this.getList(page,group_ids,comment_status); + this.setState({ + showflag:false, + AcrossTeamIds:undefined, + chooseCount:0, + chooseId:[] + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + // 筛选 + handleTableChange =(pagination, filters, sorter)=>{ + console.log(filters.course_group_name) + // if(filters.course_group_name.length > 0){ + this.setState({ + page:1, + group_ids:filters.course_group_name + }) + let { comment_status }= this.state; + this.getList(1,filters.course_group_name,comment_status); + // } + } + + // 下拉搜索 + changeSearchValue=(e)=>{ + + this.setState({ + searchValue:e.target.value + }) + } + // 显示下拉 + changeFlag=(flag)=>{ + this.setState({ + showflag:flag + }) + } + + checkonChange=(e,list)=>{ + let newlist=[] + // AcrossTeamIds + let {comment_status}=this.state; + if(e.target.checked===true){ + if(comment_status===2){ + list.map((item,key)=>{ + newlist.push(String(item.user_id)) + }) + this.setState({ + AcrossTeamIds:newlist + }) + }else{ + list.map((item,key)=>{ + newlist.push(String(item.id)) + }) + this.setState({ + AcrossTeamIds:newlist + }) + } + }else{ + this.setState({ + AcrossTeamIds:undefined + }) + } + } + render(){ + let { + comment_status, + users, + user_count, + graduation_groups, + course_groups, + teachers, + page, + limit, + tableLoading, + chooseCount, + chooseId, + AcrossTeamIds, + searchValue,showflag, + } = this.state; + let { modalVisible } = this.props; + let courseId = this.props.match.params.coursesId; + + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + marginRight:'0px' + }; + + + + const rowSelection = { + // 选中行的key,选中行 + onChange: (selectedRowKeys, selectedRows) => { + this.setState({ + chooseId:selectedRowKeys, + chooseCount:selectedRowKeys.length, + showflag:false + }) + console.log(selectedRowKeys); + }, + selectedRowKeys:chooseId, + getCheckboxProps: record => ({ + disabled: record.name === 'Disabled User', // Column configuration not to be checked + name: record.name, + }), + }; + + + // 筛选下拉列表 + const teacherList = searchValue ? teachers&&teachers.filter(e=>e.user_name.indexOf(searchValue)>-1) : teachers; + const course_groupsList = searchValue ? course_groups&&course_groups.filter(e=>e.name.indexOf(searchValue)>-1) : course_groups; + const graduation_groupslist =searchValue ? graduation_groups&&graduation_groups.filter(e=>e.name.indexOf(searchValue)>-1) : graduation_groups; + return( + + {modalVisible===true?:""} +

    + +
    + +
    + 评阅分配方式: + + + 手动分配评阅(逐一指定每个学生的交叉评阅老师) + 答辩组分配评阅(将老师加入不同答辩组,指定每个学生的交叉评阅答辩组, + + 立即设置答辩组 + + + +
    +
    + 已选 { chooseCount == 0 ? 0 : {chooseCount}} 个 + + 分配给{ comment_status && comment_status == 2 ? "老师":"答辩组"}: + + +
    :""} + {comment_status != 2 &&course_groups&&course_groups.length>10?
    + +
    :""} + {comment_status == 2 &&teacherList&&teacherList.length>2? this.checkonChange(e,teacherList)}>全选:""} + {comment_status != 2 &&graduation_groupslist&&graduation_groupslist.length>2? this.checkonChange(e,graduation_groupslist)}>全选:""} + {menu} + +
    + 提交 + 重置 +
    +
    + )} + > + { comment_status == 2 ? + teacherList && teacherList.map((i,key)=>{ + return + }): + graduation_groupslist && graduation_groupslist.map((i,key)=>{ + return + }) + } + +
    + +
  • + {/*{*/} + {/**/} + {/*}*/} +
    +
    +
    + { + user_count > limit ? + :"" + } +
    +
    + 取消 + 确认 +
    +
    + + ) + } +} +export default GraduationAcross; \ No newline at end of file diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js index 0aff1a1bd..b9830d1fc 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskDetail.js @@ -10,6 +10,7 @@ import HomeworkModal from "../../coursesPublic/HomeworkModal"; import AccessoryModal from "../../coursesPublic/AccessoryModal"; import Associationmodel from '../../coursesPublic/Associationmodel'; import CoursesListType from '../../coursesPublic/CoursesListType'; +import GraduationAcross from "./GraduationAcross"; import moment from 'moment'; import "../../css/members.css" import "../../css/Courses.css" @@ -58,7 +59,8 @@ class GraduationTaskDetail extends Component{ Modalstype:undefined, Modalstopval:undefined, ModalCancel:undefined, - ModalSave:undefined + ModalSave:undefined, + acrossVisible:undefined } } componentDidMount(){ @@ -80,6 +82,22 @@ class GraduationTaskDetail extends Component{ }) } + + // 交叉评阅设置弹框 + openAcross=()=>{ + this.setState({ + acrossVisible:true + }) + } + closeAcross=()=>{ + this.setState({ + acrossVisible:false + }) + this.getdatas() + } + + + //返回 goback=()=>{ // let courseId=this.props.match.params.coursesId; @@ -190,7 +208,6 @@ class GraduationTaskDetail extends Component{ } // 取消 cancelmodel=()=>{ - debugger this.setState({ Modalstype:false, Loadtype:false, @@ -291,11 +308,13 @@ class GraduationTaskDetail extends Component{ Modalstype, Modalstopval, ModalCancel, - ModalSave + ModalSave, + acrossVisible } = this.state const commom = { - setTab:this.setTab + setTab:this.setTab, + getdatas:this.getdatas } return(
    @@ -353,6 +372,20 @@ class GraduationTaskDetail extends Component{ destroyOnClose={true} centered={true} /> + + { + acrossVisible && + + } +

    {questionslist.course_name} > @@ -419,11 +452,11 @@ class GraduationTaskDetail extends Component{ :""} {questionslist.work_status===undefined||questionslist.work_status===null||questionslist.work_status.length===0?"":questionslist.work_status.map((item,key)=>{ return( - - {item==="提交作品"?提交作品:""} - {item==="补交作品"?补交作品:""} + + {item==="提交作品"?提交作品:""} + {item==="补交作品"?补交作品:""} {item==="修改作品"?修改作品:""} - {item==="查看作品"?查看作品 :""} + {item==="查看作品"?查看作品 :""} {item==="创建项目"?创建项目:""} {item==="关联项目"?关联项目:""} {item==="取消关联"?取消关联:""} @@ -436,7 +469,7 @@ class GraduationTaskDetail extends Component{ {/*项目在线质量检测*/} { this.props.isAdmin() ? questionslist.status===1 ? { this.end()} }>立即截止 : "" : "" } { this.props.isAdmin() ? questionslist.status===0 ? { this.publish()} }>立即发布 : "" : "" } - + { this.props.isAdmin() && questionslist.cross_comment ? 交叉评阅设置 : "" } { this.props.isAdmin() ? 编辑任务 : "" }

    diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index 7c697e31b..02e7177fa 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -335,6 +335,7 @@ class GraduationTasksSubmitedit extends Component{ } delecttask_status=(id)=>{ + let{selectmemberslist,task_status}=this.state; let newlist=task_status; let selects=selectmemberslist; @@ -350,6 +351,8 @@ class GraduationTasksSubmitedit extends Component{ selects.splice(z,1) } } + console.log(newlist) + console.log(selects) this.setState({ task_status:newlist, selectmemberslist:selects @@ -379,11 +382,9 @@ class GraduationTasksSubmitedit extends Component{ let userids=[]; for(var list of selectmemberslist){ - if(list.user_id!=undefined&&list.user_id!=null){ - userids.push(list.user_id) - } - + userids.push(list.user_id) + } } let listid=[]; @@ -392,6 +393,7 @@ class GraduationTasksSubmitedit extends Component{ listid.push(list.response == undefined ? list.id : list.response.id) } + console.log(userids) this.props.form.validateFields((err, values) => { @@ -401,6 +403,7 @@ class GraduationTasksSubmitedit extends Component{ // debugger return } + if(workslist.task_type===2){ if(userids.length { console.log(error) + this.setState({ + spinnings:false + }) }) @@ -785,6 +791,7 @@ class GraduationTasksSubmitedit extends Component{
    {selectmemberslist&&selectmemberslist.map((item,key)=>{ + console.log(item) if(item.group_name!=undefined) { return (
    {this.props.title && {this.props.title}} + watch={false} height={160} className={errorMessage ? 'editorInputError' : ''} imageExpand={true}> { showSameScore == true &&
    整组同评 (选中,则本次评阅对象指小组全部成员,否则仅评阅此成员1人 ) diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js index a7f886d78..19980cca5 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js @@ -343,6 +343,7 @@ class GraduationTaskssettingapp extends Component{ } updatesfuncrosscomment=(types,newlatetime,newcommenttime)=>{ + debugger let {endtimetype}=this.state; if(types===1){ this.setState({ @@ -372,7 +373,7 @@ class GraduationTaskssettingapp extends Component{ funcrosscomment=(e)=>{ let {latetime,end_time,allowlate,commenttime,commenttimeone}=this.state; let commenttimetype=commenttime===null||commenttime===""; - +debugger let newlatetimea=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm"); let newcommenttimea=moment(new Date()).format("YYYY-MM-DD HH:mm"); @@ -386,7 +387,7 @@ class GraduationTaskssettingapp extends Component{ let newcommenttimed=moment(end_time).add(8, 'days').format("YYYY-MM-DD HH:mm"); if(e.target.checked===true){ - if(commenttimetype===true){ + debugger if(allowlate===1||allowlate===true){ if(latetime===null||latetime===""){ @@ -401,12 +402,6 @@ class GraduationTaskssettingapp extends Component{ this.updatesfuncrosscomment(2,newend_timed,newcommenttimed) } } - }else{ - this.setState({ - crosscomment:e.target.checked, - commenttime:commenttimeone, - }) - } }else{ this.setState({ @@ -545,25 +540,29 @@ class GraduationTaskssettingapp extends Component{ endTimetypes:false }) } - + debugger if(moment(latetime)<=moment(publish_time)){ + + debugger this.setState({ latetimetype:true, latetimetypeval:"结束时间必须晚于发布时间" }) return }else if(moment(latetime)<=moment(end_time)){ + debugger this.setState({ latetimetype:true, latetimetypeval:"结束时间必须晚于截止时间" }) return }else{ + debugger this.setState({ latetimetype:false }) } - + debugger if(crosscomment===true){ if(this.state.commenttime===undefined||this.state.commenttime===null||this.state.commenttime===""){ @@ -726,7 +725,9 @@ class GraduationTaskssettingapp extends Component{ starttime:undefined, course_groupslist:[], }) - this.props.showNotification(resulet.data.message); + this.props.showNotification(resulet.data.message); + //调用父组件方法,刷新按钮 + this.props.getdatas(); } } }).catch((error)=>{ @@ -948,9 +949,7 @@ class GraduationTaskssettingapp extends Component{ // // console.log(moment(publish_time)) - // console.log(this.props.isSuperAdmin()) - - + console.log(commenttime) return( @@ -1002,8 +1001,11 @@ class GraduationTaskssettingapp extends Component{
    { !flagPageEdit && this.props.isAdmin() === true ? - + + 编辑设置 + {/**/} + : "" } {/*内容*/} @@ -1169,9 +1171,11 @@ class GraduationTaskssettingapp extends Component{
    评分设置
    最终成绩组成 (取各教师最终评分的平均分)
    - 启用交叉评阅 (给老师分配其他指导老师的学生作品) - + + 启用交叉评阅 (给老师分配其他指导老师的学生作品) + + {crosscomment===true?
    开始时间: @@ -1204,7 +1208,7 @@ class GraduationTaskssettingapp extends Component{ {crosscomment===true&&commenttimetype===true?
    {commenttimevalue}
    :""}
    -
    + {/*
    评阅方式: @@ -1219,10 +1223,10 @@ class GraduationTaskssettingapp extends Component{ -
    +
    */} -
    + {/*
    评阅数: @@ -1259,7 +1263,7 @@ class GraduationTaskssettingapp extends Component{ ) })} -
    +
    */}
    :""} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js index 0469d5d9c..b3282d7dd 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssettinglist.js @@ -40,7 +40,7 @@ class GraduationTaskssettinglist extends Component{ task_status:undefined, cross_comment:null, search:null, - order:"updated_at", + order:"update_time", b_order:"desc", course_group:undefined, loadingstate:true, @@ -92,6 +92,7 @@ class GraduationTaskssettinglist extends Component{ seacthdata=(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,pages)=>{ let{page,limit}=this.state; + // console.log(teacher_comment,task_status,course_group,cross_comment,order,b_order,search) let task_Id=this.props.match.params.task_Id; let url="/graduation_tasks/"+task_Id+"/tasks_list.json"; @@ -106,7 +107,7 @@ class GraduationTaskssettinglist extends Component{ order:order===null?undefined:order, b_order:b_order===null?undefined:b_order, search:search===null?undefined:search, - page:pages===null?undefined:page, + page:pages, limit:20, }, paramsSerializer: function(params) { @@ -281,8 +282,6 @@ class GraduationTaskssettinglist extends Component{ funtaskstatus=(checkedValues,key)=>{ // console.log(checkedValues) - console.log(checkedValues); - let {teacher_comment, course_group, cross_comment, order, b_order, search} = this.state; @@ -515,6 +514,7 @@ class GraduationTaskssettinglist extends Component{ } showAllocationModal=(id)=>{ + this.setState({ Allocationtype:true, operationId:id @@ -535,10 +535,12 @@ class GraduationTaskssettinglist extends Component{ // console.log(result) if(result.data.status===0){ this.seacthdata(teacher_comment,task_status,course_group,cross_comment,order,b_order,search,this.state.page); + this.props.showNotification(result.data.message); + this.cancelmodel(); this.setState({ - Modalstype:true, + Modalstype:false, Allocationtype:false, - Modalstopval:result.data.message, + // Modalstopval:result.data.message, ModalSave:this.cancelmodel, }) } @@ -599,7 +601,7 @@ class GraduationTaskssettinglist extends Component{ this.cannerassocition(); let {taskslistdata}=this.state; let url = "/graduation_tasks/"+taskslistdata.task_id+"/graduation_works/cancel_relate_project.json"; - console.log(url) + axios.get(url).then((result)=>{ if(result.data.status===0){ @@ -655,8 +657,7 @@ class GraduationTaskssettinglist extends Component{ /// 确认是否下载 confirmysl(url){ - debugger; - console.log(1); + let {teacher_comment, task_status, course_group, cross_comment, order, b_order, search,page} =this.state; let params ={ @@ -849,28 +850,28 @@ class GraduationTaskssettinglist extends Component{ ), - }, { + }, { title: '操作', key: 'operation', width:'100px', dataIndex: 'operation', className:'edu-txt-center', render: operation => ( -
    +
    {this.props.isAdmin()?operation.map((tag,key) => { return( { tag.name && - 调整学生最终成绩
    其它历史评分将全部失效:""}> - {tag.name==="评阅"? + 调整学生最终成绩
    其它历史评分将全部失效:""}> + {tag.name==="评阅"?
    {tag.name} : - this.showModulationtype(tag.id):tag.name==="分配"?()=>this.showAllocationModal(tag.id):""}> - {tag.name} - + this.showModulationtype(tag.id):tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":""}> + {tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"":tag.name} + }
    } @@ -882,7 +883,7 @@ class GraduationTaskssettinglist extends Component{ operation.map((tag,key) => { return(
    - {tag.view_work===false?"--":查看} + {tag.view_work===false?"--":查看}
    )} ):"" @@ -958,7 +959,7 @@ class GraduationTaskssettinglist extends Component{ } - console.log(this.props.questionslist.status) + return( @@ -973,9 +974,8 @@ class GraduationTaskssettinglist extends Component{ white-space: nowrap; } .ant-table-tbody>tr>td, .ant-table-thead>tr>th{ - padding: 16px 10px + padding:16px 5px; } - ` } @@ -1217,14 +1217,14 @@ class GraduationTaskssettinglist extends Component{
    {this.props.isAdmin()===true? {taskslistdata&&taskslistdata.work_count} - 个检索结果({taskslistdata&&taskslistdata.work_count} 学生):""} + 个检索结果({taskslistdata&&taskslistdata.all_work_count} 学生):""} {this.props.isAdmin()===true?

    - {order==="updated_at"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}排序 + {order==="update_time"?"更新时间":order==="work_score"?"最终成绩":order==="student_id"?"学生学号":""}排序

      -
    • this.funorder("updated_at")}>更新时间 +
    • this.funorder("update_time")}>更新时间
    • this.funorder("work_score" )}>最终成绩
    • @@ -1415,10 +1415,10 @@ class GraduationTaskssettinglist extends Component{

      - {order==="updated_at"?"时间":order==="work_score"?"成绩":order==="student_id"?"学号":""}排序

        -
      • this.funorder("updated_at")} className={order==="updated_at"?"none":""}>时间 +
      • this.funorder("update_time")} className={order==="update_time"?"none":""}>时间
      • this.funorder("work_score" )} className={order==="work_score"?"none":""}>成绩
      • diff --git a/public/react/src/modules/courses/graduation/tasks/index.js b/public/react/src/modules/courses/graduation/tasks/index.js index ae764cc95..9dac05a36 100644 --- a/public/react/src/modules/courses/graduation/tasks/index.js +++ b/public/react/src/modules/courses/graduation/tasks/index.js @@ -24,6 +24,7 @@ class GraduationTasks extends Component{ checkAllValue: false, checkBoxValues: [], all_count:undefined, + task_count:undefined, course_identity:undefined, course_public:undefined, tasks:[], @@ -55,6 +56,7 @@ class GraduationTasks extends Component{ if(response.status===200){ this.setState({ all_count:response.data.all_count, + task_count:response.data.task_count, course_public:response.data.course_public, tasks:response.data.tasks, unpublished_count:response.data.unpublished_count, @@ -129,7 +131,7 @@ class GraduationTasks extends Component{ let {checkBoxValues,checkAllValue}=this.state; if(checkAllValue===false){ - if(checkBoxValues.length===0){ + if(checkBoxValues.length===0||checkAllValue===undefined){ return true } } @@ -385,6 +387,7 @@ class GraduationTasks extends Component{ this.setState({ order: e.key, + page:1, isSpin:true, checkBoxValues:[], checkAllValue:false @@ -395,7 +398,7 @@ class GraduationTasks extends Component{ newkey="all" } - this.fetchAll(search,page,newkey); + this.fetchAll(search,1,newkey); } onPressEnter = (value) => { @@ -605,14 +608,14 @@ class GraduationTasks extends Component{ Saves, course_groups, search, - order + order, + task_count } = this.state; // this.fetchAll(search,page,order); const coursesId=this.props.match.params.coursesId; const category_id=this.props.match.params.Id; const graduationId=this.props.match.params.graduationId; // console.log(this.props.isCourseidentity()===isNotMember) - // console.log(category_id) return( {/*提示*/} @@ -710,14 +713,14 @@ class GraduationTasks extends Component{ {this.props.isAdmin()?all_count===undefined?'' :all_count===0?"":
        - 已选 {checkBoxValues.length} 个 (不支持跨页勾选) + 已选 {checkBoxValues===undefined?0:checkBoxValues.length} 个 (不支持跨页勾选)
        :""} @@ -737,13 +740,15 @@ class GraduationTasks extends Component{ border-radius: 2px; } `} - + { tasks&&tasks.map((item, index) => { // console.log(item) return (
        { - all_count > 15 && + task_count > 15 &&
        { + + if(this.props.checkIfLogin()===false){ + this.props.showLoginDialog() + return + } + // if(this.props.checkIfProfileCompleted()===false){ + // this.setState({ + // AccountProfiletype:true + // }) + // return + // } + // if(this.props.checkIfProfessionalCertification()===false){ + // this.props.showProfileCompleteDialog() + // return + // } + let courseId=this.props.match.params.coursesId; this.props.history.push(`/courses/${courseId}/graduation_topics/${topicId}/detail`); } @@ -67,23 +83,27 @@ class GraduateTopicItem extends Component{ text-overflow:ellipsis; white-space:nowrap } + a:hover{ + color: #4cacff; + } `}
        { isNotMember? - {discussMessage.name}:"" - + discussMessage.private_icon===true?{discussMessage.name}: + {discussMessage.name} + :"" } { isStudent? this.toDetailPage(`${discussMessage.id}`)} - className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" + className="fl mt3 font-16 font-bd color-dark maxwidth580" title={discussMessage.name}>{discussMessage.name}:"" } { - isAdmin? this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580">{discussMessage.name}:"" + isAdmin? this.toDetailPage(`${discussMessage.id}`)} className="fl mt3 font-16 font-bd color-dark maxwidth580" title={discussMessage.name}>{discussMessage.name}:"" } { discussMessage.private_icon===true? - + :"" diff --git a/public/react/src/modules/courses/graduation/topics/index.js b/public/react/src/modules/courses/graduation/topics/index.js index ef4257e2e..2f02113bc 100644 --- a/public/react/src/modules/courses/graduation/topics/index.js +++ b/public/react/src/modules/courses/graduation/topics/index.js @@ -447,7 +447,7 @@ onBoardsNew=()=>{ { course_public && course_public==1 ?
      • this.onDelete(2)}>设为公开
      • :"" } -
      • this.onDelete(3)}>加入题库
      • + {/*
      • this.onDelete(3)}>加入题库
      • */} {/*
      • 加入题库
      • */}
        diff --git a/public/react/src/modules/courses/members/ChangeRolePop.js b/public/react/src/modules/courses/members/ChangeRolePop.js new file mode 100644 index 000000000..0f9e6f5f1 --- /dev/null +++ b/public/react/src/modules/courses/members/ChangeRolePop.js @@ -0,0 +1,79 @@ +import React, { useState, useEffect } from 'react' +import { trigger, WordsBtn } from 'educoder' +import { Input, Checkbox, Popconfirm } from "antd"; +import axios from 'axios' + +/** + 角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生 +*/ +function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification, getUserId, fetchUser }) { + const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles) + useEffect(() => { + setCheckBoxRoles(member_roles) + }, [member_roles]) + function onCheckBoxChange(val) { + console.log(val) + + const isTeacher = checkBoxRoles.indexOf('PROFESSOR') + const isAssitant = checkBoxRoles.indexOf('ASSISTANT_PROFESSOR') + const isTeacherNew = val.indexOf('PROFESSOR') + const isAssitantNew = val.indexOf('ASSISTANT_PROFESSOR') + if (isTeacherNew > -1 && isTeacher == -1 && isAssitantNew > -1) { + val.splice(isAssitantNew, 1) + } + if (isAssitantNew > -1 && isAssitant == -1 && isTeacherNew > -1) { + val.splice(isTeacherNew, 1) + } + + setCheckBoxRoles(val) + } + function onCancel() { + setCheckBoxRoles(member_roles) + } + const onConfirm = async () => { + if (checkBoxRoles && checkBoxRoles.length == 0) { + showNotification('请至少选择一个角色') + return; + } + const url = `/courses/${courseId}/change_member_role.json` + const response = await axios.post(url, { + roles: checkBoxRoles, + user_id: record.user_id + }) + if (response.data.status == 0) { + showNotification('保存成功') + onChangeRoleSuccess() + + trigger('updatabanner') + if (fetchUser && record.user_id == getUserId) { + fetchUser() + } + + } + console.log(response) + } + const isAdmin = checkBoxRoles.indexOf('CREATOR') != -1 + const isTeacher = checkBoxRoles.indexOf('PROFESSOR') != -1 + const isAssitant = checkBoxRoles.indexOf('ASSISTANT_PROFESSOR') != -1 + const isStudent = checkBoxRoles.indexOf('STUDENT') != -1 + return ( + + {isAdmin && 管理员} + {!isAdmin && 教师} + 助教 + 学生 + + } + > + 修改角色 + + ) +} +export default ChangeRolePop \ No newline at end of file diff --git a/public/react/src/modules/courses/members/modal/AddAdminModal.js b/public/react/src/modules/courses/members/modal/AddAdminModal.js index 5ca1867e7..5cbf0c204 100644 --- a/public/react/src/modules/courses/members/modal/AddAdminModal.js +++ b/public/react/src/modules/courses/members/modal/AddAdminModal.js @@ -96,6 +96,9 @@ class AddAdminModal extends Component{ }).then((result)=>{ if(result.data.status==0){ this.props.showNotification('操作成功。') + if (this.props.isCourseAdmin()) { + window.location.reload() + } // this.fetchAll() this.setVisible(false) this.props.changeAdminSuccess && this.props.changeAdminSuccess() diff --git a/public/react/src/modules/courses/members/modal/AddStudentModal.js b/public/react/src/modules/courses/members/modal/AddStudentModal.js index ddd1164ea..efa801182 100644 --- a/public/react/src/modules/courses/members/modal/AddStudentModal.js +++ b/public/react/src/modules/courses/members/modal/AddStudentModal.js @@ -68,7 +68,7 @@ class AddStudentModal extends Component{ if (response.data.course_groups && response.data.course_groups.length) { this.setState({ course_groups: response.data.course_groups, - courseGroup: response.data.course_groups[0].id + courseGroup: '0' // response.data.course_groups[0].id }) } else { // showNotification('') @@ -268,6 +268,7 @@ class AddStudentModal extends Component{ {course_groups && course_groups.length &&
        所选学生分班至(选填):
        ' + + $(".newMain").after(html).hide(); + + window.editormd.markdownToHTML("MDContent", { + htmlDecode: "style,script,iframe", // you can filter tags decode + taskList: true, + tex: true, // 默认不解析 + flowChart: true, // 默认不解析 + sequenceDiagram: true // 默认不解析 + }); +} +function removeElasticLayer(){ + $(".layerContent").hide(); + $(".newMain").show(); +} +window.elasticLayer = elasticLayer +window.doElasticLayer = doElasticLayer +window.removeElasticLayer = removeElasticLayer + class Ecs extends React.Component { render() { diff --git a/public/react/src/modules/ecs/common/ECModalHOC.js b/public/react/src/modules/ecs/common/ECModalHOC.js new file mode 100644 index 000000000..650c10cbe --- /dev/null +++ b/public/react/src/modules/ecs/common/ECModalHOC.js @@ -0,0 +1,91 @@ +import React, { Component } from 'react'; +import { Modal } from 'antd'; + + +export function ECModalHOC(options = {}) { + return function wrap(WrappedComponent) { + return class Wrapper extends Component { + constructor(props) { + super(props); + + this.state = { + titlemessage: '', + Modallist: false, + Modallisttype: false, + singleButton: false + } + } + + // 全局的modal this.props.showModal 调用即可 + showModal = (title, content, okCallback) => { + this.okCallback = okCallback; + this.setState({ + titlemessage: title, + Modallist: content, + Modallisttype: true, + singleButton: false, + + }) + } + + showSingleButtonModal = (title, content) => { + this.setState({ + titlemessage: title, + Modallist: content, + Modallisttype: true, + singleButton: true, + }) + } + + onCancel = () => { + this.setState({ + Modallisttype:false + }) + } + hidemodeldelete = () => { + if (this.okCallback) { + this.okCallback() + } + + this.onCancel() + } + render() { + const { titlemessage, Modallisttype, Modallist, singleButton } = this.state; + + return ( + + +
        +
        {Modallist}
        +
        + { singleButton ?
        + 知道啦 +
        :
        + 取消 + 确定 +
        } +
        + + + +
        + ) + } + } + } +} \ No newline at end of file diff --git a/public/react/src/modules/ecs/css/ecCourseEvaluations.css b/public/react/src/modules/ecs/css/ecCourseEvaluations.css index f27ad7313..cb6c29a01 100644 --- a/public/react/src/modules/ecs/css/ecCourseEvaluations.css +++ b/public/react/src/modules/ecs/css/ecCourseEvaluations.css @@ -9,7 +9,12 @@ font-family:MicrosoftYaHei; font-weight:400; color:#05101A !important; + +} +.marginleft76{ + margin-left: 76px; } + #SystemParameters{ height: 81px; line-height: 40px; @@ -160,6 +165,9 @@ input{ margin-left: 8px; padding-left: 25px !important; } +.percentages{ + margin-left: 8px; +} .Coursetitle{ margin-bottom:0px !important; } @@ -167,6 +175,11 @@ input{ padding-left: 30px !important; width: 70px !important; } +.textaligncenters{ + width: 133px !important; + display: block; + float: left; +} .ml72{ margin-left:72px; } @@ -213,6 +226,10 @@ input{ width: 589px !important; display: inline-block; } +.evaluationdataClassy{ + width: 589px !important; + display: inline-block; +} .absolute{ position:absolute; } @@ -246,12 +263,22 @@ input{ padding: 10px 0px !important; margin: 0px 20px !important; } - +.newSystem .newtarget_scoreclassysl{ + padding: 10px 0px !important; +} +.mynewtarget_scoreclassysls{ + padding: 10px 20px!important; +} .newSystem .newtarget_target{ padding: 10px 0px !important; margin: 0px 30px !important; border-bottom:1px solid transparent !important; } +.newSystem .newtarget_targets{ + padding: 10px 0px !important; + + border-bottom:1px solid transparent !important; +} .nowrap329{ max-width: 329px !important; @@ -263,9 +290,9 @@ input{ min-width: 329px !important; } .ListTableLine li>.column-500{ - max-width: 360px !important; + max-width: 366px !important; text-align: left; - min-width: 360px !important; + min-width: 366px !important; } .color-666{ color:#666666 !important; diff --git a/public/react/src/modules/ecs/css/ecCourseSupports.css b/public/react/src/modules/ecs/css/ecCourseSupports.css index 10b6ebd91..5f53aa0f8 100644 --- a/public/react/src/modules/ecs/css/ecCourseSupports.css +++ b/public/react/src/modules/ecs/css/ecCourseSupports.css @@ -234,6 +234,10 @@ input{ .color-05101A{ color:#05101A !important; } +/*边框*/ +bordertopsolid{ + border:1px solid #000; + } .ec_graduation_name{ margin-right:20px !important; } diff --git a/public/react/src/modules/ecs/curriculum/Curriculum.js b/public/react/src/modules/ecs/curriculum/Curriculum.js index 3dae260de..889004d8d 100644 --- a/public/react/src/modules/ecs/curriculum/Curriculum.js +++ b/public/react/src/modules/ecs/curriculum/Curriculum.js @@ -36,7 +36,10 @@ const EcCompletionCalculation =Loadable({ loader: () => import('../subroute/ecCompletion_calculation/EcCompletionCalculation'), loading: Loading, }); - +const EcCourseSupportSetting =Loadable({ + loader: () => import('../subroute/ecCourseSupportSetting/index'), + loading: Loading, +}); class Curriculum extends Component { //课程体系 @@ -56,6 +59,7 @@ class Curriculum extends Component { // window.document.title = '课程达成评价结果'; } componentDidMount(){ + console.log("Curriculum"); console.log(this.props); } sync_course_data=()=>{ @@ -91,7 +95,16 @@ class Curriculum extends Component { // }) } - + bindRef = ref => { + console.log(ref); + // console.log("调用了子对象1"); + this.child = ref + }; + newrightcalculatebuttonysl=(child)=>{ + // console.log("调用了子对象2"); + // console.log(child); + child.newrightcalculatebutton(); + } onAclick=(i)=>{ console.log("onAclick"); console.log(i); @@ -112,6 +125,8 @@ class Curriculum extends Component { }; Ontitine=(s)=>{ + console.log("CurriculumCurriculum"); + console.log(s); if(s==="ec_course_support_setting"){ this.setState({ titine:1, @@ -155,7 +170,7 @@ class Curriculum extends Component { 课程体系 > {schooldata&&schooldata.ec_course_name} 达成评价详情 {/* 导出培养目标 */} -
        系统根据课程目标、课程考核方式与课程目标评价方法,一键计算评价课程目标的达成情况 window.elasticLayer(3533)}>查看详情
        +
        系统根据课程目标、课程考核方式与课程目标评价方法,一键计算评价课程目标的达成情况 查看详情
        { titine === 4 ? @@ -208,10 +223,10 @@ class Curriculum extends Component { titine===5? - 导出评价详情 + 导出评价详情 计算 + onClick={()=>this.newrightcalculatebuttonysl(this.child)}>计算 :titine===4? (各环节平均得分*占比)之和/(各环节总分*占比)之和 @@ -230,20 +245,20 @@ class Curriculum extends Component { {/*Curriculumtwo 测试用*/} {/*课程目标*/} - (this.Ontitine(i)} />) }> + (this.Ontitine(i)} />) }> {/*课程考核方式与数据来源*/} - (this.Ontitine(i)}/>) }> {/*成绩等级设置*/} - (this.Ontitine(i)}/>) }> - {/*4课程目标评价方法*/} - (this.Ontitine(i)}/>) }> {/*5课程达成评价结果*/} - (this.Ontitine(i)}/>) }> + (this.Ontitine(i)} triggerRef={this.bindRef}/>) }>
      diff --git a/public/react/src/modules/ecs/curriculum/CurriculumSubpage.js b/public/react/src/modules/ecs/curriculum/CurriculumSubpage.js new file mode 100644 index 000000000..f7efffd8a --- /dev/null +++ b/public/react/src/modules/ecs/curriculum/CurriculumSubpage.js @@ -0,0 +1,35 @@ +import React, { Component } from 'react'; + +class CurriculumSubpage extends Component { + //测试用 + constructor(props) { + super(props) + // console.log(props); + } + + componentWillMount(){ + } + componentDidMount(){ + // 起始页面 + // console.log(this.props); + console.log("CurriculumSubpage"); + console.log(this.props.match.params); + } + Curriculumstructure=()=>{ + this.props.history.push(`/ecs/major_schools/${this.props.match.params.majorId}/years/${this.props.match.params.yearId}/courses/subpage/ec_course_support_setting/1`); + } + + + render() { + // console.log("Curriculumtwo"); + // console.log(this.props); + return ( +
      + this.Curriculumstructure()}>点我进去课程体系 +
      + ) + } + + +} +export default CurriculumSubpage; \ No newline at end of file diff --git a/public/react/src/modules/ecs/curriculum/Curriculumtwo.js b/public/react/src/modules/ecs/curriculum/Curriculumtwo.js index 221b2afb5..8d457f6cd 100644 --- a/public/react/src/modules/ecs/curriculum/Curriculumtwo.js +++ b/public/react/src/modules/ecs/curriculum/Curriculumtwo.js @@ -1,28 +1,289 @@ import React, { Component } from 'react'; - +import { Select,InputNumber,message,Modal,Input,Radio,Spin,Icon,Tooltip,Popconfirm,Upload,Button} from 'antd'; +import axios from 'axios'; class Curriculumtwo extends Component { //测试用 constructor(props) { super(props) // console.log(props); + this.state={ + params:[], + deletelist:[], + ec_course_id:0, + ec_course_name:undefined, + ec_course_evaluation_lists:undefined, + course_evaluation_lists:undefined, + course_name: undefined, + deletetype:"end", + savetype:'', + schooldata:{}, + course_url:undefined, + Evaluationsparamstype:true, + idkey:null, + listid:null, + Modallist:"", + Modallisttype:false, + titlemessage:"提示", + savetypes:false, + levels:undefined, + editecGradetype:false, + editlevels:undefined, + listvaluey:null, + Modallisttypes:false, + ismanager:false + } } componentWillMount(){ + window.document.title ="成绩等级设置"; } + componentDidMount(){ - // console.log(this.props); - console.log("Curriculumtwo"); - console.log(this.props.match.params.type); - this.props.Ontitine(this.props.match.params.type); + console.log(this.props.match.params); + this.props.Ontitine(this.props.match.params.type); + let ec_course_id=706; + let Url = `/ec_courses/`+ec_course_id+`/score_levels.json`; + axios.get(Url).then((response) => { + if(response.status===200){ + this.setState({ + levels:response.data.levels, + ismanager:response.data.ismanager, + editlevels:response.data.levels + }) + } + }).catch((error) => { + console.log(error) + }) + + const jol =`/ec_major_schools/get_navigation_data?ec_course_id=`+ec_course_id; + axios.get(jol, { + withCredentials: true, + }) + .then((response) => { + if(response.status===200){ + // if(response.data.allow_visit===false){ + // window.location.href="/403" + // } + this.setState({ + schooldata:response.data + }) + } + + }) + .catch(function (error) { + console.log(error); + }); + } + + updalevels=()=>{ + let ec_course_id=this.props.match.params.ec_course_id; + let Url = `/ec_courses/`+ec_course_id+`/score_level_data`; + axios.get(Url, { + withCredentials: true, + } + ).then((response) => { + if(response.status===200){ + this.setState({ + levels:response.data.levels, + ismanager:response.data.ismanager, + editlevels:response.data.levels + }) + } + }).catch((error) => { + console.log(error) + }) + + } + editecGrade=()=>{ + this.setState({ + editecGradetype:true + }) + } + + CancelecCourseEvaluationstop=()=>{ + this.updalevels(); + this.setState({ + editecGradetype:false + }) + + } + + SaveecCourseEvaluationstop=()=>{ + let {editlevels}=this.state; + let levels=editlevels; + let ec_course_id=this.props.match.params.ec_course_id; + for(var i=0; i { + if(response.status===200){ + // this.setState({ + // editecGradetype:false + // }) + this.updalevels(); + } + }).catch((error) => { + console.log(error) + }) + + } + + deleteditecGrade=(key)=>{ + let {editlevels}=this.state; + let neweditlevels=editlevels; + // console.log(key) + neweditlevels.splice(key, 1); + this.setState({ + editlevels:neweditlevels + }) + } + + additecGrade=(key)=>{ + let {editlevels}=this.state; + let neweditlevels=editlevels; + let list={score: 0, level: ""} + neweditlevels.push(list) + // console.log(key) + this.setState({ + editlevels:neweditlevels + }) + } + + editlevelslist=(e,key)=>{ + let {editlevels}=this.state; + let neweditlevels=editlevels; + neweditlevels[key].level=e.target.value; + this.setState({ + editlevels:neweditlevels + }) } + editlevelslists=(e,key)=>{ + let {editlevels}=this.state; + let neweditlevels=editlevels; + let sum=parseInt(e.target.value); + if(isNaN(sum)){ + sum=0 + } + neweditlevels[key].score=sum; + this.setState({ + editlevels:neweditlevels + }) + } + + hidemodeldelete=()=>{ + this.setState({ + Modallisttype:false + }) + } render() { - // console.log("Curriculumtwo"); - // console.log(this.props); + const RadioGroup = Radio.Group; + let {listvaluey,params,ec_course_evaluation_lists,ec_course_id,schooldata,course_name,course_url,idkey,modeldelet,listid,titlemessage,Modallisttype,Modallist,savetypes,levels,editlevels,editecGradetype,Modallisttypes,ismanager} = this.state; + console.log(ismanager) return (
      - 测试 +
      + +

      + 等级名称 + 规则 + + + {/* 操作 */} + + {/**/} + + + + +

      + +
        + { + levels===undefined?"":levels.map((item,key)=>{ + return( +
      • + {item.level} + 分数 + {key>2?'<':'>= '} + {item.score} +
      • + ) + }) + } + +
      + + +
      +
      + +
      +
      +

      + 等级名称 + 规则 + 分值 + (请按照分数的降序方式进行等级的划分设置) +

      +
      + + + + +
      +
      提交
      +
      取消
      +
      + +
      + + + +
      +
      +
      ) } diff --git a/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js b/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js index 4be7c11d3..2b525284a 100644 --- a/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js +++ b/public/react/src/modules/ecs/subroute/ecCompletion_calculation/EcCompletionCalculation.js @@ -42,7 +42,12 @@ class EcCompletionCalculation extends Component { course_total_scoreaverage:0, calculatesetype:false, Spintype:false, - ismanager:false + ismanager:false, + course_achievement:"--", + course_rate:"--", + score_levels:[], + score_levelsdata:[], + hife:"/ecs/major_schools/3/years/60/requirement_vs_courses", } } @@ -51,26 +56,55 @@ class EcCompletionCalculation extends Component { } componentDidMount(){ - let ec_course_id =this.props.match.params.ec_course_id; - this.UpdateClassData(true); - const Url =`/ec_major_schools/get_navigation_data?ec_course_id=`+ec_course_id; - axios.get(Url, { - withCredentials: true, - }) + console.log("componentDidMount"); + console.log("EcCompletionCalculation"); + + // console.log(this.props); + // let ec_course_id =this.props.match.params.ec_course_id; + // this.UpdateClassData(true); + + // const url =`/ec_major_schools/get_navigation_data?ec_course_id=`+ec_course_id; + const ec_course_id=706; + const url =`/ec_courses/${ec_course_id}/evaluation.json`; + axios.get(url) .then((response) => { if(response.status===200){ // if(response.data.allow_visit===false){ // window.location.href="/403" // } - this.setState({ - schooldata:response.data, - ec_course_id:ec_course_id - }) + + this.setState({ + schooldata:response.data, + ec_course_id:ec_course_id, + // evaluate_result:response.data.evaluate_result, + // course_total_score:response.data.course_total_score[response.data.course_total_score.length-1].total_rate, + // total_rate_data:response.data.course_total_score[response.data.course_total_score.length-1].total_rate.length, + graduation_list:response.data.graduation_subitem_evaluations, + target_list:response.data.course_targets, + // target_score:response.data.target_score, + ec_course_targets_count:response.data.course_targets.length, + course_achievement:response.data.course_achievement, + course_rate:response.data.course_rate, + score_levels:response.data.score_levels, + // score_levelsdata:response.data.course_targets.score_levels, + // morelisttype:newmorelisttype, + // course_total_scoreaverage:course_total_scoreaverage, + // ismanager:response.data.is_manager + }) + // console.log("componentDidMount"); + // console.log(response.data.score_levels); + // console.log(response.data.course_targets.score_levels); } }) .catch(function (error) { console.log(error); }); + this.props.Ontitine("competition_calculation_info"); + try { + this.props.triggerRef(this); + }catch (e) { + + } } targetsget_navigation_data=(ec_year_id,ec_course_id)=>{ @@ -101,10 +135,11 @@ class EcCompletionCalculation extends Component { } UpdateClassData=(key)=>{ let {calculatetype} =this.state; - let ec_course_id =this.props.match.params.ec_course_id; + // let ec_course_id =this.props.match.params.ec_course_id; this.setState({ ec_course_id:ec_course_id }) + const ec_course_id=706; const Arl =`/ec_courses/`+ec_course_id+`/calculation_info_data`; axios.get(Arl, { withCredentials: true, @@ -138,19 +173,29 @@ class EcCompletionCalculation extends Component { } this.setState({ - evaluate_result:response.data.evaluate_result, - course_total_score:response.data.course_total_score[response.data.course_total_score.length-1].total_rate, - total_rate_data:response.data.course_total_score[response.data.course_total_score.length-1].total_rate.length, - graduation_list:response.data.graduation_list, - target_list:response.data.target_list, - target_score:response.data.target_score, - ec_course_targets_count:response.data.ec_course_targets_count, - morelisttype:newmorelisttype, - course_total_scoreaverage:course_total_scoreaverage, - ismanager:response.data.is_manager - }) - - + // evaluate_result:response.data.evaluate_result, + // course_total_score:response.data.course_total_score[response.data.course_total_score.length-1].total_rate, + // total_rate_data:response.data.course_total_score[response.data.course_total_score.length-1].total_rate.length, + graduation_list:response.data.graduation_subitem_evaluations, + target_list:response.data.course_targets, + // target_score:response.data.target_score, + ec_course_targets_count:response.data.course_targets.length, + course_achievement:response.data.course_achievement, + course_rate:response.data.course_rate, + score_levels:response.data.score_levels, + // score_levelsdata:, + // morelisttype:newmorelisttype, + // course_total_scoreaverage:course_total_scoreaverage, + // ismanager:response.data.is_manager + }); + // console.log("componentDidMount"); + // console.log(response.data.score_levels_map); + // Object.getOwnPropertyNames(response.data.score_levels_map).forEach(function(val) { + // console.log("正在循环"); + // console.log(val); + // }); + // console.log(response.data.course_targets.score_levels); + // ec_course_targets:response.data.ec_course_targets, this.targetsget_navigation_data(response.data.ec_year_id,ec_course_id) if(calculatetype===true){ @@ -263,25 +308,29 @@ class EcCompletionCalculation extends Component { } newrightcalculatebutton=()=>{ + console.log("调用了计算"); this.setState({ Spintype:true }) - let {ec_course_id}=this.state; - const Orl =`/ec_courses/`+ec_course_id+`/sync_data`; - axios.get(Orl, { - withCredentials:true, - }) + // let {ec_course_id}=this.state; + const ec_course_id=706; + // const Orl =`/ec_courses/`+ec_course_id+`/sync_data`; + const Orl =`/ec_courses/${ec_course_id}/evaluation.json`; + axios.get(Orl) .then((response) => { - if(response.data.status===1){ - this.setState({ - calculatetype:true, - completiontype:true, - completionlist:'计算成功', - calculatesetype:true, - Spintype:false - }) - this.UpdateClassData(true); + if(response){ + if(response.data.status===1){ + this.setState({ + calculatetype:true, + completiontype:true, + completionlist:'计算成功', + calculatesetype:true, + Spintype:false + }) + this.UpdateClassData(true); + } } + }) .catch(function (error) { console.log(error) @@ -295,14 +344,14 @@ class EcCompletionCalculation extends Component { }) } render() { - let {Spintype,calculatesetype,ec_course_id,course_total_scoreaverage,ec_course_targets_count,schooldata,ecComponentState,course_total_score,total_rate_data,ec_course_targets,graduation_list,target_list,target_score,evaluate_result,morelisttype,titlemessage,completiontype,completionlist,ismanager} = this.state; + let {Spintype,calculatesetype,ec_course_id,course_total_scoreaverage,score_levels,ec_course_targets_count,course_achievement,schooldata,course_rate,ecComponentState,course_total_score,total_rate_data,ec_course_targets,graduation_list,target_list,target_score,evaluate_result,morelisttype,titlemessage,completiontype,completionlist,ismanager} = this.state; let TargetresList = (length) => { let target_listres = []; for(let i = 0; i < length; i++) { // target_listres.push(目标{length-i}) // target_listres.push(目标{i+1}) - target_listres.push(目标{length-i}) + target_listres.push(目标{i+1}) } return target_listres } @@ -311,28 +360,30 @@ class EcCompletionCalculation extends Component { let target_listress = []; for(let i = 0; i < length; i++) { // target_listres.push(目标{length-i}) - target_listress.push(目标{i+1}) + target_listress.push(目标{i+1}) // target_listres.push(目标{length-i}) } return target_listress } - let TargetresContentList = (length,value) => { - let target_listres = []; - if(value!=undefined){ - for(let i = 0; i < length; i++) { - - if(value[i]===1){ - target_listres.push() - }else{ - target_listres.push() - } - - } - target_listres.reverse() - return target_listres - } - } + let TargetresContentList = (data,value) => { + let target_listres = []; + if(data){ + if(data.length>0){ + for(var i=0;i) + } else{ + target_listres.push() + + } + } + } + } + // target_listres.reverse() + return target_listres + }; @@ -393,7 +444,9 @@ class EcCompletionCalculation extends Component { } return target_listres } - } + }; + // console.log(ec_course_targets_count); + // console.log("EcCompletionCalculation"); return (
      -
      +
      {/**/} {/*
      */} {/*
      */} - + {/*课程目标*/}

      @@ -511,10 +564,10 @@ class EcCompletionCalculation extends Component {

    • {key+1} {item.content} - {item.result} - {item.standard_grade} - {item.real_grade} - {item.weigths} + {item.status==="not_achieved"?"未达成":"已达成"} + {item.standard_grade} + {item.actually_grade} + {item.weight}
    • ) @@ -523,7 +576,7 @@ class EcCompletionCalculation extends Component {
      - + {/*毕业要求指标点达成评价结果*/}
      @@ -540,6 +593,7 @@ class EcCompletionCalculation extends Component {

      毕业要求 {5} + 达成结果 达成目标值 达成实际值 @@ -560,52 +614,103 @@ class EcCompletionCalculation extends Component { {"--"} {"--"} {"--"} - 立即配置 + 立即配置 {TargetresContentList(5,[2,2,2,2,2])} :"" } + { Spintype===false?graduation_list.map((item,key)=>{ if(key===0){ return( -

      5 ? (76*(ec_course_targets_count+4)+380+15):1200+"px"}}> - 毕业要求 - {item.ec_subitem_content} - 达成结果 - 达成目标值 - 达成实际值 - 课程权重 +

    • 5 ? (76*(ec_course_targets_count+4)+380+15):1200+"px"}}> +
      + 毕业要求 +
      + {item.ec_subitem_content} +
      {TargetresList(ec_course_targets_count)} -

      +
      +
      + 课程权重 + 达成目标值 + 达成实际值 + 达成结果 +
      +
    • ) } }):"" } + {/*mynewtarget_scoreclassysls*/} + +
      + { + Spintype===false?graduation_list.map((item,key)=>{ + + return( + +
    • 5 ? (76*(ec_course_targets_count+4)+380+15):1200+"px"}}> +
      + {key+1} +
      + {item.content} +
      + {TargetresContentList(target_list,item.support_course_target_ids)} +
      +
      + {item.weights===null||item.weights===undefined||item.weights==="0.00"||item.weights===0.00||item.weights===0?立即配置:{item.weights}} + {item.actually_achievement===null?0:item.actually_achievement} + {item.objective_achievement===null?0:item.objective_achievement} + {item.status==="not_achieved"?"未完成":"完成"} +
      +
    • + + + //
    • 5 ? (76*(ec_course_targets_count+4)+380):1200+"px"}}> + // {/* {item.ec_graduation_name} */} + // {key+1} + // {item.content} + // {item.status==="not_achieved"?"未完成":"完成"} + // {item.objective_achievement===null?0:item.objective_achievement} + // {item.actually_achievement===null?0:item.actually_achievement} + // {item.weights===null||item.weights===0?立即配置:{item.weights}} + // {TargetresContentList(ec_course_targets_count,item.target_position)} + //
    • + ) + + }):"" + } + + +
      - - { - Spintype===false?graduation_list.map((item,key)=>{ - - return( -
    • 5 ? (76*(ec_course_targets_count+4)+380):1200+"px"}}> - {/* {item.ec_graduation_name} */} - {key+1} - {item.ec_subitem_content} - {item.result} - {item.reach_target===null?0:item.reach_target} - {item.reach_real_target===null?0:item.reach_real_target} - {item.weight===null||item.weight===0?立即配置:{item.weight}} - {TargetresContentList(ec_course_targets_count,item.target_position)} -
    • - ) - - }):"" - }
      + {/*课程总评成绩表*/}
      @@ -652,9 +757,9 @@ class EcCompletionCalculation extends Component { {/* 平均数 */} {/* 平均数 */} {Total_rate_dataList(course_total_score)} - { - course_total_score.length===0? --:"" - } + { + course_rate===undefined||course_rate===null||course_rate===""||course_rate==="0"||course_rate===0? --:{course_rate} + } :"" } {/*style={{width: 113*(total_rate_data+4)>1136?113*(total_rate_data+4):1136+"px"}}*/} @@ -687,7 +792,7 @@ class EcCompletionCalculation extends Component { {newTotal_rate_dataList(course_total_score-1,course_total_score)} {/* {course_total_score.length===0?"":course_total_score[course_total_score-1].total_score} */} { - course_total_score.length===0? --:{course_total_scoreaverage} + course_achievement===undefined||course_achievement===null||course_achievement===""||course_achievement==="0"||course_achievement===0? --:{course_achievement} } :"" } @@ -716,47 +821,63 @@ class EcCompletionCalculation extends Component { 平均分 最高分数 最低分数 - 90分以上 - 80-89分 - 70-79分 - 60-69分 - 50-59分 - 低于50分 + { + score_levels&&score_levels.map((i,k)=>{ + return( + {i.description} + ) + }) + }

      { - Spintype===false?target_score.map((i,k)=>{ + Spintype===false?target_list.map((i,k)=>{ return(
    • {k+1} - {i.average_score} - {i.top_score} - {i.low_score} - -
      {i.from90[0]}人
      -
      {(i.from90[1]).toFixed(2)}%
      -
      - -
      {i.from80[0]}人
      -
      {(i.from80[1]).toFixed(2)}%
      -
      - -
      {i.from70[0]}人
      -
      {(i.from70[1]).toFixed(2)}%
      -
      - -
      {i.from60[0]}人
      -
      {(i.from60[1]).toFixed(2)}%
      -
      - -
      {i.from50[0]}人
      -
      {(i.from50[1]).toFixed(2)}%
      -
      - -
      {i.from_down[0]}人
      -
      {(i.from_down[1]).toFixed(2)}%
      -
      + {i.standard_grade} + {i.maximum_score===null || i.maximum_score===undefined ||i.maximum_score===""?"--":i.maximum_score} + {i.minimum_score===null || i.minimum_score===undefined || i.minimum_score===""?"--":i.minimum_score} + { + i.score_levels.map((j,l)=>{ + + return( + +
      {j.count}人
      +
      {j.rate===null||j.rate===undefined||j.rate===""||j.rate===0?0.00:j.rate}%
      +
      + ) + } + ) + } + + {/*}*/} + {/**/} + {/*
      {i.from90[0]}人
      */} + {/*
      {(i.from90[1]).toFixed(2)}%
      */} + {/*
      */} + {/**/} + {/*
      {i.from80[0]}人
      */} + {/*
      {(i.from80[1]).toFixed(2)}%
      */} + {/*
      */} + {/**/} + {/*
      {i.from70[0]}人
      */} + {/*
      {(i.from70[1]).toFixed(2)}%
      */} + {/*
      */} + {/**/} + {/*
      {i.from60[0]}人
      */} + {/*
      {(i.from60[1]).toFixed(2)}%
      */} + {/*
      */} + {/**/} + {/*
      {i.from50[0]}人
      */} + {/*
      {(i.from50[1]).toFixed(2)}%
      */} + {/*
      */} + {/**/} + {/*
      {i.from_down[0]}人
      */} + {/*
      {(i.from_down[1]).toFixed(2)}%
      */} + {/*
      */} +
    • ) @@ -764,8 +885,8 @@ class EcCompletionCalculation extends Component { } { Spintype===true?}/>:"" } - - {target_score.length===0&&Spintype===false? + + {target_list.length===0&&Spintype===false?
    • -- -- diff --git a/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js index 6e27711b2..013357d44 100644 --- a/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js +++ b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/EcCourseEvaluationsbottom.js @@ -16,7 +16,7 @@ import 'antd/dist/antd.css'; import '../../css/ecCourseEvaluations.css'; import EcTitleCourseEvaluations from "../../ecTitle/ecTitle"; - +import './eccourseevalut.css' const $ = window.$; // 课程目标评价方法 @@ -48,21 +48,24 @@ class EcCourseEvaluationsbottom extends Component { meweacoursetype:false, newshowredvalue:false, percentagetype:false, - ismanager:false + ismanager:true } } getec_course_achievement_methods=()=>{ const {newec_course_idbottom}=this.state; if(newec_course_idbottom!=undefined){ - const url = `/ec_course_achievement_methods?ec_course_id=`+newec_course_idbottom; + // const url ='ec_courses/:course_id/course_targets.json'; + // const url = `/ec_course_achievement_methods?ec_course_id=`+newec_course_idbottom; + const course_id = 706 + const url =`/ec_courses/${course_id}/course_targets/course_achievement_methods.json`; axios.get(url, { withCredentials: true, }) .then((response)=>{ this.setState({ - achievement_list:response.data.achievement_list, + achievement_list:response.data.course_targets, spinningstate:false, - ismanager:response.data.is_manager + ismanager:true }) }).catch(function (error) { console.log(error); @@ -70,11 +73,11 @@ class EcCourseEvaluationsbottom extends Component { } // this.setState({ // achievement_list:[ - // {target_evaluate_data: [ + // {course_achievement_methods: [ // { // evaluate_id: 24, // evaluate_name: "期末考试", - // evaluation_relates_data: [ + // course_evaluation_subitems: [ // {evaluation_relates_id: 31, evaluation_relates_name: "期末考试1目标1考题"}, // {evaluation_relates_id: 32, evaluation_relates_name: "期末考试1目标2考题"} // ], @@ -113,25 +116,27 @@ class EcCourseEvaluationsbottom extends Component { }); } componentDidMount(){ - let ec_course_id=this.props.match.params.ec_course_id; - const url = `/ec_course_achievement_methods?ec_course_id=`+ec_course_id; - axios.get(url, { - withCredentials: true, - }) + let ec_course_id=this.props.match.params.ec_course_id; + const course_id = 706 + const url =`/ec_courses/${course_id}/course_targets/with_achievement_methods.json`; + // /ec_courses//course_targets/course_achievement_methods.json + // const url = `/ec_course_achievement_methods?ec_course_id=`+course_id; + axios.get(url) .then((response)=>{ this.setState({ - achievement_list:response.data.achievement_list, + achievement_list:response.data.course_targets, spinningstate:false, - ismanager:response.data.is_manager + ismanager:true }) }).catch(function (error) { console.log(error); }); - this.getNavigationData(ec_course_id); + // this.getNavigationData(ec_course_id); this.setState({ - newec_course_idbottom:ec_course_id + newec_course_idbottom:course_id }) + this.props.Ontitine("evaluation_methods"); } editecCourseEvaluationslist=(e)=>{ let id =e.target.getAttribute("target_id"); @@ -226,7 +231,7 @@ class EcCourseEvaluationsbottom extends Component { newec_course_target_id:id, methodologytype:true, ec_course_target_name:response.data.ec_course_target_name, - ismanager:response.data.is_manager + ismanager:true }) // this.setState({ @@ -427,15 +432,16 @@ class EcCourseEvaluationsbottom extends Component { EvaluationsSaveonloadgetdata=(id)=>{ - const url = `/ec_course_achievement_methods?ec_course_id=`+id + const course_id = 706; + const url = `/ec_courses/${course_id}/course_targets/with_achievement_methods.json`; axios.get(url, { withCredentials: true, }) .then((response)=>{ this.setState({ - achievement_list:response.data.achievement_list, + achievement_list:response.data.course_targets, spinningstate:false, - ismanager:response.data.is_manager + ismanager:true }) }).catch(function (error) { @@ -554,7 +560,9 @@ class EcCourseEvaluationsbottom extends Component { } - var Url = '/ec_course_achievement_methods/create_evaluation_methods'; + // var Url = '/ec_course_achievement_methods/create_evaluation_methods'; + var Url = '/ec_courses/:course_id/course_targets/:target_id/course_achievement_methods.json'; + axios.post(Url, { ec_course_target_id: newec_course_target_id, achievement_methods:achievement_methods @@ -575,7 +583,7 @@ class EcCourseEvaluationsbottom extends Component { achievement_methods:undefined, eacoursesavetypes:false, newshowredvalue:false, - ismanager:response.data.is_manager + ismanager:true }) // $("#ecCourseEvaluationsbottomsubmit").hide(); // $("#SystemParametersbottom").hide(); @@ -662,6 +670,8 @@ class EcCourseEvaluationsbottom extends Component { percentagetype, ismanager } = this.state; + // console.log("EcCourseEvaluationsbottom12345"); + // console.log(achievement_list); return (
      @@ -760,35 +770,35 @@ class EcCourseEvaluationsbottom extends Component {

      { - achievement_list.length===0?}/>:achievement_list.map((item,key)=>{ + achievement_list===undefined?"":achievement_list&&achievement_list.length===0?}/>:achievement_list&&achievement_list.map((item,key)=>{ return(
      { - item.target_evaluate_data.length===0? -
    • -
      - {key+1} + item.course_achievement_methods.length===0? +
    • +
      + {key+1} - + - +
      - +
      - +
      - +
      @@ -797,9 +807,9 @@ class EcCourseEvaluationsbottom extends Component { {/* 修改start*/}
      -
      +
      {/*
      */} -
      +
      {/* 课程目标{sequenceid}:{ec_course_target_name} */} 课程目标{key+1}:{ec_course_target_name} @@ -883,20 +893,20 @@ class EcCourseEvaluationsbottom extends Component {
    • - :item.target_evaluate_data.map((i,k)=>{ + :item.course_achievement_methods.map((i,k)=>{ return( -
    • -
      - {key-k===key?key+1:""} +
    • +
      + {key-k===key?key+1:""} - - {i.evaluate_name} + + {i.course_evaluation.name} - + { - i.evaluation_relates_data.map((y,e)=>{ + i.course_evaluation_subitems.map((y,e)=>{ return( -
      {y.evaluation_relates_name+" "}
      +
      {y.name+" "}
      ) }) } @@ -919,11 +929,11 @@ class EcCourseEvaluationsbottom extends Component { } - +
      {i.percentage+"%"}
      - +
      {i.score}
      @@ -931,8 +941,8 @@ class EcCourseEvaluationsbottom extends Component {
      {/* 修改start*/}
      -
      -
      +
      +
      {/* 课程目标{sequenceid}:{ec_course_target_name} */} 课程目标{key+1}:{ec_course_target_name} diff --git a/public/react/src/modules/ecs/subroute/ecCourseEvaluations/eccourseevalut.css b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/eccourseevalut.css new file mode 100644 index 000000000..c9a05d7ec --- /dev/null +++ b/public/react/src/modules/ecs/subroute/ecCourseEvaluations/eccourseevalut.css @@ -0,0 +1,8 @@ +.yslinitials{ + + display: flex; + flex-direction:initial; +} +.yslpadding{ + padding: 0px 30px; +} \ No newline at end of file diff --git a/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/EditableCourseSupportSetting.js b/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/EditableCourseSupportSetting.js new file mode 100644 index 000000000..70b39241c --- /dev/null +++ b/public/react/src/modules/ecs/subroute/ecCourseSupportSetting/EditableCourseSupportSetting.js @@ -0,0 +1,476 @@ +import React, { Component } from 'react'; + +import moment from 'moment' +import { getUrl } from 'educoder' +import { Form, Input, Icon, Button, Select, InputNumber } from 'antd'; +const { TextArea } = Input; +const { Option } = Select; + +let _url_origin = getUrl() +const $ = window.$ +// https://www.educoder.net/stylesheets/css/common.css?1546618720 +if (!window['EcLoaded']) { + $('head').append( $('') + .attr('href', `${_url_origin}/stylesheets/css/common.css?1525440977`) ); + window['EcLoaded'] = true +} + +let id = 0; + + +/** + target_id + position + target_weight + target_contents + + subitem_id + index + subitem_contents + +*/ +const data = +[{"position":0,"target_weight":0.02,"target_contents":"12","standard_grade":2,"subitem_id":"65"},{"position":3,"target_id":"0","target_weight":0.1,"target_contents":"理解数据管理技术和数据库技术的发展,区分不同数据模型的作用和特点,描述数据库系统的类型、结构、数据独立性。","standard_grade":60,"subitem_id":"66"},{"position":4,"target_weight":1,"target_contents":"22","standard_grade":33,"subitem_id":"66"},{"position":11,"target_id":"1","target_weight":0.1,"target_contents":"理解数据管理技术和数据库技术的发展,区分不同数据模型的作用和特点,描述数据库系统的类型、结构、数据独立性。","standard_grade":61,"subitem_id":"65"}] +; +let _data = [ + { + target_id: 0, + position: 1, + target_weight: 0.1, + target_contents: '理解数据管理技术和数据库技术的发展,区分不同数据模型的作用和特点,描述数据库系统的类型、结构、数据独立性。', + standard_grade: 60, + // biyeYaoqiuZhibiaodian: ':能够运用相关的工程基础和专业知识辨别材料生产中出现的技术、工艺、质量等问题', + "subitem_id": 64, + "index": "1-1", + "subitem_contents": "能够运用相关的工程基础和专业知识辨别材料生产中出现的技术、工艺、质量等问题" + }, + { + target_id: 1, + position: 2, + target_weight: 0.1, + target_contents: '理解数据管理技术和数据库技术的发展,区分不同数据模型的作用和特点,描述数据库系统的类型、结构、数据独立性。', + standard_grade: 61, + // biyeYaoqiuZhibiaodian: ':能够运用相关的工程基础和专业知识辨别材料生产中出现的技术、工艺、质量等问题', + "subitem_id": 65, + "index": "1-2", + "subitem_contents": "222能够运用相关的工程基础和专业知识辨别材料生产中出现的技术、工艺、质量等问题" + } +] +const item = {} + +class EditableCourseSupportSetting extends Component { + constructor(props) { + super(props) + this.state = { + addOrDeleting: false, + errorMsg: '' + } + } + onRemove = (k) => { + let fValues = this.props.form.getFieldsValue(); + if ( + // fValues.standard_grade[k] && fValues.standard_grade[k] != 75 + // || fValues.subitem_id[k] + // || + fValues.target_contents[k] + // || fValues.target_weight[k] + ) { + this.props.showModal('提示', '确定要删除吗?', () => { + this.remove(k) + }) + } else { + this.remove(k) + } + } + remove = (k) => { + const { form } = this.props; + // can use data-binding to get + const keys = form.getFieldValue('keys'); + // We need at least one passenger + // if (keys.length === 1) { + // return; + // } + if (keys.length === 1) { + this.setState({ errorMsg: '至少得保留一条数据' }) + return; + } + // 清除悬浮tip + window.$('.data-tip-down').hide() + + console.log('remove :' , k , this.position2Target_idMap[k]) + delete this.position2Target_idMap[k] + // can use data-binding to set + form.setFieldsValue({ + keys: keys.filter(key => key !== k), + }); + } + _reverseMap = (map) => { + let newMap = {} + for (var k in map) { + newMap[map[k]] = k; + } + return newMap + } + addIfNewKeyExist = (newKey, index_arg) => { + this.setState({ addOrDeleting: true }) + const { form } = this.props; + const keys = form.getFieldValue('keys'); + /** + [0,1,2,3] + ['11', '22', '33', '44'] + -> + [0,1,2,3,4] + ['11', '22', empty, '33', '44'] + + */ + const target_weight = form.getFieldValue('target_weight'); + const target_contents = form.getFieldValue('target_contents'); + const standard_grade = form.getFieldValue('standard_grade'); + const subitem_id = form.getFieldValue('subitem_id'); + keys.splice(index_arg, 0, newKey); + + // position2Target_idMap + // {1:2, 2:3, 3:4, 4:6 } --> {1:2, 2:3, 3:7, 4:4, 5:6 } + // 更新key/position 映射到target_id的map + // 两次revers,用这个结构,达到给position加1的效果 + let reverseMap = this._reverseMap(this.position2Target_idMap); + for (let i = index_arg ; i < keys.length; i++) { + if(keys[i] === keys[i+1]) { // 找到开始+1的行 + continue; + } + let target_id = this.position2Target_idMap[keys[i]]; + reverseMap[target_id] = parseInt(reverseMap[target_id]) + 1; + keys[i] = keys[i] + 1; + } + for (let i = 0 ; i < keys.length - 1; i++) { + if (keys[i] == keys[i + 1]) { + debugger; + } + } + this.position2Target_idMap = this._reverseMap(reverseMap); + + + target_weight.splice(newKey, 0, undefined); + target_contents.splice(newKey, 0, undefined); + standard_grade.splice(newKey, 0, undefined); + subitem_id.splice(newKey, 0, undefined); + + setTimeout(() => { + form.setFieldsValue({ + target_weight, + target_contents, + standard_grade, + subitem_id + }); + window.$('.data-tip-down').hide() + this.setState({ addOrDeleting: false }) + + }, 300) + form.setFieldsValue({ + keys: keys + }); + + } + add = (k, index) => { + this.setState({ errorMsg: '' }) + + const { form } = this.props; + // can use data-binding to get + const keys = form.getFieldValue('keys'); + let nextKeys ; + let newKey = k + 1; + + const newKeyIndex = keys.indexOf(newKey) + if (newKeyIndex != -1) { + // 新key存在,将新key位置及以后的row后移,直到找到一个之后的空位置 + this.addIfNewKeyExist(newKey, index) + } else { // 如果这个新key不存在 + // keys[newIndex] = newKey + keys.splice(index === 0 && k === -1 ? 0 : index, 0, newKey); + } + // can use data-binding to set + // important! notify form to detect changes + form.setFieldsValue({ + keys: keys, + }); + } + + handleSubmit = (e) => { + if (!this.props.is_manager) { + this.props.showModal('提示', '您没权限编辑,请联系管理员。') + return; + } + this.setState({ errorMsg: '' }) + e.preventDefault && e.preventDefault(); + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + let keysLen = values.keys.length + if (keysLen < 1) { + this.setState({ errorMsg: '至少得保留一条数据' }) + } + var data = [] + while( keysLen-- ) { + data.push({}) + } + for (var valKey in values) { + + let dataIndex = 0 + values[valKey].forEach( (item,index) => { + let _val = values[valKey][index]; + if (_val || _val == 0) { + data[dataIndex][valKey === 'keys' ? 'position' : valKey] = _val + if (valKey === 'keys' && (this.position2Target_idMap[_val] || this.position2Target_idMap[_val] === 0) ) { + data[dataIndex].target_id = this.position2Target_idMap[_val] + } + dataIndex++; + } + }) + } + + console.log('Received values of form: ', values, data); + + let totalWeight = 0; + values.target_weight.forEach(item => { + if (item) { + totalWeight += item + } + }) + // 精度问题 0.2 + 0.7 = 0.8999999999 + if (parseInt((totalWeight * 100).toFixed(1)) != 100) { + this.setState({ errorMsg: '请先保证权重和等于1' }) + return; + } + + this.props.updateCourseTargets(data) + } else { + + const keyRowNumMap = {} + let rowNum = 1; + for (var key in values.target_contents) { + keyRowNumMap[key] = rowNum; + rowNum++; + } + + // err.target_contents[1].errors[0] + // {message: "请填入目标内容", field: "target_contents[1]"} + for (var key in err) { + for (var _k in err[key]) { + let errorObj = err[key][_k].errors[0]; + + let _key = errorObj.field.match(`[(0-9)]`) + this.setState({ errorMsg: `第${keyRowNumMap[_key]}行,${errorObj.message}` }) + return; + // console.log(`第${keyRowNumMap[_key]}行,${errorObj.message}`); + } + } + } + + + }); + } + + componentDidMount = () => { + this.position2Target_idMap = {} + const { form } = this.props; + + const data = this.props.course_targets + + let target_weight = [] + let target_contents = [] + let standard_grade = [] + // let biyeYaoqiuZhibiaodian = [] + let subitem_id = [] + let keys = [] + + data.forEach(item => { + keys.push(item.position); + target_weight[item.position] = (item.target_weight) + target_contents[item.position] = (item.target_contents); + standard_grade[item.position] = (item.standard_grade); + // biyeYaoqiuZhibiaodian[item.position] = (item.biyeYaoqiuZhibiaodian); + + subitem_id[item.position] = item.subitem_id ? (item.subitem_id).toString() : item.subitem_id; + + this.position2Target_idMap[item.position] = item.target_id + }) + form.setFieldsValue({ + keys + }); + setTimeout(() => { + form.setFieldsValue({ + // keys, + target_weight, + target_contents, + standard_grade, + // biyeYaoqiuZhibiaodian, + subitem_id, + }); + // this.forceUpdate() + }, 3000) + + + } + + + render() { + const { getFieldDecorator, getFieldValue } = this.props.form; + const { requirements } = this.props; + const { addOrDeleting } = this.state; + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 4 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 20 }, + }, + }; + const formItemLayoutWithOutLabel = { + wrapperCol: { + xs: { span: 24, offset: 0 }, + sm: { span: 20, offset: 4 }, + }, + }; + getFieldDecorator('keys', { initialValue: [] }); + const keys = getFieldValue('keys'); + const formItems = keys.map((k, index) => ( +
    • + + { index + 1 } + + {getFieldDecorator(`target_weight[${k}]`, { + // validateTrigger: ['onChange', 'onBlur'], + rules: [{ + required: true, + whitespace: true, + type: 'number', + message: "请填入权重", + }], + })( + + )} + + + {getFieldDecorator(`target_contents[${k}]`, { + // validateTrigger: ['onChange', 'onBlur'], + rules: [{ + required: true, + // whitespace: true, + message: "请填入目标内容", + }], + })( +