detail.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. setTimeout(() => { this.showListbox = true }, 100)
  81. })
  82. },
  83. //修改视频播放倍数
  84. changeSpeed(speed) {
  85. if (!this.videoContext) this.videoContext = uni.createVideoContext('myVideo');
  86. this.videoContext.playbackRate(speed - 0)
  87. this.speed = speed;
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss">
  93. .head {
  94. width: 100vw;
  95. background: #fff;
  96. margin-bottom: 10px;
  97. .video {
  98. width: 375px;
  99. height: 230px;
  100. }
  101. .video-bottom {
  102. display: flex;
  103. align-items: center;
  104. justify-content: space-around;
  105. width: 375px;
  106. height: 62px;
  107. background: #FFFFFF;
  108. box-sizing: border-box;
  109. .speed {
  110. width: 71px;
  111. height: 32px;
  112. text-align: center;
  113. line-height: 32px;
  114. background: #F2F2F2;
  115. border-radius: 5px;
  116. font-family: PingFang SC, PingFang SC;
  117. font-size: 14px;
  118. color: #333333;
  119. }
  120. .active {
  121. color: #FFFFFF;
  122. background: #C30D23;
  123. }
  124. }
  125. .scroll {
  126. width: 100vw;
  127. height: 400px;
  128. background: #fff;
  129. }
  130. .audio-box {
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. height: 100px;
  135. }
  136. }
  137. .introduce {
  138. padding: 10px;
  139. .detail-title {
  140. height: 35px;
  141. background: #FFFFFF;
  142. padding-top: 2px;
  143. font-family: PingFang SC, PingFang SC;
  144. font-weight: bold;
  145. font-size: 16px;
  146. color: #333333;
  147. }
  148. .group {
  149. margin-bottom: 20px;
  150. font-family: Source Han Sans SC, Source Han Sans SC;
  151. font-size: 14px;
  152. line-height: 20px;
  153. .title {
  154. color: #666666;
  155. }
  156. .value {
  157. color: #000000;
  158. margin-top: 10px;
  159. }
  160. }
  161. }
  162. </style>