var selectKey = 0 ; var selectName=""; var d = dialog({contentType:'load', skin:'bk-popup'}); var id = 0; var pageSize = 10; var pagetype=4; var status = 0; var tab_s =0; var scroller1; Request = GetRequest(); var openid = Request["openid"]; var tabType = Request['type']; //下拉刷新 function pullDownAction(theScrollerTemp) { d.show(); setTimeout(function () { $("#publicul").html(""); id=0; fillList(); }, 100); } //上拉加载数据 function pullUpAction(theScrollerTemp) { d.show(); setTimeout(function () { fillList(); }, 100); } appendFamilyMember($('#memberContainer'),function(){ id=0; $("#publicul").empty(); selectKey = 0; selectName = '全部'; $('.div-type').html(selectName); fillList(); },function(){ //判断有授权家人,修改样式 if($('#memberContainer').is(':hidden')){ $('#wrapper').css('top','41px'); }else{ $('#wrapper').css('top','130px'); $('.div-no-info').css('padding-top','200px'); $('.div-condition').css('top','90px'); } }); var userAgent = window.localStorage.getItem(agentName); checkUserAgent(); $(function(){ scroller1 = new IScrollPullUpDown('wrapper',{ probeType:2, bounceTime: 250, bounceEasing: 'quadratic', mouseWheel:false, scrollbars:true, click:true, fadeScrollbars:true, interactiveScrollbars:false },pullDownAction,pullUpAction); //选择全部 $('.div-type').mobiscroll({ theme: 'ios', lang: 'zh', formatValue: function(d) { return d.join(','); }, customWheels: true, wheels: [ [{ keys: ['0', '1', '2'], values: ['全部', '高血压', '糖尿病'] }] ], onSelect: function(valueText, inst) { var dd = eval("[" + valueText + "]"); $('.div-type').html(dd[0].values); selectKey = dd[0].keys; selectName = dd[0].values; //公共咨询 if(tab_s==0){ id=0; $("#publicul").html(""); fillList(); } //病友圈 if(tab_s==1){ id=0; $("#patinetsul").html(""); fillList2(); } } }); bindEvents(); var diseaseType = ""; setTimeout(function(){ if(diseaseType){ tabType = diseaseType; } if(tabType==2){ $("#patientsLi").click(); }else{ fillList(); } },200); }) function bindEvents() { //点击新增事件 $(".timper-addfix").click(function(){ window.location.href ="public-consult-add.html?openid="+openid; }); //标签切换 $(".pt-tab li").click(function(){ var tabid = $(this).attr("id"); $(".pt-tab li").removeClass("hit"); $(this).addClass("hit"); if(tabid=="publicLi"){ window.localStorage.setItem("diseaseType","1"); id=0; tab_s=0; $("#publicul").show(); $("#patinetsList").hide(); $("#publicul").html(""); fillList(); } }) } function fillList() { var data = {}; data.id = id; data.pagesize = pageSize; var dis = selectKey; if(dis&&dis!=0) data.disease = dis; var userAgent = window.localStorage.getItem(agentName); $.ajax(server + "patient/consult/public/list", { data: data, type: 'POST', dataType: 'json', beforeSend: function(request) { request.setRequestHeader("userAgent", userAgent); }, error: function(res) { d.close(); if(res.status == 999 || res.status == 998 || res.status == 997){ loginUrl(res.status); return; } dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show(); }, success: function(res) { if(res.status == 999 || res.status == 998 || res.status == 997){ loginUrl(res.status); } else if (res.status == 200) { if (res.list.length > 0) { var list = res.list; var $list = $("#publicul"); id=res.list[list.length-1].id; $("#nopubliclist").hide(); $('#publicul').show(); for (var i = 0; i < list.length; i++) { var consultCode = list[i].consult; var diseaseName = list[i].diseaseName; var photo = list[i].photo; if(!photo){ photo = "../../../images/p-default.png"; } if(!diseaseName) diseaseName = ""; var content = '
  • '+ '
    【'+ list[i].diseaseName+'】'+list[i].title+ '
    ' + '
    '+ list[i].content+ '
    '+ '
    '+ '
    '+ ''+ '
    '+ '
    '+list[i].name+'
    '+ '
    '+list[i].czrq.substring(0,19)+'
    '+ '
    '+ ''+ ' '+ '
    '+ '
    '+ '
  • '; $list.append(content); } $("#publicul li").on("tap",function(){ var code = this.getAttribute("data-code"); window.open("public-consult-detail.html?code=" + code); }) scroller1.myScroll.refresh(); } else { if(id==0){ $("#nopubliclist").show(); $('#publicul').hide(); }else{ dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'无更多数据!'}).show(); } } d.close(); } else { d.close(); dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'加载失败'}).show(); } } }); } function publicdetail(code){ window.open("public-consult-detail.html?code=" + code); }