steps_detail.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
  6. <title>捐赠步数</title>
  7. <link type="text/css" rel="stylesheet"
  8. href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/weui.css?<?php echo bonus_version(); ?>"/>
  9. <link rel="stylesheet"
  10. href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css?<?php echo bonus_version(); ?>">
  11. <link type="text/css" rel="stylesheet"
  12. href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/homepage.css?<?php echo bonus_version(); ?>"/>
  13. <style type="text/css">
  14. html, body {
  15. background: #ffffff;
  16. font-family: PingFang SC, Hiragino Sans GB, Microsoft YaHei, 微软雅黑, Arial, sans-serif;
  17. }
  18. .sport_echarts {
  19. margin: 0 auto;
  20. }
  21. #mine_steps {
  22. background: url("<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/images/echarts_bg.png") no-repeat;
  23. background-size: 100% 100%;
  24. }
  25. .group_name h3 {
  26. margin-top: 7px;
  27. }
  28. .weui-cell__hd img {
  29. width: 50px;
  30. height: 50px;
  31. }
  32. .group_list .weui-cell__hd img {
  33. border-radius: 5px;
  34. margin-right: 10px;
  35. }
  36. .group_list .weui-cell__ft .weui-btn_mini {
  37. display: block;
  38. font-size: 13px;
  39. line-height: 16px;
  40. padding: 5px 10px;
  41. font-weight: bold;
  42. }
  43. .title {
  44. overflow: hidden;
  45. }
  46. .title h3{
  47. font-size: 15px;
  48. margin-left: 15px;
  49. margin-top: 10px;
  50. }
  51. .title span {
  52. font-size: 12px;
  53. font-weight: 400;
  54. color: #333333;
  55. margin-right: 15px;
  56. margin-top: 12px;
  57. }
  58. .weui-btn_primary {
  59. background: #2B2B2B;
  60. }
  61. .week_total {
  62. font-size: 12px;
  63. font-weight: 400;
  64. color: #666666;
  65. }
  66. .sport_echarts {
  67. position: relative;
  68. }
  69. .today_num,.month {
  70. position: absolute;
  71. right: 15px;
  72. top: 10px;
  73. font-size: 15px;
  74. font-weight: 600;
  75. color: #ffffff;
  76. z-index: 10;
  77. }
  78. .month {
  79. left: 15px;
  80. }
  81. .question_mark {
  82. width: 14px;
  83. height: 14px;
  84. vertical-align: bottom;
  85. margin-left: 5px;
  86. }
  87. .rules {
  88. position: absolute;
  89. right: 15px;
  90. bottom: 30px;
  91. font-size: 12px;
  92. }
  93. .group_info {
  94. position: relative;
  95. }
  96. </style>
  97. </head>
  98. <body>
  99. <div class="cover">
  100. <img src="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/images/cover.png" alt="cover">
  101. </div>
  102. <div class="group_top">
  103. <div class="group_info">
  104. <div class="group_avatar">
  105. <img src="<?php echo $output['avatar'] ?>" class='g_avatar' alt="group_avatar">
  106. </div>
  107. <div class="group_name">
  108. <h3><?php echo $output['nickname'] ?></h3>
  109. <div class="rules">
  110. <a href="xmmz://p.lrlz.com/web/web?title=捐赠规则&url=https://passport.lrlz.com/hfive/new_panda_rules/donationRules.html">
  111. <p>捐赠规则<img class="question_mark" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/images/question_mark.png"></p>
  112. </a>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="sport_echarts">
  118. <div class="month"><?php echo $output['charts']['month'] ?></div>
  119. <div class="today_num"></div>
  120. <div class="mine_steps" id="mine_steps"></div>
  121. </div>
  122. <div class="title">
  123. <h3 style="float: left;">步数捐赠至</h3>
  124. <span style="float:right;"></span>
  125. </div>
  126. <div class="group_list">
  127. <div class="weui-cells">
  128. <?php
  129. foreach ($output['room_steps'] as $room) {
  130. echo "<div class=\"weui-cell\">
  131. <div class=\"weui-cell__hd\">
  132. <img src=\"{$room['avatar']}\">
  133. </div>
  134. <div class=\"weui-cell__bd\">
  135. <p>{$room['name']}</p>
  136. <p class='week_total'>本周累计步数:{$room['steps']}</p>
  137. </div>
  138. <div class=\"weui-cell__ft\">
  139. <a href=\"javascript:void(0)\" data-roomId=\"".$room['room_id']."\" class=\"weui-btn weui-btn_mini donate\" style='background-color: #000'>选择</a>
  140. </div>
  141. </div>";
  142. }
  143. ?>
  144. </div>
  145. </div>
  146. <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js?<?php echo bonus_version(); ?>"></script>
  147. <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/jquery-weui.min.js?<?php echo bonus_version(); ?>"></script>
  148. <script src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/fastclick.js?<?php echo bonus_version(); ?>"></script>
  149. <script src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/echarts.simple.min.js?<?php echo bonus_version(); ?>"></script>
  150. <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/new_bridge.js?<?php echo bonus_version(); ?>"></script>
  151. <script type="text/javascript">
  152. $(function () {
  153. var bridge = new Bridge();
  154. var app_steps = 0;
  155. var jsInit = {
  156. action:"read_steps"
  157. };
  158. bridge.call_native_handler('on_native_click', JSON.stringify(jsInit),function(res){
  159. var datas = JSON.parse(res);
  160. $('.today_num').text("步数:"+datas.now);
  161. $('.title span').text("可兑换"+(datas.now/<?php echo $output['donate_rate'];?>)+"元");
  162. app_steps = datas.now;
  163. });
  164. var set_echarts_size = function(){
  165. var docmentWidth = $(document).width();
  166. var echartsWidth= docmentWidth-(docmentWidth*0.2);
  167. var echartsHigth = echartsWidth*9/16;
  168. $('#mine_steps').css({width:echartsWidth+"px",height:echartsHigth+"px"});
  169. $('.sport_echarts').css({width:echartsWidth+"px",height:echartsHigth+"px"});
  170. };
  171. set_echarts_size();
  172. var dateList = <?php echo json_encode($output['charts']['date'])?>;
  173. var stepsList =<?php echo json_encode($output['charts']['steps'])?>;
  174. var month = "<?php echo $output['charts']['month']; ?>";
  175. // dateList[0] = month + dateList[0];
  176. // var dateList = ['13', '14', '15', '16', '17', '18', '19'];
  177. // var stepsList = [12345, 123414, 9075, 3789, 800, 7856, 126777];
  178. var mySportEcharts = echarts.init(document.getElementById('mine_steps'));
  179. var option = {
  180. grid: {
  181. left: 10,
  182. right: 10
  183. },
  184. xAxis: {
  185. // nameGap:0,
  186. // nameLocation:'start',
  187. // name:month,
  188. offset: 24,
  189. // type: 'category',
  190. data: dateList,
  191. // splitNumber: 7,
  192. axisLine: {
  193. show: false,
  194. // onZero: false
  195. },
  196. axisTick: {
  197. show: false,
  198. // interval:2
  199. }
  200. },
  201. yAxis: {
  202. show: false
  203. },
  204. series: [{
  205. data: stepsList,
  206. type: 'line',
  207. itemStyle: {
  208. normal: {
  209. color: '#fff',
  210. lineStyle: {
  211. color: '#fff'
  212. }
  213. }
  214. }
  215. }],
  216. textStyle: {
  217. color: "#fff"
  218. }
  219. };
  220. mySportEcharts.setOption(option);
  221. $('.donate').on('click',function(){
  222. var room_id = $(this).attr('data-roomId');
  223. if(app_steps <= 0) {
  224. $.alert("目前没有可捐赠的步数 赶紧动一动吧");
  225. return;
  226. }
  227. $.confirm({
  228. title: '步数捐赠',
  229. text: '确定将您的步数捐赠到该群?',
  230. onOK: function () {
  231. $.get("/mobile/index.php",{
  232. op:'donate_steps',
  233. act:'member_talk',
  234. client_type:'ajax',
  235. steps:app_steps,
  236. room_id:room_id
  237. },function(res){
  238. var datas = JSON.parse(res);
  239. if(datas.code != 200) {
  240. $.toast(datas.message,1000);
  241. return;
  242. }
  243. var jsInit = {
  244. action:"step_callback",
  245. params: {
  246. stepCount:app_steps,
  247. }
  248. };
  249. bridge.call_native_handler('on_native_click', JSON.stringify(jsInit),function(res){
  250. var datas = JSON.parse(res);
  251. });
  252. $.alert("您为该群贡献了"+datas.datas.amount+"元基金", "捐献成功",function(){
  253. window.location.reload();
  254. });
  255. });
  256. }
  257. });
  258. });
  259. });
  260. </script>
  261. </body>
  262. </html>