detail.vue 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672
  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. 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) {
  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. this.$api.postNote(data).then((res) => {
  1332. if (res.data.code == 200) {
  1333. this.$u.toast("发布成功");
  1334. self.getNoteList();
  1335. this.noteValue = "";
  1336. }
  1337. });
  1338. },
  1339. getNoteList() {
  1340. let self = this;
  1341. self.noteList = [];
  1342. let data = {
  1343. courseId: this.courseId,
  1344. gradeId: this.gradeId,
  1345. goodsId: this.goodsId,
  1346. orderGoodsId: this.orderGoodsId,
  1347. };
  1348. if (this.playSectionId > 0) {
  1349. data.sectionId = this.playSectionId;
  1350. }
  1351. this.$api.noteList(data).then((res) => {
  1352. if (res.data.code == 200) {
  1353. self.noteList = res.data.rows;
  1354. }
  1355. });
  1356. },
  1357. delAnswer(answerId) {
  1358. let self = this;
  1359. let data = { answerId: answerId, status: -1 ,orderGoodsId: this.orderGoodsId,};
  1360. this.$api.delAnswer(data).then((res) => {
  1361. if (res.data.code == 200) {
  1362. self.getAnswerList();
  1363. }
  1364. });
  1365. },
  1366. clearCtx() {
  1367. console.log(4234);
  1368. this.placeholder = "您可以在这里输入答疑内容";
  1369. this.ctxValue = "";
  1370. this.assignUserId = 0;
  1371. },
  1372. blur() {
  1373. this.clearTimer = setTimeout(() => {
  1374. this.ctxValue = ""
  1375. this.isFocus = false;
  1376. this.assignUserId = 0;
  1377. this.placeholder = '您可以在这里输入答疑内容';
  1378. },2000)
  1379. },
  1380. replyContent(item) {
  1381. this.isFocus = true;
  1382. this.assignUserId = item.userId;
  1383. this.placeholder = "@" + item.realname;
  1384. },
  1385. delContent(item) {
  1386. this.delAnswer(item.answerId);
  1387. },
  1388. postAnswer() {
  1389. let self = this;
  1390. let data = {
  1391. courseId: this.courseId,
  1392. answerText: this.ctxValue,
  1393. goodsId: this.goodsId,
  1394. orderGoodsId: this.orderGoodsId,
  1395. };
  1396. if (this.assignUserId > 0) {
  1397. data.assignUserId = this.assignUserId;
  1398. }
  1399. this.$api.postAnswer(data).then((res) => {
  1400. if (res.data.code == 200) {
  1401. this.$u.toast("发布成功");
  1402. self.getAnswerList();
  1403. this.isFocus = false;
  1404. this.placeholder = "您可以在这里输入答疑内容";
  1405. this.ctxValue = "";
  1406. this.assignUserId = 0;
  1407. }
  1408. });
  1409. },
  1410. postContent() {
  1411. if (!this.ctxValue || this.ctxValue == "") {
  1412. this.$u.toast("请输入内容");
  1413. return;
  1414. }
  1415. this.postAnswer();
  1416. },
  1417. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  1418. console.log("status", status);
  1419. let currentTime = 0;
  1420. let PlayDuration = 0;
  1421. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1422. if (polyvPlayerContext) {
  1423. currentTime = polyvPlayerContext.getCurrentTime(); //总的视频播放时刻
  1424. PlayDuration = polyvPlayerContext.getVideoPlayDuration(); //本次看的时长
  1425. }
  1426. if (this.playChannelId > 0) {
  1427. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  1428. }
  1429. let self = this;
  1430. let data = {
  1431. photo: self.ossAvatarUrl,
  1432. sectionId: parseInt(sectionId),
  1433. goodsId: parseInt(self.goodsId),
  1434. courseId: parseInt(self.courseId),
  1435. orderGoodsId: this.orderGoodsId,
  1436. studyDuration: parseInt(
  1437. PlayDuration > 0 ? PlayDuration : self.studyDuration
  1438. ),
  1439. gradeId: parseInt(self.gradeId),
  1440. chapterId: parseInt(self.chapterId),
  1441. moduleId: parseInt(self.moduleId),
  1442. videoCurrentTime: parseInt(
  1443. currentTime > 0 ? currentTime : self.studyDuration
  1444. ),
  1445. };
  1446. if (status > 0) {
  1447. console.log(sectionId, "sectionId");
  1448. data.status = status;
  1449. }
  1450. console.log("提交接口", data);
  1451. this.$api.studyRecord(data).then((res) => {
  1452. if (res.data.code == 200) {
  1453. if (status > 0) {
  1454. let moduleId = this.moduleId || 0;
  1455. let chapterId = this.chapterId || 0;
  1456. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  1457. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  1458. console.log(playNextId, "playNextId");
  1459. console.log(playNextIdisRebuild, "playNextIdisRebuild");
  1460. uni.$emit("playNext" + playNextIdisRebuild, {
  1461. fromRebuild: this.isRebuild,
  1462. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  1463. uni.$emit("playNext" + playNextId); //通知播放结束
  1464. }
  1465. self.ossAvatarUrl = "";
  1466. } else {
  1467. this.uploadLock = false;
  1468. uni.showToast({
  1469. icon: "none",
  1470. title: res.data.msg,
  1471. });
  1472. }
  1473. console.log(res, "res");
  1474. });
  1475. },
  1476. uploadFile(options, int) {
  1477. console.log(options)
  1478. var self = this;
  1479. return new Promise((resolve, reject) => {
  1480. var data = {
  1481. imageStatus: int,
  1482. gradeId: this.gradeId,
  1483. orderGoodsId: this.orderGoodsId,
  1484. };
  1485. self.$api.aliyunpolicy(data).then((res) => {
  1486. if (res.data.code != 200) {
  1487. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1488. return;
  1489. }
  1490. var ossToken = res.data.data.resultContent;
  1491. if (ossToken.host == null || ossToken.host == undefined) {
  1492. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1493. return;
  1494. }
  1495. uni.uploadFile({
  1496. url: ossToken.host,
  1497. name: "file",
  1498. filePath: options,
  1499. fileType: "image",
  1500. header: {
  1501. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1502. },
  1503. formData: {
  1504. key: ossToken.dir,
  1505. OSSAccessKeyId: ossToken.accessid,
  1506. policy: ossToken.policy,
  1507. Signature: ossToken.signature,
  1508. callback: ossToken.callback,
  1509. success_action_status: 200,
  1510. },
  1511. success: (result) => {
  1512. if (result.statusCode === 200) {
  1513. self.ossAvatarUrl = ossToken.dir;
  1514. resolve();
  1515. } else {
  1516. uni.showToast({
  1517. title: "上传失败",
  1518. icon: "none",
  1519. });
  1520. this.openPhoto();
  1521. return;
  1522. }
  1523. },
  1524. fail: (error) => {
  1525. uni.showToast({
  1526. title: "上传接口报错,请重新拍照上传" + error,
  1527. icon: "none",
  1528. });
  1529. this.openPhoto();
  1530. return;
  1531. },
  1532. });
  1533. });
  1534. });
  1535. },
  1536. imageInfos() {
  1537. var self = this;
  1538. return new Promise((resolve, reject) => {
  1539. uni.getImageInfo({
  1540. src: self.avatarUrl,
  1541. success: async (res) => {
  1542. let canvasWidth = res.width; //图片原始长宽
  1543. let canvasHeight = res.height;
  1544. if (canvasWidth > 2000 || canvasHeight > 2000) {
  1545. uni.compressImage({
  1546. src: self.avatarUrl,
  1547. quality: 75,
  1548. width: "35%",
  1549. height: "35%",
  1550. success: async (rest) => {
  1551. const waitUpload = await self.uploadFile(
  1552. rest.tempFilePath,
  1553. 0
  1554. );
  1555. resolve(waitUpload);
  1556. },
  1557. });
  1558. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  1559. uni.compressImage({
  1560. src: self.avatarUrl,
  1561. quality: 75,
  1562. width: "50%",
  1563. height: "50%",
  1564. success: async (rest) => {
  1565. const waitUpload = await self.uploadFile(
  1566. rest.tempFilePath,
  1567. 0
  1568. );
  1569. resolve(waitUpload);
  1570. },
  1571. });
  1572. } else {
  1573. console.log("无需压缩");
  1574. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  1575. resolve(waitUpload);
  1576. }
  1577. },
  1578. });
  1579. });
  1580. },
  1581. timeEvent() {
  1582. let self = this;
  1583. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1584. if (polyvPlayerContext != null) {
  1585. this.playTime = polyvPlayerContext.getCurrentTime(); //播放时刻
  1586. // console.log(this.playTime,789,this.photoHistoryList)
  1587. //判断是否需要拍照
  1588. if (this.photoNum > 0) {
  1589. this.configPhoto();
  1590. let photoTime = 0; //获取拍照秒数
  1591. for (let i = 0; i < this.photoList.length; i++) {
  1592. photoTime = Number(this.photoList[i]); //获取拍照秒数
  1593. if (photoTime < this.playTime && photoTime > this.playTime - 8) {
  1594. //3秒区间内才触发拍照,避免拉动滚动条
  1595. if (
  1596. this.photoHistoryList.indexOf(i) < 0 &&
  1597. this.sectionItem.learning != 1
  1598. ) {
  1599. //不存在拍照历史,没有重修过,没有学过,则拍照
  1600. //启动拍照
  1601. //暂停
  1602. polyvPlayerContext.exitFullScreen();
  1603. polyvPlayerContext.pause();
  1604. this.photoIndex = i;
  1605. this.openPhoto();
  1606. }
  1607. }
  1608. }
  1609. }
  1610. }
  1611. },
  1612. closeToast() {
  1613. clearTimeout(this.toastTimer);
  1614. this.videoToastShow = false;
  1615. },
  1616. restart() {
  1617. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1618. polyvPlayerContext.seek(0);
  1619. console.log("seek1");
  1620. clearTimeout(this.toastTimer);
  1621. this.videoToastShow = false;
  1622. },
  1623. onStateChange(newstate, oldstate) {
  1624. if (newstate.detail.newstate == "playing") {
  1625. if (this.needSeek) {
  1626. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1627. if (this.recordObj.videoCurrentTime) {
  1628. console.log("seek2");
  1629. polyvPlayerContext.seek(this.recordObj.videoCurrentTime);
  1630. this.seekTime = this.$method.secondToDate(
  1631. this.recordObj.videoCurrentTime
  1632. );
  1633. this.videoToastShow = true;
  1634. this.toastTimer = setTimeout(() => {
  1635. this.videoToastShow = false;
  1636. }, 3000);
  1637. } else {
  1638. polyvPlayerContext.seek(1); //避免相同节继续播放
  1639. console.log("seek3");
  1640. }
  1641. polyvPlayerContext.play();
  1642. this.needSeek = false;
  1643. }
  1644. //开始播放
  1645. if (this.timer) {
  1646. clearInterval(this.timer);
  1647. }
  1648. this.timer = setInterval(this.timeEvent, 1000); //定时器
  1649. }
  1650. if (newstate.detail.newstate == "pause") {
  1651. clearInterval(this.timer);
  1652. //暂停提交记录
  1653. /* this.ossAvatarUrl = ""
  1654. this.postStudyRecord() */
  1655. }
  1656. if (newstate.detail.newstate == "ended") {
  1657. clearInterval(this.timer);
  1658. uni.showToast({
  1659. icon: "none",
  1660. title: "播放完毕",
  1661. });
  1662. this.hasStart = false;
  1663. this.postStudyRecord(1);
  1664. // uni.$emit('playNext') //播放重修下一节
  1665. }
  1666. },
  1667. //拍照
  1668. openPhoto() {
  1669. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1670. if (polyvPlayerContext) {
  1671. polyvPlayerContext.exitFullScreen();
  1672. }
  1673. this.enableAutoRotation = false;
  1674. this.photoPopup = true;
  1675. this.isTaking = true;
  1676. uni.setKeepScreenOn({
  1677. keepScreenOn: true,
  1678. });
  1679. uni.authorize({
  1680. scope: "scope.camera",
  1681. success() {},
  1682. });
  1683. },
  1684. /**
  1685. * 人脸匹配
  1686. */
  1687. faceRecognition() {
  1688. return new Promise((resolve) => {
  1689. let fileSystem = uni.getFileSystemManager();
  1690. fileSystem.readFile({
  1691. filePath: `${this.avatarUrl}`,
  1692. encoding: "base64",
  1693. position: 0,
  1694. success: (res) => {
  1695. console.log(res);
  1696. let base64 = "data:image/jpg;base64," + res.data;
  1697. console.log({
  1698. imageA: base64,
  1699. orderGoodsId: this.orderGoodsId,
  1700. gradeId: this.gradeId,
  1701. },'base64Data')
  1702. this.$api
  1703. .faceCertificationCompareFace({
  1704. imageA: base64,
  1705. orderGoodsId: this.orderGoodsId,
  1706. gradeId: this.gradeId,
  1707. })
  1708. .then((res) => {
  1709. console.log(res, "res");
  1710. resolve(res.data.data);
  1711. });
  1712. },
  1713. fail(err) {
  1714. console.error(err, "err");
  1715. },
  1716. });
  1717. });
  1718. },
  1719. async submit() {
  1720. if (this.uploadLock) {
  1721. return;
  1722. }
  1723. this.uploadLock = true;
  1724. let compareFaceData = await this.faceRecognition();
  1725. console.log(compareFaceData,'compareFaceData')
  1726. if (compareFaceData >= 80) {
  1727. const waitYS = await this.imageInfos();
  1728. this.postCoursePhotoRecord()
  1729. .then((res) => {
  1730. this.photoHistoryList.push(this.photoIndex);
  1731. this.postStudyRecord(); //提交记录
  1732. //恢复播放
  1733. uni.setKeepScreenOn({
  1734. keepScreenOn: false,
  1735. });
  1736. this.photoPopup = false;
  1737. this.uploadLock = false;
  1738. this.enableAutoRotation = true;
  1739. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1740. if (polyvPlayerContext != null) {
  1741. polyvPlayerContext.play();
  1742. }
  1743. })
  1744. .catch((err) => {
  1745. uni.showToast({
  1746. title: "上传接口报错,请重新拍照上传" + err,
  1747. icon: "none",
  1748. });
  1749. this.uploadLock = false;
  1750. this.openPhoto();
  1751. });
  1752. } else {
  1753. uni.showToast({
  1754. title: "人脸匹配不通过,请重新拍照上传",
  1755. icon: "none",
  1756. duration: 2000,
  1757. });
  1758. setTimeout(() => {
  1759. this.uploadLock = false;
  1760. this.openPhoto();
  1761. }, 2000);
  1762. return;
  1763. }
  1764. },
  1765. reTake() {
  1766. this.isTaking = true;
  1767. },
  1768. //确认拍照
  1769. takePhoto() {
  1770. var self = this;
  1771. const ctx = uni.createCameraContext();
  1772. ctx.takePhoto({
  1773. quality: "high",
  1774. success: (res) => {
  1775. console.log(res.tempImagePath);
  1776. self.avatarUrl = res.tempImagePath;
  1777. this.isTaking = false;
  1778. // self.submit();
  1779. // self.photoPopup = false;
  1780. // self.enableAutoRotation = true;
  1781. },
  1782. fail: (err) => {
  1783. console.log(err);
  1784. },
  1785. });
  1786. },
  1787. playError(e) {
  1788. console.log(e);
  1789. },
  1790. //拍照报错
  1791. error(e) {
  1792. console.log(e.detail);
  1793. },
  1794. //关闭相机
  1795. closePhoto() {
  1796. this.photoPopup = false;
  1797. self.enableAutoRotation = true;
  1798. },
  1799. /**
  1800. * 进入全屏
  1801. */
  1802. fullscreenchange(event) {
  1803. console.log(event);
  1804. if (event.detail.direction == "vertical") {
  1805. this.navShow = true;
  1806. } else if (event.detail.direction == "horizontal") {
  1807. this.navShow = false;
  1808. }
  1809. },
  1810. getGoodsDetail() {
  1811. let self = this;
  1812. // app/common/goods/'+ data
  1813. this.$api.goodsDetail(this.goodsId).then((res) => {
  1814. self.goodsData = res.data.data;
  1815. console.log(self.gradeId, "班级ID");
  1816. // this.courseBusiness();
  1817. // this.courseHandouts();
  1818. self.getMenuList();
  1819. console.log(self.goodsData,'self.goodsData')
  1820. //获取节笔记
  1821. this.getNoteList();
  1822. if (self.goodsData.goodsPlayConfig) {
  1823. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  1824. if (self.goodsPlayConfig.autoPlay > 0) {
  1825. self.autoplay = true;
  1826. }
  1827. if (self.goodsPlayConfig.drag > 0) {
  1828. self.isAllowSeek = "yes";
  1829. }
  1830. if (self.goodsPlayConfig.speed > 0) {
  1831. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  1832. }
  1833. }
  1834. if (self.goodsData.goodsPhotographConfig) {
  1835. self.goodsPhotographConfig = JSON.parse(
  1836. self.goodsData.goodsPhotographConfig
  1837. );
  1838. if (self.goodsPhotographConfig.photoNum > 0) {
  1839. self.photoNum = self.goodsPhotographConfig.photoNum;
  1840. console.log(self.photoNum, 777777);
  1841. }
  1842. }
  1843. });
  1844. },
  1845. startVideo() {
  1846. this.startStatus = true;
  1847. },
  1848. getAnswerList() {
  1849. let self = this;
  1850. this.$api
  1851. .answerList({ courseId: this.courseId, goodsId: this.goodsId,orderGoodsId: this.orderGoodsId, })
  1852. .then((res) => {
  1853. if (res.data.code == 200) {
  1854. self.answerList = res.data.rows;
  1855. }
  1856. });
  1857. },
  1858. getMenuList() {
  1859. let self = this;
  1860. this.$api
  1861. .reMenuList({ courseId: this.courseId, gradeId: this.gradeId,orderGoodsId: this.orderGoodsId, })
  1862. .then((res) => {
  1863. if (res.data.code == 200) {
  1864. for (let i = 0; i < res.data.rows.length; i++) {
  1865. let item = res.data.rows[i];
  1866. item.down = true;
  1867. item.id = item.menuId;
  1868. item.name = item.menuName;
  1869. item.menuType = item.type;
  1870. }
  1871. self.menuList = res.data.rows;
  1872. for (let i = 0; i < res.data.rows.length; i++) {
  1873. if (res.data.rows[i].type == 1) {
  1874. this.menuIndex = [i];
  1875. break;
  1876. } else if (res.data.rows[i].type == 2) {
  1877. this.menuIndex = [i];
  1878. break;
  1879. }
  1880. }
  1881. }
  1882. });
  1883. },
  1884. courseDetail() {
  1885. let self = this;
  1886. // /course/'+data 获取课程详细信息
  1887. this.$api.courseDetail(this.courseId).then((res) => {
  1888. if (res.data.code == 200) {
  1889. // if (res.data.data.educationName == "继续教育") {
  1890. this.$api
  1891. .lockLockAction({
  1892. action: "jxjy",
  1893. uuid:this.$method.getUuid()
  1894. })
  1895. .then((res) => {});
  1896. this.lockTimer = setInterval(() => {
  1897. this.$api
  1898. .lockLockAction({
  1899. action: "jxjy",
  1900. uuid:this.$method.getUuid()
  1901. })
  1902. .then((res) => {});
  1903. }, 10000);
  1904. websocket.sendMsg("doCourse");
  1905. // }
  1906. self.detail = res.data.data;
  1907. }
  1908. });
  1909. },
  1910. open(item) {
  1911. item.showChildren = !item.showChildren;
  1912. },
  1913. change(index) {
  1914. this.current = index;
  1915. },
  1916. openDocument() {
  1917. let self = this;
  1918. let url = this.$method.splitImgHost(this.courseHandoutsData.handoutsUrl);
  1919. console.log(url);
  1920. uni.downloadFile({
  1921. url: url,
  1922. success: function (res) {
  1923. console.log(999);
  1924. var filePath = res.tempFilePath;
  1925. uni.openDocument({
  1926. filePath: filePath,
  1927. showMenu: self.courseHandoutsData.canDownload == 1 ? true : false,
  1928. success: function (res) {
  1929. console.log(res, "打开文档成功");
  1930. },
  1931. fail: function (err) {
  1932. console.log(err);
  1933. uni.showToast({
  1934. icon: "none",
  1935. title: "文档地址错误",
  1936. });
  1937. },
  1938. });
  1939. },
  1940. fail: (err) => {
  1941. uni.showModal({
  1942. title: "提示",
  1943. content: "文档错误," + err.errMsg,
  1944. showCancel: false,
  1945. });
  1946. },
  1947. });
  1948. },
  1949. },
  1950. };
  1951. </script>
  1952. <style lang="scss" scope>
  1953. .top {
  1954. &__header {
  1955. position:relative;
  1956. width:100%;
  1957. height:150rpx;
  1958. padding:24rpx 150rpx 24rpx 24rpx;
  1959. .img {
  1960. position:absolute;
  1961. left:0;
  1962. top:0;
  1963. width:100%;
  1964. }
  1965. .note {
  1966. position:relative;
  1967. z-index: 10;
  1968. font-size: 24rpx;
  1969. font-family: PingFang SC;
  1970. font-weight: bold;
  1971. color: #EFDBFF;
  1972. }
  1973. .title {
  1974. position:relative;
  1975. z-index: 10;
  1976. font-size: 26rpx;
  1977. font-family: PingFang SC;
  1978. font-weight: bold;
  1979. color: #FFFFFF;
  1980. }
  1981. .desc {
  1982. }
  1983. }
  1984. }
  1985. .polyv_detail {
  1986. display: flex;
  1987. flex-direction: column;
  1988. height: 100vh;
  1989. .box {
  1990. flex: 1;
  1991. overflow: hidden;
  1992. margin: 20rpx;
  1993. .box_in {
  1994. height: 100%;
  1995. }
  1996. }
  1997. }
  1998. .btnSet {
  1999. width: 440rpx;
  2000. height: 80rpx;
  2001. background: #007aff;
  2002. border-radius: 40rpx;
  2003. color: #ffffff;
  2004. font-size: 28rpx;
  2005. line-height: 80rpx;
  2006. }
  2007. .btnReply {
  2008. width: 80rpx;
  2009. height: 40rpx;
  2010. background: #e3f0ff;
  2011. border-radius: 16rpx;
  2012. text-align: center;
  2013. color: #007aff;
  2014. }
  2015. .btnDel {
  2016. width: 80rpx;
  2017. height: 40rpx;
  2018. background: #ffedf0;
  2019. border-radius: 16rpx;
  2020. text-align: center;
  2021. color: #ff2d55;
  2022. }
  2023. .btnReply {
  2024. width: 80rpx;
  2025. height: 40rpx;
  2026. background: #e3f0ff;
  2027. border-radius: 16rpx;
  2028. font-size: 24rpx;
  2029. }
  2030. .lecture-box {
  2031. display: flex;
  2032. align-items: center;
  2033. height: 80rpx;
  2034. background: #ffffff;
  2035. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2036. .title {
  2037. padding: 10rpx;
  2038. flex: 1;
  2039. overflow: hidden;
  2040. text-overflow: ellipsis;
  2041. white-space: nowrap;
  2042. color: #333;
  2043. font-weight: bold;
  2044. font-size: 32rpx;
  2045. }
  2046. .btn {
  2047. display: flex;
  2048. align-items: center;
  2049. justify-content: center;
  2050. width: 80rpx;
  2051. height: 80rpx;
  2052. background: #ffffff;
  2053. box-shadow: -4rpx 0rpx 4rpx 0rpx rgba(0, 0, 0, 0.1);
  2054. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2055. }
  2056. }
  2057. .lecture-content {
  2058. background: #fff;
  2059. margin-top: 10rpx;
  2060. padding: 10rpx;
  2061. border-radius: 16rpx;
  2062. }
  2063. .photoBox {
  2064. background-color: #ffffff;
  2065. border-radius: 32px 32px 0px 0px;
  2066. .photoTop {
  2067. height: 74rpx;
  2068. display: flex;
  2069. align-items: center;
  2070. justify-content: space-between;
  2071. padding: 0rpx 38rpx;
  2072. .sqzz {
  2073. width: 28rpx;
  2074. height: 28rpx;
  2075. display: flex;
  2076. align-items: center;
  2077. justify-content: center;
  2078. }
  2079. .centersq {
  2080. color: #333;
  2081. font-size: 30rpx;
  2082. font-weight: 500;
  2083. }
  2084. }
  2085. .photoCenter {
  2086. width: 750rpx;
  2087. height: 979rpx;
  2088. position: relative;
  2089. .custom {
  2090. width: 750rpx;
  2091. height: 979rpx;
  2092. position: absolute;
  2093. z-index: 1000;
  2094. top: 0;
  2095. left: 0;
  2096. image {
  2097. width: 100%;
  2098. height: 100%;
  2099. }
  2100. }
  2101. }
  2102. .btns {
  2103. display: flex;
  2104. .btnResult {
  2105. height: 100rpx;
  2106. flex: 1;
  2107. background-color: #07c160;
  2108. text-align: center;
  2109. line-height: 100rpx;
  2110. color: #fff;
  2111. font-size: 32rpx;
  2112. font-weight: bold;
  2113. }
  2114. }
  2115. }
  2116. .chat_box {
  2117. display: flex;
  2118. padding: 20rpx;
  2119. justify-content: space-between;
  2120. }
  2121. .chat3 {
  2122. font-size: 30rpx;
  2123. font-family: PingFang SC;
  2124. font-weight: 500;
  2125. color: #666666;
  2126. margin-top: 10rpx;
  2127. }
  2128. .chat2 {
  2129. font-size: 20rpx;
  2130. font-family: PingFang SC;
  2131. font-weight: 500;
  2132. color: #999999;
  2133. margin-top: 10rpx;
  2134. }
  2135. .chat1 {
  2136. font-size: 24rpx;
  2137. font-family: PingFang SC;
  2138. font-weight: 500;
  2139. color: #333333;
  2140. }
  2141. .leftPadding {
  2142. margin-left: 8rpx;
  2143. }
  2144. .t2Content {
  2145. font-size: 28rpx;
  2146. font-family: PingFang SC;
  2147. font-weight: bold;
  2148. color: #999999;
  2149. line-height: 48rpx;
  2150. }
  2151. .tBox2 {
  2152. display: flex;
  2153. padding-top: 10rpx;
  2154. color: #333333;
  2155. font-size: 30rpx;
  2156. }
  2157. .tBox {
  2158. display: flex;
  2159. align-items: center;
  2160. padding-top: 10rpx;
  2161. }
  2162. .title {
  2163. font-size: 24rpx;
  2164. color: #999999;
  2165. }
  2166. page {
  2167. // padding-top: 10px;
  2168. // padding-top: constant(safe-area-inset-top);
  2169. // padding-top: env(safe-area-inset-top);
  2170. }
  2171. .inputBottom {
  2172. position: fixed;
  2173. left: 0;
  2174. bottom: 0;
  2175. background: #ffffff;
  2176. height: 98rpx;
  2177. display: flex;
  2178. align-items: center;
  2179. width: 100%;
  2180. .flex_auto {
  2181. flex: 1;
  2182. margin-left: 10%;
  2183. .input {
  2184. height: 60rpx;
  2185. }
  2186. }
  2187. .btn {
  2188. color: #007aff;
  2189. font-size: 30rpx;
  2190. font-weight: bold;
  2191. width: 15%;
  2192. text-align: center;
  2193. }
  2194. }
  2195. .noteBox {
  2196. width: 100%;
  2197. background: #ffffff;
  2198. padding: 10rpx;
  2199. border-radius: 16rpx;
  2200. }
  2201. .dateBox {
  2202. width: 216rpx;
  2203. height: 48rpx;
  2204. background: #ffffff;
  2205. border-radius: 24rpx;
  2206. font-size: 24rpx;
  2207. color: #666666;
  2208. text-align: center;
  2209. line-height: 48rpx;
  2210. margin: 20rpx 0;
  2211. }
  2212. .t_content1 {
  2213. color: #007aff;
  2214. margin-left: 10rpx;
  2215. }
  2216. .tag1 {
  2217. border: 2rpx solid #007aff;
  2218. border-radius: 8rpx;
  2219. font-size: 20rpx;
  2220. color: #007aff;
  2221. padding: 5rpx;
  2222. }
  2223. .b_title {
  2224. color: #333333;
  2225. font-size: 30rpx;
  2226. font-weight: bold;
  2227. }
  2228. page {
  2229. background: #eaeef1;
  2230. }
  2231. .menuBox {
  2232. width: 100%;
  2233. background: #ffffff;
  2234. border-radius: 16rpx;
  2235. padding: 20rpx;
  2236. margin-bottom: 20rpx;
  2237. }
  2238. .btnspric {
  2239. border-top: 1rpx solid #eee;
  2240. display: flex;
  2241. align-items: center;
  2242. justify-content: space-between;
  2243. height: 108rpx;
  2244. padding-left: 43rpx;
  2245. padding-right: 32rpx;
  2246. }
  2247. .btnspric > .lefprL {
  2248. font-size: 36rpx;
  2249. color: #0c141f;
  2250. font-weight: bold;
  2251. }
  2252. .btnspric > .lefprR {
  2253. padding: 0rpx 24rpx;
  2254. height: 60rpx;
  2255. line-height: 60rpx;
  2256. text-align: center;
  2257. color: #fff;
  2258. background: #32467b;
  2259. border-radius: 24rpx;
  2260. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2261. }
  2262. .yhj,
  2263. .hdyhj {
  2264. padding: 24rpx 29rpx 24rpx 34rpx;
  2265. }
  2266. .yhj {
  2267. border-bottom: 16rpx solid #f9f9f9;
  2268. }
  2269. .yhjtit {
  2270. font-size: 30rpx;
  2271. color: #0c141f;
  2272. font-weight: 500;
  2273. margin-bottom: 14rpx;
  2274. }
  2275. .yhjList {
  2276. display: flex;
  2277. align-items: center;
  2278. justify-content: space-between;
  2279. margin-bottom: 14rpx;
  2280. }
  2281. .yhjList > .yhjLefts {
  2282. display: flex;
  2283. align-items: center;
  2284. }
  2285. .yhjLefts > .yhl {
  2286. color: #32467b;
  2287. font-size: 30rpx;
  2288. margin-right: 31rpx;
  2289. }
  2290. .yhjLefts > .yhbq {
  2291. font-size: 24rpx;
  2292. color: #ff9500;
  2293. border-radius: 18rpx;
  2294. background-color: rgba(255, 149, 0, 0.2);
  2295. border: 2rpx solid #ff9500;
  2296. height: 38rpx;
  2297. line-height: 38rpx;
  2298. padding: 0rpx 16rpx;
  2299. }
  2300. .ts {
  2301. font-size: 24rpx;
  2302. color: #999;
  2303. margin: 14rpx 0rpx;
  2304. padding-right: 29rpx;
  2305. padding-left: 34rpx;
  2306. }
  2307. .yh {
  2308. padding-top: 20rpx;
  2309. }
  2310. .yh > .yhtitle {
  2311. display: flex;
  2312. align-items: center;
  2313. justify-content: space-between;
  2314. padding-right: 29rpx;
  2315. padding-left: 34rpx;
  2316. }
  2317. .priceBxs {
  2318. display: flex;
  2319. align-items: center;
  2320. }
  2321. .priceBxs > .pricleft {
  2322. border-radius: 24rpx;
  2323. border: 1rpx solid #e91313;
  2324. background-color: rgba(233, 19, 19, 0.1);
  2325. padding: 0rpx 18rpx;
  2326. height: 49rpx;
  2327. line-height: 49rpx;
  2328. text-align: center;
  2329. font-size: 30rpx;
  2330. font-weight: 500;
  2331. color: #e91313;
  2332. margin-right: 13rpx;
  2333. }
  2334. .topBox {
  2335. padding: 32rpx 32rpx 24rpx;
  2336. border-bottom: 1rpx solid #eeeeee;
  2337. }
  2338. .topBox > .boldFonstType {
  2339. font-weight: 500;
  2340. font-size: 30rpx;
  2341. margin: 16rpx 0rpx 23rpx;
  2342. }
  2343. .topBox > .firstTopL {
  2344. display: flex;
  2345. align-items: center;
  2346. }
  2347. .topBox > .firstTopL > .imageBs {
  2348. width: 331rpx;
  2349. height: 160rpx;
  2350. border-radius: 6rpx;
  2351. overflow: hidden;
  2352. margin-right: 8rpx;
  2353. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  2354. }
  2355. .topBox > .firstTopL > .imageBs > image {
  2356. width: 100%;
  2357. height: 100%;
  2358. }
  2359. .topBox > .firstTopL > .textBs {
  2360. font-size: 30rpx;
  2361. font-weight: bold;
  2362. color: #0c141f;
  2363. }
  2364. .content {
  2365. padding: 24rpx;
  2366. text-align: left;
  2367. }
  2368. .catalogBox {
  2369. display: flex;
  2370. align-items: center;
  2371. flex-wrap: nowrap;
  2372. overflow-x: auto;
  2373. padding-left: 38rpx;
  2374. max-height: 305rpx;
  2375. overflow-y: auto;
  2376. transition: all 0.4s;
  2377. }
  2378. .catalogBox > .catalogA {
  2379. min-width: 200rpx;
  2380. height: 48rpx;
  2381. line-height: 48rpx;
  2382. // text-align: center;
  2383. border: 2rpx solid transparent;
  2384. white-space: nowrap;
  2385. text-overflow: ellipsis;
  2386. overflow: hidden;
  2387. word-break: break-all;
  2388. border-radius: 10rpx;
  2389. background: rgba(22, 119, 255, 0.05);
  2390. padding-left: 19rpx;
  2391. box-sizing: border-box;
  2392. padding-right: 15rpx;
  2393. margin-right: 16rpx;
  2394. margin-bottom: 20rpx;
  2395. margin-top: 15rpx;
  2396. font-size: 24rpx;
  2397. color: #666;
  2398. }
  2399. .catalogBox > .activesq {
  2400. border-color: #1677ff;
  2401. }
  2402. .changeCatalogBox {
  2403. display: block;
  2404. }
  2405. .catalogBox::-webkit-scrollbar {
  2406. display: none; /* Chrome Safari */
  2407. }
  2408. .price_t2 {
  2409. font-size: 18rpx;
  2410. font-family: PingFang SC;
  2411. font-weight: 500;
  2412. text-decoration: line-through;
  2413. color: #999999;
  2414. }
  2415. .price_t1 {
  2416. font-size: 33rpx;
  2417. font-family: PingFang SC;
  2418. font-weight: bold;
  2419. color: #e91313;
  2420. }
  2421. .sc_t {
  2422. font-size: 22rpx;
  2423. color: #000000;
  2424. }
  2425. .sc {
  2426. width: 29rpx;
  2427. height: 29rpx;
  2428. }
  2429. .buy {
  2430. width: 138rpx;
  2431. height: 48rpx;
  2432. line-height: 48rpx;
  2433. background: #32467b;
  2434. border-radius: 10rpx;
  2435. color: #ffffff;
  2436. font-size: 28rpx;
  2437. text-align: center;
  2438. vertical-align: middle;
  2439. position: absolute;
  2440. right: 30rpx;
  2441. }
  2442. .video_body {
  2443. padding-bottom: 96rpx;
  2444. }
  2445. .footer_tab {
  2446. position: fixed;
  2447. bottom: 0;
  2448. height: 96rpx;
  2449. width: 100%;
  2450. background-color: #ffffff;
  2451. }
  2452. .tj_box {
  2453. width: 50%;
  2454. display: inline-block;
  2455. text-align: center;
  2456. margin: 10rpx 0;
  2457. }
  2458. .teacher_t {
  2459. font-size: 24rpx;
  2460. font-family: PingFang SC;
  2461. font-weight: 400;
  2462. color: #666666;
  2463. line-height: 36rpx;
  2464. margin-left: 15rpx;
  2465. }
  2466. .teacher_img {
  2467. width: 87rpx;
  2468. height: 129rpx;
  2469. }
  2470. .t2 {
  2471. font-size: 24rpx;
  2472. font-family: PingFang SC;
  2473. color: #666666;
  2474. line-height: 36rpx;
  2475. margin: 15rpx;
  2476. }
  2477. .r_t2 {
  2478. width: 201rpx;
  2479. height: 49rpx;
  2480. background: rgba(22, 119, 255, 0.05);
  2481. border: 1rpx solid #32467b;
  2482. border-radius: 16rpx;
  2483. color: #666666;
  2484. font-size: 23rpx;
  2485. text-align: center;
  2486. display: flex;
  2487. align-items: center;
  2488. padding: 5rpx;
  2489. }
  2490. .scroll_box {
  2491. width: 100%;
  2492. height: 60rpx;
  2493. background: #ffffff;
  2494. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2495. white-space: nowrap;
  2496. overflow: hidden;
  2497. margin: 15rpx 0;
  2498. }
  2499. .r_sliper {
  2500. padding: 0 20rpx;
  2501. }
  2502. .top_line {
  2503. width: 6rpx;
  2504. height: 22rpx;
  2505. background: #32467b;
  2506. margin-right: 10rpx;
  2507. }
  2508. .video_t2 {
  2509. font-size: 24rpx;
  2510. font-family: PingFang SC;
  2511. font-weight: 500;
  2512. color: #666666;
  2513. }
  2514. .video_t1 {
  2515. height: 80rpx;
  2516. color: #333333;
  2517. line-height: 80rpx;
  2518. font-size: 30rpx;
  2519. font-family: PingFang SC;
  2520. font-weight: bold;
  2521. color: #333333;
  2522. overflow: hidden;
  2523. text-overflow: ellipsis;
  2524. white-space: nowrap;
  2525. }
  2526. .notice_wrap {
  2527. height: 80rpx;
  2528. display: flex;
  2529. align-items: center;
  2530. justify-content: flex-end;
  2531. .video_t1_t {
  2532. width: 100%;
  2533. height: 40rpx;
  2534. line-height: 40rpx;
  2535. text-align: center;
  2536. background: rgba(245, 154, 35, 1);
  2537. color: #333;
  2538. border-radius: 10rpx;
  2539. font-size: 24rpx;
  2540. }
  2541. }
  2542. .video_play {
  2543. position: absolute;
  2544. width: 95rpx;
  2545. height: 95rpx;
  2546. top: 0;
  2547. left: 0;
  2548. right: 0;
  2549. bottom: 0;
  2550. margin: auto;
  2551. }
  2552. .video_box {
  2553. position: relative;
  2554. .video-toast {
  2555. position: absolute;
  2556. width: 686rpx;
  2557. height: 80rpx;
  2558. background: rgba(0, 0, 0, 0.6);
  2559. border-radius: 24rpx;
  2560. bottom: 100rpx;
  2561. left: 50%;
  2562. transform: translateX(-50%);
  2563. color: #fff;
  2564. display: flex;
  2565. font-size: 26rpx;
  2566. align-items: center;
  2567. overflow: visible;
  2568. &__text {
  2569. flex: 1;
  2570. margin-left: 40rpx;
  2571. }
  2572. &__btn {
  2573. width: 180rpx;
  2574. text-align: center;
  2575. border-left: 1rpx solid #fff;
  2576. }
  2577. }
  2578. .video-toast__close {
  2579. position: absolute;
  2580. right: 32rpx;
  2581. bottom: 184rpx;
  2582. width: 40rpx;
  2583. height: 40rpx;
  2584. line-height: 40rpx;
  2585. text-align: center;
  2586. background: rgba(0, 0, 0, 0.6);
  2587. border-radius: 50%;
  2588. color: rgba(255, 255, 255, 0.3);
  2589. }
  2590. }
  2591. .rotoct {
  2592. transform: rotate(90deg);
  2593. }
  2594. .notice_modal {
  2595. .content {
  2596. width: 100%;
  2597. height: 100%;
  2598. padding: 20rpx;
  2599. .title {
  2600. color: #333;
  2601. line-height: 40rpx;
  2602. font-size: 30rpx;
  2603. text-align: center;
  2604. font-weight: bold;
  2605. }
  2606. .text {
  2607. line-height: 40rpx;
  2608. }
  2609. }
  2610. }
  2611. </style>