detail.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <view>
  3. <view class="head">
  4. <block v-if="detail.filetype == '视频'">
  5. <video id="myVideo" class="video" :src="files[0].showUrl" />
  6. <view class="video-bottom">
  7. 倍数
  8. <view @click="changeSpeed(item)" v-for="item in speeds" :key="item" class="speed"
  9. :class="speed == item ? 'active' : ''" hover-class="navigator-hover">
  10. {{ item }}x
  11. </view>
  12. </view>
  13. </block>
  14. <block v-else-if="detail.filetype == '图文'">
  15. <scroll-view class="scroll" scroll-y>
  16. <u-parse :content="detail.content" />
  17. </scroll-view>
  18. </block>
  19. <block v-else-if="detail.filetype == '音频'">
  20. <my-audio :src="files[0].url" :title="files[0].document" />
  21. </block>
  22. </view>
  23. <My_listbox v-if="showListbox" :pullDown="false" boxBackground="#fff">
  24. <view class="introduce">
  25. <view class="detail-title">详情</view>
  26. <view class="group">
  27. <view class="title">课件名称</view>
  28. <view class="value">{{ detail.title || ' --' }}</view>
  29. </view>
  30. <view class="group">
  31. <view class="title">讲师</view>
  32. <view class="value">{{ detail.teacher || ' --' }}</view>
  33. </view>
  34. <view class="group">
  35. <view class="title">简介</view>
  36. <view class="value">{{ detail.description || ' --' }}</view>
  37. </view>
  38. </view>
  39. </My_listbox>
  40. </view>
  41. </template>
  42. <script>
  43. import myAudio from "../../components/my-audio.vue"
  44. export default {
  45. components: { myAudio },
  46. data() {
  47. return {
  48. sat_coursewaredetailid: 0,
  49. detail: {},
  50. files: [],
  51. showListbox: false,
  52. speed: '1.0',
  53. speeds: ['0.5', '1.0', '1.5', '2.0']
  54. }
  55. },
  56. onLoad(options) {
  57. console.log(options)
  58. this.sat_coursewaredetailid = options.id;
  59. this.getDetail()
  60. },
  61. methods: {
  62. getDetail() {
  63. this.$Http.basic({
  64. "id": 20240315131502,
  65. "content": {
  66. "sat_coursewaredetailid": this.sat_coursewaredetailid
  67. }
  68. }).then(res => {
  69. console.log("获取课件详情", res)
  70. if (this.cutoff(res.msg)) return;
  71. this.files = res.data.attinfos.filter(v => {
  72. if (v.usetype == "file") switch (res.data.filetype) {
  73. case '视频':
  74. v.showUrl = this.getSpecifiedImage(v, 'hls')
  75. break;
  76. }
  77. return v.usetype == "file"
  78. });
  79. this.detail = res.data;
  80. uni.setNavigationBarTitle({
  81. title: res.data.title,
  82. })
  83. setTimeout(() => { this.showListbox = true }, 100)
  84. })
  85. },
  86. //修改视频播放倍数
  87. changeSpeed(speed) {
  88. if (!this.videoContext) this.videoContext = uni.createVideoContext('myVideo');
  89. this.videoContext.playbackRate(speed - 0)
  90. this.speed = speed;
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss">
  96. .head {
  97. width: 100vw;
  98. background: #fff;
  99. margin-bottom: 10px;
  100. .video {
  101. width: 375px;
  102. height: 230px;
  103. }
  104. .video-bottom {
  105. display: flex;
  106. align-items: center;
  107. justify-content: space-around;
  108. width: 375px;
  109. height: 62px;
  110. background: #FFFFFF;
  111. box-sizing: border-box;
  112. .speed {
  113. width: 71px;
  114. height: 32px;
  115. text-align: center;
  116. line-height: 32px;
  117. background: #F2F2F2;
  118. border-radius: 5px;
  119. font-family: PingFang SC, PingFang SC;
  120. font-size: 14px;
  121. color: #333333;
  122. }
  123. .active {
  124. color: #FFFFFF;
  125. background: #C30D23;
  126. }
  127. }
  128. .scroll {
  129. width: 100vw;
  130. height: 400px;
  131. background: #fff;
  132. }
  133. .audio-box {
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. height: 100px;
  138. }
  139. }
  140. .introduce {
  141. padding: 10px;
  142. .detail-title {
  143. height: 35px;
  144. background: #FFFFFF;
  145. padding-top: 2px;
  146. font-family: PingFang SC, PingFang SC;
  147. font-weight: bold;
  148. font-size: 16px;
  149. color: #333333;
  150. }
  151. .group {
  152. margin-bottom: 20px;
  153. font-family: Source Han Sans SC, Source Han Sans SC;
  154. font-size: 14px;
  155. line-height: 20px;
  156. .title {
  157. color: #666666;
  158. }
  159. .value {
  160. color: #000000;
  161. margin-top: 10px;
  162. }
  163. }
  164. }
  165. </style>