diff --git a/app/assets/javascripts/admins/subject_settings/index.js b/app/assets/javascripts/admins/subject_settings/index.js index 80fc91f47..cbd90f37b 100644 --- a/app/assets/javascripts/admins/subject_settings/index.js +++ b/app/assets/javascripts/admins/subject_settings/index.js @@ -30,22 +30,6 @@ $(document).on('turbolinks:load', function () { }); - $(".action-container").on("change", '.subject-mobile-form', function () { - var s_id = $(this).attr("data-id"); - var s_value = $(this).val(); - var s_name = $(this).attr("name"); - var json = {}; - var s_index = $(this).parent("td").siblings(".shixun-line-no").text(); - json[s_name] = s_value; - json["page_no"] = s_index; - $.ajax({ - url: "/admins/subject_settings/update_mobile_show?subject_id=" + s_id, - type: "POST", - dataType:'script', - data: json - }); - }); - $(".subject-setting-list-container").on("change", '.subject-setting-form', function () { var s_id = $(this).attr("data-id"); var s_value = $(this).val(); diff --git a/app/queries/admins/subject_query.rb b/app/queries/admins/subject_query.rb index dc459885b..0415deb9f 100644 --- a/app/queries/admins/subject_query.rb +++ b/app/queries/admins/subject_query.rb @@ -18,9 +18,9 @@ class Admins::SubjectQuery < ApplicationQuery status = case params[:status].to_s.strip when "editing" then {status: 0} - when "processed" then {status: 2, public: 0} + when "applying" then {status: 2, public: [0, 1]} when "pending" then {public: 1} - when "publiced" then {public: 2} + when "published" then {public: 2} end subjects = subjects.where(status) if status diff --git a/app/views/admins/subject_settings/index.html.erb b/app/views/admins/subject_settings/index.html.erb index bcd2a2fc8..b46c1d90d 100644 --- a/app/views/admins/subject_settings/index.html.erb +++ b/app/views/admins/subject_settings/index.html.erb @@ -6,7 +6,7 @@ <%= form_tag(admins_subject_settings_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
- <% status_options = [['全部', ''], ['编辑中', 'pending'], ['审核中', 'applying'], ['已发布', 'published']] %> + <% status_options = [['全部', ''], ['编辑中', 'pending'], ['审核中', 'applying'], ['已公开', 'published']] %> <%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
diff --git a/app/views/admins/subject_settings/shared/_td.html.erb b/app/views/admins/subject_settings/shared/_td.html.erb index ed8216bbb..94d34f42d 100644 --- a/app/views/admins/subject_settings/shared/_td.html.erb +++ b/app/views/admins/subject_settings/shared/_td.html.erb @@ -5,7 +5,7 @@ 金课 <%= display_text subject.repertoire&.name %> -<%= display_text subject.status == 2 ? "已发布" : "未发布" %> +<%= display_text subject.public == 2 ? "已公开" : ((subject.public == 1 && subject.status == 2) ? "审核中" : "未发布") %> <%= select_tag(:sub_disciplines, options_for_select(@sub_disciplines, subject.sub_disciplines.pluck(:id)),multiple:true,class:"form-control subject-setting-form",data:{id:subject.id},id:"tags-chosen-#{subject.id}") %> @@ -26,4 +26,22 @@ multiple: true, maximumSelectionLength: 3, placeholder: '请选择课程体系'}); + + + $(".action-container").on("change", '.subject-mobile-form', function () { + var s_id = $(this).attr("data-id"); + var s_value = $(this).val(); + var s_name = $(this).attr("name"); + var json = {}; + var s_index = $(this).parent("td").siblings(".shixun-line-no").text(); + json[s_name] = s_value; + json["page_no"] = s_index; + $.ajax({ + url: "/admins/subject_settings/update_mobile_show?subject_id=" + s_id, + type: "POST", + dataType:'script', + data: json + }); + }); + \ No newline at end of file diff --git a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js index 884f93b24..707c757fd 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForthRules.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForthRules.js @@ -263,8 +263,13 @@ class PollDetailTabForthRules extends Component{ flag1=false; } else if(!arr.e_timeflag && moment(arr.end_time,dataformat) <= moment()){ - arr.end_flag="截止时间不能早于当前时间" - flag1=false; + if(this.props.type==="Shixun"){ + + }else{ + arr.end_flag="截止时间不能早于当前时间" + flag1=false; + } + }else if(!arr.e_timeflag && moment(arr.end_time,dataformat) <= moment(arr.publish_time,dataformat)){ arr.end_flag="截止时间不能早于发布时间" flag1=false; @@ -314,8 +319,13 @@ class PollDetailTabForthRules extends Component{ flag2=false; } else if(moment(arr.end_time,dataformat) <= moment()){ - arr.end_flag="截止时间不能早于当前时间" - flag2=false; + if(this.props.type==="Shixun"){ + + }else{ + arr.end_flag="截止时间不能早于当前时间" + flag2=false; + } + }else if(moment(arr.end_time,dataformat) <= moment(arr.publish_time,dataformat)){ arr.end_flag="截止时间不能早于发布时间" flag2=false; diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 405291691..a6cefb466 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -468,13 +468,13 @@ class Trainingjobsetting extends Component { if (moment(this.state.end_time, "YYYY-MM-DD HH:mm") <= moment()) { //截止时间小于当前时间 - this.scrollToAnchor("publishtimeid"); - this.setState({ - unit_e_tip: "截止时间不能早于当前时间", - p_flag: true, - borredss: "bor-reds", - }) - return; + // this.scrollToAnchor("publishtimeid"); + // this.setState({ + // unit_e_tip: "截止时间不能早于当前时间", + // p_flag: true, + // borredss: "bor-reds", + // }) + // return; } if (moment(this.state.end_time, "YYYY-MM-DD HH:mm") <= moment(this.state.publish_time, "YYYY-MM-DD HH:mm")) { //截止时间小于发布时间 @@ -787,6 +787,7 @@ class Trainingjobsetting extends Component { .then((result) => { if (result.data.status == 0) { // console.log(JSON.stringify(result)); + this.getTrainingjobsetting(true); this.props.showNotification(`更新成功`); this.setState({ flagPageEditsbox: false,