var patiCode = ""; var id = 0; var pagesize = 10; var scroller1 = null; var self = null; mui.plusReady(function() { plus.nativeUI.showWaiting(); scroller1 = new IScrollPullUpDown('wrapper',{ probeType:2, bounceTime: 250, bounceEasing: 'quadratic', mouseWheel:false, click:true, scrollbars:true, fadeScrollbars:true, interactiveScrollbars:false },pullDownAction,pullUpAction); self = plus.webview.currentWebview(); patiCode = self.code; queryInit(); }); mui.back = function(){ self.opener().reload(true); self.close(); } function queryInit(){ sendPost("doctor/health/guidance/list", { type: 0, id: id, pagesize: pagesize, patient: patiCode }, null, function(res) { console.log("指导记录:"+JSON.stringify(res)); if(res.status == 200) { if(res.list.length== 0 && id==0){ $("#div-no-info").removeClass("c-hide"); plus.nativeUI.closeWaiting(); return false; } template.helper("setSex", function(s) { if(s == 1) { return "男" } else if(s == 2) { return "女" } }); template.helper("setPhoto", function(p) { // if(!p || p.length == 0) { // return "../../../images/p-default.png"; // } else { // return p // } return getImgUrl(p); }); if(res.list.length > 0) { var list = res.list; id = list[list.length-1].id;//取最后一条的id } var cont = template("zhidao_tmpl", res); $("#zhidao_list").append(cont); scroller1.refresh(); $(".pullDown").hide(); $(".pullUp").hide(); plus.nativeUI.closeWaiting(); } }); } //下拉刷新 function pullDownAction(theScrollerTemp) { $(".pullDown").show(); $(".pullUp").hide(); setTimeout(function () { $("#zhidao_list").html(""); id=0; queryInit(); }, 100); } //上拉加载数据 function pullUpAction(theScrollerTemp) { $(".pullDown").hide(); $(".pullUp").show(); setTimeout(function () { queryInit(); }, 100); } $("#zhidao_list").on("click",".n-list",function(){ //该患者跟医生无签约关系时不可看详细信息 if(self.qyRelation == 0) return; var id = this.getAttribute("data-id"); mui.openWindow('guidance-detail.html', 'guidance-detail', { extras: { guideId: id } }) }) $("#add_btn").on("click",function(){ mui.openWindow('../../hzzd/html/xinzengzhidao.html', 'jkzd', { extras: { code: patiCode } }); })