list.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. <list ref="courseware" :list="list" />
  24. </My_listbox>
  25. <My_listbox v-if="tabsActive == '介绍'" :pullDown="false" boxBackground="#fff">
  26. <view class="introduce">
  27. <view class="title">
  28. 课程介绍
  29. </view>
  30. <view class="description">
  31. {{ detail.description || '--' }}
  32. </view>
  33. </view>
  34. </My_listbox>
  35. </view>
  36. </template>
  37. <script>
  38. import list from "../../components/collectLists/courseware"
  39. export default {
  40. components: { list },
  41. data() {
  42. return {
  43. tabsActive: "目录",
  44. list: [],
  45. detail: {},
  46. total: 0,
  47. "content": {
  48. "sat_coursewareid": 0,
  49. "where": {
  50. "condition": "",
  51. "status": "上架"
  52. }
  53. }
  54. }
  55. },
  56. onLoad(options) {
  57. this.content.sat_coursewareid = options.id;
  58. this.getList(true)
  59. this.$Http.basic({
  60. "id": 20240314134002,
  61. "content": {
  62. "sat_coursewareid": options.id
  63. }
  64. }).then(res => {
  65. console.log("获取课程详情", res)
  66. if (this.cutoff(res.msg)) return;
  67. res.data.cover = this.getSpecifiedImage(res.data.attinfos[0] || {}, 'compressed') || uni.getStorageSync("site").logo || ''
  68. this.detail = res.data;
  69. uni.setNavigationBarTitle({
  70. title: res.data.title,
  71. })
  72. })
  73. },
  74. methods: {
  75. getList(init = false) {
  76. if (this.paging(this.content, init)) return;
  77. this.$Http.basic({
  78. "id": 20240315131602,
  79. content: this.content
  80. }).then(res => {
  81. this.$refs.List.RefreshToComplete()
  82. console.log("获取课件列表", res)
  83. if (this.cutoff(res.msg)) return;
  84. res.data = this.$refs.courseware.handleList(res.data)
  85. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  86. this.total = res.total;
  87. this.content = this.$refs.List.paging(this.content, res)
  88. })
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss">
  94. .cover {
  95. width: 375px;
  96. height: 229px;
  97. background: #FFFFFF;
  98. box-sizing: border-box;
  99. overflow: hidden;
  100. .image {
  101. width: 375px;
  102. height: 229px;
  103. }
  104. }
  105. .head {
  106. padding: 10px;
  107. box-sizing: border-box;
  108. background: #fff;
  109. .title {
  110. line-height: 24px;
  111. font-family: Source Han Sans SC, Source Han Sans SC;
  112. font-weight: bold;
  113. font-size: 16px;
  114. color: #000000;
  115. }
  116. .text {
  117. display: flex;
  118. justify-content: space-between;
  119. align-items: flex-end;
  120. font-family: Source Han Sans SC, Source Han Sans SC;
  121. margin-top: 10px;
  122. .teacher {
  123. font-size: 14px;
  124. color: #999999;
  125. }
  126. .count {
  127. font-size: 12px;
  128. color: #666666;
  129. }
  130. }
  131. }
  132. .tabs {
  133. display: flex;
  134. align-items: center;
  135. justify-content: space-around;
  136. box-sizing: border-box;
  137. padding: 0 20px;
  138. width: 375px;
  139. height: 50px;
  140. background: #FFFFFF;
  141. .tab-item {
  142. line-height: 20px;
  143. font-family: Source Han Sans SC, Source Han Sans SC;
  144. font-size: 14px;
  145. color: #333333;
  146. padding: 10px;
  147. border-radius: 8px;
  148. }
  149. .active {
  150. position: relative;
  151. font-weight: bold;
  152. color: #C30D23;
  153. }
  154. .active::after {
  155. position: absolute;
  156. content: "";
  157. width: 14px;
  158. height: 3px;
  159. background: #C30D23;
  160. border-radius: 5px;
  161. bottom: 0;
  162. left: 50%;
  163. margin-left: -7px;
  164. }
  165. }
  166. .introduce {
  167. padding: 10px;
  168. .title {
  169. line-height: 20px;
  170. font-family: Source Han Sans SC, Source Han Sans SC;
  171. font-weight: bold;
  172. font-size: 14px;
  173. color: #333333;
  174. }
  175. .description {
  176. font-size: 14px;
  177. color: #333333;
  178. line-height: 24px;
  179. }
  180. }
  181. </style>