mineActive.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="mineActive">
  3. <statusBar :item="navBarData"></statusBar>
  4. <!-- 消息提示 -->
  5. <msgPop></msgPop>
  6. <view class="list">
  7. <scroll-view style="height: 100%;" scroll-y="true" @scrolltolower="lower">
  8. <view>
  9. <listBlock1 ref="listBlock1" :classList="activeList"></listBlock1>
  10. </view>
  11. <view class="loading">
  12. <view v-if="Loading==1">数据加载中...</view>
  13. <view v-if="Loading==2">没有更多了~~</view>
  14. </view>
  15. </scroll-view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. navBarData: {
  24. title: '我的活动',
  25. btn: 1
  26. },
  27. activeList: [],
  28. Loading: 0, //0默认值 1加载中 2没有更多了
  29. currentPage: 1, //页数
  30. };
  31. },
  32. // onUnload() {
  33. // this.$store.dispatch('asyncDelAll')
  34. // },
  35. methods: {
  36. gotoDetail(e) {
  37. let data = e.currentTarget.dataset.all
  38. uni.navigateTo({
  39. url: `/pages/activityDetail/activityDetail?acId=${data.acId}`,
  40. });
  41. },
  42. // 资源库触底
  43. lower() {
  44. console.log('没触底?');
  45. if (this.Loading == 2) return
  46. this.Loading = 1
  47. this.currentPage++
  48. setTimeout(this.getdata, 1000)
  49. },
  50. // 获取数据
  51. getdata() {
  52. let data = {
  53. oid: this.$store.state.user.openid, //用户id
  54. type: 2,
  55. currentPage: this.currentPage, //页数
  56. lim: 30
  57. }
  58. this.$request('/selectRegistered', "POST", data).then(res => {
  59. console.log('获取数据', res[0]);
  60. if (!res[0].length) {
  61. this.Loading = 2
  62. } else {
  63. this.Loading = 0
  64. }
  65. // console.log('this.currentPage',this.currentPage);
  66. if (this.currentPage == 1) {
  67. // console.log('haha');
  68. this.activeList = []
  69. }
  70. this.activeList = [...this.activeList, ...res[0]]
  71. // this.activeList = res[0]
  72. })
  73. }
  74. },
  75. onLoad() {},
  76. onShow() {
  77. this.Loading = 0
  78. this.currentPage = 1
  79. this.getdata()
  80. // 获取收藏事件
  81. this.$refs.listBlock1.getdata()
  82. }
  83. }
  84. </script>
  85. <style lang="scss">
  86. .loading {
  87. height: 30rpx;
  88. text-align: center;
  89. padding-top: 20rpx;
  90. padding-bottom: 100rpx;
  91. font-size: 26rpx;
  92. color: #888;
  93. line-height: 2em;
  94. }
  95. .mineActive {
  96. display: flex;
  97. flex-direction: column;
  98. height: 100vh;
  99. .list {
  100. flex: 1;
  101. overflow: hidden;
  102. }
  103. }
  104. </style>