my-help.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view>
  3. <mescroll-body-diy ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback"
  4. @up="upCallback">
  5. <view class="card" v-for="(item,index) in list" :key="index">
  6. <view class="card-top">
  7. <view>少儿普法课堂</view>
  8. <view class="flex">
  9. <image src="/static/icon/remen.png" style="width: 36rpx;height: 36rpx;margin-right: 6rpx;">
  10. </image>
  11. <text class="center">+10</text>
  12. </view>
  13. </view>
  14. <view class="card-bottom">
  15. <view class="center">2021-11-09 09:13:38</view>
  16. <view class="center">移动积分 -1000</view>
  17. </view>
  18. </view>
  19. </mescroll-body-diy>
  20. </view>
  21. </template>
  22. <script>
  23. import MescrollBodyDiy from "@/uni_modules/mescroll-uni/components/mescroll-diy/xinlang/mescroll-body.vue";
  24. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  25. export default {
  26. mixins: [MescrollMixin],
  27. components: {
  28. MescrollBodyDiy,
  29. },
  30. data() {
  31. return {
  32. downOption: {
  33. auto: false
  34. },
  35. top: 0,
  36. list: []
  37. }
  38. },
  39. methods: {
  40. downCallback() {
  41. setTimeout(() => {
  42. this.mescroll.resetUpScroll();
  43. }, 1000)
  44. },
  45. upCallback(mescroll) {
  46. try {
  47. let params = {
  48. current: mescroll.num,
  49. size: mescroll.size,
  50. }
  51. this.$api.help.list(params).then(res => {
  52. let data = res.data.data.records
  53. let total = res.data.data.total
  54. mescroll.endBySize(data.length, total);
  55. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  56. this.list = this.list.concat(data); //追加新数据
  57. })
  58. } catch (e) {
  59. console.error(e);
  60. this.mescroll.endErr()
  61. }
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .card {
  68. background-color: #FFFFFF;
  69. margin: 20rpx 0;
  70. padding: 35rpx;
  71. .card-top {
  72. display: flex;
  73. justify-content: space-between;
  74. color: #353535;
  75. font-size: 32rpx;
  76. margin-bottom: 20rpx;
  77. font-family: PingFang-SC-Bold;
  78. }
  79. .card-bottom {
  80. display: flex;
  81. justify-content: space-between;
  82. margin-top: 20rpx;
  83. color: #999999;
  84. font-size: 26rpx;
  85. font-weight: 400;
  86. }
  87. }
  88. </style>