mineActive.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 :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. }
  68. </script>
  69. <style lang="scss">
  70. .loading {
  71. height: 30rpx;
  72. text-align: center;
  73. padding-top: 20rpx;
  74. padding-bottom: 100rpx;
  75. font-size: 26rpx;
  76. color: #888;
  77. line-height: 2em;
  78. }
  79. .mineActive{
  80. display: flex;
  81. flex-direction: column;
  82. height: 100%;
  83. .scrollV{
  84. flex: 1;
  85. }
  86. }
  87. </style>