From dbaed7bc121ff38688aa2ea94092e1ea1e754f6f Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 13 May 2019 09:42:08 +0800 Subject: [PATCH 1/2] modify reject trial auth modal --- .../_reject_authorization_model.html.erb | 32 ++++++++++++++++--- .../_trial_authorization_passed_list.html.erb | 4 ++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/app/views/managements/_reject_authorization_model.html.erb b/app/views/managements/_reject_authorization_model.html.erb index 4d35359f..6d7468f4 100644 --- a/app/views/managements/_reject_authorization_model.html.erb +++ b/app/views/managements/_reject_authorization_model.html.erb @@ -51,15 +51,15 @@ - +
  • - - + +
  • @@ -79,8 +79,23 @@ var modal = $(".modal.reject-auth-modal"); var form = modal.find("#reject-auth-form"); var applyIdInput = form.find("input[name='apply_id']"); + var rejectDescriptionSpan = form.find(".reject-description-label span"); + var needRejectDescription = false; var error = modal.find(".error"); + modal.on("click", "input[name='reasons[]']", function(){ + var checkbox = $(this); + if (checkbox.data("type") != "other") { return; } + + if (checkbox.prop("checked")) { + needRejectDescription = true; + rejectDescriptionSpan.show(); + } else { + needRejectDescription = false; + rejectDescriptionSpan.hide(); + } + }); + modal.on('click', '.submit-btn', function(){ if (!formValid()) { return; } form.submit(); @@ -88,8 +103,13 @@ var formValid = function () { error.html("").hide(); - if (form.find("input[name='reasons[]']:checked").length == 0 || form.find("textarea[name='reject_description']").val() == '') { - error.html("原因和说明不能为空,请完善后再确认提交").show(); + if (form.find("input[name='reasons[]']:checked").length == 0) { + error.html("撤销原因不能为空,请完善后再确认提交").show(); + return false; + } + + if (needRejectDescription && form.find("textarea[name='reject_description']").val() == '') { + error.html("备注说明不能为空,请完善后再确认提交").show(); return false; } @@ -100,6 +120,8 @@ applyIdInput.val(''); form.find("textarea[name='reject_description']").val(''); form.find("input[name='reasons[]']").each(function(){this.checked=false;}) + needRejectDescription = false; + rejectDescriptionSpan.hide(); modal.hide(); }; // 隐藏弹窗 diff --git a/app/views/managements/_trial_authorization_passed_list.html.erb b/app/views/managements/_trial_authorization_passed_list.html.erb index 6f31ffc6..bfaf91c2 100644 --- a/app/views/managements/_trial_authorization_passed_list.html.erb +++ b/app/views/managements/_trial_authorization_passed_list.html.erb @@ -38,7 +38,9 @@ <% if authorization.status == 2 %>
  • 原因:<%= authorization.reason.blank? ? "空" : authorization.reason %>
  • -
  • 备注说明:<%= authorization.reject_description.blank? ? "空" : authorization.reject_description %>
  • + <% if authorization.reject_description.present? %> +
  • 备注说明:<%= authorization.reject_description %>
  • + <% end %> <% end %> From 8c3767cfa20c6da13f4013221a1b22ebf6e116c7 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Mon, 13 May 2019 10:38:05 +0800 Subject: [PATCH 2/2] fix my account page reject trial auth notify modal bug --- app/views/my/account.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index e70c3555..5103d7f9 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -103,7 +103,7 @@ <% if @trail_authentication.status == 1 %> sure_box_redirect_without_newtab("<%= user_path(@user) %>", "试用申请已被接受"); <% elsif @trail_authentication.status == 2 %> - sure_box_redirect_without_newtab_btn("<%= my_account_path %>", "试用申请已被拒绝
    原因:<%= @trail_authentication.reason %>", "重新申请"); + sure_box_redirect_without_newtab_btn("<%= my_account_path %>", "试用申请已被拒绝
    原因:<%= [@trail_authentication.reason, @trail_authentication.reject_description].join(';') %>", "重新申请"); <% end %> <% end %>