detail.vue 73 KB

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