detail.vue 30 KB

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