!function(t,s){ s={}; function pagesizeshow(startRow,endRow,counts){ var pagesizeshow=""; pagesizeshow+='' pagesizeshow+='' pagesizeshow+='' return pagesizeshow; } /* * counts 总页数 * linePages 每页多少条 * currentPage 当前页 */ function page(s,$this){ var pagesNum=""; var currentPage=isnull(s.currentPage)==""?1:parseInt(s.currentPage); if(isnull(s.pages)==""){ var counts=isnull(s.counts)!=""?parseInt(s.counts):0; var linePages=isnull(s.linePages)==""?20:parseInt(s.linePages); var showCounts=s.showCounts?true:false; pagesNum=counts%linePages==0?counts/linePages:parseInt(counts/linePages)+1; //共多少页 //显示条数信息 var startRow=(parseInt(currentPage)-1)* parseInt(linePages)+1; var endRow=currentPage*linePages>counts?counts:currentPage*linePages }else{ pagesNum=parseInt(s.pages); var showCounts=false; } var pageList=''; if(currentPage>pagesNum){ currentPage=pagesNum; } //获取上一页 下一页 值 //上一页 var prepage; //上一页 if(pagesNum>1){ if(currentPage==1){ prepage='' pagesizeshow+='显示第'+startRow+'到第'+endRow+'条记录,共'+counts+'条记录' pagesizeshow+='' pagesizeshow+='< '; }else{ prepage='< '; } } //下一页 var nextpage; if(pagesNum>1){ if(currentPage==pagesNum){ nextpage='> '; }else{ nextpage='> '; } } //设置分页 if(pagesNum>1){ var shenyuh='… '; var firstpage='1 '; var lastpage=''+pagesNum+' '; //末页 if(pagesNum<=11){ var yepage=''; for(var i=1; i<=pagesNum;i++){ if(i==currentPage){ yepage+=''+i+' ';//" "+i+"" }else{ yepage+=''+i+' ';//" "+i+"" } }//for结束 pageList+=prepage+yepage+nextpage; } //pagesNum<=11结束 if(pagesNum>11){ if(currentPage<=6){ var yepage=''; for(var i=1; i<=9;i++){ if(i==currentPage){ yepage+=''+i+' ' }else{ yepage+=''+i+' '; } } pageList+=prepage+yepage+shenyuh+lastpage+nextpage; } if(currentPage>=pagesNum-6){ var yepage=''; for(var i=pagesNum-8; i<=pagesNum;i++){ if(i==currentPage){ yepage+=''+i+' '; }else{ yepage+=''+i+' '; } } pageList+=prepage+firstpage+shenyuh+yepage+nextpage; } if( currentPage>6 && currentPage'+i+'' }//for i结束 var currentpages=' '+currentPage+' ' var yepage1=''; for(var j=currentPage+1; j<=currentPage+3;j++){ yepage1+=''+j+' '; }//for i结束 pageList+=prepage+firstpage+shenyuh+yepage2+currentpages+yepage1+shenyuh+lastpage+nextpage; } } //pagesNum>13结束} //pagesNum>1结束//设置分页结束/* page列表 */ var pageMain=''; pageMain+=''; pageMain+=''; showCounts && pagesNum>1?$this.html(pagesizeshow(startRow,endRow,counts)+pageMain):$this.html(pageMain) //$this.html(pagesizeshow(startRow,endRow,counts)+pageMain) }/*去除""或undefind null*/function isnull(str) { if (str == null || str == undefined || str == "undefined") { return ""; } else { return str; }}t.fn.pages=function(s){ var $this=$(this); page(s,$this);} /* *isLoding :是否正在加载 *shadeClose:是否关闭遮罩层 *shade:遮罩层颜色透明度 *shadeColor: 遮罩层颜色 *loadType: 加载类型 有1、2、3三种 */t.isloading=function(s){ var isLoad=isnull(s.isLoad)==""?"false":s.isLoad; var loadType=isnull(s.loadType)==""?3:s.loadType; //var shadeClose=s.shadeClose?true:false; var shade=isnull(s.shade)==""?0.1:s.shade; var shadeColor=isnull(s.shadeColor)==""?"#333":s.shadeColor; console.log("加载:"+loadType) if (isLoad=="true") { layer.load(loadType-1, { shadeClose: false, shade: [shade,shadeColor] //0.1透明度的白色背景 }); //0代表加载的风格,支持0-2 }}t.closeload=function(){ //console.log("close--"+y); layer.closeAll('loading');}}(jQuery, window, document)/* 点击分页 */jQuery.fn.extend({ pageclick:function(s) { var $this=$(this); $this.delegate('.pagination li', 'click', function(){ if(!$(this).hasClass("disabled") &&!$(this).hasClass("active")){ var currentPages=parseInt($(this).find("a").attr("data-page")); //$(this).addClass("active").siblings(".pagination li").removeClass("active"); s.callback(currentPages,$(this)) } }); }});'; pageMain+=''; pageMain+=''; pageMain+=pageList; pageMain+='
'; pageMain+='