detail.vue 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228
  1. <template>
  2. <view>
  3. <view style="position: fixed;width: 100%;z-index: 999;background: #FFFFFF;top: 0;" id="top">
  4. <view class="video_box" v-if="!startStatus">
  5. <image :src="$method.splitImgHost(detail.coverUrl)" style="width: 100%;height: 460rpx;"></image>
  6. <image v-if="false" class="video_play" src="/static/play.png" @click="startVideo"></image>
  7. </view>
  8. <view v-else class="video_box" style="width: 100%;height: 460rpx;">
  9. <polyv-player
  10. id="playerVideo"
  11. playerId="playerVideo"
  12. height="460rpx"
  13. :vid="vid"
  14. :showSettingBtn="true"
  15. :enablePlayGesture="true"
  16. @statechange="onStateChange"
  17. :autoplay="autoplay"
  18. :isAllowSeek="isAllowSeek"
  19. :playbackRate="playbackRate"
  20. :startTime="startTime"
  21. ></polyv-player>
  22. </view>
  23. <view>
  24. <u-row>
  25. <u-col span="10">
  26. <view class="video_t1">{{ detail.courseName }}</view>
  27. </u-col>
  28. <u-col span="2">
  29. <view class="video_t1_t" @click="openPhoto">
  30. <image src="/static/icon/jy_icon.png" style="width: 40rpx;height: 40rpx;"></image>
  31. 讲义
  32. </view>
  33. </u-col>
  34. </u-row>
  35. </view>
  36. <u-line color="#D6D6DB" />
  37. <view style="display: flex;justify-content: center;">
  38. <view style="width: 280px;"><u-tabs :list="list" font-size="24" bar-width="80" :current="current" @change="change" active-color="#007AFF"></u-tabs></view>
  39. </view>
  40. <u-line color="#D6D6DB" />
  41. </view>
  42. <view class="box">
  43. <!--目录 -->
  44. <view v-show="current == 0">
  45. <view class="menuBox" v-for="(item, index) in reMenuList">
  46. <!--模块 -->
  47. <view v-if="item.type == 1"><courseModule :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="item.menuId"></courseModule></view>
  48. <!--章 -->
  49. <view v-if="item.type == 2">
  50. <courseChapter :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter>
  51. </view>
  52. <!--节 -->
  53. <view v-if="item.type == 3">
  54. <courseSection :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection>
  55. </view>
  56. </view>
  57. </view>
  58. <!--目录 -->
  59. <view v-show="current == 1">
  60. <view class="menuBox" v-for="(item, index) in menuList">
  61. <!--模块 -->
  62. <view v-if="item.type == 1"><courseModule :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="item.menuId"></courseModule></view>
  63. <!--章 -->
  64. <view v-if="item.type == 2"><courseChapter :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter></view>
  65. <!--节 -->
  66. <view v-if="item.type == 3"><courseSection :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection></view>
  67. </view>
  68. </view>
  69. <!--笔记 -->
  70. <view v-show="current == 2">
  71. <view v-if="noteList.length == 0" style="text-align: center;">暂无笔记</view>
  72. <view class="inputBottom">
  73. <view style="width: 10%;"><image src="/static/icon/note3.png" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image></view>
  74. <view style="width: 73%;height: 88rpx;margin-bottom: 15rpx;">
  75. <u-input height="78" fixed="true" :placeholder="placeholder" type="textarea" :custom-style="inputStyle" v-model="noteValue" />
  76. </view>
  77. <view style="color: #007AFF;font-size: 30rpx;font-weight: bold;width: 15%;text-align: center;" @click="postNote">提交</view>
  78. </view>
  79. <view v-for="(item, index) in noteList">
  80. <view class="dateBox">{{ $method.timestampToTime(item.dateNote) }}</view>
  81. <view class="noteBox">
  82. <view v-for="(item1, index1) in item.userNotes" style="margin-top: 30rpx;" @click="jumpNote(item1)">
  83. <view style="display: flex;">
  84. <view>
  85. <view>
  86. <image src="/static/icon/note2.png" v-if="noteId != item1.noteId" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image>
  87. <image src="/static/icon/note1.png" v-if="noteId == item1.noteId" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image>
  88. </view>
  89. <view class="title" style="width: 39rpx;height: 39rpx;margin:0 29rpx;">{{ $method.secondToDate(item1.noteSecond) }}</view>
  90. </view>
  91. <view style="margin-left: 10rpx;">
  92. <view class="t2Content leftPadding">{{ item1.sectionName }}</view>
  93. <view class="tBox2">{{ item1.noteText }}</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <!--答疑 -->
  101. <view v-show="current == 3">
  102. <view class="inputBottom">
  103. <view style="width: 73%;height: 88rpx;margin-bottom: 15rpx;margin-left: 10% ;">
  104. <u-input height="78" fixed="true" :placeholder="placeholder" type="textarea" :custom-style="inputStyle" v-model="ctxValue" />
  105. </view>
  106. <view style="color: #007AFF;font-size: 30rpx;font-weight: bold;width: 15%;text-align: center;" @click="postContent">提交</view>
  107. </view>
  108. <view v-for="(item, index) in answerList" style="background-color: #FFFFFF;margin-bottom: 20rpx;">
  109. <view class="chat_box" @click.stop="clearCtx">
  110. <view style="display: flex;">
  111. <view><image :src="$method.splitImgHost(item.avatar)" style="width: 64rpx;height: 64rpx;"></image></view>
  112. <view style="margin-left: 15rpx;">
  113. <view class="chat1">{{ item.realname }}</view>
  114. <view class="chat2">{{ $method.timestampToTime(item.createTime) }}</view>
  115. <view class="chat3">
  116. <text v-if="item.assignUserId > 0">回复</text>
  117. <text v-if="item.assignUserId > 0" style="color: #007AFF;">@{{ item.assignRealname }}</text>
  118. {{ item.answerText }}
  119. </view>
  120. </view>
  121. </view>
  122. <view class="btnReply" @click.stop="replyContent(item)" v-if="item.userId != userInfo.userId">回复</view>
  123. <view v-else class="btnDel" @click.stop="delContent(item)">删除</view>
  124. </view>
  125. <u-line color="#D6D6DB" />
  126. </view>
  127. <view v-if="answerList.length == 0" style="text-align: center;">暂无记录</view>
  128. </view>
  129. </view>
  130. <!-- 播放前拍照start -->
  131. <u-popup v-model="photoPopup" mode="bottom" border-radius="32" :mask-close-able="false">
  132. <view class="photoBox">
  133. <view class="photoTop">
  134. <view class="sqzz" v-if="false">
  135. <u-icon name="close" color="#333333" size="30" @click="closePhoto"></u-icon>
  136. </view>
  137. <view class="centersq">
  138. 请正视手机屏幕
  139. </view>
  140. <view class="sqzz">
  141. </view>
  142. </view>
  143. <view class="photoCenter">
  144. <camera device-position="front" flash="off" @error="error" style="width: 100%; height: 100%" v-if="photoPopup"></camera>
  145. <view class="custom">
  146. <image src="@/pages2/static/zhezhao.png" mode=""></image>
  147. </view>
  148. </view>
  149. <view class="btnResult" @click="takePhoto">
  150. 拍照
  151. </view>
  152. </view>
  153. </u-popup>
  154. <!-- 播放前拍照end -->
  155. </view>
  156. </template>
  157. <script>
  158. import eventHub from '@/common/eventHub.js';
  159. import courseModule from '@/components/course/courseModule.vue';
  160. import courseChapter from '@/components/course/courseChapter.vue';
  161. import courseSection from '@/components/course/courseSection.vue';
  162. import { mapGetters } from 'vuex';
  163. export default {
  164. components: {
  165. courseModule,
  166. courseChapter,
  167. courseSection
  168. },
  169. data() {
  170. return {
  171. startStatus: false,
  172. detail: {},
  173. courseId: 0,
  174. placeholder: '您可以在这里输入笔记内容\n还可以点击左侧图标为笔记加上时间标记',
  175. inputStyle: {
  176. background: 'rgba(244, 244, 244, 0.98)',
  177. borderRadius: '24rpx',
  178. padding: '8rpx',
  179. marginBottom: '10rpx'
  180. },
  181. playbackRate: [0.5, 0.8, 1.0],
  182. list: [
  183. {
  184. name: '重修目录'
  185. },
  186. {
  187. name: '目录'
  188. },
  189. {
  190. name: '笔记'
  191. },
  192. {
  193. name: '答疑'
  194. }
  195. ],
  196. menuList: [],
  197. current: 1,
  198. vid: '',
  199. goodsId: 0,
  200. goodsData: {},
  201. photoPopup: false,
  202. goodsPlayConfig: null,
  203. autoplay: false,
  204. isAllowSeek: 'no',
  205. playbackRate: [1.0],
  206. timer: null,
  207. goodsPhotographConfig: null,
  208. intervalTimeList: [], // 间隔拍照时长
  209. intervalTimeIndex: 0, //当前处于哪个时间段拍照
  210. playTime: 0, //页面播放时长,不含暂停
  211. currentTime: 0,
  212. avatarUrl: '',
  213. ossAvatarUrl: '',
  214. studyDuration: 0, // 当前视频时长
  215. gradeId: 0,
  216. chapterId: 0,
  217. moduleId: 0,
  218. reMenuList: [],
  219. answerList: [],
  220. assignUserId: 0,
  221. placeholder: '您可以在这里输入答疑内容',
  222. ctxValue: '',
  223. noteList: [],
  224. noteValue: '',
  225. noteId: 0,
  226. recordObj: 0,
  227. needSeek: false //第一次播放是否需要跳转
  228. };
  229. },
  230. onUnload() {},
  231. computed: { ...mapGetters(['userInfo', 'playSectionId']) },
  232. onLoad(option) {
  233. this.courseId = Number(option.id);
  234. this.goodsId = Number(option.goodsId);
  235. this.courseDetail();
  236. this.getGoodsDetail();
  237. this.getAnswerList();
  238. },
  239. onShow() {
  240. var self = this;
  241. this.$api.getbaseprofiletplists({ goodsId: self.goodsId }).then(res => {
  242. if (res.data.code === 200 && res.data.rows.length) {
  243. if (res.data.rows[0].keyValue) {
  244. self.$api.getbaseprofiletpgetInfo({ goodsId: self.goodsId }).then(result => {
  245. if (result.data.code === 200) {
  246. if (!result.data.data || result.data.data.status === 3 && result.data.data.changeStatus === 0) {
  247. uni.showModal({
  248. showCancel: false,
  249. content: '资料审核不通过,请前往重新填写',
  250. success: function(resultst) {
  251. if (resultst.confirm) {
  252. self.$navTo.togo('/pages2/verify/input', {
  253. id: self.goodsId
  254. });
  255. }
  256. }
  257. });
  258. } else if (result.data.data.status === 1 && res.data.rows[0].keyValue2) {
  259. self.$api.getbaseprofileStampgetInfo({ goodsId: self.goodsId }).then(k => {
  260. if(k.data.code === 200){
  261. if(!k.data.data || k.data.data.status === 3 && k.data.data.changeStatus === 0){
  262. uni.showModal({
  263. showCancel: false,
  264. content: '资料盖章审核不通过,请前往重新填写',
  265. success: function(resultst) {
  266. if (resultst.confirm) {
  267. self.$navTo.togo('/pages2/verify/input2', {
  268. id: self.goodsId
  269. });
  270. }
  271. }
  272. });
  273. }
  274. }
  275. });
  276. }
  277. }
  278. });
  279. }
  280. }
  281. });
  282. },
  283. onUnload() {
  284. if (this.playSectionId > 0) {
  285. //退出提交记录
  286. this.ossAvatarUrl = '';
  287. this.postStudyRecord();
  288. //清除正在播放的节ID
  289. this.$store.commit('setPlaySectionId', { playSectionId: 0 });
  290. }
  291. },
  292. mounted() {
  293. eventHub.$on('changeSection', oldSectionId => {
  294. this.ossAvatarUrl = '';
  295. this.postStudyRecord(0, oldSectionId);
  296. });
  297. eventHub.$on('getSection', item => {
  298. this.playVideo(item);
  299. });
  300. eventHub.$on('levelId', item => {
  301. let arr = item.split('-');
  302. //点击节获取的各层级ID
  303. this.moduleId = arr[0];
  304. this.chapterId = arr[1];
  305. console.log(item, 99);
  306. });
  307. },
  308. methods: {
  309. async playVideo(item) {
  310. if (this.timer) {
  311. clearInterval(this.timer);
  312. }
  313. if (this.vid) {
  314. //切换视频
  315. var polyvPlayerContext = this.selectComponent('#playerVideo');
  316. polyvPlayerContext.changeVid(item.recordingUrl);
  317. } else {
  318. this.vid = item.recordingUrl;
  319. }
  320. this.recordObj = await this.getRecordLast();
  321. if (this.recordObj.studyDuration) {
  322. this.needSeek = true; //需要跳转到播放记录
  323. }
  324. console.log(this.startTime, 789);
  325. this.startStatus = true;
  326. //获取节笔记
  327. this.getNoteList();
  328. },
  329. getRecordLast() {
  330. let self = this;
  331. return new Promise(resolve => {
  332. let data = {
  333. gradeId:Number(self.gradeId),
  334. goodsId:Number(self.goodsId),
  335. sectionId:Number(self.playSectionId),
  336. courseId: Number(self.courseId),
  337. }
  338. self.$api.recordLast(data).then(res => {
  339. resolve(res.data.data)
  340. });
  341. })
  342. },
  343. jumpNote(item) {
  344. this.noteId = item.noteId;
  345. this.$u.toast('即将跳到笔记位置');
  346. //跳到笔记时刻
  347. var polyvPlayerContext = this.selectComponent('#playerVideo');
  348. polyvPlayerContext.seek(item.noteSecond);
  349. polyvPlayerContext.play();
  350. },
  351. postNote() {
  352. let self = this;
  353. if (!(this.playSectionId > 0)) {
  354. this.$u.toast('目前无播放视频');
  355. retun;
  356. }
  357. if (!this.noteValue) {
  358. this.$u.toast('请输入内容');
  359. retun;
  360. }
  361. var polyvPlayerContext = this.selectComponent('#playerVideo');
  362. let noteDate = this.$method.getZeroTime();
  363. let noteSecond = polyvPlayerContext.getCurrentTime();
  364. if (!noteSecond) {
  365. this.$u.toast('视频暂未开始');
  366. retun;
  367. }
  368. let data = {
  369. gradeId: this.gradeId,
  370. goodsId: this.goodsId,
  371. sectionId: this.playSectionId,
  372. courseId: this.courseId,
  373. noteText: this.noteValue,
  374. noteDate: noteDate,
  375. noteSecond: noteSecond
  376. };
  377. this.$api.postNote(data).then(res => {
  378. if (res.data.code == 200) {
  379. this.$u.toast('发布成功');
  380. self.getNoteList();
  381. this.noteValue = '';
  382. }
  383. });
  384. },
  385. getNoteList() {
  386. let self = this;
  387. this.$api.noteList({ sectionId: this.playSectionId, courseId: this.courseId, gradeId: this.gradeId, goodsId: this.goodsId }).then(res => {
  388. if (res.data.code == 200) {
  389. self.noteList = res.data.rows;
  390. }
  391. });
  392. },
  393. delAnswer(answerId) {
  394. let self = this;
  395. let data = { answerId: answerId, status: -1 };
  396. this.$api.delAnswer(data).then(res => {
  397. if (res.data.code == 200) {
  398. self.getAnswerList();
  399. }
  400. });
  401. },
  402. clearCtx() {
  403. console.log(4234);
  404. this.placeholder = '您可以在这里输入答疑内容';
  405. this.ctxValue = '';
  406. this.assignUserId = 0;
  407. },
  408. replyContent(item) {
  409. this.assignUserId = item.userId;
  410. this.placeholder = '@' + item.realname;
  411. },
  412. delContent(item) {
  413. this.delAnswer(item.answerId);
  414. },
  415. postAnswer() {
  416. let self = this;
  417. let data = { courseId: this.courseId, answerText: this.ctxValue };
  418. if (this.assignUserId > 0) {
  419. data.assignUserId = this.assignUserId;
  420. }
  421. this.$api.postAnswer(data).then(res => {
  422. if (res.data.code == 200) {
  423. this.$u.toast('发布成功');
  424. self.getAnswerList();
  425. this.placeholder = '您可以在这里输入答疑内容';
  426. this.ctxValue = '';
  427. this.assignUserId = 0;
  428. }
  429. });
  430. },
  431. postContent() {
  432. if (!this.ctxValue) {
  433. this.$u.toast('请输入内容');
  434. }
  435. this.postAnswer();
  436. },
  437. postStudyRecord(status=0,sectionId=this.playSectionId) {
  438. let currentTime = 0
  439. var polyvPlayerContext = this.selectComponent('#playerVideo');
  440. if(polyvPlayerContext){
  441. currentTime =polyvPlayerContext.getCurrentTime()
  442. }
  443. let self = this;
  444. let data = {
  445. photo:self.ossAvatarUrl,
  446. sectionId:parseInt(sectionId),
  447. goodsId:parseInt(self.goodsId),
  448. courseId:parseInt(self.courseId),
  449. studyDuration:parseInt(currentTime>0?currentTime:self.studyDuration),
  450. gradeId:parseInt(self.gradeId),
  451. chapterId:parseInt(self.chapterId),
  452. moduleId:parseInt(self.moduleId)
  453. }
  454. if(data.studyDuration<=5){ //5秒内不上传记录
  455. return
  456. }
  457. if(status>0){
  458. data.status = status
  459. }
  460. console.log('提交接口', data);
  461. this.$api.studyRecord(data).then(res => {
  462. console.log(res);
  463. });
  464. },
  465. uploadFile(options, int) {
  466. var self = this;
  467. return new Promise((resolve, reject) => {
  468. var data = {
  469. imageStatus: int
  470. };
  471. self.$api.aliyunpolicy(data).then(res => {
  472. if (res.data.code != 200) {
  473. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  474. return;
  475. }
  476. var ossToken = res.data.data.resultContent;
  477. if (ossToken.host == null || ossToken.host == undefined) {
  478. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  479. return;
  480. }
  481. uni.uploadFile({
  482. url: ossToken.host,
  483. name: 'file',
  484. filePath: options,
  485. fileType: 'image',
  486. header: {
  487. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  488. },
  489. formData: {
  490. key: ossToken.dir,
  491. OSSAccessKeyId: ossToken.accessid,
  492. policy: ossToken.policy,
  493. Signature: ossToken.signature,
  494. callback: ossToken.callback,
  495. success_action_status: 200
  496. },
  497. success: result => {
  498. if (result.statusCode === 200) {
  499. self.ossAvatarUrl = ossToken.dir;
  500. resolve();
  501. } else {
  502. uni.showToast({
  503. title: '上传失败',
  504. icon: 'none'
  505. });
  506. return;
  507. }
  508. },
  509. fail: error => {
  510. uni.showToast({
  511. title: '上传接口报错' + error,
  512. icon: 'none'
  513. });
  514. return;
  515. }
  516. });
  517. });
  518. });
  519. },
  520. imageInfos() {
  521. var self = this;
  522. return new Promise((resolve, reject) => {
  523. uni.getImageInfo({
  524. src: self.avatarUrl,
  525. success: async res => {
  526. let canvasWidth = res.width; //图片原始长宽
  527. let canvasHeight = res.height;
  528. if (canvasWidth > 1000 || canvasHeight > 1000) {
  529. uni.compressImage({
  530. src: self.avatarUrl,
  531. quality: 75,
  532. width: '50%',
  533. height: '50%',
  534. success: async rest => {
  535. const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
  536. resolve();
  537. }
  538. });
  539. } else {
  540. console.log('无需压缩');
  541. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  542. resolve();
  543. }
  544. }
  545. });
  546. });
  547. },
  548. timeEvent() {
  549. let self = this;
  550. var polyvPlayerContext = this.selectComponent('#playerVideo');
  551. if (polyvPlayerContext != null) {
  552. let PlayCurrentTime = polyvPlayerContext.getVideoPlayDuration();
  553. this.studyDuration = PlayCurrentTime;
  554. if (this.currentTime < PlayCurrentTime) {
  555. this.playTime += PlayCurrentTime - this.currentTime;
  556. this.currentTime = PlayCurrentTime;
  557. } else {
  558. this.currentTime = PlayCurrentTime;
  559. }
  560. //判断是否需要拍照
  561. if (this.intervalTimeList.length > this.intervalTimeIndex) {
  562. let photoTime = Number(this.intervalTimeList[this.intervalTimeIndex]) * 60; //获取拍照秒数
  563. if (photoTime < this.playTime) {
  564. //启动拍照
  565. //暂停
  566. polyvPlayerContext.exitFullScreen();
  567. polyvPlayerContext.pause();
  568. this.openPhoto();
  569. this.intervalTimeIndex++;
  570. }
  571. }
  572. }
  573. },
  574. onStateChange(newstate, oldstate) {
  575. console.log(newstate, 6989);
  576. if (newstate.detail.newstate == 'playing') {
  577. if (this.needSeek) {
  578. var polyvPlayerContext = this.selectComponent('#playerVideo');
  579. polyvPlayerContext.seek(this.recordObj.studyDuration);
  580. polyvPlayerContext.play();
  581. this.needSeek = false;
  582. }
  583. //开始播放
  584. if (this.timer) {
  585. clearInterval(this.timer);
  586. }
  587. this.timer = setInterval(this.timeEvent, 1500); //定时器
  588. }
  589. if (newstate.detail.newstate == 'pause') {
  590. //暂停提交记录
  591. /* this.ossAvatarUrl = ""
  592. this.postStudyRecord() */
  593. }
  594. if (newstate.detail.newstate == 'ended') {
  595. this.ossAvatarUrl = '';
  596. this.postStudyRecord(1);
  597. }
  598. },
  599. //拍照
  600. openPhoto() {
  601. this.photoPopup = true;
  602. },
  603. async submit() {
  604. const waitYS = await this.imageInfos();
  605. this.postStudyRecord(); //提交记录
  606. //恢复播放
  607. var polyvPlayerContext = this.selectComponent('#playerVideo');
  608. if (polyvPlayerContext != null) {
  609. polyvPlayerContext.play();
  610. }
  611. console.log(this.ossAvatarUrl, '拍照完成456');
  612. },
  613. //确认拍照
  614. takePhoto() {
  615. var self = this;
  616. const ctx = uni.createCameraContext();
  617. ctx.takePhoto({
  618. quality: 'high',
  619. success: res => {
  620. console.log(res.tempImagePath);
  621. self.avatarUrl = res.tempImagePath;
  622. self.submit();
  623. self.photoPopup = false;
  624. },
  625. fail: err => {
  626. console.log(err);
  627. }
  628. });
  629. },
  630. //拍照报错
  631. error(e) {
  632. console.log(e.detail);
  633. },
  634. //关闭相机
  635. closePhoto() {
  636. this.photoPopup = false;
  637. },
  638. getGoodsDetail() {
  639. let self = this;
  640. this.$api.goodsDetail(this.goodsId).then(res => {
  641. self.goodsData = res.data.data;
  642. self.gradeId = self.goodsData.gradeId;
  643. console.log(self.gradeId, 698);
  644. self.getMenuList();
  645. self.getReMenuList(); //获取重修目录
  646. if (self.goodsData.goodsPlayConfig) {
  647. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  648. if (self.goodsPlayConfig.autoPlay > 0) {
  649. self.autoplay = true;
  650. }
  651. if (self.goodsPlayConfig.drag > 0) {
  652. self.isAllowSeek = 'yes';
  653. }
  654. if (self.goodsPlayConfig.speed > 0) {
  655. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  656. }
  657. }
  658. if (self.goodsData.goodsPhotographConfig) {
  659. self.goodsPhotographConfig = JSON.parse(self.goodsData.goodsPhotographConfig);
  660. if (self.goodsPhotographConfig.intervalTime) {
  661. self.intervalTimeList = self.goodsPhotographConfig.intervalTime.split(',');
  662. }
  663. }
  664. });
  665. },
  666. startVideo() {
  667. this.startStatus = true;
  668. },
  669. getAnswerList() {
  670. let self = this;
  671. this.$api.answerList({ courseId: this.courseId }).then(res => {
  672. if (res.data.code == 200) {
  673. self.answerList = res.data.rows;
  674. }
  675. });
  676. },
  677. getReMenuList() {
  678. let self = this;
  679. this.$api.reMenuList({ courseId: this.courseId, rebuild: 1, gradeId: this.gradeId }).then(res => {
  680. if (res.data.code == 200) {
  681. for (let i = 0; i < res.data.rows.length; i++) {
  682. let item = res.data.rows[i];
  683. item.down = true;
  684. item.id = item.menuId;
  685. item.name = item.menuName;
  686. }
  687. self.reMenuList = res.data.rows;
  688. }
  689. });
  690. },
  691. getMenuList() {
  692. let self = this;
  693. this.$api.reMenuList({ courseId: this.courseId, gradeId: this.gradeId }).then(res => {
  694. if (res.data.code == 200) {
  695. for (let i = 0; i < res.data.rows.length; i++) {
  696. let item = res.data.rows[i];
  697. item.down = true;
  698. item.id = item.menuId;
  699. item.name = item.menuName;
  700. }
  701. self.menuList = res.data.rows;
  702. }
  703. });
  704. },
  705. courseDetail() {
  706. let self = this;
  707. this.$api.courseDetail(this.courseId).then(res => {
  708. if (res.data.code == 200) {
  709. self.detail = res.data.data;
  710. self.gradeId = self.detail.gradeId;
  711. }
  712. });
  713. },
  714. open(item) {
  715. item.showChildren = !item.showChildren;
  716. },
  717. change(index) {
  718. this.current = index;
  719. }
  720. }
  721. };
  722. </script>
  723. <style lang="scss" scope>
  724. .btnReply {
  725. width: 80rpx;
  726. height: 40rpx;
  727. background: #e3f0ff;
  728. border-radius: 16rpx;
  729. text-align: center;
  730. color: #007aff;
  731. }
  732. .btnDel {
  733. width: 80rpx;
  734. height: 40rpx;
  735. background: #ffedf0;
  736. border-radius: 16rpx;
  737. text-align: center;
  738. color: #ff2d55;
  739. }
  740. .btnReply {
  741. width: 80rpx;
  742. height: 40rpx;
  743. background: #e3f0ff;
  744. border-radius: 16rpx;
  745. font-size: 24rpx;
  746. }
  747. .photoBox {
  748. .photoTop {
  749. height: 74upx;
  750. display: flex;
  751. align-items: center;
  752. justify-content: space-between;
  753. padding: 0upx 38upx;
  754. .sqzz {
  755. width: 28upx;
  756. height: 28upx;
  757. display: flex;
  758. align-items: center;
  759. justify-content: center;
  760. }
  761. .centersq {
  762. color: #333;
  763. font-size: 30upx;
  764. font-weight: 500;
  765. }
  766. }
  767. .photoCenter {
  768. width: 750upx;
  769. height: 979upx;
  770. position: relative;
  771. .custom {
  772. width: 750upx;
  773. height: 979upx;
  774. position: absolute;
  775. top: 0;
  776. left: 0;
  777. image {
  778. width: 100%;
  779. height: 100%;
  780. }
  781. }
  782. }
  783. .btnResult {
  784. height: 100upx;
  785. width: 100%;
  786. background-color: #07c160;
  787. text-align: center;
  788. line-height: 100upx;
  789. color: #fff;
  790. font-size: 32upx;
  791. font-weight: bold;
  792. }
  793. }
  794. .chat_box {
  795. display: flex;
  796. padding: 20rpx;
  797. justify-content: space-between;
  798. }
  799. .chat3 {
  800. font-size: 30rpx;
  801. font-family: PingFang SC;
  802. font-weight: 500;
  803. color: #666666;
  804. margin-top: 10rpx;
  805. }
  806. .chat2 {
  807. font-size: 20rpx;
  808. font-family: PingFang SC;
  809. font-weight: 500;
  810. color: #999999;
  811. margin-top: 10rpx;
  812. }
  813. .chat1 {
  814. font-size: 24rpx;
  815. font-family: PingFang SC;
  816. font-weight: 500;
  817. color: #333333;
  818. }
  819. .leftPadding {
  820. margin-left: 8rpx;
  821. }
  822. .t2Content {
  823. font-size: 28rpx;
  824. font-family: PingFang SC;
  825. font-weight: bold;
  826. color: #999999;
  827. line-height: 48rpx;
  828. }
  829. .tBox2 {
  830. display: flex;
  831. padding-top: 10rpx;
  832. color: #333333;
  833. font-size: 30rpx;
  834. }
  835. .tBox {
  836. display: flex;
  837. align-items: center;
  838. padding-top: 10rpx;
  839. }
  840. .title {
  841. font-size: 24rpx;
  842. color: #999999;
  843. }
  844. page {
  845. padding-top: 10px;
  846. padding-top: constant(safe-area-inset-top);
  847. padding-top: env(safe-area-inset-top);
  848. }
  849. .inputBottom {
  850. position: fixed;
  851. left: 0;
  852. bottom: 0;
  853. background: #ffffff;
  854. height: 98rpx;
  855. display: flex;
  856. align-items: center;
  857. width: 100%;
  858. }
  859. .noteBox {
  860. width: 100%;
  861. background: #ffffff;
  862. padding: 10rpx;
  863. border-radius: 16rpx;
  864. }
  865. .dateBox {
  866. width: 216rpx;
  867. height: 48rpx;
  868. background: #ffffff;
  869. border-radius: 24rpx;
  870. font-size: 24rpx;
  871. color: #666666;
  872. text-align: center;
  873. line-height: 48rpx;
  874. margin: 20rpx 0;
  875. }
  876. .t_content1 {
  877. color: #007aff;
  878. margin-left: 10rpx;
  879. }
  880. .tag1 {
  881. border: 2rpx solid #007aff;
  882. border-radius: 8rpx;
  883. font-size: 20rpx;
  884. color: #007aff;
  885. padding: 5rpx;
  886. }
  887. .b_title {
  888. color: #333333;
  889. font-size: 30rpx;
  890. font-weight: bold;
  891. }
  892. page {
  893. background: #eaeef1;
  894. }
  895. .menuBox {
  896. width: 100%;
  897. background: #ffffff;
  898. border-radius: 16rpx;
  899. padding: 20rpx;
  900. margin-bottom: 20rpx;
  901. }
  902. .btnspric {
  903. border-top: 1rpx solid #eee;
  904. display: flex;
  905. align-items: center;
  906. justify-content: space-between;
  907. height: 108rpx;
  908. padding-left: 43rpx;
  909. padding-right: 32rpx;
  910. }
  911. .btnspric > .lefprL {
  912. font-size: 36rpx;
  913. color: #0c141f;
  914. font-weight: bold;
  915. }
  916. .btnspric > .lefprR {
  917. padding: 0rpx 24rpx;
  918. height: 60rpx;
  919. line-height: 60rpx;
  920. text-align: center;
  921. color: #fff;
  922. background: #32467b;
  923. border-radius: 24rpx;
  924. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  925. }
  926. .yhj,
  927. .hdyhj {
  928. padding: 24rpx 29rpx 24rpx 34rpx;
  929. }
  930. .yhj {
  931. border-bottom: 16rpx solid #f9f9f9;
  932. }
  933. .yhjtit {
  934. font-size: 30rpx;
  935. color: #0c141f;
  936. font-weight: 500;
  937. margin-bottom: 14rpx;
  938. }
  939. .yhjList {
  940. display: flex;
  941. align-items: center;
  942. justify-content: space-between;
  943. margin-bottom: 14rpx;
  944. }
  945. .yhjList > .yhjLefts {
  946. display: flex;
  947. align-items: center;
  948. }
  949. .yhjLefts > .yhl {
  950. color: #32467b;
  951. font-size: 30rpx;
  952. margin-right: 31rpx;
  953. }
  954. .yhjLefts > .yhbq {
  955. font-size: 24rpx;
  956. color: #ff9500;
  957. border-radius: 18rpx;
  958. background-color: rgba(255, 149, 0, 0.2);
  959. border: 2rpx solid #ff9500;
  960. height: 38rpx;
  961. line-height: 38rpx;
  962. padding: 0rpx 16rpx;
  963. }
  964. .ts {
  965. font-size: 24rpx;
  966. color: #999;
  967. margin: 14rpx 0rpx;
  968. padding-right: 29rpx;
  969. padding-left: 34rpx;
  970. }
  971. .yh {
  972. padding-top: 20rpx;
  973. }
  974. .yh > .yhtitle {
  975. display: flex;
  976. align-items: center;
  977. justify-content: space-between;
  978. padding-right: 29rpx;
  979. padding-left: 34rpx;
  980. }
  981. .priceBxs {
  982. display: flex;
  983. align-items: center;
  984. }
  985. .priceBxs > .pricleft {
  986. border-radius: 24rpx;
  987. border: 1rpx solid #e91313;
  988. background-color: rgba(233, 19, 19, 0.1);
  989. padding: 0rpx 18rpx;
  990. height: 49rpx;
  991. line-height: 49rpx;
  992. text-align: center;
  993. font-size: 30rpx;
  994. font-weight: 500;
  995. color: #e91313;
  996. margin-right: 13rpx;
  997. }
  998. .topBox {
  999. padding: 32rpx 32rpx 24rpx;
  1000. border-bottom: 1rpx solid #eeeeee;
  1001. }
  1002. .topBox > .boldFonstType {
  1003. font-weight: 500;
  1004. font-size: 30rpx;
  1005. margin: 16rpx 0rpx 23rpx;
  1006. }
  1007. .topBox > .firstTopL {
  1008. display: flex;
  1009. align-items: center;
  1010. }
  1011. .topBox > .firstTopL > .imageBs {
  1012. width: 331rpx;
  1013. height: 160rpx;
  1014. border-radius: 6rpx;
  1015. overflow: hidden;
  1016. margin-right: 8rpx;
  1017. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  1018. }
  1019. .topBox > .firstTopL > .imageBs > image {
  1020. width: 100%;
  1021. height: 100%;
  1022. }
  1023. .topBox > .firstTopL > .textBs {
  1024. font-size: 30rpx;
  1025. font-weight: bold;
  1026. color: #0c141f;
  1027. }
  1028. .content {
  1029. padding: 24rpx;
  1030. text-align: left;
  1031. }
  1032. .catalogBox {
  1033. display: flex;
  1034. align-items: center;
  1035. flex-wrap: nowrap;
  1036. overflow-x: auto;
  1037. padding-left: 38rpx;
  1038. max-height: 305rpx;
  1039. overflow-y: auto;
  1040. transition: all 0.4s;
  1041. }
  1042. .catalogBox > .catalogA {
  1043. min-width: 200rpx;
  1044. height: 48rpx;
  1045. line-height: 48rpx;
  1046. // text-align: center;
  1047. border: 2rpx solid transparent;
  1048. white-space: nowrap;
  1049. text-overflow: ellipsis;
  1050. overflow: hidden;
  1051. word-break: break-all;
  1052. border-radius: 10rpx;
  1053. background: rgba(22, 119, 255, 0.05);
  1054. padding-left: 19rpx;
  1055. box-sizing: border-box;
  1056. padding-right: 15rpx;
  1057. margin-right: 16rpx;
  1058. margin-bottom: 20rpx;
  1059. margin-top: 15rpx;
  1060. font-size: 24rpx;
  1061. color: #666;
  1062. }
  1063. .catalogBox > .activesq {
  1064. border-color: #1677ff;
  1065. }
  1066. .changeCatalogBox {
  1067. display: block;
  1068. }
  1069. .catalogBox::-webkit-scrollbar {
  1070. display: none; /* Chrome Safari */
  1071. }
  1072. .box {
  1073. position: relative;
  1074. top: 650rpx;
  1075. padding-bottom: 88rpx;
  1076. margin: 20rpx;
  1077. }
  1078. .price_t2 {
  1079. font-size: 18rpx;
  1080. font-family: PingFang SC;
  1081. font-weight: 500;
  1082. text-decoration: line-through;
  1083. color: #999999;
  1084. }
  1085. .price_t1 {
  1086. font-size: 33rpx;
  1087. font-family: PingFang SC;
  1088. font-weight: bold;
  1089. color: #e91313;
  1090. }
  1091. .sc_t {
  1092. font-size: 22rpx;
  1093. color: #000000;
  1094. }
  1095. .sc {
  1096. width: 29rpx;
  1097. height: 29rpx;
  1098. }
  1099. .buy {
  1100. width: 138rpx;
  1101. height: 48rpx;
  1102. line-height: 48rpx;
  1103. background: #32467b;
  1104. border-radius: 10rpx;
  1105. color: #ffffff;
  1106. font-size: 28rpx;
  1107. text-align: center;
  1108. vertical-align: middle;
  1109. position: absolute;
  1110. right: 30rpx;
  1111. }
  1112. .video_body {
  1113. padding-bottom: 96rpx;
  1114. }
  1115. .footer_tab {
  1116. position: fixed;
  1117. bottom: 0;
  1118. height: 96rpx;
  1119. width: 100%;
  1120. background-color: #ffffff;
  1121. }
  1122. .tj_box {
  1123. width: 50%;
  1124. display: inline-block;
  1125. text-align: center;
  1126. margin: 10rpx 0;
  1127. }
  1128. .teacher_t {
  1129. font-size: 24rpx;
  1130. font-family: PingFang SC;
  1131. font-weight: 400;
  1132. color: #666666;
  1133. line-height: 36rpx;
  1134. margin-left: 15rpx;
  1135. }
  1136. .teacher_img {
  1137. width: 87rpx;
  1138. height: 129rpx;
  1139. }
  1140. .t2 {
  1141. font-size: 24rpx;
  1142. font-family: PingFang SC;
  1143. color: #666666;
  1144. line-height: 36rpx;
  1145. margin: 15rpx;
  1146. }
  1147. .r_t2 {
  1148. width: 201rpx;
  1149. height: 49rpx;
  1150. background: rgba(22, 119, 255, 0.05);
  1151. border: 1rpx solid #32467b;
  1152. border-radius: 16rpx;
  1153. color: #666666;
  1154. font-size: 23rpx;
  1155. text-align: center;
  1156. display: flex;
  1157. align-items: center;
  1158. padding: 5rpx;
  1159. }
  1160. .scroll_box {
  1161. width: 100%;
  1162. height: 60rpx;
  1163. background: #ffffff;
  1164. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1165. white-space: nowrap;
  1166. overflow: hidden;
  1167. margin: 15rpx 0;
  1168. }
  1169. .r_sliper {
  1170. padding: 0 20rpx;
  1171. }
  1172. .top_line {
  1173. width: 6rpx;
  1174. height: 22rpx;
  1175. background: #32467b;
  1176. margin-right: 10rpx;
  1177. }
  1178. .video_t2 {
  1179. font-size: 24rpx;
  1180. font-family: PingFang SC;
  1181. font-weight: 500;
  1182. color: #666666;
  1183. }
  1184. .video_t1 {
  1185. height: 80rpx;
  1186. color: #333333;
  1187. line-height: 80rpx;
  1188. font-size: 30rpx;
  1189. font-family: PingFang SC;
  1190. font-weight: bold;
  1191. color: #333333;
  1192. overflow: hidden;
  1193. text-overflow: ellipsis;
  1194. white-space: nowrap;
  1195. }
  1196. .video_t1_t {
  1197. display: flex;
  1198. flex-direction: column;
  1199. height: 80rpx;
  1200. color: #333333;
  1201. text-align: center;
  1202. align-items: center;
  1203. border-left: solid 1px #d6d6db;
  1204. }
  1205. .video_play {
  1206. position: absolute;
  1207. width: 95rpx;
  1208. height: 95rpx;
  1209. top: 0;
  1210. left: 0;
  1211. right: 0;
  1212. bottom: 0;
  1213. margin: auto;
  1214. }
  1215. .video_box {
  1216. position: relative;
  1217. }
  1218. .rotoct {
  1219. transform: rotate(90deg);
  1220. }
  1221. </style>