guidance_detail.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. .bgc-17b3ec{background-color: #17b3ec;}
  17. .bgc-ffa54b{background-color: #ffa54b;}
  18. .bgc-f2f4f6{background-color: #fff;border-top: solid 1px #dcdcdc;}
  19. .btn_group{position: fixed; bottom: 0px; width: 100%; z-index:2;}
  20. .content p{word-wrap: break-word;}
  21. </style>
  22. </head>
  23. <body class="bgc-fff">
  24. <div class="h45">
  25. <div class="demo-comtop">
  26. <a class="mui-action-back"></a>
  27. <h1>健康指导模板</h1>
  28. </div>
  29. </div>
  30. <div class="content ptb10 plr10" style="margin-bottom: 72px;">
  31. </div>
  32. <div class="c-row ptb10 btn_group bgc-f2f4f6 c-hide" id="btn_group1">
  33. <div class="c-50 c-t-center pl10">
  34. <a class="c-btn c-f16 bgc-ffa54b c-btn-full c-btn-radius delete_btn">删除模板</a>
  35. </div>
  36. <div class="c-50 c-t-center pr10">
  37. <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius edit_btn">编辑模板</a>
  38. </div>
  39. </div>
  40. <div class="c-row ptb10 btn_group bgc-f2f4f6 c-hide" id="btn_group2">
  41. <div class="c-100 c-t-center plr10">
  42. <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius use_btn">引用模板</a>
  43. </div>
  44. </div>
  45. <div class="c-row ptb10 btn_group bgc-f2f4f6 c-hide" id="btn_group3">
  46. <div class="c-50 c-t-center pl10">
  47. <a class="c-btn c-f16 bgc-ffa54b c-btn-full c-btn-radius edit_btn">编辑模板</a>
  48. </div>
  49. <div class="c-50 c-t-center pr10">
  50. <a class="c-btn c-f16 bgc-17b3ec c-btn-full c-btn-radius send_btn">立即发送</a>
  51. </div>
  52. </div>
  53. </body>
  54. <script type="text/html" id="content_tmp">
  55. <h2 class="c-f16 c-bold c-333 c-t-center">{{modelName}}</h2>
  56. <div class="c-row">
  57. <div class="c-50">
  58. <span class="c-f12 c-909090">{{createTime}}</span>
  59. </div>
  60. <div class="c-50 c-t-right">
  61. <span class="c-f12 c-909090">使用次数:{{sendTimes}}</span>
  62. </div>
  63. </div>
  64. <p class="c-f14 c-333" id="content_text"></p>
  65. {{each imagesUrls as it}}
  66. <div>
  67. <img src="{{it | setPhoto}}" width="100%">
  68. </div>
  69. {{/each}}
  70. </script>
  71. <script src="../../../js/jquery/2.1.3/jquery.js"></script>
  72. <script src="../../../js/mui.min.js"></script>
  73. <script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
  74. <script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
  75. <script src="../../../js/app.js" type="text/javascript" charset="utf-8"></script>
  76. <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css"/>
  77. <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js" type="text/javascript" charset="utf-8"></script>
  78. <script type="text/javascript">
  79. var code="",
  80. reference,
  81. patiCode,
  82. content_details,
  83. is_sys = false;
  84. mui.init();
  85. mui.plusReady(function(){
  86. var self = plus.webview.currentWebview();
  87. code = self.code;
  88. reference = self.reference;
  89. is_sys = self.is_sys;
  90. patiCode = self.patiCode;
  91. if(reference == "mine"){
  92. if(is_sys){
  93. $("#btn_group2").show();
  94. }else{
  95. $("#btn_group1").show();
  96. }
  97. }else{
  98. $("#btn_group3").show();
  99. }
  100. getDetail();
  101. bindEvents();
  102. });
  103. function getDetail(){
  104. var url = "doctor/guidance_temp/listDetail";
  105. sendGet(url,{modelCode: code}, null, function(res){
  106. if(res.status == 200){
  107. var regN = /\n/g;
  108. var regRN = /\r\n/g;
  109. var content = res.data.content.replace(/ /g, "&nbsp;");
  110. content = content.replace(regN,"<br/>");
  111. // res.data.content = content;
  112. content_details = res.data;
  113. var html = template('content_tmp', res.data);
  114. $(".content").empty().append(html);
  115. $("#content_text").html(content);
  116. }
  117. }, true);
  118. }
  119. function bindEvents(){
  120. $(".edit_btn").on('tap', function(){
  121. openWebview('edit_guidance.html',{
  122. reference: reference,
  123. is_sys: is_sys,
  124. code: code,
  125. patiCode: patiCode,
  126. content_details: content_details
  127. });
  128. });
  129. $(".send_btn").on('tap', function(){
  130. dialog({
  131. content: "发出后无法变更,是否确认发送给居民?",
  132. okValue: "继续发送",
  133. ok: function(){
  134. var url = "doctor/health/guidance/add",
  135. params = {
  136. patient: patiCode,
  137. content: content_details.content,
  138. modelCode: code,
  139. images: content_details.imagesUrls ? content_details.imagesUrls.join(","):""
  140. };
  141. plus.nativeUI.showWaiting();
  142. sendPost(url, params, null, function(res){
  143. if (res.status == 200) {
  144. mui.toast("发送成功!");
  145. var self = plus.webview.currentWebview(),
  146. opener = self.opener(),
  147. pre_opener = self.opener().opener();
  148. if(opener.id == "jkzd"){ //自己的模板详情
  149. if(pre_opener.id == "guidance_info"){
  150. mui.fire(pre_opener.opener(), "update");
  151. pre_opener.opener().show();
  152. mui.later(function(){
  153. pre_opener.close('none');
  154. opener.close('none');
  155. self.close('none');
  156. }, 300);
  157. }else{
  158. mui.fire(pre_opener, "update");
  159. pre_opener.show();
  160. mui.later(function(){
  161. opener.close('none');
  162. self.close('none');
  163. }, 300);
  164. }
  165. }else{ //系统模板详情
  166. var pre_pre_opener = pre_opener.opener();
  167. if(pre_pre_opener.id == "guidance_info"){
  168. mui.fire(pre_pre_opener.opener(), "update");
  169. pre_pre_opener.opener().show();
  170. mui.later(function(){
  171. pre_pre_opener.close('none');
  172. opener.close('none');
  173. pre_opener.close('none');
  174. self.close('none');
  175. }, 300);
  176. }else{
  177. mui.fire(pre_pre_opener, "update");
  178. pre_pre_opener.show();
  179. mui.later(function(){
  180. opener.close('none');
  181. pre_opener.close('none');
  182. self.close('none');
  183. }, 300);
  184. }
  185. }
  186. }else{
  187. mui.toast(res.msg)
  188. }
  189. plus.nativeUI.closeWaiting();
  190. }, 'POST', '', true);
  191. },
  192. cancelValue: "不了,谢谢",
  193. cancel: function(){}
  194. }).showModal();
  195. });
  196. $(".delete_btn").on('click', function(){
  197. dialog({
  198. content: "删除后无法恢复,是否确认删除模板?",
  199. okValue: "继续删除",
  200. ok: function(){
  201. var url = "/doctor/guidance_temp/delete",
  202. params = {code: code};
  203. sendPost(url, params, null, function(res){
  204. if(res.status == 200){
  205. var self = plus.webview.currentWebview(),
  206. opener = self.opener();
  207. if(opener){
  208. opener.reload(true);
  209. // mui.fire(opener, "refresh");
  210. mui.back();
  211. }
  212. }
  213. },'POST','',true);
  214. },
  215. cancelValue: "不了,谢谢",
  216. cancel: function(){}
  217. }).showModal();
  218. });
  219. //引用模板
  220. $(".use_btn").on('click', function(){
  221. openWebview('edit_guidance.html',{
  222. reference: reference,
  223. is_sys: is_sys,
  224. code: code,
  225. patiCode: patiCode,
  226. content_details: content_details
  227. });
  228. });
  229. }
  230. template.helper("setPhoto", function(p) {
  231. return getImgUrl(p);
  232. });
  233. </script>
  234. </html>