diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index 884580a94..72a2ff118 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -1,42 +1,61 @@ -//= require rails-ujs -//= require activestorage -//= require turbolinks -//= require jquery3 -//= require popper -//= require bootstrap-sprockets -//= require jquery.validate.min -//= require additional-methods.min -//= require bootstrap-notify -//= require jquery.cookie.min -//= require select2 -//= require jquery.cxselect -//= require bootstrap-datepicker - -//= require_tree ./i18n -//= require_tree ./admins - -// ******** select2 global config ******** -$.fn.select2.defaults.set('theme', 'bootstrap4'); -$.fn.select2.defaults.set('language', 'zh-CN'); - -Turbolinks.setProgressBarDelay(200); - -$(document).on('turbolinks:load', function(){ - $('[data-toggle="tooltip"]').tooltip(); - $('[data-toggle="popover"]').popover(); - - // flash alert提示框自动关闭 - if($('.admin-alert-container .alert').length > 0){ - setTimeout(function(){ - $('.admin-alert-container .alert').alert('close'); - }, 2000); - } -}); - -$(document).on("turbolinks:before-cache", function () { - $('[data-toggle="tooltip"]').tooltip('hide'); - $('[data-toggle="popover"]').popover('hide'); -}); - -$(function () { +//= require rails-ujs +//= require activestorage +//= require turbolinks +//= require jquery3 +//= require popper +//= require bootstrap-sprockets +//= require jquery.validate.min +//= require additional-methods.min +//= require bootstrap-notify +//= require jquery.cookie.min +//= require select2 +//= require jquery.cxselect +//= require bootstrap-datepicker +//= require bootstrap.viewer + +//= require_tree ./i18n +//= require_tree ./admins + +// ******** select2 global config ******** +$.fn.select2.defaults.set('theme', 'bootstrap4'); +$.fn.select2.defaults.set('language', 'zh-CN'); + +Turbolinks.setProgressBarDelay(200); + +$(document).on('turbolinks:load', function(){ + $('[data-toggle="tooltip"]').tooltip(); + $('[data-toggle="popover"]').popover(); + + // 图片查看大图 + $('img.preview-image').bootstrapViewer(); + + // flash alert提示框自动关闭 + if($('.admin-alert-container .alert').length > 0){ + setTimeout(function(){ + $('.admin-alert-container .alert').alert('close'); + }, 2000); + } +}); + +// var progressBar = new Turbolinks.ProgressBar(); + +// $(document).on('ajax:send', function(event){ +// console.log('ajax send', event); +// progressBar.setValue(0) +// progressBar.show() +// }); +// +// $(document).on('ajax:complete', function(event){ +// console.log('ajax complete', event); +// progressBar.setValue(1) +// progressBar.hide() // 分页时不触发,奇怪 +// }); +// $(document).on('ajax:success', function(event){ +// console.log('ajax success', event); +// }); +// $(document).on('ajax:error', function(event){ +// console.log('ajax error', event); +// }); + +$(function () { }); \ No newline at end of file diff --git a/app/assets/javascripts/admins/common-refuse-modal.js b/app/assets/javascripts/admins/common-refuse-modal.js new file mode 100644 index 000000000..5eb2f3f46 --- /dev/null +++ b/app/assets/javascripts/admins/common-refuse-modal.js @@ -0,0 +1,54 @@ +$(document).on('turbolinks:load', function() { + var $refuseModal = $('.admin-common-refuse-modal'); + if ($refuseModal.length > 0) { + var $form = $refuseModal.find('form.admin-common-refuse-form'); + var $applyIdInput = $refuseModal.find('.modal-body input[name="apply_id"]'); + + $form.validate({ + errorElement: 'span', + errorClass: 'danger text-danger', + rules: { + reason: { + required: true, + maxlength: 200 + }, + } + }); + + // modal ready fire + $refuseModal.on('show.bs.modal', function (event) { + var $link = $(event.relatedTarget); + + var applyId = $link.data('id'); + var url = $link.data('url'); + + $applyIdInput.val(applyId); + $form.data('url', url); + }); + // modal visited fire + $refuseModal.on('shown.bs.modal', function(){ + $refuseModal.find('.modal-body input[name="reason"]').focus(); + }); + $refuseModal.on('hide.bs.modal', function () { + $applyIdInput.val(''); + $form.data('url', ''); + }) + + $refuseModal.on('click', '.submit-btn', function(){ + $form.find('.error').html(''); + + if ($form.valid()) { + var url = $form.data('url'); + + $.ajax({ + method: 'POST', + dataType: 'script', + url: url, + data: $form.serialize(), + }).done(function(){ + $refuseModal.modal('hide'); + }); + } + }); + } +}); \ No newline at end of file diff --git a/app/assets/javascripts/admins/identity_authentications/index.js b/app/assets/javascripts/admins/identity_authentications/index.js new file mode 100644 index 000000000..2da644ec2 --- /dev/null +++ b/app/assets/javascripts/admins/identity_authentications/index.js @@ -0,0 +1,18 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-identity-authentications-index-page').length > 0) { + var $searchFrom = $('.identity-authentication-list-form'); + + $searchFrom.on('click', '.search-form-tab', function(){ + var $link = $(this); + + $searchFrom.find('input[name="keyword"]').val(''); + $searchFrom.find('select[name="status"]').val('processed'); + + if($link.data('value') === 'processed'){ + $searchFrom.find('.status-filter').show(); + } else { + $searchFrom.find('.status-filter').hide(); + } + }); + } +}) \ No newline at end of file diff --git a/app/assets/javascripts/admins/professional_authentications/index.js b/app/assets/javascripts/admins/professional_authentications/index.js new file mode 100644 index 000000000..769a6b2fc --- /dev/null +++ b/app/assets/javascripts/admins/professional_authentications/index.js @@ -0,0 +1,18 @@ +$(document).on('turbolinks:load', function() { + if ($('body.admins-professional-authentications-index-page').length > 0) { + var $searchFrom = $('.professional-authentication-list-form'); + + $searchFrom.on('click', '.search-form-tab', function(){ + var $link = $(this); + + $searchFrom.find('input[name="keyword"]').val(''); + $searchFrom.find('select[name="status"]').val('processed'); + + if($link.data('value') === 'processed'){ + $searchFrom.find('.status-filter').show(); + } else { + $searchFrom.find('.status-filter').hide(); + } + }); + } +}) \ No newline at end of file diff --git a/app/assets/javascripts/admins/search-form-tab.js b/app/assets/javascripts/admins/search-form-tab.js new file mode 100644 index 000000000..6009412d5 --- /dev/null +++ b/app/assets/javascripts/admins/search-form-tab.js @@ -0,0 +1,10 @@ +$(document).on('turbolinks:load', function() { + var $tabs = $('.search-form-container .search-form-tabs'); + if ($tabs.length > 0) { + $tabs.on('click', '.search-form-tab', function(){ + var $activeTab = $(this); + $tabs.find('.search-form-tab').removeClass('active'); + $activeTab.addClass('active'); + }); + } +}); \ No newline at end of file diff --git a/app/assets/javascripts/bootstrap.viewer.js b/app/assets/javascripts/bootstrap.viewer.js new file mode 100755 index 000000000..4c6aa549a --- /dev/null +++ b/app/assets/javascripts/bootstrap.viewer.js @@ -0,0 +1,50 @@ +/* + * Copyright 2018-2018 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * WebSite: http://bootstrap-viewer.leftso.com + */ +$.fn.bootstrapViewer = function (options) { + $(this).on('click', function () { + var opts = $.extend({}, $.fn.bootstrapViewer.defaults, options); + var viewer = $('
头像 | +姓名 | +身份证号 | +学校/单位 | +职称 | + <% unless is_processed %> ++ 照片 + + | + <% end %> +时间 | + <% if is_processed %> +拒绝原因 | +状态 | + <% else %> +操作 | + <% end %> +
---|---|---|---|---|---|---|---|---|---|
+ <%= link_to "/users/#{user.login}", class: 'identity-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
+ |
+ <%= user.real_name %> | +<%= user.ID_number %> | +<%= raw [user.school_name.presence, user.department_name.presence].compact.join(' ') %> |
+ <%= user.identity %> <%= raw user.user_extension.student? && user.student_id ? " #{user.student_id}" : '' %> |
+
+ <% unless is_processed %>
+ + <% if File.exists?(disk_real_name_auth_filename(user.id)) %> + <%= image_tag(real_name_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> + <% else %> + <%= content_tag(:span, '图片已删除', class: 'text-secondary') %> + <% end %> + | + <% end %> + +<%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %> | + + <% if is_processed %> +<%= overflow_hidden_span apply.remarks, width: 140 %> | +<%= apply.status_text %> | + <% else %> ++ <%= agree_link '同意', agree_admins_identity_authentication_path(apply, element: ".identity-authentication-#{apply.id}"), 'data-confirm': '确认审核通过?' %> + <%= javascript_void_link('拒绝', class: 'action refuse-action', + data: { + toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, + url: refuse_admins_identity_authentication_path(apply, element: ".identity-authentication-#{apply.id}") + }) %> + | + <% end %> +
头像 | +姓名 | +学校/单位 | +职称 | + <% unless is_processed %> ++ 照片 + + | + <% end %> +时间 | + <% if is_processed %> +拒绝原因 | +状态 | + <% else %> +操作 | + <% end %> +
---|---|---|---|---|---|---|---|---|
+ <%= link_to "/users/#{user.login}", class: 'professional-authentication-avatar', target: '_blank', data: { toggle: 'tooltip', title: '个人主页' } do %>
+ |
+ <%= user.real_name %> | +<%= raw [user.school_name.presence, user.department_name.presence].compact.join(' ') %> |
+ <%= user.identity %> <%= raw user.user_extension.student? && user.student_id ? " #{user.student_id}" : '' %> |
+
+ <% unless is_processed %>
+ + <% if File.exists?(disk_professional_auth_filename(user.id)) %> + <%= image_tag(professional_auth_file_url(user.id).to_s + "?#{Time.now.to_i}", width: 40, height: 40, class: 'preview-image auth-image', data: { toggle: 'tooltip', title: '点击预览' }) %> + <% else %> + <%= content_tag(:span, '图片已删除', class: 'text-secondary') %> + <% end %> + | + <% end %> + +<%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %> | + + <% if is_processed %> +<%= overflow_hidden_span apply.remarks, width: 140 %> | +<%= apply.status_text %> | + <% else %> ++ <%= agree_link '同意', agree_admins_professional_authentication_path(apply, element: ".professional-authentication-#{apply.id}"), 'data-confirm': '确认审核通过?' %> + <%= javascript_void_link('拒绝', class: 'action refuse-action', + data: { + toggle: 'modal', target: '.admin-common-refuse-modal', id: apply.id, + url: refuse_admins_professional_authentication_path(apply, element: ".professional-authentication-#{apply.id}") + }) %> + | + <% end %> +
ID | -真实姓名 | +真实姓名 | 邮件地址 | 手机号码 | 单位 | -<%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %> | -<%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %> | -<%= sort_tag('经验值', name: 'experience', path: admins_users_path) %> | -<%= sort_tag('金币', name: 'grade', path: admins_users_path) %> | -操作 | +<%= sort_tag('创建于', name: 'created_on', path: admins_users_path) %> | +<%= sort_tag('最后登录', name: 'last_login_on', path: admins_users_path) %> | +<%= sort_tag('经验值', name: 'experience', path: admins_users_path) %> | +<%= sort_tag('金币', name: 'grade', path: admins_users_path) %> | +操作 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | <%= link_to "/users/#{user.login}", target: '_blank' do %> - <%= overflow_hidden_span user.login, width: 100 %> - <% end %> - | -- <%= link_to edit_admins_user_path(user) do %> <%= overflow_hidden_span user.real_name, width: 100 %> <% end %> | @@ -35,6 +29,8 @@<%= user.experience.to_i %> | <%= user.grade.to_i %> |
+ <%= link_to '编辑', edit_admins_user_path(user), class: 'action' %>
+
<%= javascript_void_link('奖励', class: 'action reward-grade-action', data: { toggle: 'modal', target: '.admin-users-reward-grade-modal', id: user.id }) %>
<%= javascript_void_link '解锁', class: 'action unlock-action', data: { id: user.id, confirm: '确认解锁吗?' }, style: user.locked? ? '' : 'display: none;' %>
diff --git a/config/locales/apply_user_authentications/zh-CN.yml b/config/locales/apply_user_authentications/zh-CN.yml
new file mode 100644
index 000000000..e886c2695
--- /dev/null
+++ b/config/locales/apply_user_authentications/zh-CN.yml
@@ -0,0 +1,7 @@
+zh-CN:
+ apply_user_authentication:
+ status:
+ '0': '待处理'
+ '1': '已同意'
+ '2': '已拒绝'
+ '3': '已撤销'
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 5ed8ecd69..4fc660a45 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -753,7 +753,7 @@ Rails.application.routes.draw do
get :contrast, on: :collection
end
- resources :users, only: [:index, :edit, :update] do
+ resources :users, only: [:index, :edit, :update, :destroy] do
member do
post :reward_grade
post :lock
@@ -761,6 +761,19 @@ Rails.application.routes.draw do
post :active
end
end
+
+ resources :identity_authentications, only: [:index] do
+ member do
+ post :agree
+ post :refuse
+ end
+ end
+ resources :professional_authentications, only: [:index] do
+ member do
+ post :agree
+ post :refuse
+ end
+ end
end
#git 认证回调
diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js
index bb8d3db43..0b27ea8b8 100644
--- a/public/react/src/modules/courses/boards/BoardsNew.js
+++ b/public/react/src/modules/courses/boards/BoardsNew.js
@@ -337,6 +337,17 @@ class BoardsNew extends Component{
}
+
{/* onSubmit={this.handleSubmit} */}
+
+
diff --git a/public/react/src/modules/courses/gradinforms/Eduinforms.js b/public/react/src/modules/courses/gradinforms/Eduinforms.js
index f847c87d3..10beb4507 100644
--- a/public/react/src/modules/courses/gradinforms/Eduinforms.js
+++ b/public/react/src/modules/courses/gradinforms/Eduinforms.js
@@ -287,11 +287,19 @@ class Eduinforms extends Component{
*
+
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js
index 42a128719..869295c59 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js
@@ -375,11 +375,21 @@ class GraduationTasksedit extends Component{
(选择确认后,无法修改)
-
+
@@ -1112,7 +1116,7 @@ class LoginRegisterComponent extends Component {
autoComplete="new-password"
onClick={this.changeType}
value={this.state.passwords} onChange={this.passwordonChanges}
- suffix={
+ addonAfter={
-
+
基本信息
-
+
标题:
- {String(title.length)}/{MAX_LENGTH}
}
- className="titleInput"
+ className="titleInput titleInputysl"
>
|