detail.vue 30 KB

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