mineActive.vue 2.0 KB

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