mui.plusReady(function(){ var $no_result_wrap = $('#no_result_wrap'), $list = $('#medi_list'); plus.nativeUI.showWaiting(); sendPost("doctor/prescriptionInfo/getPrescriptionTemp",{}, function(){ plus.nativeUI.closeWaiting(); mui.toast("获取数据失败") }, function(res){ plus.nativeUI.closeWaiting(); if(res.status == 200){ if(res.data.length>0){ var html = template('template_tmp',{data:$.map(res.data,function(o,index){ o.jsonStr = JSON.stringify(o); return o }) }) $list.html(html); $('.mui-scroll-wrapper').show(); }else{ $no_result_wrap.show() } }else{ mui.toast("获取数据失败") } },'get') mui.init({ pullRefresh : { container:'.mui-scroll-wrapper', up : { height:50, contentrefresh : "正在加载...", contentnomore:'没有更多数据了', callback: function() { this.endPullupToRefresh(false) } } } }) //点击显示详情 $list.on('tap','.j-li-detail',function(){ var $this = $(this); mui.openWindow({ id: "mubanxiangqing", url: "mubanxiangqing.html", extras: { prescriptionInfo:$this.attr('data-json') } }) }) //跳转搜索 $('.search-input').on('tap',function(){ mui.openWindow({ id: "mubansousuo", url: "mubansousuo.html", extras: { } }) }) //点击选择 $list.on('tap','.j-choose-btn',function(event){ var $this = $(this); plus.storage.setItem("chooseTemplate",$this.closest('.j-li-detail').attr('data-json')) var page = plus.webview.getWebviewById("change-chufang2"); if(page){ mui.fire(page, "chooseTemplate"); } backIndex() event.stopPropagation(); }) function backIndex(){ //删掉搜索页面 var last = plus.webview.getWebviewById("chufangmuban"); if(last){ last.close(); } var last1 = plus.webview.getWebviewById("mubansousuo"); if(last1){ last1.close(); } var last2 = plus.webview.getWebviewById("mubanxiangqing"); if(last2){ last2.close(); } } })