|
|
|
@ -4,19 +4,19 @@
|
|
|
|
|
<tr>
|
|
|
|
|
<th>实训名称</th>
|
|
|
|
|
<th>创建者</th>
|
|
|
|
|
<th>学员数</th>
|
|
|
|
|
<th>级别</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody class="selecshixun" onscroll="contentViewScroll">
|
|
|
|
|
<tbody class="over260" id="shixun_list_block">
|
|
|
|
|
<% @shixuns.each do |shixun| %>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="clearfix" style="padding-left: 20px">
|
|
|
|
|
<input name="shixun_exercise" type="checkbox" class="magic-checkbox" id="shixun_input_<%= shixun.id %>" value="<%= shixun.id %>">
|
|
|
|
|
<label style="top:2px" for="shixun_input_<%= shixun.id %>"></label>
|
|
|
|
|
<input name="shixun_exercise[]" type="checkbox" class="magic-checkbox" id="shixun_input_<%= shixun.id %>" value="<%= shixun.id %>">
|
|
|
|
|
<label style="top:2px" for="shixun_input_<%= shixun.id %>"></label>
|
|
|
|
|
<%= link_to shixun.name, shixun_path(shixun), :class => "edu-info-dark task-hide mt3 ml20",:style=> "text-align:left", :target => "_blank" %>
|
|
|
|
|
</td>
|
|
|
|
|
<td><%= link_to shixun.owner.try(:show_name), user_path(shixun.owner), :class => "edu-txt-w140 mt3 task-hide" %></td>
|
|
|
|
|
<td><%= shixun.myshixuns.count %></td>
|
|
|
|
|
<td><%= shixun.shixun_level %></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<% end %>
|
|
|
|
|
</tbody>
|
|
|
|
@ -36,6 +36,55 @@
|
|
|
|
|
<!-- </div>-->
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
var i = 1; //设置当前页数
|
|
|
|
|
var msg_list_loading = false;
|
|
|
|
|
$(function() {
|
|
|
|
|
var totalpage = <%= @total_pages.to_i %>; //总页数,防止超过总页数继续滚动
|
|
|
|
|
var winH = $(window).height(); //页面可视区域高度
|
|
|
|
|
|
|
|
|
|
$("#shixun_list_block").scroll(function() {
|
|
|
|
|
if (i < totalpage) { // 当滚动的页数小于总页数的时候,继续加载
|
|
|
|
|
var pageH = $(document.body).height();
|
|
|
|
|
var scrollT = $(window).scrollTop(); //滚动条top
|
|
|
|
|
var aa = (pageH - winH - scrollT) / winH;
|
|
|
|
|
if ( ! msg_list_loading ){
|
|
|
|
|
if (aa < 0.01 ) {
|
|
|
|
|
getJson(i+1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
function getJson(page) {
|
|
|
|
|
var msg_list = $('#shixun_list_block');
|
|
|
|
|
|
|
|
|
|
if (msg_list.height() + msg_list[0].scrollTop >= msg_list[0].scrollHeight - 60) {
|
|
|
|
|
msg_list_loading = true;
|
|
|
|
|
$.getJSON("<%= choose_shixuns_exercise_path(@exercise) %>&page="+page, function(json) {
|
|
|
|
|
if (json) {
|
|
|
|
|
msg_list_loading = false;
|
|
|
|
|
var str = "";
|
|
|
|
|
$.each(json, function(index, array) {
|
|
|
|
|
console.log(array);
|
|
|
|
|
str = '<tr>' +
|
|
|
|
|
' <td class="clearfix" style="padding-left: 20px">' +
|
|
|
|
|
' <input name="shixun_exercise[]" type="checkbox" class="magic-checkbox" id="shixun_input_'+array["id"]+'" value="'+array["id"]+'">' +
|
|
|
|
|
' <label style="top:2px" for="shixun_input_'+array["id"]+'"></label>' +
|
|
|
|
|
' <a href="'+array["shixun_path"]+'" class="edu-info-dark task-hide mt3 ml20" style="text-align:left" target="_blank">'+array["name"]+'</a>' +
|
|
|
|
|
' </td>' +
|
|
|
|
|
' <td><a href="'+array["owner_path"]+'" class="edu-txt-w140 mt3 task-hide" target="_blank">'+array["shixun_owner"]+'</a></td>' +
|
|
|
|
|
' <td>'+array["shixun_level"]+'</td>' +
|
|
|
|
|
' </tr>';
|
|
|
|
|
$("#shixun_list_block").append(str);
|
|
|
|
|
});
|
|
|
|
|
i ++;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
//滑动到底加载
|
|
|
|
|