You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
5.4 KiB
165 lines
5.4 KiB
<%@ page contentType="text/html;charset=UTF-8"%>
|
|
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
|
<c:if test="${page!=null && page.totalPage>0}">
|
|
<input type="hidden" id="currentpage" name="currentPage" value="${page.currentPage}" />
|
|
<input type="hidden" id="lastpage" name="lastpage" value="${page.totalPage}" />
|
|
|
|
<div class="page_warp_wd">
|
|
<div class="wid_page">
|
|
<!-- 首页 -->
|
|
<c:choose>
|
|
<c:when test="${page.currentPage==1 || page.currentPage ==0}">
|
|
<a href="javascript:void(0)" class="cursor-not-allowed" title="首页"><span class="page_pre"></span></a>
|
|
</c:when>
|
|
<c:otherwise>
|
|
<a href="javascript:getQueryPageId(0)" title="首页" class="on"><span class="page_pre"></span></a>
|
|
</c:otherwise>
|
|
</c:choose>
|
|
<!-- 上一页, 如果是第一页, 则点击上一页无操作 -->
|
|
<c:choose>
|
|
<c:when test="${page.currentPage==1 || page.currentPage ==0}">
|
|
<a href="javascript:void(0)" class="cursor-not-allowed" title="上一页"><span class="page_bfe"></span></a>
|
|
</c:when>
|
|
<c:otherwise>
|
|
<a href="javascript:getQueryPageId(-1)" title="上一页" class="on"><span class="page_bfe"></span></a>
|
|
</c:otherwise>
|
|
</c:choose>
|
|
|
|
<c:if test="${page.currentPage > 5}"><a href="javascript:myPageLast()">…</a></c:if>
|
|
|
|
<span id="my_page_div">
|
|
</span>
|
|
|
|
<!-- 如果当前页等于总页, 则点击下一页无操作 -->
|
|
<c:choose>
|
|
<c:when test="${page.currentPage==page.totalPage}">
|
|
<a href="javascript:void(0)" class="cursor-not-allowed" title="下一页"><span class="page_next"></span></a>
|
|
</c:when>
|
|
<c:otherwise>
|
|
<a href="javascript:getQueryPageId('next')" title="下一页" class="on"><span class="page_next"></span></a>
|
|
</c:otherwise>
|
|
</c:choose>
|
|
|
|
<c:choose>
|
|
<c:when test="${page.currentPage==page.totalPage}">
|
|
<a href="javascript:void(0)" class="cursor-not-allowed" title="末页"><span class="page_afr"></span></a>
|
|
</c:when>
|
|
<c:otherwise>
|
|
<a href="javascript:getQueryPageId(${page.totalPage})" title="末页" class="on"><span class="page_afr"></span></a>
|
|
</c:otherwise>
|
|
</c:choose>
|
|
<div style="clear:both"></div>
|
|
</div>
|
|
<div class="page_state">
|
|
共 <span> ${page.totalCount}条数据,
|
|
当前显示${page.totalCount==0?0:(page.currentPage-1)==0?1:((page.currentPage-1)*page.pageSize+1)}
|
|
到${page.totalCount==0?0:(page.currentPage==page.totalPage?(page.totalCount%page.pageSize==0?page.currentPage*page.pageSize:((page.currentPage-1)*page.pageSize+(page.totalCount%page.pageSize))):page.currentPage*page.pageSize)}条
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</c:if>
|
|
<script>
|
|
//载入指定页
|
|
function getQueryPageId(index) {
|
|
var page = 1;
|
|
if (index == 0) {//首页
|
|
page = 1;
|
|
} else if (index == -1) { //上一页
|
|
page =${page.prePage};
|
|
} else if (index == 'next') { //下一页
|
|
page =${page.nextPage};
|
|
// } else if (index == 2) { //末页
|
|
// page =${page.totalPage};
|
|
} else {
|
|
page = index;
|
|
}
|
|
fReloadCurrentPage(page);
|
|
}
|
|
|
|
/**
|
|
* 刷新按钮响应函数
|
|
**/
|
|
function fReloadCurrentPage(nIndex) {
|
|
var total = ${page.totalPage};
|
|
if (nIndex > total) {
|
|
document.getElementById("currentpage").value = 1;
|
|
} else {
|
|
document.getElementById("currentpage").value = nIndex;
|
|
}
|
|
document.mainForm.submit();
|
|
}
|
|
|
|
//更多...前面
|
|
function myPageLast(){
|
|
var currentPage = ${page.currentPage};//当前页
|
|
|
|
var page_last_no = 0;//点更多后的页码 例: .①②③④⑤. 点击..., 则变成 .⑥⑦⑧⑨⑩.
|
|
/**
|
|
* 用当前页能被5整除, 则是当前页码直接减5
|
|
* 如果不能被5整除, 则减去除5后的余数
|
|
*/
|
|
var remainder = parseInt(currentPage)%5;
|
|
if(remainder == 0){
|
|
page_last_no = currentPage - 5;
|
|
}else{
|
|
page_last_no = currentPage - remainder;
|
|
}
|
|
fReloadCurrentPage(page_last_no);
|
|
}
|
|
|
|
//更多...后面
|
|
function myPageNext(){
|
|
var currentPage = ${page.currentPage};//当前页
|
|
|
|
var page_next_no = 0;//点更多后的页码 例: .①②③④⑤. 点击..., 则变成 .⑥⑦⑧⑨⑩.
|
|
/**
|
|
* 用当前页取模5, 如果没有余数, 则是当前页码的最后一个, 则直接加1
|
|
* 如果不能被5整除, 则让5减去余数, 再加1
|
|
*/
|
|
var remainder = parseInt(currentPage)%5;
|
|
if(remainder == 0){
|
|
page_next_no = currentPage + 1;
|
|
}else{
|
|
page_next_no = currentPage + (5-remainder) + 1;
|
|
}
|
|
fReloadCurrentPage(page_next_no);
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
setPageNum();
|
|
});
|
|
//显示页码数
|
|
function setPageNum(){
|
|
var my_page_html = '';
|
|
var total = ${page.totalPage};//总页
|
|
var currentPage = ${page.currentPage};//当前页
|
|
var nextPage = ${page.nextPage};//下一页
|
|
|
|
var my_page_no = 0;//页码数是第几页
|
|
if(parseInt(currentPage)%5 == 0){
|
|
my_page_no = parseInt(currentPage/5)-1;
|
|
}else{
|
|
my_page_no = parseInt(currentPage/5);
|
|
}
|
|
|
|
var page_next_flag = true;//是否显示后面的...
|
|
var begin = 5 * parseInt(my_page_no) + 1;//页数从几开始
|
|
var end = begin + 5;//页数到几结束
|
|
if(end > total){//如果页数大于总页数, 则改为总页数
|
|
end = total+1;
|
|
page_next_flag = false;
|
|
}
|
|
for(var i=begin;i<end;i++){
|
|
if(i == currentPage){
|
|
my_page_html += '<a href="javascript:getQueryPageId('+i+')" class="on">'+i+'</a>';
|
|
}else{
|
|
my_page_html += '<a href="javascript:getQueryPageId('+i+')">'+i+'</a>';
|
|
}
|
|
}
|
|
if(page_next_flag){
|
|
my_page_html += '<a href="javascript:myPageNext()">…</a>';
|
|
}
|
|
|
|
$("#my_page_div").html(my_page_html);
|
|
}
|
|
</script>
|
|
|