love.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view class="content">
  3. <view class="lists">
  4. <view >
  5. <view class="list flex topp">
  6. <text class="">捐赠方</text>
  7. <text>捐赠金额</text>
  8. <text>捐赠日期</text>
  9. <text>捐赠意向</text>
  10. </view>
  11. </view>
  12. <view :class="{ top: animate == true }">
  13. <view class="list flex" v-for="(item,index) in loveList" :key="index">
  14. <text class="shabi clamp">{{item.name || '佚名'}}</text>
  15. <text class="shabi2 clamp">{{item.amount }}</text>
  16. <text class=" clamp">{{item.paytime | getTime}}</text>
  17. <text class="shabi clamp">{{item.order_name}}</text>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. loveList
  26. } from '@/api/index.js';
  27. export default {
  28. data() {
  29. return {
  30. animate: false,
  31. timer: null,
  32. loveList: [],
  33. page: 1,
  34. limit: 100,
  35. loaded: false,
  36. loadingType: 'more'
  37. }
  38. },
  39. methods: {
  40. scroll() {
  41. this.animate = true;
  42. setTimeout(() => {
  43. this.loveList.push(this.loveList[0]);
  44. this.loveList.shift();
  45. this.animate = false;
  46. }, 1000);
  47. },
  48. getLoveList() {
  49. let obj = this
  50. if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  51. return
  52. }
  53. obj.loadingType = 'loading'
  54. loveList({
  55. page: obj.page,
  56. limit: obj.limit
  57. }).then(({
  58. data
  59. }) => {
  60. obj.loveList = obj.loveList.concat(data.data)
  61. if (obj.limit == data.data.length) {
  62. obj.page++
  63. obj.loadingType = 'more'
  64. } else {
  65. obj.loadingType = 'noMore'
  66. }
  67. obj.loaded = true
  68. obj.timer = setInterval(this.scroll, 2000);
  69. })
  70. }
  71. },
  72. filters: {
  73. getTime(val) {
  74. let date = new Date(val * 1000);
  75. let Y = date.getFullYear();
  76. let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
  77. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
  78. return Y + '/' + M + '/' + D;
  79. },
  80. },
  81. onLoad() {
  82. },
  83. onReachBottom() {
  84. },
  85. onShow() {
  86. this.getLoveList()
  87. }
  88. }
  89. </script>
  90. <style lang="less">
  91. .content{
  92. display: flex;
  93. // height: 100vh;
  94. color: #ed4530;
  95. // padding: 0 30rpx;
  96. }
  97. .topp {
  98. background-color:#fef5f1;
  99. z-index: 999;
  100. position: fixed;
  101. top: 0;
  102. width: 100%;
  103. background-color: #ed4530;
  104. color: #fef5f1;
  105. }
  106. .lists{
  107. background-color: #fef5f1;
  108. // height: 500rpx;
  109. overflow: hidden;
  110. width: 100%;
  111. text-align: center;
  112. }
  113. .list{
  114. height: 50px;
  115. display: flex;
  116. align-items: center;
  117. font-size: 14px;
  118. border-bottom: 1px solid #ed4530;
  119. }
  120. text{
  121. line-height: 50px;
  122. height: 100%;
  123. padding-left: 20rpx;
  124. width: 25%;
  125. flex-grow: 1;
  126. border: 1px solid #fef5f1;
  127. }
  128. .top {
  129. transition: all 1s;
  130. margin-top: -50px;
  131. }
  132. .shabi {
  133. border-left: #ed4530 1px solid;
  134. border-right: #ed4530 1px solid;
  135. }
  136. .shabi2 {
  137. border-right: #ed4530 1px solid;
  138. }
  139. </style>