my-help.vue 2.3 KB

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