|
|
|
@ -2,15 +2,8 @@
|
|
|
|
|
<div class="task-popup-title clearfix">添加合作伙伴</div>
|
|
|
|
|
<div class="task_popup_con">
|
|
|
|
|
<div class="clearfix mb5 df">
|
|
|
|
|
<div class="flex1">
|
|
|
|
|
<div class="df">
|
|
|
|
|
<span class="fl lineh-35">地区:</span>
|
|
|
|
|
<select placeholder="请选择地区" id="province" class="flex1"></select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="df mt15">
|
|
|
|
|
<span class="fl lineh-35">单位:</span>
|
|
|
|
|
<input placeholder="请输入单位关键字" class="input-flex-35"/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="flex1" id="partners_search_form">
|
|
|
|
|
<%= render partial: "managements/partner_search_form" %>
|
|
|
|
|
</div>
|
|
|
|
|
<a href="javascript:void(0);" onclick="submit_search_user()" class="white-btn mt6 edu-blueback-btn fl ml15 mt55">搜索</a>
|
|
|
|
|
</div>
|
|
|
|
@ -19,7 +12,7 @@
|
|
|
|
|
<span class="fl ml25">单位</span>
|
|
|
|
|
<span class="fr with30">地区</span>
|
|
|
|
|
</p>
|
|
|
|
|
<div class="edu-back-skyblue clearfix pl10 over280" id="serch_user_list">
|
|
|
|
|
<div class="edu-back-skyblue clearfix pl10 over280" id="search_user_list">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<p class="clearfix" style="height: 20px;"><span class="fl lineh-20 none color-red" id="checkNotice"></span></p>
|
|
|
|
@ -35,27 +28,60 @@
|
|
|
|
|
$(function() {
|
|
|
|
|
unitDownOption();
|
|
|
|
|
showprovince("province");
|
|
|
|
|
submit_add_partner();
|
|
|
|
|
|
|
|
|
|
get_schools()
|
|
|
|
|
var i = 1; //设置当前页数
|
|
|
|
|
var msg_list_loading = false;
|
|
|
|
|
$(function() {
|
|
|
|
|
var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
|
|
|
|
|
var winH = $(window).height(); //页面可视区域高度
|
|
|
|
|
get_schools(1)
|
|
|
|
|
$("#search_user_list").scroll(function() {
|
|
|
|
|
if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
|
|
|
|
|
var pageH = $(document.body).height();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
function get_schools() {
|
|
|
|
|
$.getJSON("/managements/all_partners",function(schools){
|
|
|
|
|
let 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" +
|
|
|
|
|
" </span>\n" +
|
|
|
|
|
" <span class='fl with30'>"+array["school"]["province"]+"</span>" +
|
|
|
|
|
" </p>"
|
|
|
|
|
})
|
|
|
|
|
$("#serch_user_list").html(s_html)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
var scrollT = $(window).scrollTop(); //滚动条top
|
|
|
|
|
var aa = (pageH - winH - scrollT) / winH;
|
|
|
|
|
console.log(aa)
|
|
|
|
|
if ( !msg_list_loading ){
|
|
|
|
|
if (aa < 0.01 ) {
|
|
|
|
|
get_schools(i+1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
function get_schools(page) {
|
|
|
|
|
var msg_list = $('#search_user_list');
|
|
|
|
|
var limit_page = 1
|
|
|
|
|
if (page > 1){
|
|
|
|
|
limit_page = page
|
|
|
|
|
}else{
|
|
|
|
|
limit_page = 1
|
|
|
|
|
}
|
|
|
|
|
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
|
|
|
|
|
msg_list_loading = true;
|
|
|
|
|
$.getJSON("<%= all_path %>?page="+limit_page, function(schools) {
|
|
|
|
|
if (schools) {
|
|
|
|
|
msg_list_loading = false;
|
|
|
|
|
let 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" +
|
|
|
|
|
" </span>\n" +
|
|
|
|
|
" <span class='fl with30'>"+array["school"]["province"]+"</span>" +
|
|
|
|
|
" </p>"
|
|
|
|
|
});
|
|
|
|
|
$("#search_user_list").html(s_html);
|
|
|
|
|
i ++;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function submit_add_partner(){
|
|
|
|
|
if($("input[name='school[id]']:checked").length==0){
|
|
|
|
|
$("#checkNotice").html("请选择需要添加的内容").removeClass("none");
|
|
|
|
@ -77,4 +103,8 @@
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|