var d = dialog({contentType:'load', skin:'bk-popup'}); var id = 0; var pageSize = 10; var generatedCount=0; var pagetype=3; var userAgent = window.localStorage.getItem(agentName); var iscrollState='';//判断滑动方向 $(function(){ // 判断是否登录 checkUserAgent(); // 点击咨询详情 $("body").on("tap", ".n-list", function () { var id = $(this).data("id"); var photo = $(this).data("photo"); window.location.href = "guidance-detail.html?id=" + id; }) //一键已读 $("#read_all").on("tap", function(){ d.show(); sendPost("/patient/health/guidance/modifyStatus",{},'json','post', function(res){ d.close(); if (res && res.msg) { var d1 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:res.msg}); } else { var d2 = dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}); } }, function(res){ if(res.status == 200){ //隐藏所有的newicon $(".icon-news").hide(); } d.close(); }) }) mui.init({ pullRefresh : { container:'#wrapper', down : { height:50, auto: false, contentdown : "下拉可以刷新", contentover : "释放立即刷新", contentrefresh : "正在刷新...", callback: function(){ id = 0; iscrollState='down' queryInit() } }, up : { height:50, contentinit: '', contentdown: '', contentrefresh : "正在加载...", contentnomore:'没有更多数据了', callback: function() { iscrollState='up' queryInit() } } } }) }) appendFamilyMember($('#memberContainer'),function(){ $("#ul_guidance").empty(); $(".div-no-info").hide(); $(".main").show(); $("#read_all").show(); id=0; iscrollState=''; mui('#wrapper').pullRefresh().refresh(true) queryInit(); },function(){ //判断有授权家人,修改样式 if($('#memberContainer').is(':hidden')){ $('#wrapper').css('top','0px'); }else{ $('#wrapper').css('top','90px'); $('.div-no-info').css('padding-top','90px'); } }) /** * 界面数据初始化 */ function queryInit(){ var data = {}; data.id = id; data.pagesize = pageSize; sendPost("patient/health/guidance/list", data, "json", "post", queryListFailed, queryAppoListSuccess); } function queryListFailed() { d.close(); dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}); } function queryAppoListSuccess(res){ if (res.status == 200) { if (res.list.length > 0) { var list = res.list; var html='' for (var i = 0; i < list.length; i++){ id = list[i].id; var content1 = list[i].content; var name = list[i].name; var createTime = list[i].createTime.substring(0,16); var photo = list[i].photo; var docType=list[i].level; var job = "健管师"; if(docType==1){ job = "专科医生"; }if(docType==2){ job = "全科医生"; } if(photo == undefined || photo == null || photo == ""){ photo = "../../../images/d-default.png"; } var newHtml = ""; if(list[i].readStatus == 0){ //readStatus: 0未读 1已读 newHtml = '
'; } var content = '
  • '+createTime+'
    '+ '
    '+ '
    '+ '
    '+ '
    健康指导
    '+ ''+ '
    '+ '
    '+name+'
    '+ '
    '+ '
    '+ content1+ '
    '+ newHtml+ '
    '+ '
    '+ '
    '+ '

    点击查看

    '+ '
    '+ '
    '+ '
  • '; html += content; } if(iscrollState == 'down'){ $('#ul_guidance').empty().append(html); setTimeout(function(){ mui('#wrapper').pullRefresh().endPulldownToRefresh(false); mui('#wrapper').pullRefresh().enablePullupToRefresh();//重置 },1000) }else{ $('#ul_guidance').append(html); if(list.length < pageSize){ mui('#wrapper').pullRefresh().endPullupToRefresh(true); }else{ mui('#wrapper').pullRefresh().endPullupToRefresh(false); } } } else { if(id!=0){ setTimeout(function(){ mui('#wrapper').pullRefresh().endPullupToRefresh(true); },1000) }else{ //显示无数据的图片 $(".main").hide(); $("#read_all").hide(); $(".div-no-info").show(); mui('#wrapper').pullRefresh().enablePullupToRefresh(); } } d.close() } else { queryListFailed() } }