list.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <view>
  3. <view class="cover">
  4. <image class="image" :src="detail.cover || ''" mode="aspectFill" />
  5. </view>
  6. <view class="head">
  7. <view class="title">{{ detail.title || '--' }}</view>
  8. <view class="text">
  9. <view class="teacher">讲师:{{ detail.teacher || ' --' }}</view>
  10. <view class="count">共{{ detail.courseware_count || 0 }}个课件 | {{ detail.study_count || 1 }}人已学习</view>
  11. </view>
  12. </view>
  13. <view style="height: 10px;" />
  14. <view class="tabs">
  15. <view class="tab-item" :class="tabsActive == '目录' ? 'active' : ''" @click="tabsActive = '目录'">
  16. 目录
  17. </view>
  18. <view class="tab-item" :class="tabsActive == '介绍' ? 'active' : ''" @click="tabsActive = '介绍'">
  19. 介绍
  20. </view>
  21. </view>
  22. <My_listbox v-show="tabsActive == '目录'" ref="List" @getlist="getList" boxBackground="#fff">
  23. <view class="catalog">
  24. <navigator class="item" :url="'/packageA/course/detail?id=' + item.sat_coursewaredetailid"
  25. v-for="item in list" :key="item.sat_coursewaredetailid">
  26. <view class="cover">
  27. <view class="u-icon" v-if="item.filetype == '视频' || item.filetype == '音频'">
  28. <u-icon name="play-right-fill" color="#FFFFFF" size="30" />
  29. </view>
  30. <image class="image" :src="item.cover" mode="aspectFill" lazy-load="true" />
  31. </view>
  32. <view class="title u-line-2">
  33. {{ item.title || '--' }}
  34. </view>
  35. </navigator>
  36. </view>
  37. </My_listbox>
  38. <My_listbox v-if="tabsActive == '介绍'" :pullDown="false" boxBackground="#fff">
  39. <view class="introduce">
  40. <view class="title">
  41. 课程介绍
  42. </view>
  43. <view class="description">
  44. {{ detail.description || '--' }}
  45. </view>
  46. </view>
  47. </My_listbox>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. tabsActive: "目录",
  55. list: [],
  56. detail: {},
  57. "content": {
  58. "sat_coursewareid": 0,
  59. "where": {
  60. "condition": "",
  61. "status": ""
  62. }
  63. }
  64. }
  65. },
  66. onLoad(options) {
  67. this.content.sat_coursewareid = options.id;
  68. this.getList(true)
  69. this.$Http.basic({
  70. "id": 20240314134002,
  71. "content": {
  72. "sat_coursewareid": options.id
  73. }
  74. }).then(res => {
  75. console.log("获取课程详情", res)
  76. if (this.cutoff(res.msg)) return;
  77. res.data.cover = this.getSpecifiedImage(res.data.attinfos[0] || {})
  78. this.detail = res.data;
  79. uni.setNavigationBarTitle({
  80. title: res.data.title,
  81. })
  82. })
  83. },
  84. methods: {
  85. getList(init = false) {
  86. if (this.paging(this.content, init)) return;
  87. this.$Http.basic({
  88. "id": 20240315131602,
  89. content: this.content
  90. }).then(res => {
  91. this.$refs.List.RefreshToComplete()
  92. console.log("获取课件列表", res)
  93. if (this.cutoff(res.msg)) return;
  94. res.data = res.data.map(v => {
  95. v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "avatar") || v.attinfos[0]) : ''
  96. return v
  97. })
  98. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  99. this.content = this.$refs.List.paging(this.content, res)
  100. })
  101. }
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. .cover {
  107. width: 375px;
  108. height: 229px;
  109. background: #FFFFFF;
  110. box-sizing: border-box;
  111. overflow: hidden;
  112. .image {
  113. width: 375px;
  114. height: 229px;
  115. }
  116. }
  117. .head {
  118. padding: 10px;
  119. box-sizing: border-box;
  120. background: #fff;
  121. .title {
  122. line-height: 24px;
  123. font-family: Source Han Sans SC, Source Han Sans SC;
  124. font-weight: bold;
  125. font-size: 16px;
  126. color: #000000;
  127. }
  128. .text {
  129. display: flex;
  130. justify-content: space-between;
  131. align-items: flex-end;
  132. font-family: Source Han Sans SC, Source Han Sans SC;
  133. margin-top: 10px;
  134. .teacher {
  135. font-size: 14px;
  136. color: #999999;
  137. }
  138. .count {
  139. font-size: 12px;
  140. color: #666666;
  141. }
  142. }
  143. }
  144. .tabs {
  145. display: flex;
  146. align-items: center;
  147. justify-content: space-around;
  148. box-sizing: border-box;
  149. padding: 0 20px;
  150. width: 375px;
  151. height: 50px;
  152. background: #FFFFFF;
  153. .tab-item {
  154. line-height: 20px;
  155. font-family: Source Han Sans SC, Source Han Sans SC;
  156. font-size: 14px;
  157. color: #333333;
  158. padding: 10px;
  159. border-radius: 8px;
  160. }
  161. .active {
  162. position: relative;
  163. font-weight: bold;
  164. color: #C30D23;
  165. }
  166. .active::after {
  167. position: absolute;
  168. content: "";
  169. width: 14px;
  170. height: 3px;
  171. background: #C30D23;
  172. border-radius: 5px;
  173. bottom: 0;
  174. left: 50%;
  175. margin-left: -7px;
  176. }
  177. }
  178. .catalog {
  179. padding: 10px;
  180. display: flex;
  181. flex-wrap: wrap;
  182. justify-content: space-between;
  183. .item {
  184. flex-shrink: 0;
  185. margin-bottom: 10px;
  186. border-radius: 5px;
  187. .cover {
  188. position: relative;
  189. width: 173px;
  190. height: 106px;
  191. border-radius: 5px;
  192. overflow: hidden;
  193. .u-icon {
  194. position: absolute;
  195. display: flex;
  196. align-items: center;
  197. justify-content: center;
  198. width: 100%;
  199. height: 100%;
  200. z-index: 9999999;
  201. opacity: .9;
  202. }
  203. .image {
  204. width: 100%;
  205. height: 100%;
  206. }
  207. }
  208. .title {
  209. height: 34px;
  210. font-size: 12px;
  211. color: #333333;
  212. line-height: 17px;
  213. margin-top: 10px;
  214. width: 173px;
  215. }
  216. }
  217. }
  218. .introduce {
  219. padding: 10px;
  220. .title {
  221. line-height: 20px;
  222. font-family: Source Han Sans SC, Source Han Sans SC;
  223. font-weight: bold;
  224. font-size: 14px;
  225. color: #333333;
  226. }
  227. .description {
  228. font-size: 14px;
  229. color: #333333;
  230. line-height: 24px;
  231. }
  232. }
  233. </style>