lookShipin.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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" :videoId1="videoId" :progressMarkers1="progressMarkers" :playAuth1="playAuth"
  17. :hideFlag1="hideFlag" :seek-time1="seekTime" class="ksp-video-box" @playEnd="playEnd"></videoPlayVue>
  18. <videoPlayVue2 ref="c2" v-show="showB" :key="2" :videoId1="videoId2" :progressMarkers1="progressMarkers2" :playAuth1="playAuth2"
  19. :hideFlag1="hideFlag2" :seek-time1="seekTime2" class="ksp-video-box" @playEnd="playEnd"
  20. ></videoPlayVue2>
  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. import videoPlayVue2 from './components/videoPlay2.vue';
  69. export default {
  70. data() {
  71. return {
  72. danyuanId: null,
  73. jieInfo: {
  74. cover1: '',
  75. cover2: '',
  76. jieId: '',
  77. jieIntro: '',
  78. jieName: '',
  79. jiedianList1: [],
  80. jiedianList2: [],
  81. type: '',
  82. video1: '',
  83. video2: '',
  84. },
  85. jieId: '',
  86. shipinTitle: '',
  87. pageData: null, //上个页面获取的视频参数(视频id)
  88. playAuth: "", //播放凭证
  89. progressMarkers: [],
  90. hideFlag: 'show',
  91. videoId: "", //阿里云视频id
  92. seekTime: '',
  93. showA: true,
  94. pageData2: null, //上个页面获取的视频参数(视频id)
  95. playAuth2: "", //播放凭证
  96. progressMarkers2: [],
  97. hideFlag2: 'show',
  98. videoId2: "", //阿里云视频id
  99. seekTime2: '',
  100. showB: false,
  101. }
  102. },
  103. components: {
  104. tishiDlVue,videoPlayVue,videoPlayVue2
  105. },
  106. onLoad(options) {
  107. this.init(options)
  108. },
  109. onHide() {
  110. this.hideFlag = 'hide'
  111. this.hideFlag2 = 'hide'
  112. },
  113. onUnload() {
  114. this.hideFlag = 'hide'
  115. this.hideFlag2 = 'hide'
  116. },
  117. methods: {
  118. // 当前节学习完成
  119. saveJieWancheng() {
  120. httpApi.getShuxueChanpinWancheng({jieId: this.jieInfo.jieId}).then(res => {
  121. if (res.data) {
  122. // 更新单员状态
  123. cacheManager.updateStatusAndProess(this.jieInfo.jieId)
  124. // 学习完成提示弹窗
  125. this.$refs.popupRef.open();
  126. }
  127. })
  128. },
  129. // 当前节学习开始
  130. saveJinduStart() {
  131. httpApi.getShuxueChanpinSave({jieId: this.jieInfo.jieId})
  132. },
  133. courseBjFun() {
  134. return 'static/images/course/couse-shuxue-bj.png'
  135. },
  136. courseIconFun() {
  137. return 'static/images/course/shuxue-icon.png'
  138. },
  139. getDataInfo() {
  140. httpApi.getShuxueChanpinJieInfo({
  141. jieId: this.jieId
  142. }).then(res => {
  143. // 时间节点转换
  144. res.data.jiedianList1.forEach(item => item.offset = convertTimeToSeconds(item.time1))
  145. res.data.jiedianList2.forEach(item => item.offset = convertTimeToSeconds(item.time1))
  146. // 重新赋值
  147. Object.assign(this.jieInfo, res.data)
  148. // 触发当前节学习进度
  149. // this.saveJinduStart();
  150. // 针对视频进行赋值
  151. this.videoId = this.jieInfo.video1;
  152. this.videoId2 = this.jieInfo.video2;
  153. // 针对节点赋值
  154. this.progressMarkers = this.jieInfo.jiedianList1;
  155. this.progressMarkers = this.jieInfo.jiedianList2;
  156. // 执行方法
  157. this.getLive(); //获取播放凭证
  158. this.getLive2();
  159. })
  160. },
  161. init(options) {
  162. this.jieId = options.jieId;
  163. this.getDataInfo()
  164. },
  165. playEnd(data) {
  166. // #ifdef APP-PLUS
  167. plus.screen.lockOrientation('portrait-primary');
  168. // #endif
  169. this.saveJieWancheng();
  170. },
  171. getLive() {
  172. if (!this.videoId) {
  173. toast("video缺失!")
  174. return false
  175. }
  176. let req = {
  177. videoId: this.videoId
  178. }
  179. getVideoAuth(req).then(res => {
  180. this.playAuth = res.data
  181. })
  182. },
  183. getLive2() {
  184. if (!this.videoId2) {
  185. toast("video缺失!")
  186. return false
  187. }
  188. let req = {
  189. videoId: this.videoId2
  190. }
  191. getVideoAuth(req).then(res => {
  192. this.playAuth2 = res.data
  193. })
  194. },
  195. markersClick(data) {
  196. this.showA = true;
  197. this.showB = false;
  198. this.$refs.c2.handleStop();
  199. this.seekTime = ""
  200. this.$nextTick(() => {
  201. this.seekTime = data.offset
  202. });
  203. },
  204. markersClick2(data) {
  205. this.showA = false;
  206. this.showB = true;
  207. this.$refs.c1.handleStop()
  208. this.seekTime2 = ""
  209. this.$nextTick(() => {
  210. this.seekTime2 = data.offset
  211. });
  212. },
  213. goUpPage() {
  214. uni.navigateBack()
  215. },
  216. },
  217. }
  218. </script>