video.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="community">
  3. <!-- 列表 -->
  4. <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
  5. <view class="left">
  6. <view class="store-item" v-for="(item, index) in list" :key="index" @click="goCourse(item.id)">
  7. <image class="play-icon" src="../../static/play.png" mode="widthFix"></image>
  8. <zs-img :src="item.courseImg" width="344rpx" height="256rpx"></zs-img>
  9. <view class="info">
  10. <view class="title">
  11. {{ item.courseName }}
  12. </view>
  13. <view class="user-info">
  14. <view class="head" mode=""> 科普视频</view>
  15. <view class="user-name">
  16. 观看{{ item.viewedCount }}
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="right">
  23. <view class="store-item" v-for="(item, index) in list1" :key="index" @click="goCourse(item.id)">
  24. <image class="play-icon" src="../../static/play.png" mode=""></image>
  25. <zs-img :src="item.courseImg" width="344rpx" height="256rpx"></zs-img>
  26. <view class="info">
  27. <view class="title">
  28. {{ item.courseName }}
  29. </view>
  30. <view class="user-info">
  31. <view class="head">科普视频</view>
  32. <!-- <image class="head" src="../static/logo.png" mode=""></image> -->
  33. <view class="user-name">
  34. 观看{{ item.viewedCount }}
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </zs-list>
  41. </view>
  42. </template>
  43. <script>
  44. import { videoList } from '@/api/study.js';
  45. export default {
  46. data() {
  47. return {
  48. status: 'more',
  49. columnId: 0,
  50. list: [
  51. ],
  52. list1: [
  53. ],
  54. }
  55. },
  56. methods: {
  57. loadMore() {
  58. this.videoList()
  59. },
  60. // 课程视频
  61. videoList() {
  62. this.status = 'loading'
  63. videoList({
  64. columnId:
  65. this.columnId
  66. }).then(res => {
  67. if (res.state == 'Success') {
  68. let list = []
  69. let list1 = []
  70. res.content.records.map((item, index) => {
  71. if (index % 2) {
  72. list1.push(item)
  73. } else {
  74. list.push(item)
  75. }
  76. })
  77. this.list = this.list.concat(list)
  78. this.list1 = this.list1.concat(list1)
  79. let total = this.list.length + this.list1.length
  80. if (total >= res.content.total) {
  81. this.status = 'noMore'
  82. } else {
  83. this.status = 'more'
  84. this.query.currentPage++
  85. }
  86. }
  87. })
  88. },
  89. goCourse(id) {
  90. uni.navigateTo({
  91. url: '../courseDetail?id=' + id
  92. })
  93. },
  94. },
  95. onLoad(options) {
  96. this.columnId = options.columnId
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. .community {
  102. background: #FFFFFF;
  103. padding: 20rpx;
  104. .zs-list {
  105. display: flex;
  106. flex-wrap: wrap;
  107. justify-content: space-between;
  108. .left {}
  109. .right {}
  110. .store-item {
  111. box-shadow: 0rpx 0rpx 24rpx 2rpx rgba(0, 0, 0, 0.08);
  112. border-radius: 16rpx;
  113. width: 344rpx;
  114. margin-top: 20rpx;
  115. position: relative;
  116. .play-icon {
  117. position: absolute;
  118. top: 20rpx;
  119. right: 30rpx;
  120. width: 30rpx;
  121. height: 30rpx;
  122. z-index: 2;
  123. }
  124. .info {
  125. padding: 20rpx;
  126. .title {
  127. color: #222222;
  128. font-size: 24rpx;
  129. width: 100%;
  130. display: -webkit-box;
  131. -webkit-box-orient: vertical;
  132. -webkit-line-clamp: 2;
  133. /* 显示的最大行数 */
  134. overflow: hidden;
  135. }
  136. .user-info {
  137. display: flex;
  138. align-items: center;
  139. justify-content: space-between;
  140. margin-top: 20rpx;
  141. font-size: 20rpx;
  142. color: #AAAAAA;
  143. .head {
  144. font-size: 20rpx;
  145. }
  146. .user-name {
  147. font-size: 20rpx;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. }
  154. </style>