my-help.vue 2.3 KB

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