var self, doctorCode, patiCode; var $body = $('.yj-main'); var saveData; mui.plusReady(function(){ self = plus.webview.currentWebview(); doctorCode = self.doctorCode; patiCode = self.patiCode; plus.nativeUI.showWaiting(); sendPost("doctor/prenatalnspector/prenatalInspectorList",{patient:patiCode}, function(){ plus.nativeUI.closeWaiting(); mui.toast("请求失败"); }, function(res){ plus.nativeUI.closeWaiting(); if(res.status == 200){ if(res.list.length>0){ saveData = res.list; var html = template('nav_tmp',{list:res.list}); $body.html(html) bindEvent() bindEvent1() }else{ $('#noChildSec').show(); } }else{ mui.toast("数据加载失败"); } }) }) function bindEvent(){ changeContent(0) //切换内容 function changeContent(num){ $('.yj-nav').find('li').eq(num).addClass('active').siblings().removeClass('active'); var childPage = template('msg_tmp',{data:saveData[num],first:saveData[0].pregnancyStatus}); $('#message').html(childPage) } //切换 $('.yj-nav').on('tap','li',function(){ var $this = $(this) if(!$this.hasClass('active')){ $this.addClass('active').siblings().removeClass('active') changeContent($this.index()) bindEvent1() } }) //区域滚动 mui('.j-nav-select').scroll({ scrollY: false, //是否竖向滚动 scrollX: true, //是否横向滚动 }) $body.on("tap", ".uncheck-remind", function(e) { var prenatalId = $(this).attr("data-code"); remindResident(prenatalId); }); $body.on("tap", ".remindAgain", function(e) { var prenatalId = $(this).attr("data-code"); remindResident(prenatalId,true); }); } function remindResident(prenatalId,remindAgain){ plus.nativeUI.showWaiting(); sendPost("/doctor/prenatalnspector/sendPrenatal", {prenatalId: prenatalId,patient:patiCode,doctor:doctorCode}, null, function(res){ plus.nativeUI.closeWaiting(); if(res.status == 200){ if(remindAgain){ $(".remindAgain").removeClass("remind-true").html("已提醒").addClass("remind-false"); }else{ $(".uncheck-remind").removeClass("remind-true").html("已提醒").addClass("remind-false"); } mui.toast(res.msg); } else { mui.toast(res.msg); } }) } function bindEvent1(){ //结果 $('.check_result').on('tap',function(){ mui.openWindow({ id: "chanjianjieguo", url: "chanjianjieguo.html", extras: { pregnancyNo:$(this).attr('data-id'), patient:patiCode } }) }) //展开和关闭 $('.j-up').on('tap',function(){ var $this = $(this).parent() if($this.hasClass('active')){ $this.removeClass('active') }else{ $this.addClass('active') } }) $('.yj-section').find('li').eq(0).addClass('active') }