新版身份认证审批

This commit is contained in:
daiao 2017-05-19 14:46:45 +08:00
parent cb33692a18
commit 3d48973cfc
11 changed files with 371 additions and 2 deletions

View File

@ -939,6 +939,39 @@ class AdminController < ApplicationController
end
# 身份认证
def identity_authentication
type = params[:type] || 0 # 存在type 就用type 没有就为 0
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:name]}%'")
@unapproved_user = ApplyUserAuthentication.where(:status => type, :user_id => user_id).order("updated_at desc")
respond_to do |format|
format.html{ render :layout => 'base_edu' }
format.js
end
end
# 拒绝身份认证
def reject_authentication
apply_user = ApplyUserAuthentication.find(params[:apply_id])
reason = apply_user.update_attributes(:status => 2, :remarks => params[:reject_reason])
render :json => {success: reason}
end
# 统一身份认证
def agree_authentication
apply_user = ApplyUserAuthentication.find(params[:apply_id])
user = User.find(apply_user.user_id)
apply_user.update_attribute(:status, 1)
user.update_attribute(:authentication, true)
@unapproved_user = ApplyUserAuthentication.where(:status => 0).order("updated_at desc")
respond_to do |format|
format.js
end
end
def create_version
@versions = PhoneAppVersion.reorder('created_at desc')
@new_version = PhoneAppVersion.new

View File

@ -0,0 +1,32 @@
<% @unapproved_user.each_with_index do |apply_user, index| %>
<% user = User.find(apply_user.user_id) %>
<div class="<%= index % 2 == 0 ? 'admin-bg-grey' : '' %> admin-con-box clearfix">
<a href="<%= user_path(User.current) %>" target="_blank" class="fl with10 edu-ad-user">
<%= image_tag(url_to_avatar(@user), :class => "fl with10 edu-ad-user", :alt => "头像", :width => "50", :height => "50" ) %>
</a>
<div class="fl with90">
<ul>
<li class="clearfix mb5">
<a href="<%= user_path(user) %>" class="fl"><%= user.show_name %></a>
<span class="fl ml30 font-12 color-grey"><%= time_from_now(apply_user.updated_at) %></span>
<a href="javascript:void(0);" class="<%= apply_user.status == 1 ? 'task-btn-green' : '' %> task-btn fr"><%= apply_user.status == 1 ? "已同意" : "已拒绝" %></a>
</li>
<li class="clearfix mb10">
<% if !user.user_extensions.school_id.blank? && user.user_extensions.school %>
<span><%= user.user_extensions.school.name %></span>
<% end %>
<% if user.user_extensions && user.user_extensions.identity %>
<span class="ml30"><%= get_user_roll user %></span>
<% end %>
</li>
<li class="clearfix mb10">
<%= image_tag(url_to_auth_img(user.id, 'PRO'), :width => 200, :height => 150, :class => 'edu-renzheng-img fl mr20') %>
<%= image_tag(url_to_auth_img(user.id, 'ID'), :width => 200, :height => 150, :class => 'edu-renzheng-img fl mr20') %>
</li>
<% if apply_user.status == 2 %>
<li>原因:<span class="color-orange"><%= apply_user.remarks %></span></li>
<% end %>
</ul>
</div>
</div>
<% end %>

View File

