teachingList.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="teachingList">
  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" :item="teaData"></teaching-case>
  7. </view> -->
  8. <scroll-view class="list" scroll-y="true">
  9. <view>
  10. <!-- 推荐课程插槽组件 -->
  11. <listBlock1 v-for="i in classList">
  12. <template #pic>
  13. <image :src="i.pic" class="listBlock1PIC" mode="aspectFill"></image>
  14. </template>
  15. <template #tit>
  16. {{i.acName}}
  17. </template>
  18. <template #intro>
  19. {{ i.brief }}
  20. </template>
  21. <template #Sicon>
  22. <image src="http://43.139.158.220:5007/img/static/yym/Star 1 (Stroke).png"
  23. style="width: 28rpx; height: 26rpx" mode="aspectFill"></image>
  24. </template>
  25. <template #Dicon>
  26. <image src="http://43.139.158.220:5007/img/static/yym/Vector (Stroke).png"
  27. style="width: 22rpx; height: 26rpx" mode="aspectFill"></image>
  28. </template>
  29. <template #btn>
  30. <button class="list1btn sBtn-font" @click.stop="join">
  31. 立即参与
  32. </button>
  33. </template>
  34. </listBlock1>
  35. </view>
  36. </scroll-view>
  37. <view class="loading">
  38. <view v-if="newsLoading==1">数据加载中...</view>
  39. <view v-if="newsLoading==2">没有更多了~~</view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. navbarData: {
  48. title: '推荐课程',
  49. btn: 1
  50. },
  51. teaData: {
  52. btn: 1,
  53. btn_2: 1,
  54. },
  55. // 渲染数据
  56. classList: [],
  57. // 触底加载动画提示
  58. newsLoading: 0, //0默认值 1加载中 2没有更多了
  59. currentPage: 1,
  60. };
  61. },
  62. methods: {
  63. // 获取页面数据
  64. getData() {
  65. let data = {
  66. openid: uni.getStorageSync('oId'),
  67. ty: 3,
  68. page: this.currentPage, //下拉获取更多的备用字段
  69. lim: 10 //一次获取多少数据
  70. }
  71. this.$request('/selectActivity', "POST", data).then(res => {
  72. console.log('获取数据', res[0]);
  73. if (!res[0].length) {
  74. this.newsLoading = 2
  75. } else {
  76. this.newsLoading = 0
  77. }
  78. // return
  79. this.classList = [...this.classList, ...res[0]]
  80. // this.activeList = res[0]
  81. })
  82. },
  83. },
  84. // 触底加载更多
  85. onReachBottom() {
  86. console.log(111);
  87. if (this.newsLoading == 2) {
  88. return
  89. }
  90. this.newsLoading = 1
  91. this.currentPage++
  92. setTimeout(this.getData, 2000)
  93. },
  94. onLoad() {
  95. // 一进页面就加载数据
  96. this.getData()
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. .teachingList {
  102. .loading {
  103. height: 50rpx;
  104. text-align: center;
  105. padding-top: 20rpx;
  106. padding-bottom: 100rpx;
  107. font-size: 26rpx;
  108. color: #888;
  109. line-height: 2em;
  110. }
  111. .list1btn {
  112. z-index: 5;
  113. border: none;
  114. padding: 0;
  115. text-align: center;
  116. // padding: 8px, 24px, 8px, 24px;
  117. background-color: rgba(48, 129, 232, 1);
  118. color: #fff;
  119. border-radius: 100rpx;
  120. float: right;
  121. width: 144rpx;
  122. height: 48rpx;
  123. line-height: 48rpx;
  124. letter-spacing: 1px;
  125. }
  126. }
  127. </style>