lookShipin.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. courseBjFun() {
  118. return 'static/images/course/couse-shuxue-bj.png'
  119. },
  120. courseIconFun() {
  121. return 'static/images/course/shuxue-icon.png'
  122. },
  123. getDataInfo() {
  124. httpApi.getPinduChanpinJieInfo({
  125. jieId: this.jieId
  126. }).then(res => {
  127. // 时间节点转换
  128. res.data.jiedianList1.forEach(item => item.offset = convertTimeToSeconds(item.time1))
  129. // 重新赋值
  130. Object.assign(this.jieInfo, res.data)
  131. // 触发当前节学习进度
  132. // this.saveJinduStart();
  133. // 针对视频进行赋值
  134. this.videoId = this.jieInfo.video1;
  135. // 针对节点赋值
  136. this.progressMarkers = this.jieInfo.jiedianList1;
  137. // 执行方法
  138. this.getLive(); //获取播放凭证
  139. })
  140. },
  141. init(options) {
  142. this.jieId = options.jieId;
  143. this.getDataInfo()
  144. },
  145. playEnd(data) {
  146. // #ifdef APP-PLUS
  147. plus.screen.lockOrientation('portrait-primary');
  148. // #endif
  149. this.saveJieWancheng();
  150. },
  151. getLive() {
  152. if (!this.videoId) {
  153. toast("video缺失!")
  154. return false
  155. }
  156. let req = {
  157. videoId: this.videoId
  158. }
  159. getVideoAuth(req).then(res => {
  160. this.playAuth = res.data
  161. })
  162. },
  163. markersClick(data) {
  164. this.seekTime = ""
  165. this.$nextTick(() => {
  166. this.seekTime = data.offset
  167. });
  168. },
  169. goUpPage() {
  170. uni.switchTab({
  171. url: "/pages/chanpinneirong/index"
  172. })
  173. },
  174. },
  175. }
  176. </script>