@ -0,0 +1,40 @@
<% @unapproved_user.each do |apply_user| %>
<% user = User.find(apply_user.user_id) %>
<div class="admin-bg-grey admin-con-box clearfix">
<a href="<%= user_path(User.current) %>" target="_blank" class="fl with10 edu-ad-user">
<%= image_tag(url_to_avatar(@user), :class => "fl with10 edu-ad-user", :alt => "头像", :width => "50", :height => "50" ) %>
</a>
<div class="fl with90">
<ul>
<li class="clearfix mb5">
<a href="<%= user_path(User.current) %>" class="fl"><%= user.show_name %></a>
<span class="fl ml30 font-12 color-grey"><%= time_from_now(apply_user.updated_at) %></span>
<a href="javascript:void(0)" class="fr color-orange" onclick="reject_authentication_reason(this);" >拒绝</a>
<a href="<%= admin_agree_authentication_path(:apply_id => apply_user.id) %>" class="fr mr15 color-orange" data-remote="true" >同意</a>
</li>
<li class="clearfix mb10">
<% if !user.user_extensions.school_id.blank? && user.user_extensions.school %>
<span><%= user.user_extensions.school.name %></span>
<% end %>
<% if user.user_extensions && user.user_extensions.identity %>
<span class="ml30"><%= get_user_roll user %></span>
<% end %>
</li>
<li class="clearfix mb10">
<%= image_tag(url_to_auth_img(user.id, 'PRO'), :width => 200, :height => 150, :class => 'edu-renzheng-img fl mr20') %>
<%= image_tag(url_to_auth_img(user.id, 'ID'), :width => 200, :height => 150, :class => 'edu-renzheng-img fl mr20') %>
</li>
<div class="undis">
<li class="clearfix edu-form-border mb10">
<label class="edu-form-label fl">原因:</label>
<input type="text" class="task-form-90 task-height-40 panel-box-sizing fl edu-form-noborder" placeholder="我得说点儿什么最多200个字符">
</li>
<li class="clearfix">
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_reject_reason('<%= apply_user.id %>', this);" >确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="hide_reject_reason(this);" >取消</a>
</li>
</div>
</ul>
</div>
</div>
<% end %>

View File

@ -0,0 +1 @@
$("#authentication_list").html("<%= j( render :partial => "admin/authentication_list" ) %>");

View File

@ -0,0 +1,135 @@
<div class="edu-class-container mb15" >
<div class="edu-con-top clearfix">
<p class="ml15 fl color-grey">身份认证</p>
</div>
<div class="edu-con-bg01 mt15" >
<div class="edu-tab clearfix mb20" >
<ul id="edu-tab-nav">
<li id="edu-tab-nav-1" class="edu-tab-hover " onclick="HoverLi(1);">
<a href="<%= admin_identity_authentication_path(:type => 0) %>" class="tab_type" data-remote="true">待审批</a>
<span class="edu-tab-fa"><i class="fa fa-caret-down" ></i></span>
</li>
<li id="edu-tab-nav-2" onclick="HoverLi(2);">
<a href="<%= admin_identity_authentication_path(:type => [1,2]) %>" class="tab_type" data-remote="true" >已审批</a>
<span class="edu-tab-fa"><i class="fa fa-caret-down" ></i></span>
</li>
</ul>
<div class="cl"></div>
<div id="edu-tab-con-1" >
<div class="mt10">
<div class="edu-position fr task-form-30 mb10 mr15">
<input class="task-form-100 panel-box-sizing " placeholder="输入真实姓名进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt15" id="search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="authentication_list" >
<%= render :partial => "admin/authentication_list" %>
</div>
</div>
</div>
<div id="edu-tab-con-2" class="undis" >
<div class="mt10">
<p class="fl task-form-60 mt8 ml15">
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 active" id="audit_all_authentication">全部</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5" id="audit_agree_authentication">同意</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5" id="audit_reject_authentication" >拒绝</a>
</p>
<div class="edu-position fr task-form-30 mb10 fr mr15">
<input class="task-form-100 panel-box-sizing " placeholder="输入真实姓名进行检索" type="text" id="audit_search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt15" id="audit_search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="audit_authentication_list">
</div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
<script>
/* -------------------------- 拒绝 ------------------------------------ */
function reject_authentication_reason(nThis){
var reason = $(nThis).parent().parent().find('div');
reason.find("input").val("");
reason.toggle();
}
/* -------------------------- 取消 ------------------------------------ */
function hide_reject_reason(nThis){
var reason = $(nThis).parent().parent();
reason.find("input").val("");
reason.hide();
}
/* ------------------------- 提交拒绝原因 --------------------------------- */
function submit_reject_reason(id, nThis){
var nReason = $(nThis).parent().parent();
var reason = nReason.find("input").val();
$.ajax({
url: '<%= admin_reject_authentication_path %>',
data: {apply_id: id, reject_reason: reason },
success: function(data){
if(data.success){
location.reload();
}
}
});
}
/* -------------------------- 按名字进行收缩(未审批) ----------------------------- */
$("#search").live("click", function(){
var iName = $("#search_name").val();
$.ajax({
url: "<%= admin_identity_authentication_path %>" +".js",
data: { name: iName }
});
});
/* ----------------------- 已审批(全部) ------------------------- */
$("#audit_all_authentication").live("click", function(){
var iName = $("#audit_search_name").val();
$.ajax({
url: "<%= admin_identity_authentication_path() %>" + ".js",
data: { name: iName, type: [1, 2] }
});
});
/* ----------------------- 已审批(同意) ------------------------- */
$("#audit_agree_authentication").live("click", function(){
var iName = $("#audit_search_name").val();
$.ajax({
url: "<%= admin_identity_authentication_path() %>" +".js",
data: { name: iName, type: 1 }
});
});
/* ----------------------- 已审批(拒绝) ------------------------- */
$("#audit_reject_authentication").live("click", function(){
var iName = $("#audit_search_name").val();
$.ajax({
url: "<%= admin_identity_authentication_path() %>" +".js",
data: { name: iName, type: 2 }
});
});
/* ------------------- 按名字进行搜索(已审批)-------------------- */
$("#audit_search").live("click", function(){
var iName = $("#audit_search_name").val();
var id = $("#audit_all_authentication").parent().find(".active").attr("id");
var type = 0;
if(id = "audit_all_authentication"){
type = [1, 2];
}else if(id="audit_agree_authentication"){
type = 1;
}else{
type = 2;
}
$.ajax({
url: "<%= admin_identity_authentication_path %>" +".js",
data: { name: iName, type: type}
});
});
</script>

