detail.vue 49 KB

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