Merge branch 'dev_partners' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into dev_partners

dev_local
daiao 6 years ago
commit 72e8056d7b

@ -1290,7 +1290,6 @@ end
school.update_attributes(:partner_id => partner.id)
end
end
render :json => {status: 1, message: "创建成功!"}
end
end
@ -1339,13 +1338,17 @@ end
@partner = Partner.where(:id => params[:partner]).first
@members =
if params[:search]
User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%'")
User.where("LOWER(concat(lastname, firstname, nickname, mail)) LIKE '%#{params[:search]}%' AND partner_id is NULL")
else
User.where(:certification => 1)
User.where(:certification => 1, :partner_id => nil )
end
@members = paginateHelper @members, 8
@total_pages = (@members.count / 10.0).ceil
@members = paginateHelper @members, 10
respond_to do |format|
format.js
format.json {
render json: member_json_data(@members)
}
end
end
@ -1358,10 +1361,18 @@ end
user.update_attributes(partner_id: @partner.id) if !@partner.nil? && !user.nil?
end
end
end
redirect_to partners_managements_path
# 合作伙伴删除管理员
def delete_partner_member
if params[:partner] && params[:partner_member]
@partner = Partner.find_by_id params[:partner]
user = User.find_by_id params[:partner_member]
user.update_attributes(partner_id: nil) if !@partner.nil? && !user.nil?
end
end
# check 部门 identifier是否重复
def check_depart_identifier
logger.info("###############{params}")
@ -4380,4 +4391,19 @@ end
book.write xls_report
xls_report.string
end
def member_json_data mmebers
mmebers.map do |member|
real_name = member.show_real_name
identity = member.identity
school_name = member.school_name
user_phone = member.phone || ""
member.attributes.dup.except("login", "hashed_password", "salt", "status", "mail", "experience", "grade",
"authentication", "professional_certification").merge({real_name: real_name,
identity: identity,
school_name: school_name,
user_phone: user_phone})
end
end
end

