add-sport-record.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  5. <meta charset="utf-8">
  6. <title>运动</title>
  7. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../iconfont/iconfont.css" />
  9. <link rel="stylesheet" type="text/css" href="../css/ss-style.css" />
  10. <link rel="stylesheet" type="text/css" href="../../../css/cross.ui.css">
  11. </head>
  12. <body>
  13. <div class="c-main">
  14. <!--<div class="h45">
  15. <div class="demo-comtop">
  16. <a class="mui-action-back"></a>
  17. <h1>运动</h1>
  18. </div>
  19. </div>-->
  20. <div class="wis-fix c-border-b mt15">
  21. <ul class="c-list patient-list c-border-t mt fosx-li" data-list="patientInfo">
  22. <li>
  23. <div class="c-list-value pr30" style="width: 80px;">
  24. <h4><em class="star"></em>记录时间</h4>
  25. </div>
  26. <div class="c-list-info">
  27. <div class="input-group width-100">
  28. <input type="text" class="form-control width-100 no-border" placeholder="请输入记录时间" style="background: #FFFFFF;" data-time="date" value="" id="yd_date">
  29. <span class="form-select-arrow"></span>
  30. </div>
  31. </div>
  32. </li>
  33. <li>
  34. <div class="c-list-value pr30" style="width: 80px;">
  35. <h4><em class="star"></em>时长(分钟)</h4>
  36. </div>
  37. <div class="c-list-info">
  38. <div class="input-group width-100">
  39. <input type="text" class="form-control width-100 no-border" placeholder="请选择时长" style="background: #FFFFFF;" data-val="date2" value="" id="yd_time">
  40. <span class="form-select-arrow"></span>
  41. </div>
  42. </div>
  43. </li>
  44. <li>
  45. <div class="c-list-value pr30" style="width: 80px;">
  46. <h4><em class="star"></em>运动</h4>
  47. </div>
  48. <div class="c-list-info">
  49. <div class="input-group width-100">
  50. <input type="text" class="form-control width-100 no-border" placeholder="请选择运动强度" style="background: #FFFFFF;" data-val="sport" attr_spType="" value="" id="yd_strong">
  51. <span class="form-select-arrow"></span>
  52. </div>
  53. </div>
  54. </li>
  55. <li>
  56. <div class="c-list-value pr30" style="width: 80px;">
  57. <h4><em class="star"></em>具体运动</h4>
  58. </div>
  59. <div class="c-list-info">
  60. <div class="input-group width-100">
  61. <input type="text" class="form-control width-100 no-border" placeholder="请选择运动" style="background: #FFFFFF;" data-val="sport2" attr_sp="" value="" id="yd_val">
  62. <span class="form-select-arrow"></span>
  63. </div>
  64. </div>
  65. </li>
  66. </ul>
  67. </div>
  68. <p class="c-f16 c5b plr15 pt10">轻度运动:购物、散步、做操、太极拳、气功等</p>
  69. <p class="c-f16 c5b plr15">中度运动:快走、慢跑、骑车、爬楼梯、健身操等</p>
  70. <p class="c-f16 c5b plr15">稍强度运动:跳绳、爬山、游泳、球类、跳舞等</p>
  71. <div class="bottom-box clearfix mt20 plr15">
  72. <a href="javascript:;" id="goback" class="c-btn-full c-btn-4dcd70 c-btn-radius fl c-f18">保存</a>
  73. </div>
  74. </div>
  75. </body>
  76. <script src="../../../js/jquery/2.1.3/jquery.js"></script>
  77. <script src="../../../widget/mobiscroll/2.15.1/js/mobiscroll.js"></script>
  78. <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js"></script>
  79. <link rel="stylesheet" type="text/css" href="../../../widget/mobiscroll/2.15.1/css/mobiscroll.css">
  80. <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css">
  81. <script type="text/javascript" src="../../../js/mui.min.js"></script>
  82. <script type="text/javascript" src="../../../js/common_http.js" ></script>
  83. <script type="text/javascript" src="../../../js/weixin_common.js" ></script>
  84. <script src="../js/health-record.js"></script>
  85. <script>
  86. $(function() {
  87. document.getElementById("goback").addEventListener("tap", function() {
  88. var date = document.getElementById("yd_date").value;
  89. var time = document.getElementById("yd_time").value;
  90. var strong_bz = $("#yd_strong").attr("attr_spType");//document.getElementById("yd_strong").value;
  91. var val_bz =$("#yd_val").attr("attr_sp"); //document.getElementById("yd_val").value;
  92. var strong=document.getElementById("yd_strong").value;
  93. var val=document.getElementById("yd_val").value;
  94. if (val && date && time && strong) {
  95. setTimeout(function(){
  96. },1000);
  97. } else {
  98. dialog({contentType:'tipsbox', skin:'bk-popup' , content:'请填写完整信息'}).show();
  99. return;
  100. }
  101. var params = {};
  102. params.record_date = date;
  103. params.sportsTime = time;
  104. params.sportsType = strong_bz;
  105. params.sports = val_bz;
  106. //发送ajax请求
  107. sendPost("patient/health_record/add_sports", params, "json", "post", addHealthRecordFailed, addSportSuccess);
  108. });
  109. $('input')
  110. var opt1 = {
  111. preset: 'date',
  112. theme: 'ios',
  113. lang: 'zh',
  114. minDate: new Date(1900, 01, 01)
  115. };
  116. $('input[data-time=date]').mobiscroll(opt1);
  117. sendPost("patient/health_record/sports_type","", "json", "post", queryListFailed,sports_type_Successs1);
  118. function sports_type_Successs1(res){
  119. var arr_key=[];
  120. var arr_value=[];
  121. var data=res.list;
  122. for(var i=0;i<data.length;i++){
  123. arr_key.push(data[i].code);
  124. arr_value.push(data[i].name);
  125. }
  126. $('input[data-val="sport"]').mobiscroll({
  127. theme: 'ios',
  128. lang: 'zh',
  129. formatValue: function(d) {
  130. return d.join('-');
  131. },
  132. customWheels: true,
  133. wheels: [ //如果值非常多请事先按需求生成好
  134. [{
  135. keys:arr_key, //['1', '2', '3'],
  136. values: arr_value //['轻度运动', '中度运动', '稍强的运动']
  137. }]
  138. ],
  139. onSelect: function(valueText, inst) {
  140. var dd = eval("[" + valueText + "]");
  141. $('input[data-val="sport"]').val(dd[0].values);//
  142. $('input[data-val="sport"]').attr("attr_spType",dd[0].keys);
  143. //
  144. }
  145. });
  146. }
  147. sendPost("patient/health_record/sports"," ", "json", "post", queryListFailed,sports_Successs2);
  148. function sports_Successs2(res){
  149. var arr_key2=[];
  150. var arr_value2=[];
  151. var data=res.list;
  152. for(var i=0;i<data.length;i++){
  153. arr_key2.push(data[i].code);
  154. arr_value2.push(data[i].name);
  155. }
  156. $('input[data-val="sport2"]').mobiscroll({
  157. theme: 'ios',
  158. lang: 'zh',
  159. formatValue: function(d) {
  160. return d.join('-');
  161. },
  162. customWheels: true,
  163. wheels: [ //如果值非常多请事先按需求生成好
  164. [{
  165. keys: arr_key2,//['1', '2', '3', '4', '5'],
  166. values: arr_value2 //['购物', '散步', '做操', '太极拳', '气功']
  167. }]
  168. ],
  169. onSelect: function(valueText, inst) {
  170. var dd = eval("[" + valueText + "]");
  171. $('input[data-val="sport2"]').val(dd[0].values);
  172. $('input[data-val="sport2"]').attr("attr_sp",dd[0].keys);
  173. }
  174. });
  175. }
  176. $('input[data-val="date2"]').mobiscroll({
  177. theme: 'ios',
  178. lang: 'zh',
  179. formatValue: function(d) {
  180. return d.join('-');
  181. },
  182. customWheels: true,
  183. wheels: [ //如果值非常多请事先按需求生成好
  184. [{
  185. keys: ['1', '2', '3', '4'],
  186. values: ['5', '15', '30', '60']
  187. }]
  188. ],
  189. onSelect: function(valueText, inst) {
  190. var dd = eval("[" + valueText + "]");
  191. $('input[data-val="date2"]').val(dd[0].values);
  192. }
  193. });
  194. })
  195. </script>
  196. </html>