detail.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778
  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>
  9. <view class="video_box" style="width: 100%;height: 460rpx;" v-if="playVID">
  10. <polyv-player
  11. id="playerVideo"
  12. playerId="playerVideo"
  13. height="460rpx"
  14. :vid="vid"
  15. :showSettingBtn="true"
  16. :enablePlayGesture="true"
  17. @statechange="onStateChange"
  18. :autoplay="autoplay"
  19. :isAllowSeek="isAllowSeek"
  20. :playbackRate="playbackRate"
  21. :startTime="startTime"
  22. ></polyv-player>
  23. </view>
  24. <view class="video_box" style="width: 100%;height: 460rpx;" v-if="playChannelId>0">
  25. <player
  26. class="plv-mp-demo-player"
  27. :videoOption="videoOption"
  28. @onLiveStatusChange="playerLiveStatusChange"
  29. />
  30. </view>
  31. </view>
  32. <view>
  33. <u-row>
  34. <u-col span="10">
  35. <view class="video_t1">{{ detail.courseName }}</view>
  36. </u-col>
  37. <u-col span="2" v-if="false">
  38. <view class="video_t1_t" @click="openJY">
  39. <image src="/static/icon/jy_icon.png" style="width: 40rpx;height: 40rpx;"></image>
  40. 讲义
  41. </view>
  42. </u-col>
  43. </u-row>
  44. </view>
  45. <u-line color="#D6D6DB" />
  46. <view style="display: flex;justify-content: center;">
  47. <view><u-tabs :list="list" font-size="24" bar-width="24" :current="current" @change="change" active-color="#007AFF"></u-tabs></view>
  48. </view>
  49. <u-line color="#D6D6DB" />
  50. </view>
  51. <view class="box">
  52. <!--目录 -->
  53. <view v-show="current == 0">
  54. <view class="menuBox" v-for="(item, index) in menuList" :key="index">
  55. <!--模块 -->
  56. <view v-if="item.type == 1"><courseModule :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="item.menuId"></courseModule></view>
  57. <!--章 -->
  58. <view v-if="item.type == 2"><courseChapter :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter></view>
  59. <!--节 -->
  60. <view v-if="item.type == 3"><courseSection :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isBuy="true" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection></view>
  61. </view>
  62. </view>
  63. <!--笔记 -->
  64. <view v-show="current == 1">
  65. <view v-if="noteList.length == 0" style="text-align: center;">暂无笔记</view>
  66. <view class="inputBottom">
  67. <view style="width: 10%;"><image src="/static/icon/note3.png" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image></view>
  68. <view style="width: 73%;height: 100%;padding: 10rpx 0;">
  69. <u-input class="input" height="60" fixed="true" placeholder="您可以在这里输入笔记内容" type="textarea" :custom-style="inputStyle" v-model="noteValue" />
  70. </view>
  71. <view style="color: #007AFF;font-size: 30rpx;font-weight: bold;width: 15%;text-align: center;" @click="postNote">提交</view>
  72. </view>
  73. <view v-for="(item, index) in noteList" :key="index">
  74. <view class="dateBox">{{ $method.timestampToTime(item.dateNote) }}</view>
  75. <view class="noteBox">
  76. <view v-for="(item1, index1) in item.userNotes" :key="index1" style="margin-top: 30rpx;" @click="jumpNote(item1)">
  77. <view style="display: flex;">
  78. <view>
  79. <view>
  80. <image src="/static/icon/note2.png" v-if="noteId != item1.noteId" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image>
  81. <image src="/static/icon/note1.png" v-if="noteId == item1.noteId" style="width: 39rpx;height: 39rpx;margin:0 29rpx;"></image>
  82. </view>
  83. <view class="title" style="width: 39rpx;height: 39rpx;margin:0 29rpx;">{{ $method.secondToDate(item1.noteSecond) }}</view>
  84. </view>
  85. <view style="margin-left: 10rpx;">
  86. <view class="t2Content leftPadding">{{ item1.sectionName }}</view>
  87. <view class="tBox2">{{ item1.noteText }}</view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <!--答疑 -->
  95. <view v-show="current == 2">
  96. <view class="inputBottom">
  97. <view class="flex_auto">
  98. <u-input height="60" fixed="true" :placeholder="placeholder" type="textarea" :custom-style="inputStyle" v-model="ctxValue" />
  99. </view>
  100. <view class="btn" @click="postContent">提交</view>
  101. </view>
  102. <view v-for="(item, index) in answerList" :key="index" style="background-color: #FFFFFF;margin-bottom: 20rpx;">
  103. <view class="chat_box" @click.stop="clearCtx">
  104. <view style="display: flex;">
  105. <view><image :src="$method.splitImgHost(item.avatar)" style="width: 64rpx;height: 64rpx;"></image></view>
  106. <view style="margin-left: 15rpx;">
  107. <view class="chat1">{{ item.realname }}</view>
  108. <view class="chat2">{{ $method.timestampToTime(item.createTime) }}</view>
  109. <view class="chat3">
  110. <text v-if="item.assignUserId > 0">回复</text>
  111. <text v-if="item.assignUserId > 0" style="color: #007AFF;">@{{ item.assignRealname }}</text>
  112. {{ item.answerText }}
  113. </view>
  114. </view>
  115. </view>
  116. <view class="btnReply" @click.stop="replyContent(item)" v-if="item.userId != userInfo.userId">回复</view>
  117. <view v-else class="btnDel" @click.stop="delContent(item)">删除</view>
  118. </view>
  119. <u-line color="#D6D6DB" />
  120. </view>
  121. <view v-if="answerList.length == 0" style="text-align: center;">暂无记录</view>
  122. </view>
  123. <!--目录 -->
  124. <view v-show="current == 3" >
  125. <view class="menuBox" v-for="(item, index) in reMenuList" :key="index">
  126. <!--模块 -->
  127. <view v-if="item.type == 1"><courseModule :courseId="courseId" :goodsId="goodsId" :gradeId="gradeId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="item.menuId"></courseModule></view>
  128. <!--章 -->
  129. <view v-if="item.type == 2">
  130. <courseChapter :courseId="courseId" :gradeId="gradeId" :goodsId="goodsId" :isRebuild="true" :isBuy="true" :menuItem="item" :levelId="'0-' + item.menuId"></courseChapter>
  131. </view>
  132. <!--节 -->
  133. <view v-if="item.type == 3">
  134. <courseSection :courseId="courseId" :gradeId="gradeId" :goodsId="goodsId" :isRebuild="true" :isBuy="true" :nextMenuItem="findMenuNextSection(index)" :menuItem="item" :levelId="'0-0-' + item.menuId"></courseSection>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. <!-- 播放前拍照end -->
  140. <u-popup v-model="showSet" :mask-close-able="false" mode="center" border-radius="24">
  141. <view style="align-items:center;padding: 0 40rpx;display: flex;flex-direction: column;justify-content:center;">
  142. <view style="font-weight: bold;color: #333333;font-size: 30rpx;margin-top: 30rpx;">温馨提示</view>
  143. <view style="width: 457rpx;color: #666666;font-size: 30rpx;margin-top: 30rpx;">学习过程中需要拍照验证学员身份,
  144. 拍照功能需要使用您的相机。
  145. 是否授权使用?</view>
  146. <view style="margin: 40rpx 0;">
  147. <button open-type="openSetting" @bindopensetting="openSetting" class="btnSet">去授权</button>
  148. </view>
  149. </view>
  150. </u-popup>
  151. <u-mask :show="photoPopup" >
  152. <!-- 播放前拍照start -->
  153. <view v-if="photoPopup" :mask-close-able="false" style="bottom: 0;position: fixed;width: 100%;z-index: 999;">
  154. <view class="photoBox">
  155. <view class="photoTop">
  156. <view class="sqzz" v-if="false"><u-icon name="close" color="#333333" size="30" @click="closePhoto"></u-icon></view>
  157. <view class="centersq">请正视手机屏幕</view>
  158. <view class="sqzz"></view>
  159. </view>
  160. <view class="photoCenter">
  161. <view style="width: 100%; height: 979rpx;position: fixed;" v-if="photoPopup">
  162. <camera device-position="front" flash="off" @error="error" style="width: 100%; height: 100%;" ></camera>
  163. </view>
  164. <view class="custom"><image src="/static/zhezhao.png" mode=""></image></view>
  165. </view>
  166. <view class="btnResult" @click="takePhoto">拍照</view>
  167. </view>
  168. </view>
  169. </u-mask>
  170. </view>
  171. </template>
  172. <script>
  173. import plv from '../static/polyv-sdk/index';
  174. import courseModule from '@/components/course/courseModule.vue';
  175. import courseChapter from '@/components/course/courseChapter.vue';
  176. import courseSection from '@/components/course/courseSection.vue';
  177. import { mapGetters } from 'vuex';
  178. export default {
  179. components: {
  180. courseModule,
  181. courseChapter,
  182. courseSection
  183. },
  184. data() {
  185. return {
  186. initLiveOk:false,
  187. livePlay:false, //是否正在播放直播,不含暂停
  188. liveDuration:0, //直播观看时长
  189. videoOption:{
  190. mode: 'live',
  191. uid: '',
  192. cid: '',
  193. openId: '',
  194. isAutoChange: false,
  195. forceVideo: false,
  196. },
  197. liveDetail:{},
  198. showSet:false,
  199. startStatus: false,
  200. detail: {},
  201. courseId: 0,
  202. placeholder: '您可以在这里输入笔记内容\n还可以点击左侧图标为笔记加上时间标记',
  203. inputStyle: {
  204. background: 'rgba(244, 244, 244, 0.98)',
  205. borderRadius: '24rpx',
  206. padding: '8rpx',
  207. marginBottom: '10rpx'
  208. },
  209. list: [],
  210. menuList: [],
  211. current: 0,
  212. vid: '',
  213. goodsId: 0,
  214. goodsData: {},
  215. photoPopup: false,
  216. goodsPlayConfig: null,
  217. autoplay: false,
  218. isAllowSeek: 'no',
  219. playbackRate: [1.0],
  220. timer: null,
  221. goodsPhotographConfig: null,
  222. intervalTimeList: [], // 间隔拍照时长
  223. intervalTimeIndex: 0, //当前处于哪个时间段拍照
  224. playTime: 0, //页面播放时长,不含暂停
  225. currentTime: 0,
  226. avatarUrl: '',
  227. ossAvatarUrl: '',
  228. studyDuration: 0, // 当前视频时长
  229. gradeId: 0,
  230. chapterId: 0,
  231. moduleId: 0,
  232. reMenuList: [],
  233. answerList: [],
  234. assignUserId: 0,
  235. placeholder: '您可以在这里输入答疑内容',
  236. ctxValue: '',
  237. noteList: [],
  238. noteValue: '',
  239. noteId: 0,
  240. recordObj: 0,
  241. gradeDetail:{},
  242. needSeek: false, //第一次播放是否需要跳转
  243. needProfileModal:false, //是否需要资料审核弹框
  244. liveObj:{},
  245. photoNum:0,
  246. photoList:[], //拍照的时间点
  247. photoConfig:false, //是否配置好拍照次数
  248. photoIndex:0, //当前位于拍照的区间下标 从0开始
  249. photoHistoryList:[], //已拍照历史的下标点
  250. };
  251. },
  252. computed: { ...mapGetters(['userInfo', 'playSectionId','playChannelId','playVID']) },
  253. onLoad(option) {
  254. this.courseId = Number(option.id);
  255. this.goodsId = Number(option.goodsId);
  256. this.courseDetail();
  257. this.getGoodsDetail();
  258. this.getAnswerList();
  259. let noteSecond = Number(option.noteSecond);
  260. if(noteSecond>0){
  261. //我的消息跳过来,播放节
  262. let item = {
  263. sectionId:Number(option.sectionId),
  264. recordingUrl:option.recordingUrl,
  265. noteSecond:noteSecond
  266. }
  267. this.$store.commit('setPlaySectionId', {playSectionId :item.sectionId});
  268. this.playNoteVideo(item);
  269. }
  270. },
  271. onShow() {
  272. var self = this;
  273. //相机授权
  274. this.getCameraSetting()
  275. this.$api.getbaseprofiletplists({ goodsId: self.goodsId }).then(res => {
  276. if (res.data.code === 200 && res.data.rows.length) {
  277. if (res.data.rows[0].keyValue) {
  278. self.$api.getbaseprofiletpgetInfo({ goodsId: self.goodsId }).then(result => {
  279. if (result.data.code === 200) {
  280. if (!result.data.data || (result.data.data.status === 3 && result.data.data.changeStatus === 1)) {
  281. if (!result.data.data) {
  282. self.needProfileModal = true
  283. uni.showModal({
  284. content: '请前往填写资料',
  285. cancelText: '返回',
  286. success: function(resultst) {
  287. if (resultst.confirm) {
  288. self.$navTo.togo('/pages2/verify/input', {
  289. id: self.goodsId
  290. });
  291. }
  292. if (resultst.cancel) {
  293. uni.navigateBack();
  294. }
  295. }
  296. });
  297. } else {
  298. self.needProfileModal = true
  299. uni.showModal({
  300. content: '资料审核不通过,请前往重新填写',
  301. cancelText: '返回',
  302. success: function(resultst) {
  303. if (resultst.confirm) {
  304. self.$navTo.togo('/pages2/verify/input', {
  305. id: self.goodsId
  306. });
  307. }
  308. if (resultst.cancel) {
  309. uni.navigateBack();
  310. }
  311. }
  312. });
  313. }
  314. } else if (result.data.data.status === 1 && res.data.rows[0].keyValue2) {
  315. self.$api.getbaseprofileStampgetInfo({ goodsId: self.goodsId }).then(k => {
  316. if (k.data.code === 200) {
  317. if (!k.data.data || (k.data.data.status === 3 && k.data.data.changeStatus === 1)) {
  318. if (!k.data.data) {
  319. self.needProfileModal = true
  320. uni.showModal({
  321. cancelText: '返回',
  322. content: '请前往填写盖章资料',
  323. success: function(resultst) {
  324. if (resultst.confirm) {
  325. self.$navTo.togo('/pages2/verify/input2', {
  326. id: self.goodsId
  327. });
  328. }
  329. if (resultst.cancel) {
  330. uni.navigateBack();
  331. }
  332. }
  333. });
  334. } else {
  335. self.needProfileModal = true
  336. uni.showModal({
  337. cancelText: '返回',
  338. content: '资料盖章审核不通过,请前往重新填写',
  339. success: function(resultst) {
  340. if (resultst.confirm) {
  341. self.$navTo.togo('/pages2/verify/input2', {
  342. id: self.goodsId
  343. });
  344. }
  345. if (resultst.cancel) {
  346. uni.navigateBack();
  347. }
  348. }
  349. });
  350. }
  351. }
  352. }
  353. });
  354. }
  355. }
  356. });
  357. }
  358. }
  359. });
  360. console.log(this.gradeId,7512)
  361. if(this.gradeId>0){
  362. //提交完资料返回判断是否已开班
  363. this.getGradeInfo()
  364. }
  365. },
  366. onUnload() {
  367. if (this.playSectionId > 0) {
  368. //退出提交记录
  369. this.postStudyRecord();
  370. }
  371. //清除正在播放的节ID
  372. this.$store.commit('setPlaySectionId', { playSectionId: 0 });
  373. this.$store.commit('setPlayChannelId', { playChannelId: 0 });
  374. this.$store.commit('setPlayVID', { playVID: null });
  375. this.closePlv()
  376. //移除所有的事件监听器
  377. uni.$off();
  378. if (this.timer) {
  379. clearInterval(this.timer);
  380. }
  381. },
  382. mounted() {
  383. uni.$on('changeSection', oldSectionId => {
  384. console.log(this.playVID)
  385. this.photoConfig = false
  386. this.photoIndex = 0
  387. var polyvPlayerContext = this.selectComponent('#playerVideo');
  388. if(polyvPlayerContext){
  389. //解决同个节视频切换问题
  390. polyvPlayerContext.pause();
  391. }
  392. //清除直播
  393. this.$store.commit('setPlayChannelId', { playChannelId: 0 });
  394. this.postStudyRecord(0, oldSectionId);
  395. });
  396. uni.$on('getSection', item => {
  397. //清除直播
  398. this.photoConfig = false
  399. this.photoIndex = 0
  400. this.$store.commit('setPlayChannelId', { playChannelId: 0 });
  401. //获取拍照历史
  402. this.getPhotoLastRecord()
  403. this.playVideo(item);
  404. });
  405. uni.$on('levelId', item => {
  406. let arr = item.split('-');
  407. //点击节获取的各层级ID
  408. this.moduleId = arr[0];
  409. this.chapterId = arr[1];
  410. });
  411. uni.$on('getChannel', item => {
  412. //清除录播
  413. this.$store.commit('setPlayVID', {playVID :null});
  414. this.playChannel(item);
  415. });
  416. },
  417. methods: {
  418. findMenuNextSection(index){
  419. for(let i=index+1;i<this.reMenuList.length;i++){
  420. let item = this.reMenuList[i]
  421. if(item.type==3){
  422. return item;
  423. }
  424. }
  425. return {}
  426. },
  427. getPhotoLastRecord() {
  428. let self = this;
  429. let data = {
  430. sectionId: parseInt(self.playSectionId),
  431. goodsId: parseInt(self.goodsId),
  432. courseId: parseInt(self.courseId),
  433. gradeId: parseInt(self.gradeId),
  434. chapterId: parseInt(self.chapterId),
  435. moduleId: parseInt(self.moduleId)}
  436. this.$api.getPhotoLastRecord(data).then(res => {
  437. if(res.data.code==200){
  438. //清空历史数据
  439. self.photoHistoryList = []
  440. this.photoIndex = 0
  441. self.photoList = []
  442. for(let i=0;i<res.data.data.length;i++){
  443. //-2存储随机拍照数组
  444. if(res.data.data[i].photoIndex==-2){
  445. self.photoList = res.data.data[i].timeInterval.split(',')
  446. }else{
  447. self.photoHistoryList.push(res.data.data[i].photoIndex)
  448. }
  449. }
  450. }
  451. });
  452. },
  453. //postTime 只提交随机时间
  454. postCoursePhotoRecord(postTime=false) {
  455. let currentTime = 0;
  456. var polyvPlayerContext = this.selectComponent('#playerVideo');
  457. if (polyvPlayerContext) {
  458. currentTime = polyvPlayerContext.getCurrentTime();
  459. }
  460. let self = this;
  461. let photoIndex = self.photoIndex
  462. let data = {
  463. photo: self.ossAvatarUrl,
  464. sectionId: parseInt(self.playSectionId),
  465. goodsId: parseInt(self.goodsId),
  466. courseId: parseInt(self.courseId),
  467. photoTime: parseInt(currentTime > 0 ? currentTime : 0),
  468. gradeId: parseInt(self.gradeId),
  469. photoIndex: postTime?-2:parseInt(photoIndex),//从0算起,-2只提交随机时间
  470. photoNum:parseInt(self.photoNum),
  471. chapterId: parseInt(self.chapterId),
  472. moduleId: parseInt(self.moduleId),
  473. timeInterval: postTime?self.photoList.join(','):''
  474. };
  475. console.log('提交接口', data);
  476. this.$api.coursePhotoRecord(data).then(res => {
  477. console.log(res);
  478. });
  479. },
  480. randomNum(minNum,maxNum){
  481. switch(arguments.length){
  482. case 1:
  483. return parseInt(Math.random()*minNum+1,10);
  484. break;
  485. case 2:
  486. return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10);
  487. break;
  488. default:
  489. return 0;
  490. break;
  491. }
  492. },
  493. //配置随机拍照时间
  494. configPhoto(){
  495. var polyvPlayerContext = this.selectComponent('#playerVideo');
  496. let totalVideoTime = polyvPlayerContext.getDuration()
  497. let duration = polyvPlayerContext.getCurrentTime()
  498. let photoNum = this.photoNum
  499. if(!this.photoConfig){
  500. this.photoConfig = true
  501. let spaceTime = Math.floor(totalVideoTime/photoNum) //拍照时间区间
  502. if(spaceTime<5){//区间小于5秒
  503. photoNum = Math.floor(totalVideoTime/5)
  504. spaceTime = 5
  505. }
  506. if(photoNum<1){
  507. photoNum = 1 //只要设置,至少拍一次
  508. spaceTime = totalVideoTime
  509. }
  510. let initSpace = 0
  511. //没有历史拍照间隔数据
  512. if(this.photoList.length==0){
  513. for(let i=0;i<photoNum;i++){
  514. let s = this.randomNum(initSpace,initSpace+spaceTime)
  515. if(s>totalVideoTime){
  516. s = totalVideoTime-1
  517. }
  518. if(s<=5){
  519. s =5 //避免出现5秒内拍照时间
  520. }
  521. this.photoList.push(s)
  522. initSpace+=spaceTime
  523. }
  524. console.log(this.photoList,"随机拍照时间数组11",photoNum,initSpace,spaceTime)
  525. this.postCoursePhotoRecord(true)//提交随机拍照时间数组
  526. }
  527. console.log(this.photoList,"随机拍照时间数组")
  528. //兼容已有观看历史
  529. for(let i=0;i<this.photoList.length-1;i++){
  530. if(this.photoList[i]<duration&&this.photoList[i+1]>duration){
  531. this.photoIndex = i+1
  532. // console.log("我的修改了photoIndex")
  533. break
  534. }
  535. if(duration>this.photoList[this.photoList.length-1]){
  536. this.photoIndex = this.photoList.length-1 //取最后一个下标
  537. // console.log("我的修改了photoIndex")
  538. break
  539. }
  540. }
  541. }
  542. },
  543. getLiveUid(channelId) {
  544. let self = this;
  545. return new Promise(resolve => {
  546. let data = {
  547. channelId: channelId
  548. };
  549. self.$api.polyvSign(data).then(res => {
  550. resolve(res.data.data);
  551. });
  552. });
  553. },
  554. timeEventLiving() {
  555. if (plv != null) {
  556. if(this.livePlay){
  557. this.liveDuration = this.liveDuration +1 //每隔1秒
  558. if(this.liveDuration==2){ //直播第2秒拍照
  559. if(this.goodsPhotographConfig){
  560. if(this.goodsPhotographConfig.livephotograph==1){
  561. //开启直播拍照
  562. this.openPhoto();
  563. }
  564. }
  565. }
  566. }
  567. }
  568. },
  569. playerLiveStatusChange(e) {
  570. const status = e.detail.status;
  571. console.log('直播状态',status);
  572. if (status === 'live') {
  573. console.log('开始直播');
  574. //开始播放
  575. if (this.timer) {
  576. clearInterval(this.timer);
  577. }
  578. this.livePlay = true
  579. this.timer = setInterval(this.timeEventLiving, 1000); //定时器
  580. }
  581. if (status === 'end') {
  582. if(this.livePlay){
  583. //只有播放过的结束才提交,避免未开播触发结束
  584. this.postStudyRecord(1);
  585. }
  586. console.log('结束直播');
  587. this.livePlay = false
  588. // 未开始
  589. }
  590. },
  591. closePlv(){
  592. if(plv){
  593. plv.destroy();
  594. }
  595. },
  596. playChannel(item){
  597. if (this.timer) {
  598. clearInterval(this.timer);
  599. }
  600. this.startStatus = true
  601. this.initLive()
  602. },
  603. setLiveOption(status) {
  604. const { userId, channelId, recordFileSimpleModel, playbackEnabled } = this.detail;
  605. const playRecordFile = playbackEnabled && recordFileSimpleModel && status === 'end';
  606. this.videoOption = {
  607. mode: 'live',
  608. uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
  609. cid: this.playChannelId,
  610. openId: this.userInfo.userAccount,
  611. isAutoChange: false,
  612. forceVideo: false,
  613. }
  614. },
  615. async initLive(){
  616. console.log(this.playChannelId,7111)
  617. this.liveObj = await this.getLiveUid(this.playChannelId);
  618. this.initLiveOk = true
  619. let optionsData = {}
  620. optionsData.mode = 'live';
  621. optionsData.forceVideo = false;
  622. optionsData.channelId = this.playChannelId; // 频道ID '2553128'
  623. optionsData.openId = this.userInfo.userAccount; // 用户openId this.userInfo.userAccount 'oQ5eX5BCtSjkE1ct8CzvxGWgh0hQ'
  624. optionsData.userId = this.liveObj.uid // 2.0.0及以上版本的demo需要使用 userId 设置学员唯一id 'egsxlptzdq'
  625. let self = this
  626. this.closePlv()
  627. plv.init(optionsData)
  628. .then(({ detail, chat }) => {
  629. self.liveDetail = detail
  630. // 设置mode为live的videoOption
  631. this.setLiveOption();
  632. if (detail.isPPT) {
  633. chat.on(chat.events.SLICESTART, () => {
  634. // 开始直播
  635. });
  636. } else {
  637. plv.api.getOrdinaryLiveStatus(detail.stream);
  638. }
  639. });
  640. },
  641. openSetting(res){
  642. console.log(res,98)
  643. },
  644. getCameraSetting () {
  645. const self = this
  646. wx.getSetting({
  647. success: res => {
  648. if (res.authSetting['scope.camera']) {
  649. // 用户已经授权
  650. self.showSet = false
  651. } else {
  652. // 用户还没有授权,向用户发起授权请求
  653. wx.authorize({
  654. scope: 'scope.camera',
  655. success() { // 用户同意授权
  656. self.showSet = false
  657. },
  658. fail() { // 用户不同意授权
  659. self.showSet = true
  660. /* wx.showToast({
  661. title: '摄像头授权失败',
  662. icon: 'none',
  663. duration: 3000
  664. }) */
  665. }
  666. })
  667. }
  668. },
  669. fail: res => {
  670. }
  671. })
  672. },
  673. openJY(){
  674. this.$u.toast('此功能正在开发中');
  675. },
  676. //播放笔记视频
  677. async playNoteVideo(item) {
  678. if (this.timer) {
  679. clearInterval(this.timer);
  680. }
  681. if (this.vid) {
  682. //切换视频
  683. var polyvPlayerContext = this.selectComponent('#playerVideo');
  684. polyvPlayerContext.changeVid(item.recordingUrl);
  685. } else {
  686. this.vid = item.recordingUrl;
  687. }
  688. this.recordObj = {videoCurrentTime:item.noteSecond}
  689. if (this.recordObj.studyDuration) {
  690. this.needSeek = true; //需要跳转到播放记录
  691. }
  692. this.startStatus = true;
  693. //获取节笔记
  694. this.getNoteList();
  695. },
  696. //正常播放视频
  697. async playVideo(item) {
  698. if (this.timer) {
  699. clearInterval(this.timer);
  700. }
  701. if (this.vid) {
  702. //切换视频
  703. var polyvPlayerContext = this.selectComponent('#playerVideo');
  704. polyvPlayerContext.changeVid(item.recordingUrl);
  705. } else {
  706. this.vid = item.recordingUrl;
  707. }
  708. this.recordObj = null
  709. this.recordObj = await this.getRecordLast();
  710. this.needSeek = true; //跳转到播放记录
  711. this.startStatus = true;
  712. //获取节笔记
  713. this.getNoteList();
  714. },
  715. getRecordLast() {
  716. let self = this;
  717. return new Promise(resolve => {
  718. let data = {
  719. gradeId: Number(self.gradeId),
  720. goodsId: Number(self.goodsId),
  721. sectionId: Number(self.playSectionId),
  722. courseId: Number(self.courseId),
  723. chapterId: parseInt(self.chapterId),
  724. moduleId: parseInt(self.moduleId)
  725. };
  726. self.$api.recordLast(data).then(res => {
  727. resolve(res.data.data);
  728. });
  729. });
  730. },
  731. jumpNote(item) {
  732. this.noteId = item.noteId;
  733. //没视频播放
  734. if(this.playSectionId==0){
  735. this.$u.toast('即将跳到笔记位置');
  736. this.$store.commit('setPlaySectionId', {playSectionId :item.sectionId});
  737. this.playNoteVideo(item);
  738. }else{
  739. //正在看当前笔记视频
  740. this.$u.toast('即将跳到笔记位置');
  741. //跳到笔记时刻
  742. var polyvPlayerContext = this.selectComponent('#playerVideo');
  743. polyvPlayerContext.seek(item.noteSecond);
  744. polyvPlayerContext.play();
  745. }
  746. },
  747. postNote() {
  748. let self = this;
  749. if (!(this.playSectionId > 0)) {
  750. this.$u.toast('目前无播放视频');
  751. return;
  752. }
  753. if (!this.noteValue) {
  754. this.$u.toast('请输入内容');
  755. return;
  756. }
  757. if(!this.gradeId){
  758. this.$u.toast('暂无班级数据');
  759. return;
  760. }
  761. var polyvPlayerContext = this.selectComponent('#playerVideo');
  762. let noteDate = this.$method.getZeroTime();
  763. let noteSecond = polyvPlayerContext.getCurrentTime();
  764. console.log(noteSecond,698)
  765. if (!noteSecond) {
  766. if(noteSecond==0){
  767. //播放结束
  768. noteSecond = polyvPlayerContext.getDuration();
  769. console.log(noteSecond,63398)
  770. }
  771. if(!noteSecond){
  772. this.$u.toast('视频暂未开始');
  773. return;
  774. }
  775. }
  776. let data = {
  777. gradeId: this.gradeId,
  778. goodsId: this.goodsId,
  779. sectionId: this.playSectionId,
  780. courseId: this.courseId,
  781. noteText: this.noteValue,
  782. noteDate: noteDate,
  783. noteSecond: noteSecond
  784. };
  785. this.$api.postNote(data).then(res => {
  786. if (res.data.code == 200) {
  787. this.$u.toast('发布成功');
  788. self.getNoteList();
  789. this.noteValue = '';
  790. }
  791. });
  792. },
  793. getGradeInfo() {
  794. let self = this;
  795. this.$store.state.allowLoading = false;
  796. this.$api.goodsGradeInfo(this.gradeId).then(res => {
  797. if (res.data.code == 200) {
  798. self.gradeDetail = res.data.data;
  799. if(self.needProfileModal){
  800. return
  801. }
  802. if(self.gradeDetail.learningStatus==2){
  803. uni.showModal({
  804. showCancel:false,
  805. cancelText: '返回',
  806. content: '当前课程正在申请中,请耐心等待',
  807. success: function(resultst) {
  808. uni.navigateBack();
  809. }
  810. });
  811. }
  812. if(self.gradeDetail.learningStatus==3&&(Number(self.gradeDetail.learningTimeStart)>Number((new Date())/1000))){
  813. uni.showModal({
  814. showCancel:false,
  815. cancelText: '返回',
  816. content: '当前课程正在申请中,请耐心等待',
  817. success: function(resultst) {
  818. uni.navigateBack();
  819. }
  820. });
  821. }
  822. }
  823. });
  824. this.$store.state.allowLoading = true;
  825. },
  826. getNoteList() {
  827. let self = this;
  828. self.noteList = [];
  829. let data = { courseId: this.courseId, gradeId: this.gradeId, goodsId: this.goodsId }
  830. if(this.playSectionId>0){
  831. data.sectionId = this.playSectionId
  832. }
  833. this.$api.noteList(data).then(res => {
  834. if (res.data.code == 200) {
  835. self.noteList = res.data.rows;
  836. }
  837. });
  838. },
  839. delAnswer(answerId) {
  840. let self = this;
  841. let data = { answerId: answerId, status: -1 };
  842. this.$api.delAnswer(data).then(res => {
  843. if (res.data.code == 200) {
  844. self.getAnswerList();
  845. }
  846. });
  847. },
  848. clearCtx() {
  849. console.log(4234);
  850. this.placeholder = '您可以在这里输入答疑内容';
  851. this.ctxValue = '';
  852. this.assignUserId = 0;
  853. },
  854. replyContent(item) {
  855. this.assignUserId = item.userId;
  856. this.placeholder = '@' + item.realname;
  857. },
  858. delContent(item) {
  859. this.delAnswer(item.answerId);
  860. },
  861. postAnswer() {
  862. let self = this;
  863. let data = { courseId: this.courseId, answerText: this.ctxValue, goodsId: this.goodsId };
  864. if (this.assignUserId > 0) {
  865. data.assignUserId = this.assignUserId;
  866. }
  867. this.$api.postAnswer(data).then(res => {
  868. if (res.data.code == 200) {
  869. this.$u.toast('发布成功');
  870. self.getAnswerList();
  871. this.placeholder = '您可以在这里输入答疑内容';
  872. this.ctxValue = '';
  873. this.assignUserId = 0;
  874. }
  875. });
  876. },
  877. postContent() {
  878. if (!this.ctxValue||this.ctxValue=='') {
  879. this.$u.toast('请输入内容');
  880. return
  881. }
  882. this.postAnswer();
  883. },
  884. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  885. let currentTime = 0;
  886. let PlayDuration = 0
  887. var polyvPlayerContext = this.selectComponent('#playerVideo');
  888. if (polyvPlayerContext) {
  889. currentTime = polyvPlayerContext.getCurrentTime(); //总的视频播放时刻
  890. PlayDuration = polyvPlayerContext.getVideoPlayDuration();//本次看的时长
  891. }
  892. if(this.playChannelId>0){
  893. currentTime = 2;//直播无法获取,无论开始结束都传2秒
  894. }
  895. let self = this;
  896. let data = {
  897. photo: self.ossAvatarUrl,
  898. sectionId: parseInt(sectionId),
  899. goodsId: parseInt(self.goodsId),
  900. courseId: parseInt(self.courseId),
  901. studyDuration: parseInt(PlayDuration > 0 ? PlayDuration : self.studyDuration),
  902. gradeId: parseInt(self.gradeId),
  903. chapterId: parseInt(self.chapterId),
  904. moduleId: parseInt(self.moduleId),
  905. videoCurrentTime: parseInt(currentTime > 0 ? currentTime : self.studyDuration)
  906. };
  907. if (status > 0) {
  908. data.status = status;
  909. }
  910. console.log('提交接口', data);
  911. this.$api.studyRecord(data).then(res => {
  912. self.ossAvatarUrl = ''
  913. console.log(res);
  914. });
  915. },
  916. uploadFile(options, int) {
  917. var self = this;
  918. return new Promise((resolve, reject) => {
  919. var data = {
  920. imageStatus: int
  921. };
  922. self.$api.aliyunpolicy(data).then(res => {
  923. if (res.data.code != 200) {
  924. self.$method.showToast('签名错误' + JSON.stringify(res.data));
  925. return;
  926. }
  927. var ossToken = res.data.data.resultContent;
  928. if (ossToken.host == null || ossToken.host == undefined) {
  929. self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
  930. return;
  931. }
  932. uni.uploadFile({
  933. url: ossToken.host,
  934. name: 'file',
  935. filePath: options,
  936. fileType: 'image',
  937. header: {
  938. AuthorizationToken: 'WX ' + uni.getStorageSync('token')
  939. },
  940. formData: {
  941. key: ossToken.dir,
  942. OSSAccessKeyId: ossToken.accessid,
  943. policy: ossToken.policy,
  944. Signature: ossToken.signature,
  945. callback: ossToken.callback,
  946. success_action_status: 200
  947. },
  948. success: result => {
  949. if (result.statusCode === 200) {
  950. self.ossAvatarUrl = ossToken.dir;
  951. resolve();
  952. } else {
  953. uni.showToast({
  954. title: '上传失败',
  955. icon: 'none'
  956. });
  957. return;
  958. }
  959. },
  960. fail: error => {
  961. uni.showToast({
  962. title: '上传接口报错' + error,
  963. icon: 'none'
  964. });
  965. return;
  966. }
  967. });
  968. });
  969. });
  970. },
  971. imageInfos() {
  972. var self = this;
  973. return new Promise((resolve, reject) => {
  974. uni.getImageInfo({
  975. src: self.avatarUrl,
  976. success: async res => {
  977. let canvasWidth = res.width; //图片原始长宽
  978. let canvasHeight = res.height;
  979. if (canvasWidth > 1000 || canvasHeight > 1000) {
  980. uni.compressImage({
  981. src: self.avatarUrl,
  982. quality: 75,
  983. width: '50%',
  984. height: '50%',
  985. success: async rest => {
  986. const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
  987. resolve();
  988. }
  989. });
  990. } else {
  991. console.log('无需压缩');
  992. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  993. resolve();
  994. }
  995. }
  996. });
  997. });
  998. },
  999. timeEvent() {
  1000. let self = this;
  1001. var polyvPlayerContext = this.selectComponent('#playerVideo');
  1002. if (polyvPlayerContext != null) {
  1003. this.playTime = polyvPlayerContext.getCurrentTime() //播放时刻
  1004. console.log(this.photoIndex,789)
  1005. //判断是否需要拍照
  1006. if (this.photoNum > 0) {
  1007. this.configPhoto()
  1008. let photoTime =0; //获取拍照秒数
  1009. for(let i=0;i<this.photoList.length;i++){
  1010. photoTime = Number(this.photoList[i]); //获取拍照秒数
  1011. if (photoTime < this.playTime&&photoTime>this.playTime-4) { //3秒区间内才触发拍照,避免拉动滚动条
  1012. if(this.photoHistoryList.indexOf(i)<0){ //不存在拍照历史则拍照
  1013. //启动拍照
  1014. //暂停
  1015. polyvPlayerContext.exitFullScreen();
  1016. polyvPlayerContext.pause();
  1017. this.photoHistoryList.push(i)
  1018. this.openPhoto();
  1019. this.photoIndex = i
  1020. }
  1021. }
  1022. }
  1023. }
  1024. }
  1025. },
  1026. onStateChange(newstate, oldstate) {
  1027. if (newstate.detail.newstate == 'playing') {
  1028. if (this.needSeek) {
  1029. var polyvPlayerContext = this.selectComponent('#playerVideo');
  1030. if(this.recordObj.videoCurrentTime){
  1031. polyvPlayerContext.seek(this.recordObj.videoCurrentTime);
  1032. }else{
  1033. polyvPlayerContext.seek(1);//避免相同节继续播放
  1034. }
  1035. polyvPlayerContext.play();
  1036. this.needSeek = false;
  1037. }
  1038. //开始播放
  1039. if (this.timer) {
  1040. clearInterval(this.timer);
  1041. }
  1042. this.timer = setInterval(this.timeEvent, 1000); //定时器
  1043. }
  1044. if (newstate.detail.newstate == 'pause') {
  1045. //暂停提交记录
  1046. /* this.ossAvatarUrl = ""
  1047. this.postStudyRecord() */
  1048. }
  1049. if (newstate.detail.newstate == 'ended') {
  1050. this.postStudyRecord(1);
  1051. uni.$emit('playNext') //播放重修下一节
  1052. }
  1053. },
  1054. //拍照
  1055. openPhoto() {
  1056. this.photoPopup = true;
  1057. uni.authorize({
  1058. scope: 'scope.camera',
  1059. success() {
  1060. }
  1061. })
  1062. },
  1063. async submit() {
  1064. const waitYS = await this.imageInfos();
  1065. this.postCoursePhotoRecord()
  1066. this.postStudyRecord(); //提交记录
  1067. //恢复播放
  1068. var polyvPlayerContext = this.selectComponent('#playerVideo');
  1069. if (polyvPlayerContext != null) {
  1070. polyvPlayerContext.play();
  1071. }
  1072. },
  1073. //确认拍照
  1074. takePhoto() {
  1075. var self = this;
  1076. const ctx = uni.createCameraContext();
  1077. ctx.takePhoto({
  1078. quality: 'high',
  1079. success: res => {
  1080. console.log(res.tempImagePath);
  1081. self.avatarUrl = res.tempImagePath;
  1082. self.submit();
  1083. self.photoPopup = false;
  1084. },
  1085. fail: err => {
  1086. console.log(err);
  1087. }
  1088. });
  1089. },
  1090. //拍照报错
  1091. error(e) {
  1092. console.log(e.detail);
  1093. },
  1094. //关闭相机
  1095. closePhoto() {
  1096. this.photoPopup = false;
  1097. },
  1098. getGoodsDetail() {
  1099. let self = this;
  1100. this.$api.goodsDetail(this.goodsId).then(res => {
  1101. self.goodsData = res.data.data;
  1102. self.gradeId = self.goodsData.gradeId;
  1103. console.log(self.gradeId, "班级ID");
  1104. self.getMenuList();
  1105. self.getReMenuList(); //获取重修目录
  1106. setTimeout(function(){
  1107. if(!self.needProfileModal){
  1108. self.getGradeInfo()
  1109. }
  1110. },500)
  1111. //获取节笔记
  1112. this.getNoteList();
  1113. if (self.goodsData.goodsPlayConfig) {
  1114. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  1115. if (self.goodsPlayConfig.autoPlay > 0) {
  1116. self.autoplay = true;
  1117. }
  1118. if (self.goodsPlayConfig.drag > 0) {
  1119. self.isAllowSeek = 'yes';
  1120. }
  1121. if (self.goodsPlayConfig.speed > 0) {
  1122. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  1123. }
  1124. }
  1125. if (self.goodsData.goodsPhotographConfig) {
  1126. self.goodsPhotographConfig = JSON.parse(self.goodsData.goodsPhotographConfig);
  1127. if (self.goodsPhotographConfig.photoNum>0) {
  1128. self.photoNum = self.goodsPhotographConfig.photoNum
  1129. console.log(self.photoNum,777777)
  1130. }
  1131. }
  1132. });
  1133. },
  1134. startVideo() {
  1135. this.startStatus = true;
  1136. },
  1137. getAnswerList() {
  1138. let self = this;
  1139. this.$api.answerList({ courseId: this.courseId,goodsId: this.goodsId }).then(res => {
  1140. if (res.data.code == 200) {
  1141. self.answerList = res.data.rows;
  1142. }
  1143. });
  1144. },
  1145. getReMenuList() {
  1146. let self = this;
  1147. this.$api.reMenuList({ courseId: this.courseId, rebuild: 1, gradeId: this.gradeId }).then(res => {
  1148. if (res.data.code == 200) {
  1149. for (let i = 0; i < res.data.rows.length; i++) {
  1150. let item = res.data.rows[i];
  1151. item.down = true;
  1152. item.id = item.menuId;
  1153. item.name = item.menuName;
  1154. }
  1155. self.reMenuList = res.data.rows;
  1156. if(self.reMenuList.length>0){
  1157. self.list = [
  1158. {
  1159. name: '目录'
  1160. },
  1161. {
  1162. name: '笔记'
  1163. },
  1164. {
  1165. name: '答疑'
  1166. },{name:'重修目录'}
  1167. ];
  1168. this.current = 0;
  1169. } else {
  1170. self.list = [
  1171. {
  1172. name: '目录'
  1173. },
  1174. {
  1175. name: '笔记'
  1176. },
  1177. {
  1178. name: '答疑'
  1179. }
  1180. ];
  1181. this.current = 0;
  1182. }
  1183. }
  1184. });
  1185. },
  1186. getMenuList() {
  1187. let self = this;
  1188. this.$api.reMenuList({ courseId: this.courseId, gradeId: this.gradeId }).then(res => {
  1189. if (res.data.code == 200) {
  1190. for (let i = 0; i < res.data.rows.length; i++) {
  1191. let item = res.data.rows[i];
  1192. item.down = true;
  1193. item.id = item.menuId;
  1194. item.name = item.menuName;
  1195. }
  1196. self.menuList = res.data.rows;
  1197. }
  1198. });
  1199. },
  1200. courseDetail() {
  1201. let self = this;
  1202. this.$api.courseDetail(this.courseId).then(res => {
  1203. if (res.data.code == 200) {
  1204. self.detail = res.data.data;
  1205. }
  1206. });
  1207. },
  1208. open(item) {
  1209. item.showChildren = !item.showChildren;
  1210. },
  1211. change(index) {
  1212. this.current = index;
  1213. }
  1214. }
  1215. };
  1216. </script>
  1217. <style lang="scss" scope>
  1218. .btnSet{
  1219. width: 440rpx;
  1220. height: 80rpx;
  1221. background: #007AFF;
  1222. border-radius: 40rpx;
  1223. color: #FFFFFF;
  1224. font-size: 28rpx;
  1225. line-height: 80rpx;
  1226. }
  1227. .btnReply {
  1228. width: 80rpx;
  1229. height: 40rpx;
  1230. background: #e3f0ff;
  1231. border-radius: 16rpx;
  1232. text-align: center;
  1233. color: #007aff;
  1234. }
  1235. .btnDel {
  1236. width: 80rpx;
  1237. height: 40rpx;
  1238. background: #ffedf0;
  1239. border-radius: 16rpx;
  1240. text-align: center;
  1241. color: #ff2d55;
  1242. }
  1243. .btnReply {
  1244. width: 80rpx;
  1245. height: 40rpx;
  1246. background: #e3f0ff;
  1247. border-radius: 16rpx;
  1248. font-size: 24rpx;
  1249. }
  1250. .photoBox {
  1251. background-color: #FFFFFF;
  1252. border-radius: 32px 32px 0px 0px;
  1253. .photoTop {
  1254. height: 74upx;
  1255. display: flex;
  1256. align-items: center;
  1257. justify-content: space-between;
  1258. padding: 0upx 38upx;
  1259. .sqzz {
  1260. width: 28upx;
  1261. height: 28upx;
  1262. display: flex;
  1263. align-items: center;
  1264. justify-content: center;
  1265. }
  1266. .centersq {
  1267. color: #333;
  1268. font-size: 30upx;
  1269. font-weight: 500;
  1270. }
  1271. }
  1272. .photoCenter {
  1273. width: 750upx;
  1274. height: 979upx;
  1275. position: relative;
  1276. .custom {
  1277. width: 750upx;
  1278. height: 979upx;
  1279. position: absolute;
  1280. z-index: 1000;
  1281. top: 0;
  1282. left: 0;
  1283. image {
  1284. width: 100%;
  1285. height: 100%;
  1286. }
  1287. }
  1288. }
  1289. .btnResult {
  1290. height: 100rpx;
  1291. width: 100%;
  1292. background-color: #07c160;
  1293. text-align: center;
  1294. line-height: 100upx;
  1295. color: #fff;
  1296. font-size: 32upx;
  1297. font-weight: bold;
  1298. }
  1299. }
  1300. .chat_box {
  1301. display: flex;
  1302. padding: 20rpx;
  1303. justify-content: space-between;
  1304. }
  1305. .chat3 {
  1306. font-size: 30rpx;
  1307. font-family: PingFang SC;
  1308. font-weight: 500;
  1309. color: #666666;
  1310. margin-top: 10rpx;
  1311. }
  1312. .chat2 {
  1313. font-size: 20rpx;
  1314. font-family: PingFang SC;
  1315. font-weight: 500;
  1316. color: #999999;
  1317. margin-top: 10rpx;
  1318. }
  1319. .chat1 {
  1320. font-size: 24rpx;
  1321. font-family: PingFang SC;
  1322. font-weight: 500;
  1323. color: #333333;
  1324. }
  1325. .leftPadding {
  1326. margin-left: 8rpx;
  1327. }
  1328. .t2Content {
  1329. font-size: 28rpx;
  1330. font-family: PingFang SC;
  1331. font-weight: bold;
  1332. color: #999999;
  1333. line-height: 48rpx;
  1334. }
  1335. .tBox2 {
  1336. display: flex;
  1337. padding-top: 10rpx;
  1338. color: #333333;
  1339. font-size: 30rpx;
  1340. }
  1341. .tBox {
  1342. display: flex;
  1343. align-items: center;
  1344. padding-top: 10rpx;
  1345. }
  1346. .title {
  1347. font-size: 24rpx;
  1348. color: #999999;
  1349. }
  1350. page {
  1351. padding-top: 10px;
  1352. padding-top: constant(safe-area-inset-top);
  1353. padding-top: env(safe-area-inset-top);
  1354. }
  1355. .inputBottom {
  1356. position: fixed;
  1357. left: 0;
  1358. bottom: 0;
  1359. background: #ffffff;
  1360. height: 98rpx;
  1361. display: flex;
  1362. align-items: center;
  1363. width: 100%;
  1364. .flex_auto {
  1365. flex:1;
  1366. margin-left: 10% ;
  1367. .input {
  1368. height:60rpx;
  1369. }
  1370. }
  1371. .btn {
  1372. color: #007AFF;font-size: 30rpx;font-weight: bold;width: 15%;text-align: center;
  1373. }
  1374. }
  1375. .noteBox {
  1376. width: 100%;
  1377. background: #ffffff;
  1378. padding: 10rpx;
  1379. border-radius: 16rpx;
  1380. }
  1381. .dateBox {
  1382. width: 216rpx;
  1383. height: 48rpx;
  1384. background: #ffffff;
  1385. border-radius: 24rpx;
  1386. font-size: 24rpx;
  1387. color: #666666;
  1388. text-align: center;
  1389. line-height: 48rpx;
  1390. margin: 20rpx 0;
  1391. }
  1392. .t_content1 {
  1393. color: #007aff;
  1394. margin-left: 10rpx;
  1395. }
  1396. .tag1 {
  1397. border: 2rpx solid #007aff;
  1398. border-radius: 8rpx;
  1399. font-size: 20rpx;
  1400. color: #007aff;
  1401. padding: 5rpx;
  1402. }
  1403. .b_title {
  1404. color: #333333;
  1405. font-size: 30rpx;
  1406. font-weight: bold;
  1407. }
  1408. page {
  1409. background: #eaeef1;
  1410. }
  1411. .menuBox {
  1412. width: 100%;
  1413. background: #ffffff;
  1414. border-radius: 16rpx;
  1415. padding: 20rpx;
  1416. margin-bottom: 20rpx;
  1417. }
  1418. .btnspric {
  1419. border-top: 1rpx solid #eee;
  1420. display: flex;
  1421. align-items: center;
  1422. justify-content: space-between;
  1423. height: 108rpx;
  1424. padding-left: 43rpx;
  1425. padding-right: 32rpx;
  1426. }
  1427. .btnspric > .lefprL {
  1428. font-size: 36rpx;
  1429. color: #0c141f;
  1430. font-weight: bold;
  1431. }
  1432. .btnspric > .lefprR {
  1433. padding: 0rpx 24rpx;
  1434. height: 60rpx;
  1435. line-height: 60rpx;
  1436. text-align: center;
  1437. color: #fff;
  1438. background: #32467b;
  1439. border-radius: 24rpx;
  1440. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1441. }
  1442. .yhj,
  1443. .hdyhj {
  1444. padding: 24rpx 29rpx 24rpx 34rpx;
  1445. }
  1446. .yhj {
  1447. border-bottom: 16rpx solid #f9f9f9;
  1448. }
  1449. .yhjtit {
  1450. font-size: 30rpx;
  1451. color: #0c141f;
  1452. font-weight: 500;
  1453. margin-bottom: 14rpx;
  1454. }
  1455. .yhjList {
  1456. display: flex;
  1457. align-items: center;
  1458. justify-content: space-between;
  1459. margin-bottom: 14rpx;
  1460. }
  1461. .yhjList > .yhjLefts {
  1462. display: flex;
  1463. align-items: center;
  1464. }
  1465. .yhjLefts > .yhl {
  1466. color: #32467b;
  1467. font-size: 30rpx;
  1468. margin-right: 31rpx;
  1469. }
  1470. .yhjLefts > .yhbq {
  1471. font-size: 24rpx;
  1472. color: #ff9500;
  1473. border-radius: 18rpx;
  1474. background-color: rgba(255, 149, 0, 0.2);
  1475. border: 2rpx solid #ff9500;
  1476. height: 38rpx;
  1477. line-height: 38rpx;
  1478. padding: 0rpx 16rpx;
  1479. }
  1480. .ts {
  1481. font-size: 24rpx;
  1482. color: #999;
  1483. margin: 14rpx 0rpx;
  1484. padding-right: 29rpx;
  1485. padding-left: 34rpx;
  1486. }
  1487. .yh {
  1488. padding-top: 20rpx;
  1489. }
  1490. .yh > .yhtitle {
  1491. display: flex;
  1492. align-items: center;
  1493. justify-content: space-between;
  1494. padding-right: 29rpx;
  1495. padding-left: 34rpx;
  1496. }
  1497. .priceBxs {
  1498. display: flex;
  1499. align-items: center;
  1500. }
  1501. .priceBxs > .pricleft {
  1502. border-radius: 24rpx;
  1503. border: 1rpx solid #e91313;
  1504. background-color: rgba(233, 19, 19, 0.1);
  1505. padding: 0rpx 18rpx;
  1506. height: 49rpx;
  1507. line-height: 49rpx;
  1508. text-align: center;
  1509. font-size: 30rpx;
  1510. font-weight: 500;
  1511. color: #e91313;
  1512. margin-right: 13rpx;
  1513. }
  1514. .topBox {
  1515. padding: 32rpx 32rpx 24rpx;
  1516. border-bottom: 1rpx solid #eeeeee;
  1517. }
  1518. .topBox > .boldFonstType {
  1519. font-weight: 500;
  1520. font-size: 30rpx;
  1521. margin: 16rpx 0rpx 23rpx;
  1522. }
  1523. .topBox > .firstTopL {
  1524. display: flex;
  1525. align-items: center;
  1526. }
  1527. .topBox > .firstTopL > .imageBs {
  1528. width: 331rpx;
  1529. height: 160rpx;
  1530. border-radius: 6rpx;
  1531. overflow: hidden;
  1532. margin-right: 8rpx;
  1533. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  1534. }
  1535. .topBox > .firstTopL > .imageBs > image {
  1536. width: 100%;
  1537. height: 100%;
  1538. }
  1539. .topBox > .firstTopL > .textBs {
  1540. font-size: 30rpx;
  1541. font-weight: bold;
  1542. color: #0c141f;
  1543. }
  1544. .content {
  1545. padding: 24rpx;
  1546. text-align: left;
  1547. }
  1548. .catalogBox {
  1549. display: flex;
  1550. align-items: center;
  1551. flex-wrap: nowrap;
  1552. overflow-x: auto;
  1553. padding-left: 38rpx;
  1554. max-height: 305rpx;
  1555. overflow-y: auto;
  1556. transition: all 0.4s;
  1557. }
  1558. .catalogBox > .catalogA {
  1559. min-width: 200rpx;
  1560. height: 48rpx;
  1561. line-height: 48rpx;
  1562. // text-align: center;
  1563. border: 2rpx solid transparent;
  1564. white-space: nowrap;
  1565. text-overflow: ellipsis;
  1566. overflow: hidden;
  1567. word-break: break-all;
  1568. border-radius: 10rpx;
  1569. background: rgba(22, 119, 255, 0.05);
  1570. padding-left: 19rpx;
  1571. box-sizing: border-box;
  1572. padding-right: 15rpx;
  1573. margin-right: 16rpx;
  1574. margin-bottom: 20rpx;
  1575. margin-top: 15rpx;
  1576. font-size: 24rpx;
  1577. color: #666;
  1578. }
  1579. .catalogBox > .activesq {
  1580. border-color: #1677ff;
  1581. }
  1582. .changeCatalogBox {
  1583. display: block;
  1584. }
  1585. .catalogBox::-webkit-scrollbar {
  1586. display: none; /* Chrome Safari */
  1587. }
  1588. .box {
  1589. position: relative;
  1590. top: 650rpx;
  1591. padding-bottom: 88rpx;
  1592. margin: 20rpx;
  1593. }
  1594. .price_t2 {
  1595. font-size: 18rpx;
  1596. font-family: PingFang SC;
  1597. font-weight: 500;
  1598. text-decoration: line-through;
  1599. color: #999999;
  1600. }
  1601. .price_t1 {
  1602. font-size: 33rpx;
  1603. font-family: PingFang SC;
  1604. font-weight: bold;
  1605. color: #e91313;
  1606. }
  1607. .sc_t {
  1608. font-size: 22rpx;
  1609. color: #000000;
  1610. }
  1611. .sc {
  1612. width: 29rpx;
  1613. height: 29rpx;
  1614. }
  1615. .buy {
  1616. width: 138rpx;
  1617. height: 48rpx;
  1618. line-height: 48rpx;
  1619. background: #32467b;
  1620. border-radius: 10rpx;
  1621. color: #ffffff;
  1622. font-size: 28rpx;
  1623. text-align: center;
  1624. vertical-align: middle;
  1625. position: absolute;
  1626. right: 30rpx;
  1627. }
  1628. .video_body {
  1629. padding-bottom: 96rpx;
  1630. }
  1631. .footer_tab {
  1632. position: fixed;
  1633. bottom: 0;
  1634. height: 96rpx;
  1635. width: 100%;
  1636. background-color: #ffffff;
  1637. }
  1638. .tj_box {
  1639. width: 50%;
  1640. display: inline-block;
  1641. text-align: center;
  1642. margin: 10rpx 0;
  1643. }
  1644. .teacher_t {
  1645. font-size: 24rpx;
  1646. font-family: PingFang SC;
  1647. font-weight: 400;
  1648. color: #666666;
  1649. line-height: 36rpx;
  1650. margin-left: 15rpx;
  1651. }
  1652. .teacher_img {
  1653. width: 87rpx;
  1654. height: 129rpx;
  1655. }
  1656. .t2 {
  1657. font-size: 24rpx;
  1658. font-family: PingFang SC;
  1659. color: #666666;
  1660. line-height: 36rpx;
  1661. margin: 15rpx;
  1662. }
  1663. .r_t2 {
  1664. width: 201rpx;
  1665. height: 49rpx;
  1666. background: rgba(22, 119, 255, 0.05);
  1667. border: 1rpx solid #32467b;
  1668. border-radius: 16rpx;
  1669. color: #666666;
  1670. font-size: 23rpx;
  1671. text-align: center;
  1672. display: flex;
  1673. align-items: center;
  1674. padding: 5rpx;
  1675. }
  1676. .scroll_box {
  1677. width: 100%;
  1678. height: 60rpx;
  1679. background: #ffffff;
  1680. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  1681. white-space: nowrap;
  1682. overflow: hidden;
  1683. margin: 15rpx 0;
  1684. }
  1685. .r_sliper {
  1686. padding: 0 20rpx;
  1687. }
  1688. .top_line {
  1689. width: 6rpx;
  1690. height: 22rpx;
  1691. background: #32467b;
  1692. margin-right: 10rpx;
  1693. }
  1694. .video_t2 {
  1695. font-size: 24rpx;
  1696. font-family: PingFang SC;
  1697. font-weight: 500;
  1698. color: #666666;
  1699. }
  1700. .video_t1 {
  1701. height: 80rpx;
  1702. color: #333333;
  1703. line-height: 80rpx;
  1704. font-size: 30rpx;
  1705. font-family: PingFang SC;
  1706. font-weight: bold;
  1707. color: #333333;
  1708. overflow: hidden;
  1709. text-overflow: ellipsis;
  1710. white-space: nowrap;
  1711. }
  1712. .video_t1_t {
  1713. display: flex;
  1714. flex-direction: column;
  1715. height: 80rpx;
  1716. color: #333333;
  1717. text-align: center;
  1718. align-items: center;
  1719. border-left: solid 1px #d6d6db;
  1720. }
  1721. .video_play {
  1722. position: absolute;
  1723. width: 95rpx;
  1724. height: 95rpx;
  1725. top: 0;
  1726. left: 0;
  1727. right: 0;
  1728. bottom: 0;
  1729. margin: auto;
  1730. }
  1731. .video_box {
  1732. position: relative;
  1733. }
  1734. .rotoct {
  1735. transform: rotate(90deg);
  1736. }
  1737. </style>