detail.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  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:Number(self.gradeId),
  325. goodsId:Number(self.goodsId),
  326. sectionId:Number(self.playSectionId),
  327. courseId: Number(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=this.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(data.studyDuration<=5){ //5秒内不上传记录
  446. return
  447. }
  448. if(status>0){
  449. data.status = status
  450. }
  451. console.log('提交接口', data);
  452. this.$api.studyRecord(data).then(res => {
  453. console.log(res);
  454. });
  455. },
  456. uploadFile(options, int) {
  457. var self = this;
  458. return new Promise((resolve, reject) => {
  459. var data = {
  460. imageStatus: int
  461. };
  462. self.$api.aliyunpolicy(data).then(res => {
  463. if (res.data.code != 200) {
  464. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  465. return;
  466. }
  467. var ossToken = res.data.data.resultContent;
  468. if (ossToken.host == null || ossToken.host == undefined) {
  469. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  470. return;
  471. }
  472. uni.uploadFile({
  473. url: ossToken.host,
  474. name: 'file',
  475. filePath: options,
  476. fileType: 'image',
  477. header: {
  478. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  479. },
  480. formData: {
  481. key: ossToken.dir,
  482. OSSAccessKeyId: ossToken.accessid,
  483. policy: ossToken.policy,
  484. Signature: ossToken.signature,
  485. callback: ossToken.callback,
  486. success_action_status: 200
  487. },
  488. success: result => {
  489. if (result.statusCode === 200) {
  490. self.ossAvatarUrl = ossToken.dir;
  491. resolve();
  492. } else {
  493. uni.showToast({
  494. title: '上传失败',
  495. icon: 'none'
  496. });
  497. return;
  498. }
  499. },
  500. fail: error => {
  501. uni.showToast({
  502. title: '上传接口报错' + error,
  503. icon: 'none'
  504. });
  505. return;
  506. }
  507. });
  508. });
  509. });
  510. },
  511. imageInfos() {
  512. var self = this;
  513. return new Promise((resolve, reject) => {
  514. uni.getImageInfo({
  515. src: self.avatarUrl,
  516. success: async res => {
  517. let canvasWidth = res.width; //图片原始长宽
  518. let canvasHeight = res.height;
  519. if (canvasWidth > 1000 || canvasHeight > 1000) {
  520. uni.compressImage({
  521. src: self.avatarUrl,
  522. quality: 75,
  523. width: '50%',
  524. height: '50%',
  525. success: async rest => {
  526. const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
  527. resolve();
  528. }
  529. });
  530. } else {
  531. console.log('无需压缩');
  532. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  533. resolve();
  534. }
  535. }
  536. });
  537. });
  538. },
  539. timeEvent() {
  540. let self = this;
  541. var polyvPlayerContext = this.selectComponent('#playerVideo');
  542. if (polyvPlayerContext != null) {
  543. let PlayCurrentTime = polyvPlayerContext.getVideoPlayDuration();
  544. this.studyDuration = PlayCurrentTime;
  545. if (this.currentTime < PlayCurrentTime) {
  546. this.playTime += PlayCurrentTime - this.currentTime;
  547. this.currentTime = PlayCurrentTime;
  548. } else {
  549. this.currentTime = PlayCurrentTime;
  550. }
  551. //判断是否需要拍照
  552. if (this.intervalTimeList.length > this.intervalTimeIndex) {
  553. let photoTime = Number(this.intervalTimeList[this.intervalTimeIndex]) * 60; //获取拍照秒数
  554. if (photoTime < this.playTime) {
  555. //启动拍照
  556. //暂停
  557. polyvPlayerContext.exitFullScreen();
  558. polyvPlayerContext.pause();
  559. this.openPhoto();
  560. this.intervalTimeIndex++;
  561. }
  562. }
  563. }
  564. },
  565. onStateChange(newstate, oldstate) {
  566. console.log(newstate, 6989);
  567. if (newstate.detail.newstate == 'playing') {
  568. if (this.needSeek) {
  569. var polyvPlayerContext = this.selectComponent('#playerVideo');
  570. polyvPlayerContext.seek(this.recordObj.studyDuration);
  571. polyvPlayerContext.play();
  572. this.needSeek = false;
  573. }
  574. //开始播放
  575. if (this.timer) {
  576. clearInterval(this.timer);
  577. }
  578. this.timer = setInterval(this.timeEvent, 1500); //定时器
  579. }
  580. if (newstate.detail.newstate == 'pause') {
  581. //暂停提交记录
  582. /* this.ossAvatarUrl = ""
  583. this.postStudyRecord() */
  584. }
  585. if (newstate.detail.newstate == 'ended') {
  586. this.ossAvatarUrl = '';
  587. this.postStudyRecord(1);
  588. }
  589. },
  590. //拍照
  591. openPhoto() {
  592. this.photoPopup = true;
  593. },
  594. async submit() {
  595. const waitYS = await this.imageInfos();
  596. this.postStudyRecord(); //提交记录
  597. //恢复播放
  598. var polyvPlayerContext = this.selectComponent('#playerVideo');
  599. if (polyvPlayerContext != null) {
  600. polyvPlayerContext.play();
  601. }
  602. console.log(this.ossAvatarUrl, '拍照完成456');
  603. },
  604. //确认拍照
  605. takePhoto() {
  606. var self = this;
  607. const ctx = uni.createCameraContext();
  608. ctx.takePhoto({
  609. quality: 'high',
  610. success: res => {
  611. console.log(res.tempImagePath);
  612. self.avatarUrl = res.tempImagePath;
  613. self.submit();
  614. self.photoPopup = false;
  615. },
  616. fail: err => {
  617. console.log(err);
  618. }
  619. });
  620. },
  621. //拍照报错
  622. error(e) {
  623. console.log(e.detail);
  624. },
  625. //关闭相机
  626. closePhoto() {
  627. this.photoPopup = false;
  628. },
  629. getGoodsDetail() {
  630. let self = this;
  631. this.$api.goodsDetail(this.goodsId).then(res => {
  632. self.goodsData = res.data.data;
  633. self.gradeId = self.goodsData.gradeId;
  634. console.log(self.gradeId, 698);
  635. self.getMenuList();
  636. self.getReMenuList(); //获取重修目录
  637. if (self.goodsData.goodsPlayConfig) {
  638. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  639. if (self.goodsPlayConfig.autoPlay > 0) {
  640. self.autoplay = true;
  641. }
  642. if (self.goodsPlayConfig.drag > 0) {
  643. self.isAllowSeek = 'yes';
  644. }
  645. if (self.goodsPlayConfig.speed > 0) {
  646. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  647. }
  648. }
  649. if (self.goodsData.goodsPhotographConfig) {
  650. self.goodsPhotographConfig = JSON.parse(self.goodsData.goodsPhotographConfig);
  651. if (self.goodsPhotographConfig.intervalTime) {
  652. self.intervalTimeList = self.goodsPhotographConfig.intervalTime.split(',');
  653. }
  654. }
  655. });
  656. },
  657. startVideo() {
  658. this.startStatus = true;
  659. },
  660. getAnswerList() {
  661. let self = this;
  662. this.$api.answerList({ courseId: this.courseId }).then(res => {
  663. if (res.data.code == 200) {
  664. self.answerList = res.data.rows;
  665. }
  666. });
  667. },
  668. getReMenuList() {
  669. let self = this;
  670. this.$api.reMenuList({ courseId: this.courseId, rebuild: 1, gradeId: this.gradeId }).then(res => {
  671. if (res.data.code == 200) {
  672. for (let i = 0; i < res.data.rows.length; i++) {
  673. let item = res.data.rows[i];
  674. item.down = true;
  675. item.id = item.menuId;
  676. item.name = item.menuName;
  677. }
  678. self.reMenuList = res.data.rows;
  679. }
  680. });
  681. },
  682. getMenuList() {
  683. let self = this;
  684. this.$api.reMenuList({ courseId: this.courseId, gradeId: this.gradeId }).then(res => {
  685. if (res.data.code == 200) {
  686. for (let i = 0; i < res.data.rows.length; i++) {
  687. let item = res.data.rows[i];
  688. item.down = true;
  689. item.id = item.menuId;
  690. item.name = item.menuName;
  691. }
  692. self.menuList = res.data.rows;
  693. }
  694. });
  695. },
  696. courseDetail() {
  697. let self = this;
  698. this.$api.courseDetail(this.courseId).then(res => {
  699. if (res.data.code == 200) {
  700. self.detail = res.data.data;
  701. self.gradeId = self.detail.gradeId;
  702. }
  703. });
  704. },
  705. open(item) {
  706. item.showChildren = !item.showChildren;
  707. },
  708. change(index) {
  709. this.current = index;
  710. }
  711. }
  712. };
  713. </script>
  714. <style lang="scss" scope>
  715. .btnReply {
  716. width: 80rpx;
  717. height: 40rpx;
  718. background: #e3f0ff;
  719. border-radius: 16rpx;
  720. text-align: center;
  721. color: #007aff;
  722. }
  723. .btnDel {
  724. width: 80rpx;
  725. height: 40rpx;
  726. background: #ffedf0;
  727. border-radius: 16rpx;
  728. text-align: center;
  729. color: #ff2d55;
  730. }
  731. .btnReply {
  732. width: 80rpx;
  733. height: 40rpx;
  734. background: #e3f0ff;
  735. border-radius: 16rpx;
  736. font-size: 24rpx;
  737. }
  738. .photoBox {
  739. .photoTop {
  740. height: 74upx;
  741. display: flex;
  742. align-items: center;
  743. justify-content: space-between;
  744. padding: 0upx 38upx;
  745. .sqzz {
  746. width: 28upx;
  747. height: 28upx;
  748. display: flex;
  749. align-items: center;
  750. justify-content: center;
  751. }
  752. .centersq {
  753. color: #333;
  754. font-size: 30upx;
  755. font-weight: 500;
  756. }
  757. }
  758. .photoCenter {
  759. width: 750upx;
  760. height: 979upx;
  761. position: relative;
  762. .custom {
  763. width: 750upx;
  764. height: 979upx;
  765. position: absolute;
  766. top: 0;
  767. left: 0;
  768. image {
  769. width: 100%;
  770. height: 100%;
  771. }
  772. }
  773. }
  774. .btnResult {
  775. height: 100upx;
  776. width: 100%;
  777. background-color: #07c160;
  778. text-align: center;
  779. line-height: 100upx;
  780. color: #fff;
  781. font-size: 32upx;
  782. font-weight: bold;
  783. }
  784. }
  785. .chat_box {
  786. display: flex;
  787. padding: 20rpx;
  788. justify-content: space-between;
  789. }
  790. .chat3 {
  791. font-size: 30rpx;
  792. font-family: PingFang SC;
  793. font-weight: 500;
  794. color: #666666;
  795. margin-top: 10rpx;
  796. }
  797. .chat2 {
  798. font-size: 20rpx;
  799. font-family: PingFang SC;
  800. font-weight: 500;
  801. color: #999999;
  802. margin-top: 10rpx;
  803. }
  804. .chat1 {
  805. font-size: 24rpx;
  806. font-family: PingFang SC;
  807. font-weight: 500;
  808. color: #333333;
  809. }
  810. .leftPadding {
  811. margin-left: 8rpx;
  812. }
  813. .t2Content {
  814. font-size: 28rpx;
  815. font-family: PingFang SC;
  816. font-weight: bold;
  817. color: #999999;
  818. line-height: 48rpx;
  819. }
  820. .tBox2 {
  821. display: flex;
  822. padding-top: 10rpx;
  823. color: #333333;
  824. font-size: 30rpx;
  825. }
  826. .tBox {
  827. display: flex;
  828. align-items: center;
  829. padding-top: 10rpx;
  830. }
  831. .title {
  832. font-size: 24rpx;
  833. color: #999999;
  834. }
  835. page {
  836. padding-top: 10px;
  837. padding-top: constant(safe-area-inset-top);
  838. padding-top: env(safe-area-inset-top);
  839. }
  840. .inputBottom {
  841. position: fixed;
  842. left: 0;
  843. bottom: 0;
  844. background: #ffffff;
  845. height: 98rpx;
  846. display: flex;
  847. align-items: center;
  848. width: 100%;
  849. }
  850. .noteBox {
  851. width: 100%;
  852. background: #ffffff;
  853. padding: 10rpx;
  854. border-radius: 16rpx;
  855. }
  856. .dateBox {
  857. width: 216rpx;
  858. height: 48rpx;
  859. background: #ffffff;
  860. border-radius: 24rpx;
  861. font-size: 24rpx;
  862. color: #666666;
  863. text-align: center;
  864. line-height: 48rpx;
  865. margin: 20rpx 0;
  866. }
  867. .t_content1 {
  868. color: #007aff;
  869. margin-left: 10rpx;
  870. }
  871. .tag1 {
  872. border: 2rpx solid #007aff;
  873. border-radius: 8rpx;
  874. font-size: 20rpx;
  875. color: #007aff;
  876. padding: 5rpx;
  877. }
  878. .b_title {
  879. color: #333333;
  880. font-size: 30rpx;
  881. font-weight: bold;
  882. }
  883. page {
  884. background: #eaeef1;
  885. }
  886. .menuBox {
  887. width: 100%;
  888. background: #ffffff;
  889. border-radius: 16rpx;
  890. padding: 20rpx;
  891. margin-bottom: 20rpx;
  892. }
  893. .btnspric {
  894. border-top: 1rpx solid #eee;
  895. display: flex;
  896. align-items: center;
  897. justify-content: space-between;
  898. height: 108rpx;
  899. padding-left: 43rpx;
  900. padding-right: 32rpx;
  901. }
  902. .btnspric > .lefprL {
  903. font-size: 36rpx;
  904. color: #0c141f;
  905. font-weight: bold;
  906. }
  907. .btnspric > .lefprR {
  908. padding: 0rpx 24rpx;
  909. height: 60rpx;
  910. line-height: 60rpx;
  911. text-align: center;
  912. color: #fff;
  913. background: #32467b;
  914. border-radius: 24rpx;
  915. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  916. }
  917. .yhj,
  918. .hdyhj {
  919. padding: 24rpx 29rpx 24rpx 34rpx;
  920. }
  921. .yhj {
  922. border-bottom: 16rpx solid #f9f9f9;
  923. }
  924. .yhjtit {
  925. font-size: 30rpx;
  926. color: #0c141f;
  927. font-weight: 500;
  928. margin-bottom: 14rpx;
  929. }
  930. .yhjList {
  931. display: flex;
  932. align-items: center;
  933. justify-content: space-between;
  934. margin-bottom: 14rpx;
  935. }
  936. .yhjList > .yhjLefts {
  937. display: flex;
  938. align-items: center;
  939. }
  940. .yhjLefts > .yhl {
  941. color: #32467b;
  942. font-size: 30rpx;
  943. margin-right: 31rpx;
  944. }
  945. .yhjLefts > .yhbq {
  946. font-size: 24rpx;
  947. color: #ff9500;
  948. border-radius: 18rpx;
  949. background-color: rgba(255, 149, 0, 0.2);
  950. border: 2rpx solid #ff9500;
  951. height: 38rpx;
  952. line-height: 38rpx;
  953. padding: 0rpx 16rpx;
  954. }
  955. .ts {
  956. font-size: 24rpx;
  957. color: #999;
  958. margin: 14rpx 0rpx;
  959. padding-right: 29rpx;
  960. padding-left: 34rpx;
  961. }
  962. .yh {
  963. padding-top: 20rpx;
  964. }
  965. .yh > .yhtitle {
  966. display: flex;
  967. align-items: center;
  968. justify-content: space-between;
  969. padding-right: 29rpx;
  970. padding-left: 34rpx;
  971. }
  972. .priceBxs {
  973. display: flex;
  974. align-items: center;
  975. }
  976. .priceBxs > .pricleft {
  977. border-radius: 24rpx;
  978. border: 1rpx solid #e91313;
  979. background-color: rgba(233, 19, 19, 0.1);
  980. padding: 0rpx 18rpx;
  981. height: 49rpx;
  982. line-height: 49rpx;
  983. text-align: center;
  984. font-size: 30rpx;
  985. font-weight: 500;
  986. color: #e91313;
  987. margin-right: 13rpx;
  988. }
  989. .topBox {
  990. padding: 32rpx 32rpx 24rpx;
  991. border-bottom: 1rpx solid #eeeeee;
  992. }
  993. .topBox > .boldFonstType {
  994. font-weight: 500;
  995. font-size: 30rpx;
  996. margin: 16rpx 0rpx 23rpx;
  997. }
  998. .topBox > .firstTopL {
  999. display: flex;
  1000. align-items: center;
  1001. }
  1002. .topBox > .firstTopL > .imageBs {
  1003. width: 331rpx;
  1004. height: 160rpx;
  1005. border-radius: 6rpx;
  1006. overflow: hidden;
  1007. margin-right: 8rpx;
  1008. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  1009. }
  1010. .topBox > .firstTopL > .imageBs > image {
  1011. width: 100%;
  1012. height: 100%;
  1013. }
  1014. .topBox > .firstTopL > .textBs {
  1015. font-size: 30rpx;
  1016. font-weight: bold;
  1017. color: #0c141f;
  1018. }
  1019. .content {
  1020. padding: 24rpx;
  1021. text-align: left;
  1022. }
  1023. .catalogBox {
  1024. display: flex;
  1025. align-items: center;
  1026. flex-wrap: nowrap;
  1027. overflow-x: auto;
  1028. padding-left: 38rpx;
  1029. max-height: 305rpx;
  1030. overflow-y: auto;
  1031. transition: all 0.4s;
  1032. }
  1033. .catalogBox > .catalogA {
  1034. min-width: 200rpx;
  1035. height: 48rpx;
  1036. line-height: 48rpx;
  1037. // text-align: center;
  1038. border: 2rpx solid transparent;
  1039. white-space: nowrap;
  1040. text-overflow: ellipsis;
  1041. overflow: hidden;
  1042. word-break: break-all;
  1043. border-radius: 10rpx;
  1044. background: rgba(22, 119, 255, 0.05);
  1045. padding-left: 19rpx;
  1046. box-sizing: border-box;
  1047. padding-right: 15rpx;
  1048. margin-right: 16rpx;
  1049. margin-bottom: 20rpx;
  1050. margin-top: 15rpx;
  1051. font-size: 24rpx;
  1052. color: #666;
  1053. }
  1054. .catalogBox > .activesq {
  1055. border-color: #1677ff;
  1056. }
  1057. .changeCatalogBox {
  1058. display: block;
  1059. }
  1060. .catalogBox::-webkit-scrollbar {
  1061. display: none; /* Chrome Safari */
  1062. }
  1063. .box {
  1064. position: relative;
  1065. top: 650rpx;
  1066. padding-bottom: 88rpx;
  1067. margin: 20rpx;
  1068. }
  1069. .price_t2 {
  1070. font-size: 18rpx;
  1071. font-family: PingFang SC;
  1072. font-weight: 500;
  1073. text-decoration: line-through;
  1074. color: #999999;
  1075. }
  1076. .price_t1 {
  1077. font-size: 33rpx;
  1078. font-family: PingFang SC;
  1079. font-weight: bold;
  1080. color: #e91313;
  1081. }
  1082. .sc_t {
  1083. font-size: 22rpx;
  1084. color: #000000;
  1085. }
  1086. .sc {
  1087. width: 29rpx;
  1088. height: 29rpx;
  1089. }
  1090. .buy {
  1091. width: 138rpx;
  1092. height: 48rpx;
  1093. line-height: 48rpx;
  1094. background: #32467b;
  1095. border-radius: 10rpx;
  1096. color: #ffffff;
  1097. font-size: 28rpx;
  1098. text-align: center;
  1099. vertical-align: middle;
  1100. position: absolute;
  1101. right: 30rpx;
  1102. }
  1103. .video_body {
  1104. padding-bottom: 96rpx;
  1105. }
  1106. .footer_tab {
  1107. position: fixed;
  1108. bottom: 0;
  1109. height: 96rpx;
  1110. width: 100%;
  1111. background-color: #ffffff;
  1112. }
  1113. .tj_box {
  1114. width: 50%;
  1115. display: inline-block;
  1116. text-align: center;
  1117. margin: 10rpx 0;
  1118. }
  1119. .teacher_t {
  1120. font-size: 24rpx;
  1121. font-family: PingFang SC;
  1122. font-weight: 400;
  1123. color: #666666;
  1124. line-height: 36rpx;
  1125. margin-left: 15rpx;
  1126. }
  1127. .teacher_img {
  1128. width: 87rpx;
  1129. height: 129rpx;
  1130. }
  1131. .t2 {
  1132. font-size: 24rpx;
  1133. font-family: PingFang SC;
  1134. color: #666666;
  1135. line-height: 36rpx;
  1136. margin: 15rpx;
  1137. }
  1138. .r_t2 {
  1139. width: 201rpx;
  1140. height: 49rpx;
  1141. background: rgba(22, 119, 255, 0.05);
  1142. border: 1rpx solid #32467b;
  1143. border-radius: 16rpx;
  1144. color: #666666;
  1145. font-size: 23rpx;
  1146. text-align: center;
  1147. display: flex;
  1148. align-items: center;
  1149. padding: 5rpx;
  1150. }
  1151. .scroll_box {
  1152. width: 100%;
  1153. height: 60rpx;
  1154. background: #ffffff;
  1155. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1156. white-space: nowrap;
  1157. overflow: hidden;
  1158. margin: 15rpx 0;
  1159. }
  1160. .r_sliper {
  1161. padding: 0 20rpx;
  1162. }
  1163. .top_line {
  1164. width: 6rpx;
  1165. height: 22rpx;
  1166. background: #32467b;
  1167. margin-right: 10rpx;
  1168. }
  1169. .video_t2 {
  1170. font-size: 24rpx;
  1171. font-family: PingFang SC;
  1172. font-weight: 500;
  1173. color: #666666;
  1174. }
  1175. .video_t1 {
  1176. height: 80rpx;
  1177. color: #333333;
  1178. line-height: 80rpx;
  1179. font-size: 30rpx;
  1180. font-family: PingFang SC;
  1181. font-weight: bold;
  1182. color: #333333;
  1183. overflow: hidden;
  1184. text-overflow: ellipsis;
  1185. white-space: nowrap;
  1186. }
  1187. .video_t1_t {
  1188. display: flex;
  1189. flex-direction: column;
  1190. height: 80rpx;
  1191. color: #333333;
  1192. text-align: center;
  1193. align-items: center;
  1194. border-left: solid 1px #d6d6db;
  1195. }
  1196. .video_play {
  1197. position: absolute;
  1198. width: 95rpx;
  1199. height: 95rpx;
  1200. top: 0;
  1201. left: 0;
  1202. right: 0;
  1203. bottom: 0;
  1204. margin: auto;
  1205. }
  1206. .video_box {
  1207. position: relative;
  1208. }
  1209. .rotoct {
  1210. transform: rotate(90deg);
  1211. }
  1212. </style>