list.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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. })
  80. },
  81. methods: {
  82. getList(init = false) {
  83. if (this.paging(this.content, init)) return;
  84. this.$Http.basic({
  85. "id": 20240315131602,
  86. content: this.content
  87. }).then(res => {
  88. this.$refs.List.RefreshToComplete()
  89. console.log("获取课件列表", res)
  90. if (this.cutoff(res.msg)) return;
  91. res.data = res.data.map(v => {
  92. v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "avatar") || v.attinfos[0]) : ''
  93. return v
  94. })
  95. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  96. this.content = this.$refs.List.paging(this.content, res)
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. .cover {
  104. width: 375px;
  105. height: 229px;
  106. background: #FFFFFF;
  107. box-sizing: border-box;
  108. overflow: hidden;
  109. .image {
  110. width: 375px;
  111. height: 229px;
  112. }
  113. }
  114. .head {
  115. padding: 10px;
  116. box-sizing: border-box;
  117. background: #fff;
  118. .title {
  119. line-height: 24px;
  120. font-family: Source Han Sans SC, Source Han Sans SC;
  121. font-weight: bold;
  122. font-size: 16px;
  123. color: #000000;
  124. }
  125. .text {
  126. display: flex;
  127. justify-content: space-between;
  128. align-items: flex-end;
  129. font-family: Source Han Sans SC, Source Han Sans SC;
  130. margin-top: 10px;
  131. .teacher {
  132. font-size: 14px;
  133. color: #999999;
  134. }
  135. .count {
  136. font-size: 12px;
  137. color: #666666;
  138. }
  139. }
  140. }
  141. .tabs {
  142. display: flex;
  143. align-items: center;
  144. justify-content: space-around;
  145. box-sizing: border-box;
  146. padding: 0 20px;
  147. width: 375px;
  148. height: 50px;
  149. background: #FFFFFF;
  150. .tab-item {
  151. line-height: 20px;
  152. font-family: Source Han Sans SC, Source Han Sans SC;
  153. font-size: 14px;
  154. color: #333333;
  155. padding: 10px;
  156. border-radius: 8px;
  157. }
  158. .active {
  159. position: relative;
  160. font-weight: bold;
  161. color: #C30D23;
  162. }
  163. .active::after {
  164. position: absolute;
  165. content: "";
  166. width: 14px;
  167. height: 3px;
  168. background: #C30D23;
  169. border-radius: 5px;
  170. bottom: 0;
  171. left: 50%;
  172. margin-left: -7px;
  173. }
  174. }
  175. .catalog {
  176. padding: 10px;
  177. display: flex;
  178. flex-wrap: wrap;
  179. justify-content: space-between;
  180. .item {
  181. flex-shrink: 0;
  182. margin-bottom: 10px;
  183. border-radius: 5px;
  184. .cover {
  185. position: relative;
  186. width: 173px;
  187. height: 106px;
  188. border-radius: 5px;
  189. overflow: hidden;
  190. .u-icon {
  191. position: absolute;
  192. display: flex;
  193. align-items: center;
  194. justify-content: center;
  195. width: 100%;
  196. height: 100%;
  197. z-index: 9999999;
  198. opacity: .9;
  199. }
  200. .image {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. }
  205. .title {
  206. height: 34px;
  207. font-size: 12px;
  208. color: #333333;
  209. line-height: 17px;
  210. margin-top: 10px;
  211. width: 173px;
  212. }
  213. }
  214. }
  215. .introduce {
  216. padding: 10px;
  217. .title {
  218. line-height: 20px;
  219. font-family: Source Han Sans SC, Source Han Sans SC;
  220. font-weight: bold;
  221. font-size: 14px;
  222. color: #333333;
  223. }
  224. .description {
  225. font-size: 14px;
  226. color: #333333;
  227. line-height: 24px;
  228. }
  229. }
  230. </style>