var sbPageString ="";
var displayNum = 10;//显示页面数量
var totalPages = ${pageCount}; //页面码数
var pageNumber = ${pagedVo.paging.pageNumber}; //当前页码
var startPage = 0; //首页
var endPage = 0; //最后页
if (totalPages <= displayNum) {
startPage = 1;
endPage = totalPages;
}/* else if (pageNumber <= (displayNum - 1) / 2) {
startPage = 1;
endPage = displayNum;
} else if (pageNumber >= totalPages - (displayNum - 1) / 2) {
startPage = totalPages - displayNum + 1;
endPage = totalPages;
} else {
startPage = pageNumber - (displayNum - 1) / 2;
endPage = pageNumber + (displayNum - 1) / 2;
} */
if(totalPages<=10){
if(totalPages==1||totalPages==0){
sbPageString = "" + 1 + "";
}else{
sbPageString += "上一页 ";
for(var i=1;i<=totalPages;i++){
if(i
sbPageString += "" + i + "";
}else if(i==pageNumber){
sbPageString += "" + pageNumber + "";
}else if(i>pageNumber){
sbPageString += "" + i + "";
}
}
sbPageString += "下一页 ";
}
}
if(totalPages>10){
if(pageNumber!=1){
sbPageString += "上一页 ";
}
if(pageNumber<=4){
for(var i=1;i<=parseInt(pageNumber);i++){
if(i!=pageNumber){
sbPageString += "" + i + "";}
if(i==pageNumber){
sbPageString += "" + pageNumber + "";
}
}
sbPageString += "" + (pageNumber+1) + "";
sbPageString += "" + (pageNumber+2) + "...";
sbPageString += "" + totalPages + "";
}
if(pageNumber>4&&pageNumber<=totalPages-3){
sbPageString += "" + 1 + "...";
sbPageString += "" + (pageNumber-2) + "";
sbPageString += "" + (pageNumber-1) + "";
sbPageString += "" + pageNumber + "";
sbPageString += "" + (pageNumber+1) + "";
sbPageString += "" + (pageNumber+2) + "...";
sbPageString += "" + totalPages + "";
}
if(pageNumber>totalPages-3){
sbPageString += "" + 1 + "...";
sbPageString += "" + (pageNumber-2) + "";
sbPageString += "" + (pageNumber-1) + "";
sbPageString += "" + pageNumber + "";
for(var i=pageNumber+1;i<=totalPages;i++){
sbPageString += "" + i + "";
}
}
if(parseInt(pageNumber)!=totalPages){
sbPageString += "下一页 ";
}
}
$(".yema").append(sbPageString);