lottery_log.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
  6. <title>抽奖记录</title>
  7. <link rel="stylesheet" href="__STATIC__/box/css/_flexible.css?v={:config('js_version')}">
  8. <link rel="stylesheet" href="__STATIC__/box/css/log.css?v={:config('js_version')}">
  9. <script src="__STATIC__/box/js/flexible375.js?v={:config('js_version')}"></script>
  10. </head>
  11. <body>
  12. <div class="tab">
  13. <a class="tab_cell" href="{:url('exchange/log/'.$wx_app_id)}?v={:config('js_version')}">兑换记录</a>
  14. <a class="tab_cell active" href="{:url('lottery/log/'.$wx_app_id)}?v={:config('js_version')}">抽奖记录</a>
  15. </div>
  16. <div class="lotteryList">
  17. <ul class="js-template">
  18. <foreach name="list" item="vo">
  19. <li class="lotteryList_item">
  20. <span class="money">{$vo.title}</span>
  21. <span class="time">{$vo.time}</span>
  22. </li>
  23. </foreach>
  24. </ul>
  25. </div>
  26. <script src="__STATIC__/box/js/jquery.js"></script>
  27. <script>
  28. $(function () {
  29. var params = {
  30. format: 'json',
  31. page: 1,
  32. offset: 10
  33. };
  34. var get = 0
  35. $(window).bind('scroll', function(){
  36. var h=$(document.body).height()
  37. var c = $(window).scrollTop()
  38. var wh = $(window).height()
  39. if (Math.ceil(wh+c)>=h-10){
  40. getLog()
  41. }
  42. });
  43. function getLog() {
  44. if (get) return false
  45. get = 1
  46. params.page = ++params.page
  47. $.ajax({
  48. url: '/lottery/log/{$wx_app_id}',
  49. data: params,
  50. type: 'post',
  51. success: function (res) {
  52. var _html = ''
  53. for (var i = 0; i < res.data.list.length; i++) {
  54. _html += '<li class="lotteryList_item">\n' +
  55. ' <span class="money">'+res.data.list[i].title+'</span>\n' +
  56. ' <span class="time">'+res.data.list[i].time+'</span>\n' +
  57. ' </li>';
  58. }
  59. $('.js-template').append(_html)
  60. if ($('.js-template .content_item').length >= res.data.count) {
  61. $(window).unbind('scroll')
  62. }
  63. get = 0
  64. },
  65. error: function () {
  66. get = 0
  67. }
  68. })
  69. }
  70. })
  71. </script>
  72. </body>
  73. </html>