View File

@ -0,0 +1,30 @@
var nTabIcon_1 = $("#edu-tab-con-1");
var nTabIcon_2 = $("#edu-tab-con-2");
var nTabNav_1 = $("#edu-tab-nav-1");
var nTabNav_2 = $("#edu-tab-nav-2");
var nAudit = $("#audit_all_authentication").parent();
<% if params[:type] == "0" %>
$("#authentication_list").html("<%= j( render :partial => "admin/authentication_list" ) %>");
nTabNav_1.addClass("edu-tab-hover");
nTabNav_2.removeClass("edu-tab-hover");
nTabIcon_1.show();
nTabIcon_2.hide();
<% else %>
$("#audit_authentication_list").html("<%= j( render :partial => "admin/audit_authentication_list" ) %>");
nTabNav_1.removeClass("edu-tab-hover");
nTabNav_2.addClass("edu-tab-hover");
nTabIcon_1.hide();
nTabIcon_2.show();
/* -------------------------- 未审批(全部、同意、拒绝点击时动态样式) ------------------------------ */
if(<%= params[:type] == "1" %>){
nAudit.find(".active").removeClass("active");
$("#audit_agree_authentication").addClass("active");
}else if(<%= params[:type] == "2" %>){
nAudit.find(".active").removeClass("active");
$("#audit_reject_authentication").addClass("active");
}else{
nAudit.find(".active").removeClass("active");
$("#audit_all_authentication").addClass("active");
}
<% end %>

View File

@ -9,7 +9,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-common', 'css/edu-public','css/taskstyle', 'css/font-awesome', 'css/edu-class', 'css/edu-popup', 'css/ketang' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-common', 'css/edu-public','css/taskstyle', 'css/font-awesome', 'css/edu-class', 'css/edu-popup', 'css/ketang', "css/edu-admin" %>
<%= javascript_include_tag "edu/application",'edu/base_edu' %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>

