detail.vue 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681
  1. <template>
  2. <view class="polyv_detail">
  3. <nav-bar
  4. :title="detail.courseName || '课程详情'"
  5. v-show="navShow"
  6. ></nav-bar>
  7. <view id="top">
  8. <view class="video_box" v-if="!startStatus">
  9. <image
  10. :src="$method.splitImgHost(detail.coverUrl)"
  11. mode="widthFix"
  12. style="width: 100%; height: 421rpx"
  13. ></image>
  14. <image
  15. v-if="false"
  16. class="video_play"
  17. src="/static/play.png"
  18. @click="startVideo"
  19. ></image>
  20. </view>
  21. <view v-else>
  22. <view
  23. class="video_box"
  24. style="width: 100%; height: 421rpx"
  25. v-if="playVID"
  26. >
  27. <polyv-player
  28. id="playerVideo"
  29. playerId="playerVideo"
  30. height="421rpx"
  31. :vid="vid"
  32. :showSettingBtn="true"
  33. :enablePlayGesture="true"
  34. :custom-cache="false"
  35. :object-fit="'contain'"
  36. @statechange="onStateChange"
  37. @fullscreenchange="fullscreenchange"
  38. @error="playError"
  39. :autoplay="true"
  40. :page-gesture="true"
  41. :vslide-gesture="true"
  42. :vslide-gesture-in-fullscreen="true"
  43. :isAllowSeek="isAllowSeek"
  44. :playbackRate="playbackRate"
  45. :startTime="startTime"
  46. :enableAutoRotation="enableAutoRotation"
  47. @loadedmetadata="loadedmetadata"
  48. ></polyv-player>
  49. <cover-view
  50. class="video-toast__close"
  51. v-if="videoToastShow"
  52. @click="closeToast()"
  53. >X</cover-view
  54. >
  55. <cover-view class="video-toast" v-if="videoToastShow">
  56. <cover-view class="video-toast__text"
  57. >您上次看到 {{ seekTime }},正在自动续播</cover-view
  58. >
  59. <cover-view class="video-toast__btn" @click="restart()"
  60. >从头播放</cover-view
  61. >
  62. </cover-view>
  63. </view>
  64. <view
  65. class="video_box"
  66. style="width: 100%; height: 421rpx"
  67. v-if="playChannelId > 0"
  68. >
  69. <player
  70. class="plv-mp-demo-player"
  71. :videoOption="videoOption"
  72. :page-gesture="true"
  73. :vslide-gesture="true"
  74. :vslide-gesture-in-fullscreen="true"
  75. @onLiveStatusChange="playerLiveStatusChange"
  76. />
  77. </view>
  78. </view>
  79. <view class="course_name">
  80. <u-row>
  81. <u-col span="10">
  82. <view class="video_t1">{{ detail.courseName }}</view>
  83. </u-col>
  84. <u-col span="2">
  85. <div class="notice_wrap" v-if="goodsData.buyNote">
  86. <view class="video_t1_t" @click="studyNotice"> 学员须知 </view>
  87. </div>
  88. </u-col>
  89. </u-row>
  90. </view>
  91. <u-line color="#D6D6DB" />
  92. <view>
  93. <view
  94. ><u-tabs
  95. gutter="0"
  96. :item-width="itemWidth()"
  97. :list="list"
  98. font-size="32"
  99. bar-width="24"
  100. :current="current"
  101. @change="change"
  102. active-color="#007AFF"
  103. ></u-tabs
  104. ></view>
  105. </view>
  106. <u-line color="#D6D6DB" />
  107. </view>
  108. <view class="box">
  109. <scroll-view class="box_in" scroll-y="true">
  110. <!--目录 -->
  111. <view v-show="current == 0">
  112. <view class="top__header" v-if="livingItem" @click="goLive(livingItem)">
  113. <image class="img" src="/pages5/static/live.png" mode="widthFix"></image>
  114. <view class="note">正在直播中</view>
  115. <view class="title">{{livingItem.sectionName}}</view>
  116. </view>
  117. <view class="menuBox" v-for="(item, index) in menuList" :key="index">
  118. <!--模块 -->
  119. <view v-if="item.type == 1"
  120. ><courseModule
  121. :isLive="true"
  122. :orderGoodsId="orderGoodsId"
  123. :sectionMaxNum="goodsData.sectionMaxNum"
  124. :needOpen="menuIndex[0] === index ? true : false"
  125. :courseId="courseId"
  126. :preItem="menuList[index - 1]"
  127. :learningOrder="businessData.goodsLearningOrder"
  128. :goodsId="goodsId"
  129. :gradeId="gradeId"
  130. :isBuy="true"
  131. :menuItem="item"
  132. :levelId="item.menuId"
  133. ></courseModule
  134. ></view>
  135. <!--章 -->
  136. <view v-if="item.type == 2"
  137. ><courseChapter
  138. :isLive="true"
  139. :orderGoodsId="orderGoodsId"
  140. :sectionMaxNum="goodsData.sectionMaxNum"
  141. :needOpen="menuIndex[0] === index ? true : false"
  142. :courseId="courseId"
  143. :preItem="menuList[index - 1]"
  144. @playEnd="sectionPlayEnd($event, index)"
  145. :learningOrder="businessData.goodsLearningOrder"
  146. :goodsId="goodsId"
  147. :gradeId="gradeId"
  148. :isBuy="true"
  149. :menuItem="item"
  150. :levelId="'0-' + item.menuId"
  151. ></courseChapter
  152. ></view>
  153. <!--节 -->
  154. <view v-if="item.type == 3"
  155. ><courseSection
  156. :isLive="true"
  157. :orderGoodsId="orderGoodsId"
  158. :sectionMaxNum="goodsData.sectionMaxNum"
  159. @playEnd="sectionPlayEnd($event, index)"
  160. :courseId="courseId"
  161. :preItem="menuList[index - 1]"
  162. :learningOrder="businessData.goodsLearningOrder"
  163. :goodsId="goodsId"
  164. :gradeId="gradeId"
  165. :isBuy="true"
  166. :menuItem="item"
  167. :levelId="'0-0-' + item.menuId"
  168. ></courseSection
  169. ></view>
  170. </view>
  171. </view>
  172. <!--笔记 -->
  173. <view v-show="current == 1">
  174. <view v-if="noteList.length == 0" style="text-align: center"
  175. >暂无笔记</view
  176. >
  177. <view class="inputBottom" v-if="!(isPlayRebuild > 0) && playChannelId ==0">
  178. <view style="width: 10%"
  179. ><image
  180. src="/static/icon/note3.png"
  181. style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
  182. ></image
  183. ></view>
  184. <view style="width: 73%; height: 100%; padding: 10rpx 0">
  185. <u-input
  186. class="input"
  187. height="60"
  188. fixed="true"
  189. placeholder="您可以在这里输入笔记内容"
  190. type="input"
  191. :custom-style="inputStyle"
  192. v-model="noteValue"
  193. />
  194. </view>
  195. <view
  196. style="
  197. color: #007aff;
  198. font-size: 30rpx;
  199. font-weight: bold;
  200. width: 15%;
  201. text-align: center;
  202. "
  203. @click="postNote"
  204. >提交</view
  205. >
  206. </view>
  207. <view v-for="(item, index) in noteList" :key="index">
  208. <view class="dateBox">{{
  209. $method.timestampToTime(item.dateNote)
  210. }}</view>
  211. <view class="noteBox">
  212. <view
  213. v-for="(item1, index1) in item.userNotes"
  214. :key="index1"
  215. style="margin-top: 30rpx"
  216. @click="jumpNote(item1)"
  217. >
  218. <view style="display: flex">
  219. <view class="left_ti">
  220. <view>
  221. <image
  222. src="/static/icon/note2.png"
  223. v-if="noteId != item1.noteId"
  224. style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
  225. ></image>
  226. <image
  227. src="/static/icon/note1.png"
  228. v-if="noteId == item1.noteId"
  229. style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
  230. ></image>
  231. </view>
  232. <view
  233. class="title"
  234. style="width: 39rpx; height: 39rpx;"
  235. >{{ $method.secondToDate(item1.noteSecond) }}</view
  236. >
  237. </view>
  238. <view style="margin-left: 10rpx">
  239. <view class="t2Content leftPadding">{{
  240. item1.sectionName
  241. }}</view>
  242. <view class="tBox2">{{ item1.noteText }}</view>
  243. </view>
  244. </view>
  245. </view>
  246. </view>
  247. </view>
  248. </view>
  249. <!--答疑 -->
  250. <view v-show="current == 2">
  251. <view class="inputBottom">
  252. <view class="flex_auto">
  253. <u-input
  254. height="60"
  255. fixed="true"
  256. :focus="isFocus"
  257. :placeholder="placeholder"
  258. type="input"
  259. @blur="blur"
  260. :custom-style="inputStyle"
  261. v-model="ctxValue"
  262. />
  263. </view>
  264. <view class="btn" @click="postContent">提交</view>
  265. </view>
  266. <view
  267. v-for="(item, index) in answerList"
  268. :key="index"
  269. style="background-color: #ffffff; margin-bottom: 20rpx"
  270. >
  271. <view class="chat_box" @click.stop="clearCtx">
  272. <view style="display: flex; flex: 1">
  273. <view
  274. ><image
  275. :src="
  276. item.assignUserId > 0 && !item.realname
  277. ? '/static/logo_xcx.png'
  278. : $method.splitImgHost(item.avatar)
  279. "
  280. style="width: 64rpx; height: 64rpx"
  281. ></image
  282. ></view>
  283. <view style="margin-left: 15rpx">
  284. <view class="chat1">{{
  285. item.assignUserId > 0 && !item.realname
  286. ? "祥粤老师"
  287. : item.realname
  288. }}</view>
  289. <view class="chat2">{{
  290. $method.timestampToTime(item.createTime, false)
  291. }}</view>
  292. <view class="chat3">
  293. <text v-if="item.assignUserId > 0">回复</text>
  294. <text v-if="item.assignUserId > 0" style="color: #007aff"
  295. >@{{ item.assignRealname }}</text
  296. >
  297. <view style="word-break: break-all">{{
  298. item.answerText
  299. }}</view>
  300. </view>
  301. </view>
  302. </view>
  303. <view
  304. class="btnReply"
  305. @click.stop="replyContent(item)"
  306. v-if="item.userId != userInfo.userId"
  307. >回复</view
  308. >
  309. <view v-else class="btnDel" @click.stop="delContent(item)"
  310. >删除</view
  311. >
  312. </view>
  313. <u-line color="#D6D6DB" />
  314. </view>
  315. <view v-if="answerList.length == 0" style="text-align: center"
  316. >暂无记录</view
  317. >
  318. </view>
  319. <!--答疑 -->
  320. <view v-show="current == 3">
  321. <view
  322. v-for="(item, index) in historyChatMsgList"
  323. :key="index"
  324. style="background-color: #ffffff; margin-bottom: 20rpx"
  325. >
  326. <view class="chat_box" @click.stop="clearCtx">
  327. <view style="display: flex; flex: 1">
  328. <view
  329. ><image
  330. :src="
  331. item.user.pic
  332. "
  333. style="width: 64rpx; height: 64rpx"
  334. ></image
  335. ></view>
  336. <view style="margin-left: 15rpx">
  337. <view class="chat1">{{
  338. item.user.nickname
  339. }}</view>
  340. <view class="chat2">{{
  341. item.time | formatDate
  342. }}</view>
  343. <view class="chat3">
  344. <!-- <text v-if="item.assignUserId > 0">回复</text>
  345. <text v-if="item.assignUserId > 0" style="color: #007aff"
  346. >@{{ item.assignRealname }}</text
  347. > -->
  348. <view style="word-break: break-all">{{
  349. item.content
  350. }}</view>
  351. </view>
  352. </view>
  353. </view>
  354. </view>
  355. <u-line color="#D6D6DB" />
  356. </view>
  357. <view v-if="historyChatMsgList.length == 0" style="text-align: center"
  358. >暂无记录</view
  359. >
  360. </view>
  361. </scroll-view>
  362. </view>
  363. <!-- 播放前拍照end -->
  364. <u-popup
  365. v-model="showSet"
  366. :mask-close-able="false"
  367. mode="center"
  368. border-radius="24"
  369. >
  370. <view
  371. style="
  372. align-items: center;
  373. padding: 0 40rpx;
  374. display: flex;
  375. flex-direction: column;
  376. justify-content: center;
  377. "
  378. >
  379. <view
  380. style="
  381. font-weight: bold;
  382. color: #333333;
  383. font-size: 30rpx;
  384. margin-top: 30rpx;
  385. "
  386. >温馨提示</view
  387. >
  388. <view
  389. style="
  390. width: 457rpx;
  391. color: #666666;
  392. font-size: 30rpx;
  393. margin-top: 30rpx;
  394. "
  395. >学习过程中需要拍照验证学员身份, 拍照功能需要使用您的相机。
  396. 是否授权使用?</view
  397. >
  398. <view style="margin: 40rpx 0">
  399. <button
  400. open-type="openSetting"
  401. @bindopensetting="openSetting"
  402. class="btnSet"
  403. >
  404. 去授权
  405. </button>
  406. </view>
  407. </view>
  408. </u-popup>
  409. <u-mask :show="photoPopup">
  410. <!-- 播放前拍照start -->
  411. <view
  412. v-if="photoPopup"
  413. :mask-close-able="false"
  414. style="bottom: 0; position: fixed; width: 100%; z-index: 999"
  415. >
  416. <view class="photoBox">
  417. <view class="photoTop">
  418. <view class="sqzz" v-if="false"
  419. ><u-icon
  420. name="close"
  421. color="#333333"
  422. size="30"
  423. @click="closePhoto"
  424. ></u-icon
  425. ></view>
  426. <view class="centersq">请正视手机屏幕</view>
  427. <view class="sqzz"></view>
  428. </view>
  429. <view class="photoCenter">
  430. <view
  431. style="width: 100%; height: 979rpx; position: fixed"
  432. v-if="photoPopup && isTaking"
  433. >
  434. <camera
  435. device-position="front"
  436. flash="off"
  437. @error="error"
  438. style="width: 100%; height: 100%"
  439. ></camera>
  440. </view>
  441. <view class="custom" v-if="!isTaking"
  442. ><image :src="avatarUrl" mode=""></image
  443. ></view>
  444. </view>
  445. <view class="btns">
  446. <view class="btnResult" v-if="isTaking" @click="takePhoto"
  447. >拍照</view
  448. >
  449. <view class="btnResult" v-if="!isTaking" @click="reTake">重拍</view>
  450. <view class="btnResult" v-if="!isTaking" @click="submit">确认</view>
  451. </view>
  452. </view>
  453. </view>
  454. </u-mask>
  455. <u-popup
  456. v-model="noticeShow"
  457. class="notice_modal"
  458. mode="center"
  459. border-radius="14"
  460. width="700rpx"
  461. height="900rpx"
  462. >
  463. <div class="content">
  464. <scroll-view scroll-y="true" style="height: 100%">
  465. <view class="title">学员须知</view>
  466. <text class="text">
  467. {{ goodsData.buyNote }}
  468. </text>
  469. </scroll-view>
  470. </div>
  471. </u-popup>
  472. </view>
  473. </template>
  474. <script>
  475. import plv from "@/pages3/static/polyv-sdk/index";
  476. import courseModule from "@/components/course/courseModule.vue";
  477. import courseChapter from "@/components/course/courseChapter.vue";
  478. import courseSection from "@/components/course/courseSection.vue";
  479. import {WEBVIEW_URL} from '@/common/request.js'
  480. // import { websocket } from "@/common/socket.js";
  481. import { mapGetters, mapMutations } from "vuex";
  482. export default {
  483. components: {
  484. courseModule,
  485. courseChapter,
  486. courseSection,
  487. },
  488. filters: {
  489. formatDate(date) {
  490. const nDate = new Date(date)
  491. const nyear = nDate.getFullYear()
  492. const nmonth = (nDate.getMonth()+1).toString().padStart(2,0)
  493. const nday = nDate.getDate().toString().padStart(2,0)
  494. const hour = nDate.getHours()
  495. const mins = nDate.getMinutes()
  496. const seconds = nDate.getSeconds()
  497. return nyear+'-'+nmonth+'-'+nday+' '+hour+':'+(mins>=10 ? mins : '0'+mins)+':'+(seconds>=10 ? seconds : '0'+seconds)
  498. }
  499. },
  500. data() {
  501. return {
  502. hasStart:false,
  503. channelItem:null,
  504. lockTimer: null,
  505. orderGoodsId: 0,
  506. noticeShow: false,
  507. navShow: true,
  508. enableAutoRotation: true,
  509. seekTime: "",
  510. toastTimer: null,
  511. videoToastShow: false,
  512. initLiveOk: false,
  513. livePlay: false, //是否正在播放直播,不含暂停
  514. liveDuration: 0, //直播观看时长
  515. videoOption: {
  516. mode: "live",
  517. uid: "",
  518. cid: "",
  519. openId: "",
  520. isAutoChange: false,
  521. forceVideo: false,
  522. },
  523. courseHandoutsData: "",
  524. liveDetail: {},
  525. showSet: false,
  526. startStatus: false,
  527. detail: {},
  528. courseId: 0,
  529. placeholder:
  530. "您可以在这里输入笔记内容\n还可以点击左侧图标为笔记加上时间标记",
  531. inputStyle: {
  532. background: "rgba(244, 244, 244, 0.98)",
  533. borderRadius: "24rpx",
  534. padding: "8rpx",
  535. marginBottom: "10rpx",
  536. },
  537. list: [{
  538. name: "目录",
  539. },
  540. {
  541. name: "笔记",
  542. },
  543. {
  544. name: "答疑",
  545. },
  546. {
  547. name: "聊天",
  548. }],
  549. menuList: [],
  550. current: 0,
  551. vid: "",
  552. goodsId: 0,
  553. goodsData: {},
  554. photoPopup: false,
  555. goodsPlayConfig: null,
  556. autoplay: false,
  557. isAllowSeek: "no",
  558. playbackRate: [1.0],
  559. timer: null,
  560. answerTimer: null,
  561. goodsPhotographConfig: null,
  562. intervalTimeList: [], // 间隔拍照时长
  563. intervalTimeIndex: 0, //当前处于哪个时间段拍照
  564. playTime: 0, //页面播放时长,不含暂停
  565. currentTime: 0,
  566. avatarUrl: "",
  567. ossAvatarUrl: "",
  568. studyDuration: 0, // 当前视频时长
  569. gradeId: 0,
  570. chapterId: 0,
  571. moduleId: 0,
  572. reMenuList: [],
  573. answerList: [],
  574. assignUserId: 0,
  575. placeholder: "您可以在这里输入答疑内容",
  576. ctxValue: "",
  577. noteList: [],
  578. noteValue: "",
  579. noteId: 0,
  580. recordObj: 0,
  581. gradeDetail: {},
  582. isTaking: true, //是否正在拍照
  583. needSeek: false, //第一次播放是否需要跳转
  584. needProfileModal: false, //是否需要资料审核弹框
  585. liveObj: {},
  586. photoNum: 0,
  587. photoList: [], //拍照的时间点
  588. photoConfig: false, //是否配置好拍照次数
  589. photoIndex: 0, //当前位于拍照的区间下标 从0开始
  590. photoHistoryList: [], //已拍照历史的下标点
  591. sectionItem: null,
  592. businessData: {},
  593. showNotes: true,
  594. menuIndex: [],
  595. uploadLock: false, //上传图片
  596. isPlayRebuild: false, //是否正在播放重修视频
  597. isRebuild: false, //视频是否从重修目录点击
  598. isFocus:false,
  599. clearTimer:null,
  600. historyChatMsgList:[],
  601. livingItem:''
  602. };
  603. },
  604. computed: {
  605. ...mapGetters(["userInfo", "playSectionId", "playChannelId", "playVID"]),
  606. },
  607. onLoad(option) {
  608. console.log('option====', option)
  609. this.courseId = Number(option.courseId);
  610. this.goodsId = Number(option.goodsId);
  611. // this.gradeId = option.gradeId || 0
  612. this.orderGoodsId = Number(option.orderGoodsId) || '';
  613. this.updateLiveLast(null)
  614. this.courseDetail();
  615. this.getGoodsDetail();
  616. this.getAnswerList();
  617. this.studyRecordMenuAllList();
  618. this.answerTimer = setInterval(() => {
  619. this.getAnswerList();
  620. }, 5000);
  621. let noteSecond = Number(option.noteSecond);
  622. if (noteSecond > 0) {
  623. //我的消息跳过来,播放节
  624. let item = {
  625. sectionId: Number(option.sectionId),
  626. recordingUrl: option.recordingUrl,
  627. noteSecond: noteSecond,
  628. studyDuration: noteSecond,
  629. };
  630. let playNextId = `moduleId${option.moduleId}chapterId${
  631. option.chapterId
  632. }sectionId${option.sectionId}${option.isRebuild ? "isRebuild" : ""}`;
  633. this.$store.commit("setPlaySectionId", { playSectionId: item.sectionId });
  634. this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
  635. this.$store.commit("updatePlayNextId", playNextId);
  636. console.log("this.playNoteVideo");
  637. this.playNoteVideo(item)
  638. } else {
  639. this.studyRecordQueryLiveLast();
  640. }
  641. },
  642. onShow() {
  643. var self = this;
  644. //相机授权
  645. // this.userConfirmInfoDetail().then(res => {
  646. // })
  647. // this.getbaseprofiletplists();
  648. console.log(this.gradeId, 7512);
  649. },
  650. onHide() {
  651. },
  652. onUnload() {
  653. if (this.playSectionId > 0 && this.hasStart) {
  654. //退出提交记录
  655. this.postStudyRecord();
  656. }
  657. //清除正在播放的节ID
  658. // this.$store.commit('setPlayObj',null)
  659. this.$store.commit("setPlaySectionId", { playSectionId: 0 });
  660. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  661. this.$store.commit("setPlayVID", { playVID: null });
  662. this.closePlv();
  663. console.log("onUnload");
  664. //移除所有的事件监听器
  665. uni.$off();
  666. clearInterval(this.answerTimer);
  667. if (this.timer) {
  668. clearInterval(this.timer);
  669. }
  670. // console.log(this.lockTimer, "this.lockTimer");
  671. // if (this.lockTimer) {
  672. // clearInterval(this.lockTimer);
  673. // this.$api
  674. // .lockDelLock({
  675. // action: "jxjy",
  676. // })
  677. // .then((res) => {});
  678. // }
  679. // websocket.sendMsg("delAction");
  680. },
  681. mounted() {
  682. uni.$on("changeSection", (oldSectionId) => {
  683. console.log(this.playVID);
  684. this.hasStart = false;
  685. this.photoConfig = false;
  686. this.photoIndex = 0;
  687. var polyvPlayerContext = this.selectComponent("#playerVideo");
  688. if (polyvPlayerContext) {
  689. //解决同个节视频切换问题
  690. polyvPlayerContext.seek(0);
  691. polyvPlayerContext.pause();
  692. }
  693. //清除直播
  694. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  695. this.postStudyRecord(0, oldSectionId);
  696. });
  697. uni.$on("getSection", (item) => {
  698. //清除直播
  699. this.hasStart = false;
  700. this.isPlayRebuild = item.rebuild;
  701. this.photoConfig = false;
  702. this.photoIndex = 0;
  703. this.sectionItem = item;
  704. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  705. //获取拍照历史
  706. this.getPhotoLastRecord();
  707. this.polyvLiveHistoryChatMsgList();
  708. this.playVideo(item);
  709. });
  710. uni.$on("levelId", (item) => {
  711. let arr = item.split("-");
  712. //点击节获取的各层级ID
  713. this.moduleId = arr[0];
  714. this.chapterId = arr[1];
  715. });
  716. uni.$on("getChannel", (item) => {
  717. //清除录播
  718. this.hasStart = false;
  719. this.$store.commit("setPlayVID", { playVID: null });
  720. this.getPhotoLastRecord();
  721. this.playChannel(item);
  722. this.channelItem = item;
  723. });
  724. uni.$on("isRebuild", (item) => {
  725. console.log(item);
  726. this.isRebuild = item;
  727. });
  728. this.updateChapterOpen(true);
  729. },
  730. methods: {
  731. ...mapMutations(["updateChapterOpen","updateLiveLast"]),
  732. /**
  733. * 获取上次观看的直播
  734. */
  735. studyRecordGetLastLive() {
  736. this.$api.studyRecordGetLastLive({
  737. orderGoodsId:this.orderGoodsId,
  738. courseId:this.courseId
  739. }).then(res => {
  740. console.log(res,'liveres')
  741. this.updateLiveLast(res.data.data)
  742. })
  743. },
  744. /**
  745. * 获取最后一次看的节
  746. */
  747. studyRecordQueryLiveLast() {
  748. this.$api.studyRecordQueryLiveLast({
  749. orderGoodsId:this.orderGoodsId,
  750. courseId:this.courseId
  751. }).then(res => {
  752. console.log(res,'couse')
  753. if(res.data.data) {
  754. if(res.data.data.sectionType == 1) { //录播
  755. this.$store.commit("setPlaySectionId", { playSectionId: res.data.data.sectionId });
  756. this.$store.commit("setPlayVID", { playVID: res.data.data.recordingUrl });
  757. this.sectionItem = res.data.data;
  758. this.playVideo(res.data.data)
  759. } else if(res.data.data.sectionType == 2) { //直播
  760. this.studyRecordGetLastLive();
  761. } else if(res.data.data.sectionType == 3) { //回放
  762. this.$store.commit("setPlaySectionId", { playSectionId: res.data.data.sectionId });
  763. this.$store.commit("setPlayVID", { playVID: res.data.data.recordingUrl });
  764. this.sectionItem = res.data.data;
  765. this.polyvLiveHistoryChatMsgList();
  766. if(!res.data.data.recordingUrl) {
  767. return;
  768. }
  769. this.playVideo(res.data.data)
  770. }
  771. }
  772. })
  773. },
  774. async goLive(item) {
  775. let data = await this.studyRecordGetChannelBasicInfo(item.liveUrl);
  776. let nowTime = +this.$method.timest();
  777. if (item.liveStartTime > nowTime) {
  778. if (data.watchStatus == "end" || data.watchStatus == "playback") {
  779. uni.showToast({
  780. title: '直播未开始',
  781. icon: 'none'
  782. });
  783. return;
  784. }
  785. } else if (
  786. item.liveStartTime < nowTime &&
  787. item.liveEndTime > nowTime
  788. ) {
  789. if (data.watchStatus == "end" || data.watchStatus == "playback") {
  790. uni.showToast({
  791. title: '暂无直播',
  792. icon: 'none'
  793. });
  794. return;
  795. }
  796. } else if (item.liveEndTime < nowTime) {
  797. if (data.watchStatus == "end" || data.watchStatus == "playback") {
  798. uni.showToast({
  799. title: '直播已结束',
  800. icon: 'none'
  801. });
  802. return;
  803. }
  804. }
  805. let moduleId = item.moduleId || 0;
  806. let chapterId = item.chapterId || 0;
  807. let sectionId = item.sectionId || item.menuId;
  808. let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='+item.liveUrl+'&gradeId='+this.gradeId+'&courseId='+this.courseId+'&goodsId='+this.goodsId+'&orderGoodsId='+this.orderGoodsId+'&sectionId='+sectionId+'&chapterId='+chapterId+'&moduleId='+moduleId)
  809. uni.navigateTo({
  810. url:`../../pages/webview/index?url=`+encode
  811. })
  812. },
  813. studyRecordMenuAllList() {
  814. this.$api.studyRecordMenuAllList({
  815. courseId:this.courseId,
  816. gradeId:this.gradeId,
  817. goodsId:this.goodsId
  818. }).then(res => {
  819. let nowTime = Number(new Date().getTime()/1000).toFixed(0)
  820. // this.livingItem = res.data.data[0]
  821. this.livingItem = res.data.data.find(item => item.liveStartTime<=nowTime&&item.liveEndTime>nowTime);
  822. })
  823. },
  824. studyRecordGetChannelBasicInfo(channelId) {
  825. return new Promise((resolve) => {
  826. this.$api
  827. .studyRecordGetChannelBasicInfo({
  828. channelId,
  829. })
  830. .then((res) => {
  831. resolve(res.data.data);
  832. });
  833. });
  834. },
  835. polyvLiveHistoryChatMsgList() {
  836. this.$api.polyvLiveHistoryChatMsgList({
  837. sectionId:this.playSectionId,
  838. channelId:this.sectionItem.liveUrl
  839. }).then(res => {
  840. this.historyChatMsgList = res.data.data
  841. })
  842. },
  843. /**
  844. * 获取业务层次详情
  845. */
  846. // courseBusiness() {
  847. // this.$api.courseBusiness(this.goodsData.businessId).then((res) => {
  848. // this.businessData = res.data.data;
  849. // });
  850. // },
  851. /**
  852. * 计算tabs宽度
  853. */
  854. itemWidth() {
  855. return 100 / this.list.length + "%";
  856. },
  857. /**
  858. * 获取讲义权限
  859. */
  860. // courseHandouts() {
  861. // this.$api.courseHandouts(this.goodsData.handoutsId).then((res) => {
  862. // this.courseHandoutsData = res.data.data;
  863. // });
  864. // },
  865. findMenuNextSection(index) {
  866. for (let i = index + 1; i < this.reMenuList.length; i++) {
  867. let item = this.reMenuList[i];
  868. if (item.type == 3) {
  869. return item;
  870. }
  871. }
  872. return {};
  873. },
  874. loadedmetadata(e) {
  875. var polyvPlayerContext = this.selectComponent("#playerVideo");
  876. this.hasStart = true;
  877. uni.$off('playPause')
  878. uni.$on('playPause',() => {
  879. polyvPlayerContext.pause()
  880. })
  881. if(!this.recordObj.videoCurrentTime) { //新视频直接提交一条观看记录
  882. this.postStudyRecord(0)
  883. }
  884. },
  885. getPhotoLastRecord() {
  886. let self = this;
  887. let data = {
  888. sectionId: parseInt(self.playSectionId),
  889. goodsId: parseInt(self.goodsId),
  890. courseId: parseInt(self.courseId),
  891. gradeId: parseInt(self.gradeId),
  892. chapterId: parseInt(self.chapterId),
  893. moduleId: parseInt(self.moduleId),
  894. orderGoodsId: this.orderGoodsId,
  895. };
  896. this.$api.getPhotoLastRecord(data).then((res) => {
  897. if (res.data.code == 200) {
  898. //清空历史数据
  899. self.photoHistoryList = [];
  900. this.photoIndex = 0;
  901. self.photoList = [];
  902. for (let i = 0; i < res.data.data.length; i++) {
  903. //-2存储随机拍照数组
  904. if (res.data.data[i].photoIndex == -2) {
  905. self.photoList = res.data.data[i].timeInterval.split(",");
  906. } else {
  907. self.photoHistoryList.push(res.data.data[i].photoIndex);
  908. }
  909. }
  910. }
  911. });
  912. },
  913. //postTime 只提交随机时间
  914. postCoursePhotoRecord(postTime = false) {
  915. return new Promise((resolve, reject) => {
  916. let currentTime = 0;
  917. var polyvPlayerContext = this.selectComponent("#playerVideo");
  918. if (polyvPlayerContext) {
  919. currentTime = polyvPlayerContext.getCurrentTime();
  920. }
  921. let self = this;
  922. let photoIndex = self.photoIndex;
  923. let data = {
  924. photo: self.ossAvatarUrl,
  925. sectionId: parseInt(self.playSectionId),
  926. goodsId: parseInt(self.goodsId),
  927. courseId: parseInt(self.courseId),
  928. photoTime: parseInt(currentTime > 0 ? currentTime : 0),
  929. gradeId: parseInt(self.gradeId),
  930. photoIndex: postTime ? -2 : parseInt(photoIndex), //从0算起,-2只提交随机时间
  931. photoNum: parseInt(self.photoNum),
  932. chapterId: parseInt(self.chapterId),
  933. moduleId: parseInt(self.moduleId),
  934. timeInterval: postTime ? self.photoList.join(",") : "",
  935. orderGoodsId: this.orderGoodsId,
  936. };
  937. console.log("提交接口", data);
  938. this.$api
  939. .coursePhotoRecord(data)
  940. .then((res) => {
  941. console.log(res,'postCoursePhotoRecord')
  942. if (res.data.code == 200) {
  943. resolve();
  944. } else {
  945. reject();
  946. }
  947. })
  948. .catch((err) => {
  949. reject();
  950. });
  951. });
  952. },
  953. randomNum(minNum, maxNum) {
  954. switch (arguments.length) {
  955. case 1:
  956. return parseInt(Math.random() * minNum + 1, 10);
  957. break;
  958. case 2:
  959. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  960. break;
  961. default:
  962. return 0;
  963. break;
  964. }
  965. },
  966. //配置随机拍照时间
  967. configPhoto() {
  968. var polyvPlayerContext = this.selectComponent("#playerVideo");
  969. let totalVideoTime = polyvPlayerContext.getDuration();
  970. let duration = polyvPlayerContext.getCurrentTime();
  971. let photoNum = this.photoNum;
  972. if (!this.photoConfig) {
  973. this.photoConfig = true;
  974. // let spaceTime = Math.floor(totalVideoTime/photoNum) //拍照时间区间
  975. // if(spaceTime<5){//区间小于5秒
  976. // photoNum = Math.floor(totalVideoTime/5)
  977. // spaceTime = 5
  978. // }
  979. // if(photoNum<1){
  980. // photoNum = 1 //只要设置,至少拍一次
  981. // spaceTime = totalVideoTime
  982. // }
  983. // let initSpace = 0
  984. //没有历史拍照间隔数据
  985. if (this.photoList.length == 0) {
  986. if (totalVideoTime >= 900) {
  987. //大于15分钟
  988. if (photoNum == 1) {
  989. //开头拍1张
  990. this.photoList.push(0);
  991. } else if (photoNum == 3) {
  992. //拍3张
  993. this.photoList.push(0); //开头拍一张
  994. let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
  995. let centerMinTime = centerTime - 300; //前后5分钟
  996. let centerMaxTime = centerTime + 300;
  997. let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
  998. this.photoList.push(centerTakeTime); //中间拍一张
  999. let endMaxTime = totalVideoTime - 60;
  1000. let endMinTime = totalVideoTime - 300;
  1001. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  1002. this.photoList.push(endTakeTime); //最后拍一张
  1003. }
  1004. } else {
  1005. //小于15分钟,只拍前后各一张
  1006. if (photoNum == 1) {
  1007. //开头拍1张
  1008. this.photoList.push(0);
  1009. } else if (photoNum == 3) {
  1010. //拍2张
  1011. if (totalVideoTime <= 300) {
  1012. //小于5分钟
  1013. this.photoList.push(0); //开头拍一张
  1014. let endTakeTime = this.randomNum(10, totalVideoTime); //中间随机取一张
  1015. this.photoList.push(endTakeTime);
  1016. } else {
  1017. this.photoList.push(0); //开头拍一张
  1018. let endMaxTime = totalVideoTime - 60;
  1019. let endMinTime = totalVideoTime - 300;
  1020. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  1021. this.photoList.push(endTakeTime); //最后1-5分钟拍一张
  1022. }
  1023. }
  1024. }
  1025. // for(let i=0;i<photoNum;i++){
  1026. // let s = this.randomNum(initSpace,initSpace+spaceTime)
  1027. // if(s>totalVideoTime){
  1028. // s = totalVideoTime-1
  1029. // }
  1030. // if(s<=5){
  1031. // s =5 //避免出现5秒内拍照时间
  1032. // }
  1033. // this.photoList.push(s)
  1034. // initSpace+=spaceTime
  1035. // }
  1036. console.log(this.photoList, "随机拍照时间数组11", photoNum);
  1037. this.postCoursePhotoRecord(true); //提交随机拍照时间数组
  1038. }
  1039. console.log(this.photoList, "随机拍照时间数组");
  1040. //兼容已有观看历史
  1041. for (let i = 0; i < this.photoList.length - 1; i++) {
  1042. if (
  1043. this.photoList[i] < duration &&
  1044. this.photoList[i + 1] > duration
  1045. ) {
  1046. this.photoIndex = i + 1;
  1047. // console.log("我的修改了photoIndex")
  1048. break;
  1049. }
  1050. if (duration > this.photoList[this.photoList.length - 1]) {
  1051. this.photoIndex = this.photoList.length - 1; //取最后一个下标
  1052. // console.log("我的修改了photoIndex")
  1053. break;
  1054. }
  1055. }
  1056. }
  1057. },
  1058. getLiveUid(channelId) {
  1059. let self = this;
  1060. return new Promise((resolve) => {
  1061. let data = {
  1062. channelId: channelId,
  1063. orderGoodsId: this.orderGoodsId,
  1064. };
  1065. self.$api.polyvSign(data).then((res) => {
  1066. resolve(res.data.data);
  1067. });
  1068. });
  1069. },
  1070. timeEventLiving() {
  1071. if (plv != null) {
  1072. if (this.livePlay) {
  1073. this.liveDuration = this.liveDuration + 1; //每隔1秒
  1074. if (this.liveDuration == 2) {
  1075. //直播第2秒拍照
  1076. console.log(this.channelItem)
  1077. console.log(this.photoHistoryList,'this.photoHistoryList')
  1078. if (
  1079. this.goodsPhotographConfig && this.goodsPhotographConfig.livephotograph == 1 &&
  1080. this.channelItem.learning != 1 && this.photoHistoryList.length == 0
  1081. ) {
  1082. //开启直播拍照
  1083. this.openPhoto();
  1084. } else {
  1085. this.postStudyRecord(0);
  1086. }
  1087. }
  1088. }
  1089. }
  1090. },
  1091. playerLiveStatusChange(e) {
  1092. const status = e.detail.status;
  1093. console.log("直播状态", status);
  1094. if (status === "live") {
  1095. console.log("开始直播");
  1096. //开始播放
  1097. if (this.timer) {
  1098. clearInterval(this.timer);
  1099. }
  1100. this.livePlay = true;
  1101. this.timer = setInterval(this.timeEventLiving, 1000); //定时器
  1102. }
  1103. if (status === "end") {
  1104. this.hasStart = false;
  1105. if (this.livePlay) {
  1106. //只有播放过的结束才提交,避免未开播触发结束
  1107. this.postStudyRecord(1);
  1108. }
  1109. console.log("结束直播");
  1110. this.livePlay = false;
  1111. // 未开始
  1112. }
  1113. },
  1114. closePlv() {
  1115. if (plv) {
  1116. plv.destroy();
  1117. }
  1118. },
  1119. playChannel(item) {
  1120. if (this.timer) {
  1121. clearInterval(this.timer);
  1122. }
  1123. this.startStatus = true;
  1124. this.initLive();
  1125. },
  1126. setLiveOption(status) {
  1127. const { userId, channelId, recordFileSimpleModel, playbackEnabled } =
  1128. this.detail;
  1129. const playRecordFile =
  1130. playbackEnabled && recordFileSimpleModel && status === "end";
  1131. // if(this.channelItem.sectionType == 3) { //回放
  1132. // // this.videoOption = {
  1133. // // mode: "live",
  1134. // // uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
  1135. // // cid: this.playChannelId,
  1136. // // openId: this.userInfo.userAccount,
  1137. // // isAutoChange: false,
  1138. // // forceVideo: false,
  1139. // // };
  1140. // } else { //直播
  1141. this.videoOption = {
  1142. mode: "live",
  1143. uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
  1144. cid: this.playChannelId,
  1145. openId: this.userInfo.userAccount,
  1146. isAutoChange: false,
  1147. forceVideo: false,
  1148. };
  1149. // }
  1150. },
  1151. async initLive() {
  1152. console.log(this.playChannelId, 7111);
  1153. this.liveObj = await this.getLiveUid(this.playChannelId);
  1154. this.initLiveOk = true;
  1155. let optionsData = {};
  1156. optionsData.mode = "live";
  1157. optionsData.forceVideo = false;
  1158. optionsData.channelId = this.playChannelId; // 频道ID '2553128'
  1159. optionsData.openId = this.userInfo.userAccount; // 用户openId this.userInfo.userAccount 'oQ5eX5BCtSjkE1ct8CzvxGWgh0hQ'
  1160. optionsData.userId = this.liveObj.uid; // 2.0.0及以上版本的demo需要使用 userId 设置学员唯一id 'egsxlptzdq'
  1161. let self = this;
  1162. this.closePlv();
  1163. plv.init(optionsData).then(({ detail, chat }) => {
  1164. self.liveDetail = detail;
  1165. // 设置mode为live的videoOption
  1166. this.setLiveOption();
  1167. if (detail.isPPT) {
  1168. chat.on(chat.events.SLICESTART, () => {
  1169. // 开始直播
  1170. });
  1171. } else {
  1172. plv.api.getOrdinaryLiveStatus(detail.stream);
  1173. }
  1174. });
  1175. },
  1176. openSetting(res) {
  1177. console.log(res, 98);
  1178. },
  1179. getCameraSetting() {
  1180. const self = this;
  1181. wx.getSetting({
  1182. success: (res) => {
  1183. if (res.authSetting["scope.camera"]) {
  1184. // 用户已经授权
  1185. self.showSet = false;
  1186. } else {
  1187. // 用户还没有授权,向用户发起授权请求
  1188. wx.authorize({
  1189. scope: "scope.camera",
  1190. success() {
  1191. // 用户同意授权
  1192. self.showSet = false;
  1193. },
  1194. fail() {
  1195. // 用户不同意授权
  1196. self.showSet = true;
  1197. /* wx.showToast({
  1198. title: '摄像头授权失败',
  1199. icon: 'none',
  1200. duration: 3000
  1201. }) */
  1202. },
  1203. });
  1204. }
  1205. },
  1206. fail: (res) => {},
  1207. });
  1208. },
  1209. studyNotice() {
  1210. this.noticeShow = true;
  1211. },
  1212. //播放笔记视频
  1213. async playNoteVideo(item) {
  1214. console.log(item, "noteItem");
  1215. if (this.timer) {
  1216. clearInterval(this.timer);
  1217. }
  1218. if (this.vid) {
  1219. //切换视频
  1220. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1221. polyvPlayerContext.changeVid(item.recordingUrl);
  1222. } else {
  1223. this.vid = item.recordingUrl;
  1224. }
  1225. this.recordObj = { videoCurrentTime: item.noteSecond };
  1226. if (this.recordObj.videoCurrentTime) {
  1227. this.needSeek = true; //需要跳转到播放记录
  1228. }
  1229. this.startStatus = true;
  1230. //获取节笔记
  1231. this.getNoteList();
  1232. },
  1233. //正常播放视频
  1234. async playVideo(item) {
  1235. console.log(item);
  1236. if (this.timer) {
  1237. clearInterval(this.timer);
  1238. }
  1239. if (this.vid) {
  1240. //切换视频
  1241. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1242. polyvPlayerContext.changeVid(item.recordingUrl);
  1243. } else {
  1244. console.log(2)
  1245. this.vid = item.recordingUrl;
  1246. }
  1247. this.recordObj = null;
  1248. this.recordObj = await this.getRecordLast();
  1249. this.needSeek = true; //跳转到播放记录
  1250. this.startStatus = true;
  1251. //获取节笔记
  1252. this.getNoteList();
  1253. },
  1254. getRecordLast() {
  1255. let self = this;
  1256. return new Promise((resolve) => {
  1257. let data = {
  1258. gradeId: Number(self.gradeId),
  1259. goodsId: Number(self.goodsId),
  1260. sectionId: Number(self.playSectionId),
  1261. courseId: Number(self.courseId),
  1262. chapterId: parseInt(self.chapterId),
  1263. moduleId: parseInt(self.moduleId),
  1264. orderGoodsId: this.orderGoodsId,
  1265. };
  1266. self.$api.recordLast(data).then((res) => {
  1267. resolve(res.data.data);
  1268. });
  1269. });
  1270. },
  1271. jumpNote(item) {
  1272. this.noteId = item.noteId;
  1273. //没视频播放
  1274. if (this.playSectionId == 0) {
  1275. console.log("即将跳到笔记位置1");
  1276. this.$u.toast("即将跳到笔记位置");
  1277. this.$store.commit("setPlaySectionId", {
  1278. playSectionId: item.sectionId,
  1279. });
  1280. this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
  1281. this.playNoteVideo(item);
  1282. } else {
  1283. //正在看当前笔记视频
  1284. console.log("即将跳到笔记位置2");
  1285. this.$u.toast("即将跳到笔记位置");
  1286. //跳到笔记时刻
  1287. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1288. polyvPlayerContext.seek(item.noteSecond);
  1289. polyvPlayerContext.play();
  1290. }
  1291. },
  1292. postNote() {
  1293. let self = this;
  1294. if (!(this.playSectionId > 0)) {
  1295. this.$u.toast("目前无播放视频");
  1296. return;
  1297. }
  1298. if (!this.noteValue) {
  1299. this.$u.toast("请输入内容");
  1300. return;
  1301. }
  1302. // if (!this.gradeId) { // 直播课程没有班级,去掉判断,默认为0
  1303. // this.$u.toast("暂无班级数据");
  1304. // return;
  1305. // }
  1306. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1307. let noteDate = this.$method.getZeroTime();
  1308. let noteSecond = polyvPlayerContext.getCurrentTime();
  1309. console.log(noteSecond, 698);
  1310. if (!noteSecond) {
  1311. if (noteSecond == 0) {
  1312. //播放结束
  1313. noteSecond = polyvPlayerContext.getDuration();
  1314. console.log(noteSecond, 63398);
  1315. }
  1316. if (!noteSecond) {
  1317. this.$u.toast("视频暂未开始");
  1318. return;
  1319. }
  1320. }
  1321. let data = {
  1322. gradeId: this.gradeId,
  1323. goodsId: this.goodsId,
  1324. sectionId: this.playSectionId,
  1325. courseId: this.courseId,
  1326. noteText: this.noteValue,
  1327. noteDate: noteDate,
  1328. noteSecond: noteSecond,
  1329. orderGoodsId: this.orderGoodsId,
  1330. };
  1331. // /user/note 新增用户笔记
  1332. this.$api.postNote(data).then((res) => {
  1333. if (res.data.code == 200) {
  1334. this.$u.toast("发布成功");
  1335. self.getNoteList();
  1336. this.noteValue = "";
  1337. }
  1338. });
  1339. },
  1340. getNoteList() {
  1341. let self = this;
  1342. self.noteList = [];
  1343. let data = {
  1344. courseId: this.courseId,
  1345. gradeId: this.gradeId,
  1346. goodsId: this.goodsId,
  1347. orderGoodsId: this.orderGoodsId,
  1348. };
  1349. if (this.playSectionId > 0) {
  1350. data.sectionId = this.playSectionId;
  1351. }
  1352. this.$api.noteList(data).then((res) => {
  1353. if (res.data.code == 200) {
  1354. self.noteList = res.data.rows;
  1355. }
  1356. });
  1357. },
  1358. delAnswer(answerId) {
  1359. let self = this;
  1360. let data = { answerId: answerId, status: -1 ,orderGoodsId: this.orderGoodsId,};
  1361. this.$api.delAnswer(data).then((res) => {
  1362. if (res.data.code == 200) {
  1363. self.getAnswerList();
  1364. }
  1365. });
  1366. },
  1367. clearCtx() {
  1368. console.log(4234);
  1369. this.placeholder = "您可以在这里输入答疑内容";
  1370. this.ctxValue = "";
  1371. this.assignUserId = 0;
  1372. },
  1373. blur() {
  1374. this.clearTimer = setTimeout(() => {
  1375. this.ctxValue = ""
  1376. this.isFocus = false;
  1377. this.assignUserId = 0;
  1378. this.placeholder = '您可以在这里输入答疑内容';
  1379. },2000)
  1380. },
  1381. replyContent(item) {
  1382. this.isFocus = true;
  1383. this.assignUserId = item.userId;
  1384. this.placeholder = "@" + item.realname;
  1385. },
  1386. delContent(item) {
  1387. this.delAnswer(item.answerId);
  1388. },
  1389. postAnswer() {
  1390. let self = this;
  1391. let data = {
  1392. courseId: this.courseId,
  1393. answerText: this.ctxValue,
  1394. goodsId: this.goodsId,
  1395. orderGoodsId: this.orderGoodsId,
  1396. };
  1397. if (this.assignUserId > 0) {
  1398. data.assignUserId = this.assignUserId;
  1399. }
  1400. this.$api.postAnswer(data).then((res) => {
  1401. if (res.data.code == 200) {
  1402. this.$u.toast("发布成功");
  1403. self.getAnswerList();
  1404. this.isFocus = false;
  1405. this.placeholder = "您可以在这里输入答疑内容";
  1406. this.ctxValue = "";
  1407. this.assignUserId = 0;
  1408. }
  1409. });
  1410. },
  1411. postContent() {
  1412. if (!this.ctxValue || this.ctxValue == "") {
  1413. this.$u.toast("请输入内容");
  1414. return;
  1415. }
  1416. this.postAnswer();
  1417. },
  1418. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  1419. console.log("status", status);
  1420. let currentTime = 0;
  1421. let PlayDuration = 0;
  1422. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1423. if (polyvPlayerContext) {
  1424. currentTime = polyvPlayerContext.getCurrentTime(); //总的视频播放时刻
  1425. PlayDuration = polyvPlayerContext.getVideoPlayDuration(); //本次看的时长
  1426. }
  1427. if (this.playChannelId > 0) {
  1428. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  1429. }
  1430. let self = this;
  1431. let data = {
  1432. photo: self.ossAvatarUrl,
  1433. sectionId: parseInt(sectionId),
  1434. goodsId: parseInt(self.goodsId),
  1435. courseId: parseInt(self.courseId),
  1436. orderGoodsId: this.orderGoodsId,
  1437. studyDuration: parseInt(
  1438. PlayDuration > 0 ? PlayDuration : self.studyDuration
  1439. ),
  1440. gradeId: parseInt(self.gradeId),
  1441. chapterId: parseInt(self.chapterId),
  1442. moduleId: parseInt(self.moduleId),
  1443. videoCurrentTime: parseInt(
  1444. currentTime > 0 ? currentTime : self.studyDuration
  1445. ),
  1446. };
  1447. if (status > 0) {
  1448. console.log(sectionId, "sectionId");
  1449. data.status = status;
  1450. }
  1451. console.log("提交接口", data);
  1452. this.$api.studyRecord(data).then((res) => {
  1453. if (res.data.code == 200) {
  1454. if (status > 0) {
  1455. let moduleId = this.moduleId || 0;
  1456. let chapterId = this.chapterId || 0;
  1457. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  1458. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  1459. console.log(playNextId, "playNextId");
  1460. console.log(playNextIdisRebuild, "playNextIdisRebuild");
  1461. uni.$emit("playNext" + playNextIdisRebuild, {
  1462. fromRebuild: this.isRebuild,
  1463. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  1464. uni.$emit("playNext" + playNextId); //通知播放结束
  1465. }
  1466. self.ossAvatarUrl = "";
  1467. } else {
  1468. this.uploadLock = false;
  1469. uni.showToast({
  1470. icon: "none",
  1471. title: res.data.msg,
  1472. });
  1473. }
  1474. console.log(res, "res");
  1475. });
  1476. },
  1477. uploadFile(options, int) {
  1478. console.log(options)
  1479. var self = this;
  1480. return new Promise((resolve, reject) => {
  1481. var data = {
  1482. imageStatus: int,
  1483. gradeId: this.gradeId,
  1484. orderGoodsId: this.orderGoodsId,
  1485. };
  1486. self.$api.aliyunpolicy(data).then((res) => {
  1487. if (res.data.code != 200) {
  1488. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1489. return;
  1490. }
  1491. var ossToken = res.data.data.resultContent;
  1492. if (ossToken.host == null || ossToken.host == undefined) {
  1493. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1494. return;
  1495. }
  1496. uni.uploadFile({
  1497. url: ossToken.host,
  1498. name: "file",
  1499. filePath: options,
  1500. fileType: "image",
  1501. header: {
  1502. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1503. },
  1504. formData: {
  1505. key: ossToken.dir,
  1506. OSSAccessKeyId: ossToken.accessid,
  1507. policy: ossToken.policy,
  1508. Signature: ossToken.signature,
  1509. callback: ossToken.callback,
  1510. success_action_status: 200,
  1511. },
  1512. success: (result) => {
  1513. if (result.statusCode === 200) {
  1514. self.ossAvatarUrl = ossToken.dir;
  1515. resolve();
  1516. } else {
  1517. uni.showToast({
  1518. title: "上传失败",
  1519. icon: "none",
  1520. });
  1521. this.openPhoto();
  1522. return;
  1523. }
  1524. },
  1525. fail: (error) => {
  1526. uni.showToast({
  1527. title: "上传接口报错,请重新拍照上传" + error,
  1528. icon: "none",
  1529. });
  1530. this.openPhoto();
  1531. return;
  1532. },
  1533. });
  1534. });
  1535. });
  1536. },
  1537. imageInfos() {
  1538. var self = this;
  1539. return new Promise((resolve, reject) => {
  1540. uni.getImageInfo({
  1541. src: self.avatarUrl,
  1542. success: async (res) => {
  1543. let canvasWidth = res.width; //图片原始长宽
  1544. let canvasHeight = res.height;
  1545. if (canvasWidth > 2000 || canvasHeight > 2000) {
  1546. uni.compressImage({
  1547. src: self.avatarUrl,
  1548. quality: 75,
  1549. width: "35%",
  1550. height: "35%",
  1551. success: async (rest) => {
  1552. const waitUpload = await self.uploadFile(
  1553. rest.tempFilePath,
  1554. 0
  1555. );
  1556. resolve(waitUpload);
  1557. },
  1558. });
  1559. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  1560. uni.compressImage({
  1561. src: self.avatarUrl,
  1562. quality: 75,
  1563. width: "50%",
  1564. height: "50%",
  1565. success: async (rest) => {
  1566. const waitUpload = await self.uploadFile(
  1567. rest.tempFilePath,
  1568. 0
  1569. );
  1570. resolve(waitUpload);
  1571. },
  1572. });
  1573. } else {
  1574. console.log("无需压缩");
  1575. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  1576. resolve(waitUpload);
  1577. }
  1578. },
  1579. });
  1580. });
  1581. },
  1582. timeEvent() {
  1583. let self = this;
  1584. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1585. if (polyvPlayerContext != null) {
  1586. this.playTime = polyvPlayerContext.getCurrentTime(); //播放时刻
  1587. // console.log(this.playTime,789,this.photoHistoryList)
  1588. //判断是否需要拍照
  1589. if (this.photoNum > 0) {
  1590. this.configPhoto();
  1591. let photoTime = 0; //获取拍照秒数
  1592. for (let i = 0; i < this.photoList.length; i++) {
  1593. photoTime = Number(this.photoList[i]); //获取拍照秒数
  1594. if (photoTime < this.playTime && photoTime > this.playTime - 8) {
  1595. //3秒区间内才触发拍照,避免拉动滚动条
  1596. if (
  1597. this.photoHistoryList.indexOf(i) < 0 &&
  1598. this.sectionItem.learning != 1
  1599. ) {
  1600. //不存在拍照历史,没有重修过,没有学过,则拍照
  1601. //启动拍照
  1602. //暂停
  1603. polyvPlayerContext.exitFullScreen();
  1604. polyvPlayerContext.pause();
  1605. this.photoIndex = i;
  1606. this.openPhoto();
  1607. }
  1608. }
  1609. }
  1610. }
  1611. }
  1612. },
  1613. closeToast() {
  1614. clearTimeout(this.toastTimer);
  1615. this.videoToastShow = false;
  1616. },
  1617. restart() {
  1618. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1619. polyvPlayerContext.seek(0);
  1620. console.log("seek1");
  1621. clearTimeout(this.toastTimer);
  1622. this.videoToastShow = false;
  1623. },
  1624. onStateChange(newstate, oldstate) {
  1625. if (newstate.detail.newstate == "playing") {
  1626. if (this.needSeek) {
  1627. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1628. if (this.recordObj.videoCurrentTime) {
  1629. console.log("seek2");
  1630. polyvPlayerContext.seek(this.recordObj.videoCurrentTime);
  1631. this.seekTime = this.$method.secondToDate(
  1632. this.recordObj.videoCurrentTime
  1633. );
  1634. this.videoToastShow = true;
  1635. this.toastTimer = setTimeout(() => {
  1636. this.videoToastShow = false;
  1637. }, 3000);
  1638. } else {
  1639. polyvPlayerContext.seek(1); //避免相同节继续播放
  1640. console.log("seek3");
  1641. }
  1642. polyvPlayerContext.play();
  1643. this.needSeek = false;
  1644. }
  1645. //开始播放
  1646. if (this.timer) {
  1647. clearInterval(this.timer);
  1648. }
  1649. this.timer = setInterval(this.timeEvent, 1000); //定时器
  1650. }
  1651. if (newstate.detail.newstate == "pause") {
  1652. clearInterval(this.timer);
  1653. //暂停提交记录
  1654. /* this.ossAvatarUrl = ""
  1655. this.postStudyRecord() */
  1656. }
  1657. if (newstate.detail.newstate == "ended") {
  1658. clearInterval(this.timer);
  1659. uni.showToast({
  1660. icon: "none",
  1661. title: "播放完毕",
  1662. });
  1663. this.hasStart = false;
  1664. this.postStudyRecord(1);
  1665. // uni.$emit('playNext') //播放重修下一节
  1666. }
  1667. },
  1668. //拍照
  1669. openPhoto() {
  1670. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1671. if (polyvPlayerContext) {
  1672. polyvPlayerContext.exitFullScreen();
  1673. }
  1674. this.enableAutoRotation = false;
  1675. this.photoPopup = true;
  1676. this.isTaking = true;
  1677. uni.setKeepScreenOn({
  1678. keepScreenOn: true,
  1679. });
  1680. uni.authorize({
  1681. scope: "scope.camera",
  1682. success() {},
  1683. });
  1684. },
  1685. /**
  1686. * 人脸匹配
  1687. */
  1688. faceRecognition() {
  1689. return new Promise((resolve) => {
  1690. let fileSystem = uni.getFileSystemManager();
  1691. fileSystem.readFile({
  1692. filePath: `${this.avatarUrl}`,
  1693. encoding: "base64",
  1694. position: 0,
  1695. success: (res) => {
  1696. console.log(res);
  1697. let base64 = "data:image/jpg;base64," + res.data;
  1698. console.log({
  1699. imageA: base64,
  1700. orderGoodsId: this.orderGoodsId,
  1701. gradeId: this.gradeId,
  1702. },'base64Data')
  1703. this.$api
  1704. .faceCertificationCompareFace({
  1705. imageA: base64,
  1706. orderGoodsId: this.orderGoodsId,
  1707. gradeId: this.gradeId,
  1708. })
  1709. .then((res) => {
  1710. console.log(res, "res");
  1711. resolve(res.data.data);
  1712. });
  1713. },
  1714. fail(err) {
  1715. console.error(err, "err");
  1716. },
  1717. });
  1718. });
  1719. },
  1720. async submit() {
  1721. if (this.uploadLock) {
  1722. return;
  1723. }
  1724. this.uploadLock = true;
  1725. let compareFaceData = await this.faceRecognition();
  1726. console.log(compareFaceData,'compareFaceData')
  1727. if (compareFaceData >= 80) {
  1728. const waitYS = await this.imageInfos();
  1729. this.postCoursePhotoRecord()
  1730. .then((res) => {
  1731. this.photoHistoryList.push(this.photoIndex);
  1732. this.postStudyRecord(); //提交记录
  1733. //恢复播放
  1734. uni.setKeepScreenOn({
  1735. keepScreenOn: false,
  1736. });
  1737. this.photoPopup = false;
  1738. this.uploadLock = false;
  1739. this.enableAutoRotation = true;
  1740. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1741. if (polyvPlayerContext != null) {
  1742. polyvPlayerContext.play();
  1743. }
  1744. })
  1745. .catch((err) => {
  1746. uni.showToast({
  1747. title: "上传接口报错,请重新拍照上传" + err,
  1748. icon: "none",
  1749. });
  1750. this.uploadLock = false;
  1751. this.openPhoto();
  1752. });
  1753. } else {
  1754. uni.showToast({
  1755. title: "人脸匹配不通过,请重新拍照上传",
  1756. icon: "none",
  1757. duration: 2000,
  1758. });
  1759. setTimeout(() => {
  1760. this.uploadLock = false;
  1761. this.openPhoto();
  1762. }, 2000);
  1763. return;
  1764. }
  1765. },
  1766. reTake() {
  1767. this.isTaking = true;
  1768. },
  1769. //确认拍照
  1770. takePhoto() {
  1771. var self = this;
  1772. const ctx = uni.createCameraContext();
  1773. ctx.takePhoto({
  1774. quality: "high",
  1775. success: (res) => {
  1776. console.log(res.tempImagePath);
  1777. self.avatarUrl = res.tempImagePath;
  1778. this.isTaking = false;
  1779. // self.submit();
  1780. // self.photoPopup = false;
  1781. // self.enableAutoRotation = true;
  1782. },
  1783. fail: (err) => {
  1784. console.log(err);
  1785. },
  1786. });
  1787. },
  1788. playError(e) {
  1789. console.log(e);
  1790. },
  1791. //拍照报错
  1792. error(e) {
  1793. console.log(e.detail);
  1794. },
  1795. //关闭相机
  1796. closePhoto() {
  1797. this.photoPopup = false;
  1798. self.enableAutoRotation = true;
  1799. },
  1800. /**
  1801. * 进入全屏
  1802. */
  1803. fullscreenchange(event) {
  1804. console.log(event);
  1805. if (event.detail.direction == "vertical") {
  1806. this.navShow = true;
  1807. } else if (event.detail.direction == "horizontal") {
  1808. this.navShow = false;
  1809. }
  1810. },
  1811. getGoodsDetail() {
  1812. let self = this;
  1813. // app/common/goods/'+ data
  1814. this.$api.goodsDetail(this.goodsId).then((res) => {
  1815. self.goodsData = res.data.data;
  1816. console.log(self.gradeId, "班级ID");
  1817. // this.courseBusiness();
  1818. // this.courseHandouts();
  1819. self.getMenuList();
  1820. console.log(self.goodsData,'self.goodsData')
  1821. //获取节笔记
  1822. this.getNoteList();
  1823. if (self.goodsData.goodsPlayConfig) {
  1824. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  1825. if (self.goodsPlayConfig.autoPlay > 0) {
  1826. self.autoplay = true;
  1827. }
  1828. if (self.goodsPlayConfig.drag > 0) {
  1829. self.isAllowSeek = "yes";
  1830. }
  1831. if (self.goodsPlayConfig.speed > 0) {
  1832. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  1833. }
  1834. }
  1835. if (self.goodsData.goodsPhotographConfig) {
  1836. self.goodsPhotographConfig = JSON.parse(
  1837. self.goodsData.goodsPhotographConfig
  1838. );
  1839. if (self.goodsPhotographConfig.photoNum > 0) {
  1840. self.photoNum = self.goodsPhotographConfig.photoNum;
  1841. console.log(self.photoNum, 777777);
  1842. }
  1843. }
  1844. });
  1845. },
  1846. startVideo() {
  1847. this.startStatus = true;
  1848. },
  1849. getAnswerList() {
  1850. let self = this;
  1851. this.$api
  1852. .answerList({ courseId: this.courseId, goodsId: this.goodsId,orderGoodsId: this.orderGoodsId, })
  1853. .then((res) => {
  1854. if (res.data.code == 200) {
  1855. self.answerList = res.data.rows;
  1856. }
  1857. });
  1858. },
  1859. getMenuList() {
  1860. let self = this;
  1861. this.$api
  1862. .reMenuList({ courseId: this.courseId, gradeId: this.gradeId,orderGoodsId: this.orderGoodsId, })
  1863. .then((res) => {
  1864. if (res.data.code == 200) {
  1865. for (let i = 0; i < res.data.rows.length; i++) {
  1866. let item = res.data.rows[i];
  1867. item.down = true;
  1868. item.id = item.menuId;
  1869. item.name = item.menuName;
  1870. item.menuType = item.type;
  1871. }
  1872. self.menuList = res.data.rows;
  1873. for (let i = 0; i < res.data.rows.length; i++) {
  1874. if (res.data.rows[i].type == 1) {
  1875. this.menuIndex = [i];
  1876. break;
  1877. } else if (res.data.rows[i].type == 2) {
  1878. this.menuIndex = [i];
  1879. break;
  1880. }
  1881. }
  1882. }
  1883. });
  1884. },
  1885. courseDetail() {
  1886. let self = this;
  1887. // /course/'+data 获取课程详细信息
  1888. this.$api.courseDetail(this.courseId).then((res) => {
  1889. if (res.data.code == 200) {
  1890. // if (res.data.data.educationName == "继续教育") {
  1891. this.$api
  1892. .lockLockAction({
  1893. action: "jxjy",
  1894. uuid:this.$method.getUuid()
  1895. })
  1896. .then((res) => {});
  1897. this.lockTimer = setInterval(() => {
  1898. this.$api
  1899. .lockLockAction({
  1900. action: "jxjy",
  1901. uuid:this.$method.getUuid()
  1902. })
  1903. .then((res) => {});
  1904. }, 10000);
  1905. // websocket.sendMsg("doCourse");
  1906. // }
  1907. self.detail = res.data.data;
  1908. }
  1909. });
  1910. },
  1911. open(item) {
  1912. item.showChildren = !item.showChildren;
  1913. },
  1914. change(index) {
  1915. this.current = index;
  1916. },
  1917. openDocument() {
  1918. let self = this;
  1919. let url = this.$method.splitImgHost(this.courseHandoutsData.handoutsUrl);
  1920. console.log(url);
  1921. uni.downloadFile({
  1922. url: url,
  1923. success: function (res) {
  1924. console.log(999);
  1925. var filePath = res.tempFilePath;
  1926. uni.openDocument({
  1927. filePath: filePath,
  1928. showMenu: self.courseHandoutsData.canDownload == 1 ? true : false,
  1929. success: function (res) {
  1930. console.log(res, "打开文档成功");
  1931. },
  1932. fail: function (err) {
  1933. console.log(err);
  1934. uni.showToast({
  1935. icon: "none",
  1936. title: "文档地址错误",
  1937. });
  1938. },
  1939. });
  1940. },
  1941. fail: (err) => {
  1942. uni.showModal({
  1943. title: "提示",
  1944. content: "文档错误," + err.errMsg,
  1945. showCancel: false,
  1946. });
  1947. },
  1948. });
  1949. },
  1950. },
  1951. };
  1952. </script>
  1953. <style lang="scss" scope>
  1954. .top {
  1955. &__header {
  1956. position:relative;
  1957. width:100%;
  1958. height:150rpx;
  1959. padding:24rpx 150rpx 24rpx 24rpx;
  1960. .img {
  1961. position:absolute;
  1962. left:0;
  1963. top:0;
  1964. width:100%;
  1965. }
  1966. .note {
  1967. position:relative;
  1968. z-index: 10;
  1969. font-size: 24rpx;
  1970. font-family: PingFang SC;
  1971. font-weight: bold;
  1972. color: #EFDBFF;
  1973. }
  1974. .title {
  1975. position:relative;
  1976. z-index: 10;
  1977. font-size: 26rpx;
  1978. font-family: PingFang SC;
  1979. font-weight: bold;
  1980. color: #FFFFFF;
  1981. }
  1982. .desc {
  1983. }
  1984. }
  1985. }
  1986. .polyv_detail {
  1987. display: flex;
  1988. flex-direction: column;
  1989. height: 100vh;
  1990. .box {
  1991. flex: 1;
  1992. overflow: hidden;
  1993. margin: 20rpx;
  1994. .box_in {
  1995. height: 100%;
  1996. }
  1997. }
  1998. }
  1999. .btnSet {
  2000. width: 440rpx;
  2001. height: 80rpx;
  2002. background: #007aff;
  2003. border-radius: 40rpx;
  2004. color: #ffffff;
  2005. font-size: 28rpx;
  2006. line-height: 80rpx;
  2007. }
  2008. .btnReply {
  2009. width: 80rpx;
  2010. height: 40rpx;
  2011. background: #e3f0ff;
  2012. border-radius: 16rpx;
  2013. text-align: center;
  2014. color: #007aff;
  2015. }
  2016. .btnDel {
  2017. width: 80rpx;
  2018. height: 40rpx;
  2019. background: #ffedf0;
  2020. border-radius: 16rpx;
  2021. text-align: center;
  2022. color: #ff2d55;
  2023. }
  2024. .btnReply {
  2025. width: 80rpx;
  2026. height: 40rpx;
  2027. background: #e3f0ff;
  2028. border-radius: 16rpx;
  2029. font-size: 24rpx;
  2030. }
  2031. .lecture-box {
  2032. display: flex;
  2033. align-items: center;
  2034. height: 80rpx;
  2035. background: #ffffff;
  2036. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2037. .title {
  2038. padding: 10rpx;
  2039. flex: 1;
  2040. overflow: hidden;
  2041. text-overflow: ellipsis;
  2042. white-space: nowrap;
  2043. color: #333;
  2044. font-weight: bold;
  2045. font-size: 32rpx;
  2046. }
  2047. .btn {
  2048. display: flex;
  2049. align-items: center;
  2050. justify-content: center;
  2051. width: 80rpx;
  2052. height: 80rpx;
  2053. background: #ffffff;
  2054. box-shadow: -4rpx 0rpx 4rpx 0rpx rgba(0, 0, 0, 0.1);
  2055. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2056. }
  2057. }
  2058. .lecture-content {
  2059. background: #fff;
  2060. margin-top: 10rpx;
  2061. padding: 10rpx;
  2062. border-radius: 16rpx;
  2063. }
  2064. .photoBox {
  2065. background-color: #ffffff;
  2066. border-radius: 32px 32px 0px 0px;
  2067. .photoTop {
  2068. height: 74rpx;
  2069. display: flex;
  2070. align-items: center;
  2071. justify-content: space-between;
  2072. padding: 0rpx 38rpx;
  2073. .sqzz {
  2074. width: 28rpx;
  2075. height: 28rpx;
  2076. display: flex;
  2077. align-items: center;
  2078. justify-content: center;
  2079. }
  2080. .centersq {
  2081. color: #333;
  2082. font-size: 30rpx;
  2083. font-weight: 500;
  2084. }
  2085. }
  2086. .photoCenter {
  2087. width: 750rpx;
  2088. height: 979rpx;
  2089. position: relative;
  2090. .custom {
  2091. width: 750rpx;
  2092. height: 979rpx;
  2093. position: absolute;
  2094. z-index: 1000;
  2095. top: 0;
  2096. left: 0;
  2097. image {
  2098. width: 100%;
  2099. height: 100%;
  2100. }
  2101. }
  2102. }
  2103. .btns {
  2104. display: flex;
  2105. .btnResult {
  2106. height: 100rpx;
  2107. flex: 1;
  2108. background-color: #07c160;
  2109. text-align: center;
  2110. line-height: 100rpx;
  2111. color: #fff;
  2112. font-size: 32rpx;
  2113. font-weight: bold;
  2114. }
  2115. }
  2116. }
  2117. .chat_box {
  2118. display: flex;
  2119. padding: 20rpx;
  2120. justify-content: space-between;
  2121. }
  2122. .chat3 {
  2123. font-size: 30rpx;
  2124. font-family: PingFang SC;
  2125. font-weight: 500;
  2126. color: #666666;
  2127. margin-top: 10rpx;
  2128. }
  2129. .chat2 {
  2130. font-size: 20rpx;
  2131. font-family: PingFang SC;
  2132. font-weight: 500;
  2133. color: #999999;
  2134. margin-top: 10rpx;
  2135. }
  2136. .chat1 {
  2137. font-size: 24rpx;
  2138. font-family: PingFang SC;
  2139. font-weight: 500;
  2140. color: #333333;
  2141. }
  2142. .leftPadding {
  2143. margin-left: 8rpx;
  2144. }
  2145. .t2Content {
  2146. font-size: 24rpx;
  2147. font-family: PingFang SC;
  2148. font-weight: bold;
  2149. color: #999999;
  2150. line-height: 48rpx;
  2151. }
  2152. .tBox2 {
  2153. display: flex;
  2154. padding-top: 10rpx;
  2155. color: #333333;
  2156. font-size: 30rpx;
  2157. font-weight: 400;
  2158. }
  2159. .tBox {
  2160. display: flex;
  2161. align-items: center;
  2162. padding-top: 10rpx;
  2163. }
  2164. .title {
  2165. font-size: 24rpx;
  2166. color: #999999;
  2167. }
  2168. page {
  2169. // padding-top: 10px;
  2170. // padding-top: constant(safe-area-inset-top);
  2171. // padding-top: env(safe-area-inset-top);
  2172. }
  2173. .inputBottom {
  2174. position: fixed;
  2175. left: 0;
  2176. bottom: 0;
  2177. background: #ffffff;
  2178. height: 98rpx;
  2179. display: flex;
  2180. align-items: center;
  2181. width: 100%;
  2182. z-index: 99;
  2183. .flex_auto {
  2184. flex: 1;
  2185. margin-left: 10%;
  2186. .input {
  2187. height: 60rpx;
  2188. }
  2189. }
  2190. .btn {
  2191. color: #007aff;
  2192. font-size: 30rpx;
  2193. font-weight: bold;
  2194. width: 15%;
  2195. text-align: center;
  2196. }
  2197. }
  2198. .noteBox {
  2199. width: 100%;
  2200. background: #ffffff;
  2201. padding: 10rpx;
  2202. border-radius: 16rpx;
  2203. .left_ti {
  2204. padding-top: 14rpx;
  2205. }
  2206. }
  2207. .dateBox {
  2208. width: 216rpx;
  2209. height: 48rpx;
  2210. background: #ffffff;
  2211. border-radius: 24rpx;
  2212. font-size: 24rpx;
  2213. color: #666666;
  2214. text-align: center;
  2215. line-height: 48rpx;
  2216. margin: 20rpx 0;
  2217. }
  2218. .t_content1 {
  2219. color: #007aff;
  2220. margin-left: 10rpx;
  2221. }
  2222. .tag1 {
  2223. border: 2rpx solid #007aff;
  2224. border-radius: 8rpx;
  2225. font-size: 20rpx;
  2226. color: #007aff;
  2227. padding: 5rpx;
  2228. }
  2229. .b_title {
  2230. color: #333333;
  2231. font-size: 30rpx;
  2232. font-weight: bold;
  2233. }
  2234. page {
  2235. background: #eaeef1;
  2236. }
  2237. .menuBox {
  2238. width: 100%;
  2239. background: #ffffff;
  2240. border-radius: 16rpx;
  2241. padding: 20rpx;
  2242. margin-bottom: 20rpx;
  2243. }
  2244. .btnspric {
  2245. border-top: 1rpx solid #eee;
  2246. display: flex;
  2247. align-items: center;
  2248. justify-content: space-between;
  2249. height: 108rpx;
  2250. padding-left: 43rpx;
  2251. padding-right: 32rpx;
  2252. }
  2253. .btnspric > .lefprL {
  2254. font-size: 36rpx;
  2255. color: #0c141f;
  2256. font-weight: bold;
  2257. }
  2258. .btnspric > .lefprR {
  2259. padding: 0rpx 24rpx;
  2260. height: 60rpx;
  2261. line-height: 60rpx;
  2262. text-align: center;
  2263. color: #fff;
  2264. background: #32467b;
  2265. border-radius: 24rpx;
  2266. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2267. }
  2268. .yhj,
  2269. .hdyhj {
  2270. padding: 24rpx 29rpx 24rpx 34rpx;
  2271. }
  2272. .yhj {
  2273. border-bottom: 16rpx solid #f9f9f9;
  2274. }
  2275. .yhjtit {
  2276. font-size: 30rpx;
  2277. color: #0c141f;
  2278. font-weight: 500;
  2279. margin-bottom: 14rpx;
  2280. }
  2281. .yhjList {
  2282. display: flex;
  2283. align-items: center;
  2284. justify-content: space-between;
  2285. margin-bottom: 14rpx;
  2286. }
  2287. .yhjList > .yhjLefts {
  2288. display: flex;
  2289. align-items: center;
  2290. }
  2291. .yhjLefts > .yhl {
  2292. color: #32467b;
  2293. font-size: 30rpx;
  2294. margin-right: 31rpx;
  2295. }
  2296. .yhjLefts > .yhbq {
  2297. font-size: 24rpx;
  2298. color: #ff9500;
  2299. border-radius: 18rpx;
  2300. background-color: rgba(255, 149, 0, 0.2);
  2301. border: 2rpx solid #ff9500;
  2302. height: 38rpx;
  2303. line-height: 38rpx;
  2304. padding: 0rpx 16rpx;
  2305. }
  2306. .ts {
  2307. font-size: 24rpx;
  2308. color: #999;
  2309. margin: 14rpx 0rpx;
  2310. padding-right: 29rpx;
  2311. padding-left: 34rpx;
  2312. }
  2313. .yh {
  2314. padding-top: 20rpx;
  2315. }
  2316. .yh > .yhtitle {
  2317. display: flex;
  2318. align-items: center;
  2319. justify-content: space-between;
  2320. padding-right: 29rpx;
  2321. padding-left: 34rpx;
  2322. }
  2323. .priceBxs {
  2324. display: flex;
  2325. align-items: center;
  2326. }
  2327. .priceBxs > .pricleft {
  2328. border-radius: 24rpx;
  2329. border: 1rpx solid #e91313;
  2330. background-color: rgba(233, 19, 19, 0.1);
  2331. padding: 0rpx 18rpx;
  2332. height: 49rpx;
  2333. line-height: 49rpx;
  2334. text-align: center;
  2335. font-size: 30rpx;
  2336. font-weight: 500;
  2337. color: #e91313;
  2338. margin-right: 13rpx;
  2339. }
  2340. .topBox {
  2341. padding: 32rpx 32rpx 24rpx;
  2342. border-bottom: 1rpx solid #eeeeee;
  2343. }
  2344. .topBox > .boldFonstType {
  2345. font-weight: 500;
  2346. font-size: 30rpx;
  2347. margin: 16rpx 0rpx 23rpx;
  2348. }
  2349. .topBox > .firstTopL {
  2350. display: flex;
  2351. align-items: center;
  2352. }
  2353. .topBox > .firstTopL > .imageBs {
  2354. width: 331rpx;
  2355. height: 160rpx;
  2356. border-radius: 6rpx;
  2357. overflow: hidden;
  2358. margin-right: 8rpx;
  2359. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  2360. }
  2361. .topBox > .firstTopL > .imageBs > image {
  2362. width: 100%;
  2363. height: 100%;
  2364. }
  2365. .topBox > .firstTopL > .textBs {
  2366. font-size: 30rpx;
  2367. font-weight: bold;
  2368. color: #0c141f;
  2369. }
  2370. .content {
  2371. padding: 24rpx;
  2372. text-align: left;
  2373. }
  2374. .catalogBox {
  2375. display: flex;
  2376. align-items: center;
  2377. flex-wrap: nowrap;
  2378. overflow-x: auto;
  2379. padding-left: 38rpx;
  2380. max-height: 305rpx;
  2381. overflow-y: auto;
  2382. transition: all 0.4s;
  2383. }
  2384. .catalogBox > .catalogA {
  2385. min-width: 200rpx;
  2386. height: 48rpx;
  2387. line-height: 48rpx;
  2388. // text-align: center;
  2389. border: 2rpx solid transparent;
  2390. white-space: nowrap;
  2391. text-overflow: ellipsis;
  2392. overflow: hidden;
  2393. word-break: break-all;
  2394. border-radius: 10rpx;
  2395. background: rgba(22, 119, 255, 0.05);
  2396. padding-left: 19rpx;
  2397. box-sizing: border-box;
  2398. padding-right: 15rpx;
  2399. margin-right: 16rpx;
  2400. margin-bottom: 20rpx;
  2401. margin-top: 15rpx;
  2402. font-size: 24rpx;
  2403. color: #666;
  2404. }
  2405. .catalogBox > .activesq {
  2406. border-color: #1677ff;
  2407. }
  2408. .changeCatalogBox {
  2409. display: block;
  2410. }
  2411. .catalogBox::-webkit-scrollbar {
  2412. display: none; /* Chrome Safari */
  2413. }
  2414. .price_t2 {
  2415. font-size: 18rpx;
  2416. font-family: PingFang SC;
  2417. font-weight: 500;
  2418. text-decoration: line-through;
  2419. color: #999999;
  2420. }
  2421. .price_t1 {
  2422. font-size: 33rpx;
  2423. font-family: PingFang SC;
  2424. font-weight: bold;
  2425. color: #e91313;
  2426. }
  2427. .sc_t {
  2428. font-size: 22rpx;
  2429. color: #000000;
  2430. }
  2431. .sc {
  2432. width: 29rpx;
  2433. height: 29rpx;
  2434. }
  2435. .buy {
  2436. width: 138rpx;
  2437. height: 48rpx;
  2438. line-height: 48rpx;
  2439. background: #32467b;
  2440. border-radius: 10rpx;
  2441. color: #ffffff;
  2442. font-size: 28rpx;
  2443. text-align: center;
  2444. vertical-align: middle;
  2445. position: absolute;
  2446. right: 30rpx;
  2447. }
  2448. .video_body {
  2449. padding-bottom: 96rpx;
  2450. }
  2451. .footer_tab {
  2452. position: fixed;
  2453. bottom: 0;
  2454. height: 96rpx;
  2455. width: 100%;
  2456. background-color: #ffffff;
  2457. }
  2458. .tj_box {
  2459. width: 50%;
  2460. display: inline-block;
  2461. text-align: center;
  2462. margin: 10rpx 0;
  2463. }
  2464. .teacher_t {
  2465. font-size: 24rpx;
  2466. font-family: PingFang SC;
  2467. font-weight: 400;
  2468. color: #666666;
  2469. line-height: 36rpx;
  2470. margin-left: 15rpx;
  2471. }
  2472. .teacher_img {
  2473. width: 87rpx;
  2474. height: 129rpx;
  2475. }
  2476. .t2 {
  2477. font-size: 24rpx;
  2478. font-family: PingFang SC;
  2479. color: #666666;
  2480. line-height: 36rpx;
  2481. margin: 15rpx;
  2482. }
  2483. .r_t2 {
  2484. width: 201rpx;
  2485. height: 49rpx;
  2486. background: rgba(22, 119, 255, 0.05);
  2487. border: 1rpx solid #32467b;
  2488. border-radius: 16rpx;
  2489. color: #666666;
  2490. font-size: 23rpx;
  2491. text-align: center;
  2492. display: flex;
  2493. align-items: center;
  2494. padding: 5rpx;
  2495. }
  2496. .scroll_box {
  2497. width: 100%;
  2498. height: 60rpx;
  2499. background: #ffffff;
  2500. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2501. white-space: nowrap;
  2502. overflow: hidden;
  2503. margin: 15rpx 0;
  2504. }
  2505. .r_sliper {
  2506. padding: 0 20rpx;
  2507. }
  2508. .top_line {
  2509. width: 6rpx;
  2510. height: 22rpx;
  2511. background: #32467b;
  2512. margin-right: 10rpx;
  2513. }
  2514. .video_t2 {
  2515. font-size: 24rpx;
  2516. font-family: PingFang SC;
  2517. font-weight: 500;
  2518. color: #666666;
  2519. }
  2520. .course_name {
  2521. height: 80rpx;
  2522. background-color: #fff;
  2523. }
  2524. .video_t1 {
  2525. height: 80rpx;
  2526. color: #333333;
  2527. line-height: 80rpx;
  2528. font-size: 30rpx;
  2529. font-family: PingFang SC;
  2530. font-weight: bold;
  2531. color: #333333;
  2532. margin-left: 15rpx;
  2533. overflow: hidden;
  2534. text-overflow: ellipsis;
  2535. white-space: nowrap;
  2536. }
  2537. .notice_wrap {
  2538. height: 80rpx;
  2539. display: flex;
  2540. align-items: center;
  2541. justify-content: flex-end;
  2542. .video_t1_t {
  2543. width: 100%;
  2544. height: 40rpx;
  2545. line-height: 40rpx;
  2546. text-align: center;
  2547. background: rgba(245, 154, 35, 1);
  2548. color: #333;
  2549. border-radius: 10rpx;
  2550. font-size: 24rpx;
  2551. }
  2552. }
  2553. .video_play {
  2554. position: absolute;
  2555. width: 95rpx;
  2556. height: 95rpx;
  2557. top: 0;
  2558. left: 0;
  2559. right: 0;
  2560. bottom: 0;
  2561. margin: auto;
  2562. }
  2563. .video_box {
  2564. position: relative;
  2565. .video-toast {
  2566. position: absolute;
  2567. width: 686rpx;
  2568. height: 80rpx;
  2569. background: rgba(0, 0, 0, 0.6);
  2570. border-radius: 24rpx;
  2571. bottom: 100rpx;
  2572. left: 50%;
  2573. transform: translateX(-50%);
  2574. color: #fff;
  2575. display: flex;
  2576. font-size: 26rpx;
  2577. align-items: center;
  2578. overflow: visible;
  2579. &__text {
  2580. flex: 1;
  2581. margin-left: 40rpx;
  2582. }
  2583. &__btn {
  2584. width: 180rpx;
  2585. text-align: center;
  2586. border-left: 1rpx solid #fff;
  2587. }
  2588. }
  2589. .video-toast__close {
  2590. position: absolute;
  2591. right: 32rpx;
  2592. bottom: 184rpx;
  2593. width: 40rpx;
  2594. height: 40rpx;
  2595. line-height: 40rpx;
  2596. text-align: center;
  2597. background: rgba(0, 0, 0, 0.6);
  2598. border-radius: 50%;
  2599. color: rgba(255, 255, 255, 0.3);
  2600. }
  2601. }
  2602. .rotoct {
  2603. transform: rotate(90deg);
  2604. }
  2605. .notice_modal {
  2606. .content {
  2607. width: 100%;
  2608. height: 100%;
  2609. padding: 20rpx;
  2610. .title {
  2611. color: #333;
  2612. line-height: 40rpx;
  2613. font-size: 30rpx;
  2614. text-align: center;
  2615. font-weight: bold;
  2616. }
  2617. .text {
  2618. line-height: 40rpx;
  2619. }
  2620. }
  2621. }
  2622. </style>