diff --git a/app/assets/javascripts/admins/competition_settings/index.js b/app/assets/javascripts/admins/competition_settings/index.js index 4804ae16e..03c940b88 100644 --- a/app/assets/javascripts/admins/competition_settings/index.js +++ b/app/assets/javascripts/admins/competition_settings/index.js @@ -9,7 +9,7 @@ $(document).on('turbolinks:load', function(){ }; var timeOptions = { - // autoclose: true, + autoclose: 1, language: 'zh-CN', format: 'yyyy-mm-dd hh:ii:ss', minuteStep: 30 @@ -23,18 +23,9 @@ $(document).on('turbolinks:load', function(){ $(element).find('.end-date').datepicker('setStartDate', e.date); }); }; + $(".competition-start-end-date .start-date").datetimepicker(timeOptions); - var defineTimeRangeSelect = function (element) { - // var options = $.extend({inputs: $(element).find('.start-date, .end-date')}, timeOptions); - $(".start-date").datetimepicker(timeOptions); - - $(element).find('.start-date').datetimepicker().on('changeDate', function (e) { - $(element).find('.end-date').datetimepicker('setStartDate', e.date); - }); - }; - $(".competition-start-end-date .start-date").datetimepicker(); - - $(".competition-start-end-date .end-date").datetimepicker(); + $(".competition-start-end-date .end-date").datetimepicker(timeOptions); defineDateRangeSelect('.teaching-mode-date'); // defineTimeRangeSelect('.competition-start-end-date'); @@ -62,13 +53,13 @@ $(document).on('turbolinks:load', function(){ if ($("input[name='mode']:checked").val() == 2) { var $courseId = $("input[name='course_id'"); - if ($courseId.val() === undefined || $course_id.val().length === 0) { + if ($courseId.val() === undefined || $courseId.val().length === 0) { $courseId.addClass('danger text-danger'); valid = false; } else { $courseId.removeClass('danger text-danger'); } - } else if ($("input[name='mode']:checked").val() == 4) { + } else if ($("input[name='mode']:checked").val() == 3) { var $techStartTime = $("input[name='teach_start_time'"); var $techEndTime = $("input[name='teach_end_time'"); if ($techStartTime.val() === undefined || $techStartTime.val().length === 0) { @@ -84,6 +75,10 @@ $(document).on('turbolinks:load', function(){ } else { $techEndTime.removeClass('danger text-danger'); } + } else { + $("input[name='course_id'").removeClass('danger text-danger'); + $("input[name='teach_start_time'").removeClass('danger text-danger'); + $("input[name='teach_end_time'").removeClass('danger text-danger'); } if (!valid) return; @@ -113,81 +108,80 @@ $(document).on('turbolinks:load', function(){ $(function () { //MD编辑 - $("#MD_typeFrom").on("click",".add_MD_type",function () { - - var length=$(".MD_type").find(".add_MD_type").length + 1; - var html='