View File

@ -911,7 +911,7 @@ zh:
label_principal_search: "搜索用户或组:"
label_user_search: "搜索用户:"
label_mobile_version: "移动端版本管理"
label_identity_authentication: "身份认证"
button_create_and_continue: 创建并继续

View File

@ -1443,6 +1443,9 @@ RedmineApp::Application.routes.draw do
get 'admin/code_work_tests'
post 'admin/select_course_syllabus'
post 'admin/create_syllabus'
get 'admin/identity_authentication'
get 'admin/reject_authentication'
get 'admin/agree_authentication'
resources :auth_sources do
member do

View File

@ -385,6 +385,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
menu.push :applied_schools, {:controller => 'admin', :action => 'applied_schools'}, :caption => :label_applied_shcools
menu.push :applied_departments, {:controller => 'admin', :action => 'applied_departments'}, :caption => :label_applied_departments
menu.push :identity_authentication, { :controller => 'admin', :action => 'identity_authentication' }, :caption => :label_identity_authentication
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural

View File

@ -0,0 +1,94 @@
/* 共用 后期再添加至公共样式 bylinda*/
a:link,a:visited{text-decoration:none;color:#666; }
a:hover {color:#5faee3;}
a:hover.fa{color:#5faee3;}
a.link-color-grey{color:#aaa!important;}
a:hover.link-color-grey{color:#5faee3!important;}
a.link-name-dark{ color:#333; max-width:140px; display: block; }
a:hover.link-name-dark{ color:#5faee3;}
.mb50{ margin-bottom: 50px;}
.mr50{ margin-right: 50px;}
.ml35{ margin-left:35px;}
input,textarea,select{ border:1px solid #eee; background: #fff; color:#666;}
.edu-name-dark{ max-width:100px; display: block; }
.edu-info-dark{ max-width:345px; display: block; }
.edu-color-grey{ color:#666;}
.edu-color-grey:hover{color:#5faee3;}
.edu-btn-search{ position: absolute; top:0; right:15px;}
.edu-bg-light-blue{ background:#f7f9fd; padding:5px;}
.edu-max-h200{ height:200px; overflow: auto;}
.edu-position{ position: relative;}
.edu-h200-auto{ max-height:200px; overflow:auto;}
.edu-h300-auto{ max-height:300px; overflow:auto;}
.edu-h350-auto{ max-height:350px; overflow:auto;}
.edu-txt-w240{ width:240px; display: block;}
.edu-txt-w280{ width:280px; display: block;}
.edu-txt-w200{ width:200px; display: block;}
a.edu-txt-w140,.edu-txt-w140{ width:141px; display: inline-block;}
a.edu-txt-w100,.edu-txt-w100{ width:100px; display: inline-block;}
.edu-txt-w50{ width:50px;}
.edu-con-top{ padding:10px 0; background:#fff; border-bottom:1px solid #eee;font-size:16px; }
.edu-con-top h2{ font-size:16px;}
.edu-form-label{display: inline-block; width:60px;text-align: right; line-height: 40px; font-weight: normal;}
.edu-form-border{ border:1px solid #ddd;}
.edu-form-noborder,input.edu-form-noborder{ border:none; outline:none;}
.edu-w245{ width: 245px; }
a.edu-btn{display: inline-block;border:none; padding:0 12px;color: #666!important;border:1px solid #ccc; text-align:center;font-size: 14px; height: 29px;line-height: 29px; border-radius:3px; font-weight: bold;letter-spacing:1px;}
a:hover.edu-btn{ border:1px solid #5faee3; color: #5faee3!important;}
.edu-cir-grey{ display: inline-block; padding:0px 5px; color:#666; background:#eaeaea; text-align: center; border-radius:15px; font-size:12px; line-height:20px!important;}
a.edu-filter-cir-grey{display: inline-block; padding:0px 15px; color:#666; border:1px solid #ddd; text-align: center; border-radius:3px; font-size:12px; height:25px; line-height:25px;}
a:hover.edu-filter-cir-grey,a.edu-filter-cir-grey.active{ border:1px solid #3498db; color:#3498db; }
.edu-filter-btn{display: inline-block; padding:0px 10px; color:#666; background:#eee; text-align: center; border-radius:3px; font-size:12px; height:25px; line-height:25px;}
.edu-filter-btn-blue{background:#ebf6fe; color:#3498db;}
.edu-filter-btn-orange{background:#ffeee8; color:#ff5055;}
.edu-filter-btn-red{background:#fee4e5; color:#d72e36;}
.edu-filter-btn-green{background:#e4f3ec; color:#6fbb9d;}
.edu-filter-btn-yellow{background:#fdefde; color:#ef9324;}
.edu-filter-btn-danger{background:#d72e36; color:#fff;}
.edu-pop-table{ width: 100%; border:1px solid #eee; border-bottom:none; background:#fff; color:#888;}
.edu-pop-table tr{ height:40px; line-height: 40px; }
.edu-pop-table tr.edu-bg-grey{ background:#f5f5f5;}
.edu-txt-center{ text-align: center;}
.edu-pop-table tr th{ color:#333;border-bottom:1px solid #eee; }
.edu-pop-table tr td{border-bottom:1px solid #eee;}
.edu-pop-table.table-line tr td,.edu-pop-table.table-line tr th{ border-right:1px solid #eee;}
.edu-pop-table.table-line tr td:last-child,.edu-pop-table.table-line tr th:last-child{border-right:none;}
.edu-line{ border-bottom:1px solid #eee;}
table.table-th-grey th{ background:#f5f5f5;}
table.table-pa5 th,table.table-pa5 td{ padding:0 5px;}
.panel-comment_item .orig_cont-red{ border:solid 2px #cc0000; border-radius:10px; padding:4px;color:#999;margin-top:-1px; }
.alert-red{ background-color: #f2dede;border-color: #eed3d7; color: #d14f4d; text-align: left!important;}
.eud-pointer{ cursor:pointer;}
.edu-bg-grey{ background:#f6f6f6; width:90%; min-width:700px; color:#666;}
/* 与课程通用框架和tab 17/05/11 bylinda*/
.edu-class-con{ width:50%; margin:0px auto; font-size:14px; padding:50px 0;}
.edu-con-bg01{ width: 100%; background:#fff;}
.edu-class-box{ width:100%;}
.edu-class-container{ width: 1200px; margin:10px auto 20px;}
.edu-class-top{ background:#fff; padding:20px;}
.edu-class-top-info{ }
.edu-class-top-img{ width:260px; height: 140px;}
/* tab */
.edu-tab{ width: 100%; background:#fff; }
#edu-tab-nav{height:47px;background: #fff; }
#edu-tab-nav li {float:left; width: 170px; text-align:center;height: 47px;line-height: 47px; position: relative; }
.edu-tab-fa{ position: absolute; top:45px; left:85px; color: #fff;}
#edu-tab-nav li a{font-size:14px; }
.edu-tab-hover {border-bottom:3px solid #5faee3; background: #fff; }
.edu-tab-hover .edu-tab-fa{ color: #5faee3;}
.edu-tab-hover a{ color:#5faee3; font-weight:bold;}
.undis {display:none;}
.dis {display:block;}
.edu-tab-con-box{ padding:15px; max-height:1200px; overflow: auto; color:#666; line-height: 2.0; background:#fff;}
/* 审核 17/05/11 bylinda*/
.admin-con-box { padding:15px;}
a.edu-ad-user{ }
.edu-ad-user img{width:80px; height: 80px; border-radius:100px;}
.edu-renzheng-img{ width:200px;}
.admin-bg-grey{ background:#fafbfb; }