list.vue 6.9 KB

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