detail.vue 74 KB

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