mineActive.vue 1.9 KB

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