lookShipin.vue 5.9 KB

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