detail.vue 49 KB

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