detail.vue 47 KB

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