mineActive.vue 2.4 KB

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