teachingList.vue 3.0 KB

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