lookShipin.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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.saveJinduStart();
  149. // 针对视频进行赋值
  150. this.videoId = this.jieInfo.video1;
  151. this.videoId2 = this.jieInfo.video2;
  152. // 针对节点赋值
  153. this.progressMarkers = this.jieInfo.jiedianList1;
  154. this.progressMarkers = this.jieInfo.jiedianList2;
  155. // 执行方法
  156. this.getLive(); //获取播放凭证
  157. this.getLive2();
  158. })
  159. },
  160. init(options) {
  161. this.jieId = options.jieId;
  162. this.getDataInfo()
  163. },
  164. playEnd(data) {
  165. // #ifdef APP-PLUS
  166. plus.screen.lockOrientation('portrait-primary');
  167. // #endif
  168. this.saveJieWancheng();
  169. },
  170. getLive() {
  171. if (!this.videoId) {
  172. toast("video缺失!")
  173. return false
  174. }
  175. let req = {
  176. videoId: this.videoId
  177. }
  178. getVideoAuth(req).then(res => {
  179. this.playAuth = res.data
  180. })
  181. },
  182. getLive2() {
  183. if (!this.videoId2) {
  184. toast("video缺失!")
  185. return false
  186. }
  187. let req = {
  188. videoId: this.videoId2
  189. }
  190. getVideoAuth(req).then(res => {
  191. this.playAuth2 = res.data
  192. })
  193. },
  194. markersClick(data) {
  195. this.showA = true;
  196. this.showB = false;
  197. this.$refs.c2.handleStop();
  198. this.seekTime = ""
  199. this.$nextTick(() => {
  200. this.seekTime = data.offset
  201. });
  202. },
  203. markersClick2(data) {
  204. this.showA = false;
  205. this.showB = true;
  206. this.$refs.c1.handleStop()
  207. this.seekTime2 = ""
  208. this.$nextTick(() => {
  209. this.seekTime2 = data.offset
  210. });
  211. },
  212. goUpPage() {
  213. uni.navigateBack()
  214. },
  215. },
  216. }
  217. </script>