lookShipin.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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-page-body jstx-ksp-page-body">
  8. <!-- 核心基础题 -->
  9. <videoPlayVue ref="c1" :key="1" :videoId1="videoId" :progressMarkers1="progressMarkers"
  10. :playAuth1="playAuth" :hideFlag1="hideFlag" :seek-time1="seekTime" class="ksp-video-box"
  11. @playEnd="playEnd"></videoPlayVue>
  12. <view class="ksp-scroll-view">
  13. <view class="ksp-item-list" v-for="(item,index) in jieInfo.jiedianList1" :key="index">
  14. <view class="list-head">
  15. <view class="list-title">{{item.name}}</view>
  16. <!-- <ezyActiveVue class="ezy-btn-active list-btn" @click="markersClick(item)"></ezyActiveVue>-->
  17. </view>
  18. <view class="list-body">
  19. <rich-text :nodes="item.title"></rich-text>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 无数据 -->
  24. <template v-if="!videoId">
  25. <view class="ezy-no-sj">
  26. <icon></icon>
  27. <text>暂无数据</text>
  28. </view>
  29. </template>
  30. </view>
  31. <!-- 弹窗 -->
  32. <tishiDlVue ref="popupRef"></tishiDlVue>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. ref
  38. } from 'vue';
  39. import {
  40. onLoad,
  41. onReady
  42. } from '@dcloudio/uni-app';
  43. import {
  44. getVideoAuth,
  45. getVideoAuthYk,
  46. videoWancheng
  47. } from "@/api/shipin.js"
  48. import {
  49. toast,
  50. convertTimeToSeconds
  51. } from "@/utils/common";
  52. import cacheManager from "@/utils/cacheManager.js";
  53. import * as httpApi from "@/api/chanpinZiRanPinDu.js";
  54. import tishiDlVue from './components/tishiDl.vue';
  55. import videoPlayVue from './components/videoPlay.vue';
  56. import ezyActiveVue from "@/components/ezyActive/ezyActive.vue";
  57. export default {
  58. data() {
  59. return {
  60. danyuanId: null,
  61. jieInfo: {
  62. cover1: '',
  63. cover2: '',
  64. jieId: '',
  65. jieIntro: '',
  66. jieName: '',
  67. jiedianList1: [],
  68. jiedianList2: [],
  69. type: '',
  70. video1: '',
  71. video2: '',
  72. },
  73. jieId: '',
  74. shipinTitle: '',
  75. pageData: null, //上个页面获取的视频参数(视频id)
  76. playAuth: "", //播放凭证
  77. progressMarkers: [],
  78. hideFlag: 'show',
  79. videoId: "", //阿里云视频id
  80. seekTime: '',
  81. }
  82. },
  83. components: {
  84. tishiDlVue,
  85. videoPlayVue,
  86. ezyActiveVue
  87. },
  88. onLoad(options) {
  89. this.init(options)
  90. },
  91. onHide() {
  92. this.hideFlag = 'hide'
  93. },
  94. onUnload() {
  95. this.hideFlag = 'hide'
  96. },
  97. methods: {
  98. // 当前节学习完成
  99. saveJieWancheng() {
  100. httpApi.getPinduChanpinWancheng({
  101. jieId: this.jieInfo.jieId
  102. }).then(res => {
  103. if (res.data) {
  104. // 更新单员状态
  105. cacheManager.updatePinduWanchengStatus(this.jieInfo.jieId)
  106. // 学习完成提示弹窗
  107. this.$refs.popupRef.open();
  108. }
  109. })
  110. },
  111. // 当前节学习开始
  112. saveJinduStart() {
  113. httpApi.getPinduChanpinSave({
  114. jieId: this.jieInfo.jieId
  115. })
  116. },
  117. getDataInfo() {
  118. httpApi.getPinduChanpinJieInfo({
  119. jieId: this.jieId
  120. }).then(res => {
  121. // 时间节点转换
  122. res.data.jiedianList1.forEach(item => item.offset = convertTimeToSeconds(item.time1))
  123. // 重新赋值
  124. Object.assign(this.jieInfo, res.data)
  125. // 触发当前节学习进度
  126. // this.saveJinduStart();
  127. // 针对视频进行赋值
  128. this.videoId = this.jieInfo.video1;
  129. // 针对节点赋值
  130. this.progressMarkers = this.jieInfo.jiedianList1;
  131. // 执行方法
  132. this.getLive(); //获取播放凭证
  133. })
  134. },
  135. init(options) {
  136. this.jieId = options.jieId;
  137. this.getDataInfo()
  138. },
  139. playEnd(data) {
  140. // #ifdef APP-PLUS
  141. plus.screen.lockOrientation('portrait-primary');
  142. // #endif
  143. this.saveJieWancheng();
  144. },
  145. getLive() {
  146. if (!this.videoId) {
  147. toast("video缺失!")
  148. return false
  149. }
  150. let req = {
  151. videoId: this.videoId
  152. }
  153. getVideoAuth(req).then(res => {
  154. this.playAuth = res.data
  155. })
  156. },
  157. markersClick(data) {
  158. this.seekTime = ""
  159. this.$nextTick(() => {
  160. this.seekTime = data.offset
  161. });
  162. },
  163. goUpPage() {
  164. uni.switchTab({
  165. url: "/pages/chanpinneirong/index"
  166. })
  167. },
  168. },
  169. }
  170. </script>