@ -14,7 +14,7 @@
</p>
<%= form_for @partner, :url => add_partner_member_managements_path,:html => {:id => 'add_partner_member_form', :remote => true, :method => :post} do |f| %>
<input type="hidden" value="<%= @partner.id %>" name="partner">
<div id="serch_user_list">
<div class="edu-back-skyblue clearfix pl10 over280" id="member_search_user_list">
<%= render :partial => "partner_member_search_list" %>
</div>
<% end %>
@ -27,14 +27,14 @@
</div>
</div>
<script>
var i = 1; //设置当前页数
var member_i = 1; //设置当前页数
var msg_list_loading = false;
$(function() {
var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
var winH = $(window).height(); //页面可视区域高度
$("#search_user_list").scroll(function() {
if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
$("#member_search_user_list").scroll(function() {
if (member_i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
var pageH = $(document.body).height();
var scrollT = $(window).scrollTop(); //滚动条top
@ -42,7 +42,7 @@
console.log(aa);
if ( !msg_list_loading ){
if (aa < 0.01 ) {
get_schools(i+1)
get_schools(member_i+1)
}
}
}
@ -50,26 +50,26 @@
});
function get_schools(page) {
var msg_list = $('#search_user_list');
var msg_list = $('#member_search_user_list');
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
msg_list_loading = true;
$.getJSON("/managements/add_partner_member_box?partner=<%= @partner.id %>&search="+$("#partner_member_search").val()+"&page="+page, function(schools) {
if (schools) {
$.getJSON("/managements/add_partner_member_box?partner=<%= @partner.id %>&search="+$("#partner_member_search").val()+"&page="+page, function(members) {
if (members) {
msg_list_loading = false;
var s_html = "";
$.each(schools,function (index,array) {
s_html = s_html+ "<p class='clearfix mt5'>" +
" <span class='fl with70'>" +
" <span>" +
" <input type='checkbox' name='school[id]' value='"+array["school"]["id"]+"' id='school_'"+array["school"]["id"]+"'class='magic-checkbox'>" +
" <label for='school_'"+array["school"]["id"]+">"+array["school"]["name"]+"</label>" +
" </span>\n" +
$.each(members,function (index,array) {
s_html = s_html+ "<p class='clearfix'>" +
" <span class='fl edu-txt-w90'>" +
" <input type='checkbox' name='partner_member[]' value='"+array["id"]+"' id='user_'"+array["id"]+"'class='magic-checkbox'>" +
" <label for='user_'"+array["id"]+">"+array["real_name"]+"</label>" +
" </span>\n" +
" <span class='fl with30'>"+array["school"]["province"]+"</span>" +
"<span class='fl edu-txt-w90 mt5 edu-txt-center color-grey-6 pointer'>"+array["identity"]+"</span>" +
"<span class=\"fl task-hide edu-txt-w200 mt5 edu-txt-left color-grey-9\">"+array["school_name"]+"</span>" +
"<span class=\"fl edu-txt-w100 mt5 edu-txt-center color-grey-9\">"+array["user_phone"]+"</span>" +
" </p>"
});
$("#search_user_list").append(s_html);
i ++;
$("#member_search_user_list").append(s_html);
member_i ++;
}
});
}

@ -0,0 +1,10 @@
<% partner.users.each do |user| %>
<li>
<%= image_tag(url_to_avatar(user)) %>
<a href="javascript:void(0)" onclick="delete_confirm_box_2('<%= delete_partner_member_managements_path(partner: partner.id,
partner_member: user.id) %>', '确定要删除该管理员吗')" class="removeImg">
<i class="iconfont icon-htmal5icon19 color-grey-9"></i>
</a>
<span class="task-hide managementName">胡莎莎</span>
</li>
<% end %>

@ -24,7 +24,11 @@
<span class="mr45 color-grey-9 fl">管理员</span>
<ul class="manageList">
<li><a href="javascript:void(0)" class="addManage">+</a></li>
<li><img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=105293018,2500805440&fm=27&gp=0.jpg"/><a href="javascript:void(0)" class="removeImg"><i class="iconfont icon-htmal5icon19 color-grey-9"></i></a></li>
<li>
<img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=105293018,2500805440&fm=27&gp=0.jpg"/>
<a href="javascript:void(0)" class="removeImg"><i class="iconfont icon-htmal5icon19 color-grey-9"></i></a>
<span class="task-hide manageName">胡莎莎</span>
</li>
</ul>
</div>
</div>

@ -0,0 +1 @@
$("#partner_member_list").html("<%= j(render :partial => "partner_member_list", :locals => {partner: @partner}) %>")

@ -1,5 +1,5 @@
<% if params[:search] %>
$("#serch_user_list").html("<%= j(render :partial => "partner_member_search_list") %>")
$("#member_search_user_list").html("<%= j(render :partial => "partner_member_search_list") %>")
<% else %>
var html="<%= escape_javascript(render :partial => "managements/partner_addManage") %>";
pop_box_new(html,572,500);

@ -0,0 +1 @@
$("#partner_member_list").html("<%= j(render :partial => "partner_member_list", :locals => {partner: @partner}) %>")

@ -20,26 +20,16 @@
<div class="edu-back-white">
<div>
<div class="padding10-20">
<p class="mb20">
<span class="mr30 color-grey-9">添加时间</span><span class="color-grey-6"><%= format_time @current_partner.try(:created_at) %></span>
</p>
<p class="mb20"><span class="mr30 color-grey-9">添加时间</span><span class="color-grey-6"><%= format_time @current_partner.try(:created_at) %></span></p>
<div class="clearfix">
<span class="mr45 color-grey-9 fl">管理员</span>
<ul class="manageList">
<li>
<%= link_to '+', add_partner_member_box_managements_path(:partner => 1), :remote => true, :class => "addManage" %>
<%= link_to '+', add_partner_member_box_managements_path(:partner => @current_partner.try(:id)), :remote => true, :class => "addManage" %>
</li>
<% unless @current_partner.nil? %>
<% @current_partner.users.each_with_index do |user, index| %>
<li>
<%= image_tag(url_to_avatar(user)) %>
<a href="javascript:void(0)" class="removeImg">
<i class="iconfont icon-htmal5icon19 color-grey-9"></i>
</a>
</li>
<% end %>
<% end %>
<div id="partner_member_list" class="fl">
<%= render :partial => "partner_member_list", :locals => {partner: @current_partner} %>
</div>
</ul>
</div>
</div>
@ -59,7 +49,7 @@
<a href="javascript:void(0)" class="color-grey-9">删除</a>
</span>
<span>
2019-04-03 16:04
<%= format_time customer.created_at %>
</span>
</li>
<% end %>
@ -78,11 +68,5 @@
$(".partnerList li a").removeClass("active");
$(this).addClass("active");
})
$(".removeImg").on("click",function(){
$(this).parents("li").remove();
})
})
</script>

@ -556,6 +556,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'partners'
get 'add_partner_member_box'
post 'add_partner_member'
delete 'delete_partner_member'
get 'get_partner'
get 'all_partners'
post 'add_partner'

@ -2984,9 +2984,10 @@ a.singlepublishtwo{
}
.partnerList{max-height: 500px;overflow-y: auto;}
.manageList{float: left}
.manageList li{width: 60px;height: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;}
.manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;float: left;margin-right: 10px;border-radius: 50%;}
.manageList li{width: 60px;float: left;margin-right: 15px;border-radius: 50%;text-align: center;position: relative;margin-bottom: 10px;}
.manageList li>a.addManage,.manageList li>img{width: 60px;height: 60px;line-height: 49px;margin-right: 10px;border-radius: 50%;display: block}
.addManage{display: block;background: #cdcdcd;color: #fff!important;font-size: 55px;}
.managementName{display: block;width: 60px;color: #666;}
.removeImg{position: absolute;right: 1px;top: -12px;}
.tableList .tableHead{background: #fafafa}
.tableList{min-height: 400px;}
@ -3133,40 +3134,40 @@ line-height: 20px;display: inline-block;color: rgba(65, 140, 205, 1) !important;
width: calc( 100% )
}
#requireTable thead .td-head-child:last-child{border-right: none;}
/*用户列表*/
.managerPanels a{margin-right:24px;}
.managerPanels a:nth-child(16n){margin-right: 0px;}
.managerPanels a span{display: block;text-align: center;max-width: 70px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color: #666;}
.managerPanels a:hover span{color: #4cacff!important;}
.userimg{position: absolute;top: -16px;right: -5px;}
.useradd{font-size: 42px !important; position: absolute; top: -16px;}
.ListTableLines .column-2{
width: 150px;
text-align: center;
padding-left: 5px;
box-sizing: border-box;
color:#999999;
}
.ListTableLines .column-No{
color:#999999;
}
.courselist .column-2{
width: 150px;
text-align: center;
padding-left: 5px;
box-sizing: border-box;
color:#656565;
}
.courselist .column-No{
color:#999999;
}
.poll_list a {
display: inline-block;
padding: 20px;
font-size: 18px;
text-align: center;
position: relative;
color: #05101a;
/*用户列表*/
.managerPanels a{margin-right:24px;}
.managerPanels a:nth-child(16n){margin-right: 0px;}
.managerPanels a span{display: block;text-align: center;max-width: 70px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color: #666;}
.managerPanels a:hover span{color: #4cacff!important;}
.userimg{position: absolute;top: -16px;right: -5px;}
.useradd{font-size: 42px !important; position: absolute; top: -16px;}
.ListTableLines .column-2{
width: 150px;
text-align: center;
padding-left: 5px;
box-sizing: border-box;
color:#999999;
}
.ListTableLines .column-No{
color:#999999;
}
.courselist .column-2{
width: 150px;
text-align: center;
padding-left: 5px;
box-sizing: border-box;
color:#656565;
}
.courselist .column-No{
color:#999999;
}
.poll_list a {
display: inline-block;
padding: 20px;
font-size: 18px;
text-align: center;
position: relative;
color: #05101a;
}
Loading…
Cancel
Save