|
|
@@ -531,6 +531,10 @@ function page(current){ |
|
|
|
function nextPage(){ |
|
|
|
currentPage = currentPage+1; |
|
|
|
console.log("currentPage=" + currentPage); |
|
|
|
if(currentPage >= endIndex){ |
|
|
|
startIndex=startIndex+1; |
|
|
|
endIndex = endIndex +1; |
|
|
|
} |
|
|
|
page(currentPage); |
|
|
|
} |
|
|
|
|
|
|
@@ -538,19 +542,15 @@ function page(current){ |
|
|
|
console.log("currentPage=" + currentPage); |
|
|
|
if(currentPage > 1){ |
|
|
|
currentPage = currentPage-1; |
|
|
|
if(currentPage <= startIndex && startIndex >= 1){ |
|
|
|
startIndex = startIndex -1; |
|
|
|
endIndex = endIndex - 1; |
|
|
|
} |
|
|
|
console.log("currentPage=" + (currentPage)); |
|
|
|
page(currentPage); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#inputpage').on('keypress',function(event){ |
|
|
|
if(event.keyCode == 13){ |
|
|
|
goPage(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function goPage(){ |
|
|
|
var goNum = $('#inputpage').val(); |
|
|
|
|
|
|
@@ -566,41 +566,47 @@ function page(current){ |
|
|
|
} |
|
|
|
|
|
|
|
function setPage(currentPage){ |
|
|
|
console.log("totalPage=" + totalPage); |
|
|
|
var html =""; |
|
|
|
console.log("currentPage=" + currentPage); |
|
|
|
if(totalPage==0){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
console.log("currentPage=" + currentPage); |
|
|
|
$('#page_total').text("共 " + totalNum + " 条"); |
|
|
|
html += "<span class=\"item\">共 " + totalNum + " </span>" |
|
|
|
if(currentPage > 1){ |
|
|
|
$('#startPage').removeClass("disabled"); |
|
|
|
$('#lastPage').removeClass("disabled"); |
|
|
|
html += "<a class=\"item navigation\" href=\"javascript:page(1)\"><span class=\"navigation_label\">首页</span></a>"; |
|
|
|
html += "<a class=\"item navigation\" href=\"javascript:prePage()\"><i class=\"left arrow icon\"></i></a>"; |
|
|
|
}else{ |
|
|
|
$('#startPage').addClass("disabled"); |
|
|
|
$('#lastPage').addClass("disabled"); |
|
|
|
html += "<a class=\"disabled item navigation\" href=\"javascript:page(1)\"><span class=\"navigation_label\">首页</span></a>"; |
|
|
|
html += "<a class=\"disabled item navigation\" href=\"javascript:prePage()\"><i class=\"left arrow icon\"></i></a>"; |
|
|
|
} |
|
|
|
|
|
|
|
console.log("totalPage=" + totalPage); |
|
|
|
var html =""; |
|
|
|
for(var i=startIndex-1; i < endIndex; i++){ |
|
|
|
var page_i = (currentPage + i); |
|
|
|
for(var i=startIndex; i <= endIndex; i++){ |
|
|
|
var page_i = i; |
|
|
|
if(page_i > totalPage){ |
|
|
|
break; |
|
|
|
} |
|
|
|
if( i == (startIndex -1)){ |
|
|
|
if( page_i == currentPage){ |
|
|
|
html += "<a id=\"page_" + page_i+ "\" class=\"active item\" href=\"page(" + page_i +")\">" + page_i + "</a>"; |
|
|
|
}else{ |
|
|
|
html += "<a id=\"page_" + page_i+ "\" class=\"item\" href=\"page(" + page_i +")\">" + page_i + "</a>"; |
|
|
|
} |
|
|
|
} |
|
|
|
console.log("html=" + html) |
|
|
|
document.getElementById("page_ids").innerHTML=html; |
|
|
|
|
|
|
|
if(currentPage >=totalPage){ |
|
|
|
$('#nextPage').addClass("disabled"); |
|
|
|
$('#endPage').addClass("disabled"); |
|
|
|
html += "<a class=\"disabled item navigation\" href=\"javascript:nextPage()\"><i class=\"icon right arrow\"></i></a>"; |
|
|
|
html += "<a class=\"disabled item navigation\" href=\"javascript:page(" + totalPage + ")\"><span class=\"navigation_label\">末页</span></a>"; |
|
|
|
}else{ |
|
|
|
$('#nextPage').removeClass("disabled"); |
|
|
|
$('#endPage').removeClass("disabled"); |
|
|
|
$('#endPage').attr("href","javascript:page(" + totalPage + ")"); |
|
|
|
html += "<a class=\"item navigation\" href=\"javascript:nextPage()\"><i class=\"icon right arrow\"></i></a>"; |
|
|
|
html += "<a class=\"item navigation\" href=\"javascript:page(" + totalPage + ")\"><span class=\"navigation_label\">末页</span></a>"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
html +="<div class=\"item\"> 前往<div class=\"ui input\"><input id=\"inputpage\" type=\"text\" placeholder=\"1\"></div>页</div>"; |
|
|
|
console.log("html=" + html) |
|
|
|
document.getElementById("page_menu").innerHTML=html; |
|
|
|
$('#inputpage').on('keypress',function(event){ |
|
|
|
if(event.keyCode == 13){ |
|
|
|
goPage(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |