activityList.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view class="activeList">
  3. <statusBar :item="navbarData"></statusBar>
  4. <!-- <teaching-case :item="teaData"></teaching-case> -->
  5. <!-- <view class="" style="padding-bottom: 50rpx;">
  6. <teaching-case :activeList="activeList" :indexId="index"></teaching-case>
  7. </view> -->
  8. <scroll-view class="list" scroll-y="true">
  9. <view>
  10. <teaching-case :activeList="activeList" :indexId="index"></teaching-case>
  11. </view>
  12. </scroll-view>
  13. <view class="loading">
  14. <view v-if="newsLoading==1">数据加载中...</view>
  15. <view v-if="newsLoading==2">没有更多了~~</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. teaData: {
  28. btn: 1
  29. },
  30. activeList: [],
  31. // 触底加载动画提示
  32. newsLoading: 1, //0默认值 1加载中 2没有更多了
  33. currentPage: 1,
  34. };
  35. },
  36. methods: {
  37. // 获取教研活动
  38. getData() {
  39. let data = {
  40. openid: uni.getStorageSync('oId'),
  41. ty: 1,
  42. page: currentPage, //下拉获取更多的备用字段
  43. lim: 6 //一次获取多少数据
  44. }
  45. this.$request('/selectActivity', "POST", data).then(res => {
  46. console.log(res[0]);
  47. if (!res[0].length) {
  48. this.newsLoading = 2
  49. } else {
  50. this.newsLoading = 0
  51. }
  52. this.activeList = [...this.activeList, ...res[0]]
  53. // this.activeList = res[0]
  54. })
  55. },
  56. },
  57. // 触底加载更多
  58. onReachBottom() {
  59. console.log(111);
  60. if (this.newsLoading == 2) {
  61. return
  62. }
  63. this.newsLoading = 1
  64. this.currentPage++
  65. setTimeout(this.getData, 2000)
  66. },
  67. onLoad() {
  68. this.getData()
  69. }
  70. }
  71. </script>
  72. <style lang="scss">
  73. .activeList {
  74. .loading {
  75. height: 50rpx;
  76. text-align: center;
  77. padding-top: 20rpx;
  78. padding-bottom: 100rpx;
  79. font-size: 26rpx;
  80. color: #888;
  81. line-height: 2em;
  82. }
  83. }
  84. </style>