guidance_list_old.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>健康指导</title>
  6. <meta name="format-detection" content="telephone=no" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  8. <meta name="apple-mobile-web-app-capable" content="yes" />
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  10. <link rel="stylesheet" href="../iconfont/iconfont.css" />
  11. <link rel="stylesheet" type="text/css" href="../../../css/mui.min.css"/>
  12. <link rel="stylesheet" href="../../../common/cross/css/cross.css" type="text/css">
  13. <link rel="stylesheet" href="../../../common/cross/css/cross.ui.css" type="text/css" />
  14. <link rel="stylesheet" type="text/css" href="../../../common/cross/css/ui.all.css"/>
  15. <style type="text/css">
  16. .ptb3{padding: 3px 0;}
  17. .add-btn{width: 50px;height: 50px;position: fixed;bottom: 30px;right: 30px; background: url(../images/xuanfu_btn.png) no-repeat center top;background-size: 50px;z-index: 999;}
  18. </style>
  19. </head>
  20. <body>
  21. <div class="h45">
  22. <div class="demo-comtop">
  23. <a class="mui-action-back"></a>
  24. <h1>健康指导</h1>
  25. </div>
  26. </div>
  27. <div class="mt10 ui-grid ptb5 bgc-fff c-border-tb">
  28. <div class="ui-col-1 c-border-r c-t-center ptb3" id="tuanduimuban">
  29. <img src="../images/yiyongmoban_icon.png" width="14" class="mt5">
  30. <span class="c-f16 c-333 ml5">团队模板</span>
  31. </div>
  32. <div class="ui-col-1 c-t-center ptb3" id="sys_guidance">
  33. <img src="../images/yiyongmoban_icon.png" width="14" class="mt5">
  34. <span class="c-f16 c-333 ml5">系统模板</span>
  35. </div>
  36. </div>
  37. <div id="no_result_wrap" class="c-hide">
  38. <img class="no-result-img" src="../../../images/shujuweikong_img.png">
  39. <div class="f-fs14 c-323232 c-t-center">暂无指导模板</div>
  40. </div>
  41. <div class="mui-scroll-wrapper c-hide" id="result_wrap" style="top:97px;">
  42. <div class="mui-scroll">
  43. <div class="c-f12 c-909090 ml10 mtb5">使用自定义模板</div>
  44. <ul class="c-list c-border-tb temp_panel"></ul>
  45. </div>
  46. </div>
  47. <div id="add_guidance" class="add-btn"></div>
  48. </body>
  49. <script type="text/html" id="guidance_list_tmp">
  50. {{each list as it}}
  51. <li class="list-arrow-r ptb10" data-code="{{it.code}}">
  52. <div class="c-list-key pr20 c-f14 c-333">{{it.modelName}}</div>
  53. <div class="c-list-info c-t-right">
  54. <img src="../images/shiyongren_icon.png" width="14" class="mt5">
  55. <span class="c-f12 c-909090">{{it.sendTimes}}</span>
  56. </div>
  57. </li>
  58. {{/each}}
  59. </script>
  60. <script src="../../../js/jquery/2.1.3/jquery.js"></script>
  61. <script src="../../../js/es6-promise.js"></script>
  62. <script src="../../../js/mui.min.js"></script>
  63. <script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
  64. <script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
  65. <script src="../../../js/app.js" type="text/javascript" charset="utf-8"></script>
  66. <script>
  67. var patient = null,
  68. docInfo = null,
  69. reference,
  70. page = 1,
  71. pagesize = 10,
  72. scroller,
  73. isFirst = true,
  74. hasMore = true;
  75. mui.init();
  76. mui.plusReady(function(){
  77. var self = plus.webview.currentWebview();
  78. var opener = self.opener();
  79. if(opener.id == "mine.html"){
  80. reference = "mine";
  81. }
  82. page = 1;
  83. patient = self.code;
  84. initScroll();
  85. getList(false);
  86. bindEvents();
  87. });
  88. function getList(isInit){
  89. plus.nativeUI.showWaiting();
  90. console.log("getList");
  91. page = isInit ? 1 : page;
  92. var url = "doctor/guidance_temp/list",
  93. params = {type:2, pageNo: page, pageSize: pagesize}; //模板类型 1:系统 2:自定义 为空:所有
  94. sendGet(url, params, null, function(res){
  95. if(res.status == 200){
  96. page ++;
  97. if (isFirst) {
  98. mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
  99. }
  100. var html = template('guidance_list_tmp', {list:res.data});
  101. if(res.data.length == 0 && isFirst){
  102. $("#no_result_wrap").show();
  103. $('#result_wrap').hide();
  104. }else{
  105. if (res.data.length > 0) {
  106. hasMore = true;
  107. if (isInit) {
  108. $('.temp_panel').html(html);
  109. $(".mui-pull").eq(0).hide();
  110. } else {
  111. $('.temp_panel').append(html);
  112. }
  113. $("#result_wrap").show();
  114. $("#no_result_wrap").hide();
  115. mui(".mui-scroll-wrapper").pullRefresh().refresh(true);
  116. }
  117. if(res.data.length < pagesize){
  118. hasMore = false;
  119. mui(".mui-scroll-wrapper").pullRefresh().endPullupToRefresh(true);
  120. }
  121. if (isInit) {
  122. mui('.mui-scroll-wrapper').pullRefresh().endPulldownToRefresh();
  123. }
  124. }
  125. isFirst = false;
  126. }
  127. plus.nativeUI.closeWaiting();
  128. },true);
  129. }
  130. function bindEvents(){
  131. $("#add_guidance").on('click', function(){
  132. openWebview('edit_guidance.html',{action: "add",reference: reference, patiCode: patient});
  133. });
  134. $("#sys_guidance").on('click', function(){
  135. openWebview("sys_guidance_list.html",{reference: reference, patiCode: patient});
  136. });
  137. $(".temp_panel").on('tap', 'li', function(){
  138. var code = $(this).attr("data-code");
  139. openWebview("guidance_detail.html",{code: code, reference: reference, patiCode: patient});
  140. });
  141. $('#tuanduimuban').on( 'click', function () {
  142. openWebview("tuanduimubanliebiao.html",{reference: reference, patiCode: patient});
  143. });
  144. // window.addEventListener('refresh', function(){
  145. // getList(true);
  146. // });
  147. }
  148. function initScroll() {
  149. //阻尼系数
  150. var deceleration = mui.os.ios?0.003:0.0009;
  151. mui('.mui-scroll-wrapper').scroll({
  152. bounce: false,
  153. indicators: true, //是否显示滚动条
  154. deceleration:deceleration
  155. });
  156. mui(".mui-scroll-wrapper").pullRefresh({
  157. down: {
  158. callback: function() {
  159. var self = this;
  160. $(".mui-pull").show();
  161. setTimeout(function() {
  162. // $(".mui-pull").show();
  163. hasMore = true;
  164. getList(true);
  165. self.endPullupToRefresh(true);
  166. // self.enablePullupToRefresh();
  167. }, 1000);
  168. }
  169. },
  170. up: {
  171. callback: function(){
  172. var self = this;
  173. setTimeout(function(){
  174. if(hasMore) {
  175. getList(false);
  176. self.endPullupToRefresh();
  177. } else {
  178. self.endPullupToRefresh(true);
  179. }
  180. // self.endPullupToRefresh(!hasMore);
  181. },300);
  182. }
  183. }
  184. });
  185. }
  186. </script>
  187. </html>