lookShipin.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <view class="ezy-course-page" :style="{backgroundImage: 'url(' + courseBjFun() + ')'}">
  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"></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"
  19. ></videoPlayVue>
  20. <!-- 核心基础题 -->
  21. <view class="course-content-border" >
  22. <view class="course-content-box">
  23. <view v-for="(item,index) in jieInfo.jiedianList1" :key="index" @click="markersClick(item)">
  24. <view class="title-play-box">
  25. <icon class="course-icon"></icon>
  26. <view class="course-title">{{item.name}}</view>
  27. <view class="course-title">{{item.time1}}</view>
  28. <view class="course-title">{{item.time2}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 能力提升题 -->
  34. <view class="course-content-border">
  35. <view class="course-content-box">
  36. <view v-for="(item,index) in jieInfo.jiedianList2" :key="index" @click="markersClick2(item)">
  37. <view class="title-play-box">
  38. <icon class="course-icon"></icon>
  39. <view class="course-title">{{item.name}}</view>
  40. <view class="course-title">{{item.time1}}</view>
  41. <view class="course-title">{{item.time2}}</view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 弹窗 -->
  47. <tishiDlVue ref="popupRef"></tishiDlVue>
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. ref
  53. } from 'vue';
  54. import {
  55. onLoad,
  56. onReady
  57. } from '@dcloudio/uni-app';
  58. import {
  59. getVideoAuth,
  60. getVideoAuthYk,
  61. videoWancheng
  62. } from "@/api/shipin.js"
  63. import {
  64. toast,convertTimeToSeconds
  65. } from "@/utils/common";
  66. import cacheManager from "@/utils/cacheManager.js";
  67. import * as httpApi from "@/api/chanpinShuxue.js";
  68. import tishiDlVue from './components/tishiDl.vue';
  69. import videoPlayVue from './components/videoPlay.vue';
  70. export default {
  71. data() {
  72. return {
  73. danyuanId: null,
  74. jieInfo: {
  75. cover1: '',
  76. cover2: '',
  77. jieId: '',
  78. jieIntro: '',
  79. jieName: '',
  80. jiedianList1: [],
  81. jiedianList2: [],
  82. type: '',
  83. video1: '',
  84. video2: '',
  85. },
  86. jieId: '',
  87. shipinTitle: '',
  88. pageData: null, //上个页面获取的视频参数(视频id)
  89. playAuth: "", //播放凭证
  90. progressMarkers: [],
  91. hideFlag: 'show',
  92. videoId: "", //阿里云视频id
  93. seekTime: '',
  94. showA: true,
  95. pageData2: null, //上个页面获取的视频参数(视频id)
  96. playAuth2: "", //播放凭证
  97. progressMarkers2: [],
  98. hideFlag2: 'show',
  99. videoId2: "", //阿里云视频id
  100. seekTime2: '',
  101. showB: false,
  102. }
  103. },
  104. components: {
  105. tishiDlVue,videoPlayVue
  106. },
  107. onLoad(options) {
  108. this.init(options)
  109. },
  110. onHide() {
  111. this.hideFlag = 'hide'
  112. this.hideFlag2 = 'hide'
  113. },
  114. onUnload() {
  115. this.hideFlag = 'hide'
  116. this.hideFlag2 = 'hide'
  117. },
  118. methods: {
  119. // 当前节学习完成
  120. saveJieWancheng() {
  121. getShuxueChanpinWancheng({jieId: this.jieInfo.jieId}).then(res => {
  122. if (res.data) {
  123. // 学习完成提示弹窗
  124. this.$refs.popupRef.open();
  125. }
  126. })
  127. },
  128. // 当前节学习开始
  129. saveJinduStart() {
  130. httpApi.getShuxueChanpinSave({jieId: this.jieInfo.jieId})
  131. },
  132. courseBjFun() {
  133. return 'static/images/course/couse-shuxue-bj.png'
  134. },
  135. courseIconFun() {
  136. return 'static/images/course/shuxue-icon.png'
  137. },
  138. getDataInfo() {
  139. httpApi.getShuxueChanpinJieInfo({
  140. jieId: this.jieId
  141. }).then(res => {
  142. // 时间节点转换
  143. res.data.jiedianList1.forEach(item => item.offset = convertTimeToSeconds(item.time1))
  144. res.data.jiedianList2.forEach(item => item.offset = convertTimeToSeconds(item.time1))
  145. // 重新赋值
  146. Object.assign(this.jieInfo, res.data)
  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>