recentWatching.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view>
  3. <view class="class-list">
  4. <view class="item-box" v-for="(item,index) in list" :key="index">
  5. <view class="item" @click="goDetail(item)">
  6. <view class="tag" v-if="item.has_vip">会员专享</view>
  7. <image class="cover" :src="item.study_url" mode="aspectFill"></image>
  8. <view class="box">
  9. <view class="desc">{{item.study_name}}</view>
  10. <view class="author"><text class="label">讲师:</text>{{item.study_teacher}}</view>
  11. <view class="count">
  12. <text class="iconfont2">&#xe709;</text>
  13. <text class="num">学习人次:{{item.studying_count}}次</text>
  14. </view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view>
  20. <noData v-if="list<=0"></noData>
  21. <u-loadmore v-else :status="status" />
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import noData from "@/components/noData/nodata.vue"
  27. export default{
  28. components:{noData},
  29. data(){
  30. return{
  31. param:{
  32. page:1,
  33. limit:10
  34. },
  35. list:[],
  36. totalCount:0,
  37. status:"nomore", //加载前值为loadmore,加载中为loading,没有数据为nomore
  38. }
  39. },
  40. onLoad() {
  41. this.getList()
  42. },
  43. onReachBottom(){
  44. if(this.status=='loadmore'){
  45. this.param.page++
  46. this.getList()
  47. }
  48. },
  49. onPullDownRefresh(){
  50. this.getList('reset')
  51. },
  52. methods:{
  53. // 获取课程列表
  54. getList(reset) {
  55. if (reset) this.param.page = 1;
  56. this.status='loading';
  57. this.$http.get('/studying/studyingLately/page', this.param).then(res => {
  58. if (res && res.code == 200) {
  59. if (reset) this.list = []
  60. this.list.push(...res.page.list);
  61. this.totalCount=res.page.totalCount;
  62. uni.stopPullDownRefresh();
  63. if(this.list.length<this.totalCount) this.status='loadmore';
  64. else this.status='nomore';
  65. }
  66. })
  67. },
  68. goDetail(item) {
  69. uni.navigateTo({
  70. url: '/pages/learningClassroom/detail?id='+item.id
  71. })
  72. },
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .class-list {
  78. display: flex;
  79. justify-content: space-between;
  80. padding: 27rpx 30rpx 30rpx 30rpx;
  81. flex-wrap: wrap;
  82. .item-box {
  83. width: 336rpx;
  84. }
  85. .item {
  86. display: block;
  87. width: 100%;
  88. border-radius: 16rpx;
  89. overflow: hidden;
  90. margin: 0 20rpx 35rpx 0;
  91. background-color: white;
  92. filter: drop-shadow(1px 2px 4px rgba(26, 58, 70, 0.1));
  93. box-shadow: 0rpx 4rpx 8rpx 0rpx #f1f1f1;
  94. position: relative;
  95. .tag {
  96. background: #138e46;
  97. color: white;
  98. border-radius: 0px 16rpx 0px 16rpx;
  99. padding: 0 10rpx;
  100. height: 41rpx;
  101. width: fit-content;
  102. line-height: 41rpx;
  103. font-size: 24rpx;
  104. position: absolute;
  105. top: 0;
  106. right: 0;
  107. z-index: 1;
  108. }
  109. .cover {
  110. width: 100%;
  111. height: 240rpx;
  112. background-color: #f2f2f2;
  113. }
  114. .box {
  115. padding: 5rpx 26rpx 38rpx 26rpx;
  116. .desc {
  117. font-size: 24rpx;
  118. font-family: PingFang SC, PingFang SC-Regular;
  119. font-weight: 400;
  120. text-align: left;
  121. color: #333333;
  122. line-height: 36rpx;
  123. height: 72rpx;
  124. margin-bottom: 5rpx;
  125. white-space: normal;
  126. }
  127. .author {
  128. font-size: 24rpx;
  129. font-family: PingFang SC, PingFang SC-Regular;
  130. font-weight: 400;
  131. color: #808080;
  132. line-height: 34rpx;
  133. .label {
  134. color: #1a1a1a;
  135. }
  136. }
  137. .count {
  138. .iconfont2 {
  139. font-size: 35rpx;
  140. color: #2DB62B;
  141. vertical-align: middle;
  142. }
  143. .num {
  144. font-size: 24rpx;
  145. font-family: PingFang SC, PingFang SC-Regular;
  146. font-weight: 400;
  147. text-align: left;
  148. color: #999999;
  149. line-height: 24rpx;
  150. vertical-align: middle;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. </style>