sign_in_list.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. {extend name="public/container"}
  2. {block name="title"}签到明细{/block}
  3. {block name="head_top"}
  4. <style>
  5. body {
  6. background: #f5f5f5;
  7. }
  8. .loading {
  9. font-size: .4rem;
  10. text-align: center;
  11. color: #999;
  12. }
  13. .loaded {
  14. font-size: .28rem;
  15. line-height: .72rem;
  16. text-align: center;
  17. color: #999;
  18. }
  19. .nothing {
  20. position: absolute;
  21. top: 30%;
  22. left: 50%;
  23. width: 4rem;
  24. height: 4rem;
  25. -webkit-transform: translate(-50%, -50%);
  26. transform: translate(-50%, -50%);
  27. }
  28. </style>
  29. {/block}
  30. {block name="content"}
  31. <div v-cloak id="app">
  32. <div class="sign-list">
  33. <div v-if="signList.length" class="list">
  34. <div v-for="(item, index) in signList" class="item">
  35. <div class="text">
  36. <div class="name">签到</div>
  37. <div class="time">{{ item.add_time }}</div>
  38. </div>
  39. <div class="num">+{{ item.number }}</div>
  40. </div>
  41. </div>
  42. <div v-show="loading" class="loading">
  43. <span class="fa fa-spinner"></span>
  44. </div>
  45. <div v-if="loadend && signList.length" class="loaded">{{loadTitle}}</div>
  46. <div v-if="!signList.length && !loading">
  47. <img class="nothing" src="/wap/first/zsff/images/no_data_available.png">
  48. </div>
  49. </div>
  50. <shortcut></shortcut>
  51. </div>
  52. <script>
  53. require(['vue', 'helper', 'store', '{__WAP_PATH}zsff/js/shortcut.js'], function (Vue, $h, store) {
  54. var app = new Vue({
  55. el: '#app',
  56. data: {
  57. signList: [],
  58. limit: 20,
  59. page: 1,
  60. loadend: false,
  61. loading: false,
  62. loadTitle:''
  63. },
  64. computed: {
  65. },
  66. mounted: function () {
  67. this.$nextTick(function () {
  68. var that = this;
  69. that.getSignList();
  70. window.addEventListener('scroll', function () {
  71. var clientHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
  72. scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight,
  73. scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  74. if (clientHeight + scrollTop >= scrollHeight) {
  75. that.getSignList();
  76. }
  77. });
  78. });
  79. },
  80. methods: {
  81. getSignList: function () {
  82. var that = this;
  83. if (this.loadend) return;
  84. if (this.loading) return;
  85. this.loading = true;
  86. store.baseGet($h.U({ c: 'auth_api', a: 'getUserSignList', p: { page: that.page, limit: that.limit } }), function (res) {
  87. var list = res.data.data;
  88. var signList = $h.SplitArray(list, that.signList);
  89. that.loading = false;
  90. that.loadend = list.length < that.limit;
  91. that.loadTitle = that.loadend ? '已全部加载' : '上拉加载更多';
  92. that.page = that.page + 1;
  93. that.$set(that, 'signList', signList);
  94. }, function (params) {
  95. that.loadTitle = '上拉加载更多';
  96. that.loading = false;
  97. });
  98. }
  99. }
  100. });
  101. });
  102. </script>
  103. {/block}