var msgType=mobile.getUrlVars("msgType"); var pageNum = 1; var pageSize=10; var totalPage=0; mui.init({ pullRefresh: { container: '#pullrefresh', up: { contentrefresh: '正在加载...', callback: pullupRefresh } } }); mui.ready(function() { pullupRefresh(); $('.mui-table-view').on('tap', '.mui-table-view-cell', function(event) { top.location.href=$(this).find("a").attr("href"); }); }); function nofind(){ var img=event.srcElement; img.src=resourceUrl+"/mobile/image/blank_2.png"; img.onerror=null; } /** * 上拉加载具体业务实现 */ function pullupRefresh() { query(); } function query() { mobile.ajaxPost(base+"/wxMsg/queryMobile",{ msgType:msgType, pageNumber:pageNum, pageSize:pageSize },function(json){ totalPage=json.totalPage; if(json.list&&json.list.length>0){ if(pageNum>=totalPage){ mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); }else{ mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); } pageNum++; jQuery.each(json.list,function(id,item){ var html=""; html +='
  • '; html +=''; if(item.msg_img){ html +=''; } html +='
    '; html +='

    '+mobile.nullToSpace(item.msg_title)+'

    '; html +='

    '+item.create_time.substring(0,10)+'

    '; html +='
    '; html +='
    '; html +='
  • '; jQuery(".mui-table-view").append(html); }); }else{ mui('#pullrefresh').pullRefresh().endPullupToRefresh(true); if(pageNum==1){ mobile.tip(".mui-content","暂无数据"); } } }); } function getListContent(){ ajaxPost(ctx+'/wxPubMsgListController/getListContent.do',{listId:listId},function(json){ if(json.status=="error"){ return layer.open({content: '请求异常',time: 3}); } if(json.data){ $(".mui-title").html(json.data.listTitle); $("#post-date").html("发布日期:"+json.data.publishTimeString+""); $("#js_content").html(json.data.listCont); } }); } function getAll(){ ajaxPost(ctx+'/wxPubMsgListController/getAll.do',{},function(json){ if(json.status=="error"){ return layer.open({content: '请求异常',time: 3}); } $.each(json,function(id,item){ $("#type"+item.LIST_TYPE+ " .mui-badge").removeClass("mui-hidden"); $("#type"+item.LIST_TYPE+ " .mui-badge").html(parseInt($("#type"+item.LIST_TYPE+ " .mui-badge").html())+1); }); }); }