
_txt){
$(this).text($(this).text().substring(0,_txt));
$(this).html($(this).html() + '...');
}
});
$('.page-nav a').each(function(){
var $this = $(this);
if($this[0].href == String(window.location)){
$this.addClass("active");
}
})
var pageIndex = 1,
totalPages = $("#content-page").data("pagetotal"),
//获取url中指定参数值
_getQueryString = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return r[2];
return null;
}
var _onloadAjax = function () {
queryString = [
"pagesize=3",
"page=" + pageIndex,
"menu_guid=" + _getQueryString("menu_guid"),
"show=1"
];
$.get( lanh.apiHost+ "service/cms_article/list.html?" + queryString.join("&"), function (result) {
if (!!result) { _addHtml(result); }
}, "json");
}
var _addHtml = function (result) {
$(".page-about-list ul li").remove();
totalPages = result.paginated.page;
if (!!result.data) {
var _html = "";
$.each(result.data, function (i, val) {
var _href = "";
_href = _href + "aboutUsInfo?art_id=" + val.art_id+"&art_menu_guid="+val.art_menu_guid;
var _image = val.art_titleimg;
var _imgerror = "this.src='public/images/default_noImg.png'";
_html = _html +'
'+val.art_title+'
'+val.art_desc+'
细致理解';
});
$(".page-about-list > ul").append(_html);
}
}
var _onLoadPage = function () {
var options = {
currentPage: 1,
numberOfPages: 5,
totalPages: totalPages,
size: "normal",
itemTexts: function (type, page, current) {
switch (type) {
case "first":
return "首页";
case "prev":
return "上一页";
case "next":
return "下一页";
case "last":
return "尾页";
case "page":
return page;
}
},
onPageClicked: function (e, originalEvent, type, page) {
pageIndex = page;
_onloadAjax();
},
itemContainerClass: function (type, page, current) {
switch (type) {
case "first":
case "prev":
case "last":
case "next":
if (current == page) return "disabled";
break;
default:
return current == page ? "active" : "";
}
},
shouldShowPage: function (type, page, current) {
switch (type) {
case "prev":
case "next":
default:
return true;
}
},
tooltipTitles: function (type, page, current) {
return page;
}
}
$('#content-page').bootstrapPaginator(options);
}
_onLoadPage();