lookShipin.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="ezy-ksp-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">{{jieInfo.jieIntro}}</text>
  6. </view>
  7. <view class="ksp-body">
  8. <!-- <view class="ezy-video-box course-video-box">
  9. <view ref="videoContent" id="wgy-player-test" :playAuth="playAuth"
  10. :change:playAuth="renderScript.receiveMsg" :videoId="videoId" :change:videoId="renderScript.videoIdFun"
  11. :hideFlag="hideFlag" :change:hideFlag="renderScript.hideFlagFun" :progressMarkers="progressMarkers"
  12. :change:progressMarkers="renderScript.progressMarkersMsg" :seekTime="seekTime"
  13. :change:seekTime="renderScript.seekTimeFun" class="ezy-video">
  14. </view>
  15. </view> -->
  16. <videoPlayVue ref="c1" v-show="showA" :key="1" cId="wgy-player-test" :videoId1="videoId" :progressMarkers1="progressMarkers" :playAuth1="playAuth"
  17. :hideFlag1="hideFlag" :seek-time1="seekTime" class="ksp-video-box"></videoPlayVue>
  18. <videoPlayVue ref="c2" v-show="showB" :key="2" cId="wgy-player-test2" :videoId1="videoId2" :progressMarkers1="progressMarkers2" :playAuth1="playAuth2"
  19. :hideFlag1="hideFlag2" :seek-time1="seekTime2" class="ksp-video-box"
  20. ></videoPlayVue>
  21. <!-- 核心基础题 -->
  22. <view class="ksp-item-list">
  23. <view class="item-title">核心基础题</view>
  24. <view class="ksp-item-box" v-for="(item,index) in jieInfo.jiedianList1" :key="index" @click="markersClick(item)">
  25. <icon class="ksp-icon"></icon>
  26. <view>
  27. <view class="ksp-title">{{item.name}}</view>
  28. <view class="ksp-title">课程位置:{{item.time1}}-{{item.time2}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 能力提升题 -->
  33. <view class="ksp-item-list">
  34. <view class="item-title">能力提升题</view>
  35. <view class="ksp-item-box" v-for="(item,index) in jieInfo.jiedianList2" :key="index" @click="markersClick2(item)">
  36. <icon class="ksp-icon"></icon>
  37. <view>
  38. <view class="ksp-title">{{item.name}}</view>
  39. <view class="ksp-title">课程位置:{{item.time1}}-{{item.time2}}</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <!-- 弹窗 -->
  45. <tishiDlVue ref="popupRef"></tishiDlVue>
  46. </view>
  47. </template>
  48. <script>
  49. import {
  50. ref
  51. } from 'vue';
  52. import {
  53. onLoad,
  54. onReady
  55. } from '@dcloudio/uni-app';
  56. import {
  57. getVideoAuth,
  58. getVideoAuthYk,
  59. videoWancheng
  60. } from "@/api/shipin.js"
  61. import {
  62. toast,convertTimeToSeconds
  63. } from "@/utils/common";
  64. import cacheManager from "@/utils/cacheManager.js";
  65. import * as httpApi from "@/api/chanpinShuxue.js";
  66. import tishiDlVue from './components/tishiDl.vue';
  67. import videoPlayVue from './components/videoPlay.vue';
  68. export default {
  69. data() {
  70. return {
  71. danyuanId: null,
  72. jieInfo: {
  73. cover1: '',
  74. cover2: '',
  75. jieId: '',
  76. jieIntro: '',
  77. jieName: '',
  78. jiedianList1: [],
  79. jiedianList2: [],
  80. type: '',
  81. video1: '',
  82. video2: '',
  83. },
  84. jieId: '',
  85. shipinTitle: '',
  86. pageData: null, //上个页面获取的视频参数(视频id)
  87. playAuth: "", //播放凭证
  88. progressMarkers: [],
  89. hideFlag: 'show',
  90. videoId: "", //阿里云视频id
  91. seekTime: '',
  92. showA: true,
  93. pageData2: null, //上个页面获取的视频参数(视频id)
  94. playAuth2: "", //播放凭证
  95. progressMarkers2: [],
  96. hideFlag2: 'show',
  97. videoId2: "", //阿里云视频id
  98. seekTime2: '',
  99. showB: false,
  100. }
  101. },
  102. components: {
  103. tishiDlVue,videoPlayVue
  104. },
  105. onLoad(options) {
  106. this.init(options)
  107. },
  108. onHide() {
  109. this.hideFlag = 'hide'
  110. this.hideFlag2 = 'hide'
  111. },
  112. onUnload() {
  113. this.hideFlag = 'hide'
  114. this.hideFlag2 = 'hide'
  115. },
  116. methods: {
  117. // 当前节学习完成
  118. saveJieWancheng() {
  119. getShuxueChanpinWancheng({jieId: this.jieInfo.jieId}).then(res => {
  120. if (res.data) {
  121. // 学习完成提示弹窗
  122. this.$refs.popupRef.open();
  123. }
  124. })
  125. },
  126. // 当前节学习开始
  127. saveJinduStart() {
  128. httpApi.getShuxueChanpinSave({jieId: this.jieInfo.jieId})
  129. },
  130. courseBjFun() {
  131. return 'static/images/course/couse-shuxue-bj.png'
  132. },
  133. courseIconFun() {
  134. return 'static/images/course/shuxue-icon.png'
  135. },
  136. getDataInfo() {
  137. httpApi.getShuxueChanpinJieInfo({
  138. jieId: this.jieId
  139. }).then(res => {
  140. // 时间节点转换
  141. res.data.jiedianList1.forEach(item => item.offset = convertTimeToSeconds(item.time1))
  142. res.data.jiedianList2.forEach(item => item.offset = convertTimeToSeconds(item.time1))
  143. // 重新赋值
  144. Object.assign(this.jieInfo, res.data)
  145. // 触发当前节学习进度
  146. // this.saveJinduStart();
  147. // 针对视频进行赋值
  148. this.videoId = this.jieInfo.video1;
  149. this.videoId2 = this.jieInfo.video2;
  150. // 针对节点赋值
  151. this.progressMarkers = this.jieInfo.jiedianList1;
  152. this.progressMarkers = this.jieInfo.jiedianList2;
  153. // 执行方法
  154. this.getLive(); //获取播放凭证
  155. this.getLive2();
  156. })
  157. },
  158. init(options) {
  159. this.jieId = options.jieId;
  160. this.getDataInfo()
  161. },
  162. playEnd(data) {
  163. // #ifdef APP-PLUS
  164. plus.screen.lockOrientation('portrait-primary');
  165. // #endif
  166. this.saveJieWancheng();
  167. },
  168. getLive() {
  169. if (!this.videoId) {
  170. toast("video缺失!")
  171. return false
  172. }
  173. let req = {
  174. videoId: this.videoId
  175. }
  176. getVideoAuth(req).then(res => {
  177. this.playAuth = res.data
  178. })
  179. },
  180. getLive2() {
  181. if (!this.videoId2) {
  182. toast("video缺失!")
  183. return false
  184. }
  185. let req = {
  186. videoId: this.videoId2
  187. }
  188. getVideoAuth(req).then(res => {
  189. this.playAuth2 = res.data
  190. })
  191. },
  192. markersClick(data) {
  193. this.showA = true;
  194. this.showB = false;
  195. this.$refs.c2.handleStop();
  196. this.seekTime = ""
  197. this.$nextTick(() => {
  198. this.seekTime = data.offset
  199. });
  200. },
  201. markersClick2(data) {
  202. this.showA = false;
  203. this.showB = true;
  204. this.$refs.c1.handleStop()
  205. this.seekTime2 = ""
  206. this.$nextTick(() => {
  207. this.seekTime2 = data.offset
  208. });
  209. },
  210. goUpPage() {
  211. uni.navigateBack()
  212. },
  213. },
  214. }
  215. </script>