detail.vue 140 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725
  1. <template>
  2. <view class="polyv_detail">
  3. <!-- <nav-bar
  4. :title="detail.courseName || '课程详情'"
  5. v-show="navShow"
  6. ></nav-bar> -->
  7. <uni-nav-bar
  8. left-icon="back"
  9. :statusBar="true"
  10. fixed="true"
  11. :title="detail.courseName || '课程详情'"
  12. @clickLeft="clickLeft"
  13. ></uni-nav-bar>
  14. <view id="top">
  15. <view class="video_box" v-if="!startStatus">
  16. <image
  17. :src="$method.splitImgHost(goodsData.coverUrl)"
  18. mode="widthFix"
  19. style="width: 100%; height: 421rpx"
  20. ></image>
  21. <image
  22. v-if="false"
  23. class="video_play"
  24. src="/static/play.png"
  25. @click="startVideo"
  26. ></image>
  27. </view>
  28. <view v-else>
  29. <!-- v-if="playVID" -->
  30. <!-- #ifdef MP-WEIXIN -->
  31. <view class="video_box" style="width: 100%; height: 421rpx">
  32. <polyv-player
  33. v-if="playVID"
  34. id="playerVideo"
  35. playerId="playerVideo"
  36. height="421rpx"
  37. :vid="vid"
  38. :showSettingBtn="true"
  39. :enablePlayGesture="true"
  40. :custom-cache="false"
  41. :object-fit="'contain'"
  42. @statechange="onStateChange"
  43. @fullscreenchange="fullscreenchange"
  44. @error="playError"
  45. :autoplay="autoplay"
  46. :page-gesture="true"
  47. :vslide-gesture="true"
  48. :vslide-gesture-in-fullscreen="true"
  49. :isAllowSeek="isAllowSeek"
  50. :playbackRate="playbackRate"
  51. :enableAutoRotation="enableAutoRotation"
  52. @loadedmetadata="loadedmetadata"
  53. ></polyv-player>
  54. <!-- :startTime="startTime" -->
  55. <cover-view
  56. class="video-toast__close"
  57. v-if="videoToastShow"
  58. @click="closeToast()"
  59. >X</cover-view
  60. >
  61. <cover-view class="video-toast" v-if="videoToastShow">
  62. <cover-view class="video-toast__text"
  63. >您上次看到 {{ seekTime }},正在自动续播</cover-view
  64. >
  65. <cover-view class="video-toast__btn" @click="restart()"
  66. >从头播放</cover-view
  67. >
  68. </cover-view>
  69. </view>
  70. <!-- #endif -->
  71. <!-- #ifdef H5 -->
  72. <view class="video_box" style="width: 100%; height: 421rpx">
  73. <view v-show="vid" id="player"></view>
  74. <cover-view
  75. class="video-toast__close"
  76. v-if="videoToastShow"
  77. @click="closeToast()"
  78. >X</cover-view
  79. >
  80. <cover-view class="video-toast" v-if="videoToastShow">
  81. <cover-view class="video-toast__text"
  82. >您上次看到 {{ seekTime }},正在自动续播</cover-view
  83. >
  84. <cover-view class="video-toast__btn" @click="restart()"
  85. >从头播放</cover-view
  86. >
  87. </cover-view>
  88. </view>
  89. <!-- #endif -->
  90. <view
  91. class="video_box"
  92. style="width: 100%; height: 421rpx"
  93. v-if="playChannelId > 0"
  94. >
  95. <player
  96. class="plv-mp-demo-player"
  97. :videoOption="videoOption"
  98. :page-gesture="true"
  99. :vslide-gesture="true"
  100. :vslide-gesture-in-fullscreen="true"
  101. @onLiveStatusChange="playerLiveStatusChange"
  102. />
  103. </view>
  104. </view>
  105. <view class="course_name">
  106. <view class="course_titles">
  107. <view class="video_t1" :class="{ one: !goodsData.buyNote }">{{
  108. detail.courseName
  109. }}</view>
  110. <view class="notice_wrap" v-if="goodsData.buyNote">
  111. <view class="video_t1_t" @click="studyNotice"> 学员须知 </view>
  112. </view>
  113. <view
  114. class="toggle_course"
  115. v-if="goodsTeacher.length > 1"
  116. @click="changeCourses()"
  117. >
  118. <image
  119. class="img"
  120. src="/pages3/static/imgs/toggle.png"
  121. mode="widthFix"
  122. ></image>
  123. <view class="toggle_name">切换课程</view>
  124. <!-- courseTotal -->
  125. <view class="numbers">共{{ goodsTeacher.length }}门</view>
  126. </view>
  127. </view>
  128. </view>
  129. <u-line color="#D6D6DB" />
  130. <view>
  131. <view>
  132. <u-tabs
  133. :item-width="itemWidth()"
  134. :list="list"
  135. font-size="32"
  136. bar-width="24"
  137. :current="current"
  138. @change="change"
  139. active-color="#007AFF"
  140. ></u-tabs>
  141. </view>
  142. </view>
  143. <u-line color="#D6D6DB" />
  144. </view>
  145. <view class="box" :class="{ first_ml: current == 0 }">
  146. <scroll-view class="box_in" scroll-y="true">
  147. <!--目录 -->
  148. <view v-show="current == 0">
  149. <view
  150. class="top__header"
  151. v-if="livingItem"
  152. @click="goLive(livingItem)"
  153. >
  154. <image
  155. class="img"
  156. src="/pages3/static/imgs/live.png"
  157. mode="widthFix"
  158. ></image>
  159. <view class="note">正在直播中</view>
  160. <view class="title">{{ livingItem.sectionName }}</view>
  161. </view>
  162. <view
  163. v-if="teacherList && teacherList.length > 0"
  164. class="teacher_names"
  165. >
  166. <view
  167. v-for="(tea, index) in teacherList"
  168. :key="index"
  169. class="names"
  170. :class="{ nactive: teacherIndex == index }"
  171. @click="activeFunc(tea, index)"
  172. >
  173. {{ tea.aliasName }}
  174. </view>
  175. </view>
  176. <view
  177. class="menuBox onessss"
  178. v-for="(item, index) in menuList"
  179. :key="index"
  180. >
  181. <!--模块 -->
  182. <view v-if="item.type == 1"
  183. ><courseModule
  184. v-if="reStart"
  185. :orderGoodsId="orderGoodsId"
  186. :sectionMaxNum="goodsData.sectionMaxNum"
  187. :needOpen="menuIndex[0] === index ? true : false"
  188. :courseId="courseId"
  189. :preItem="menuList[index - 1]"
  190. :learningOrder="businessData.goodsLearningOrder"
  191. :goodsId="goodsId"
  192. :gradeId="gradeId"
  193. :isBuy="true"
  194. :menuItem="item"
  195. :levelId="item.menuId"
  196. :goodsType="1"
  197. :menuAllList="menuAllList"
  198. :sectionItem="sectionItem"
  199. ></courseModule
  200. ></view>
  201. <!--章 -->
  202. <view v-if="item.type == 2"
  203. ><courseChapter
  204. v-if="reStart"
  205. :orderGoodsId="orderGoodsId"
  206. :sectionMaxNum="goodsData.sectionMaxNum"
  207. :needOpen="menuIndex[0] === index ? true : false"
  208. :courseId="courseId"
  209. :preItem="menuList[index - 1]"
  210. @playEnd="sectionPlayEnd($event, index)"
  211. :learningOrder="businessData.goodsLearningOrder"
  212. :goodsId="goodsId"
  213. :gradeId="gradeId"
  214. :isBuy="true"
  215. :menuItem="item"
  216. :levelId="'0-' + item.menuId"
  217. :goodsType="1"
  218. :menuAllList="menuAllList"
  219. ></courseChapter
  220. ></view>
  221. <!--节 -->
  222. <view v-if="item.type == 3"
  223. ><courseSection
  224. ref="MoudleSection"
  225. v-if="reStart"
  226. :orderGoodsId="orderGoodsId"
  227. :sectionMaxNum="goodsData.sectionMaxNum"
  228. @playEnd="sectionPlayEnd($event, index)"
  229. :courseId="courseId"
  230. :preItem="menuList[index - 1]"
  231. :learningOrder="businessData.goodsLearningOrder"
  232. :goodsId="goodsId"
  233. :gradeId="gradeId"
  234. :isBuy="true"
  235. :menuItem="item"
  236. :levelId="'0-0-' + item.menuId"
  237. :goodsType="1"
  238. :testType="3"
  239. :menuAllList="menuAllList"
  240. ></courseSection
  241. ></view>
  242. <!-- @togoBack="togoBack($event)" -->
  243. </view>
  244. </view>
  245. <!--讲义 -->
  246. <view v-show="current == 1">
  247. <handouts-box
  248. :handoutsId="goodsData.handoutsId"
  249. v-if="goodsData.handoutsId"
  250. ></handouts-box>
  251. </view>
  252. <!--笔记 -->
  253. <view v-show="current == 2">
  254. <view v-if="noteList.length == 0" style="text-align: center"
  255. >暂无笔记</view
  256. >
  257. <view v-for="(item, index) in noteList" :key="index">
  258. <view class="dateBox">{{
  259. $method.timestampToTime(item.dateNote)
  260. }}</view>
  261. <view class="noteBox">
  262. <view
  263. v-for="(item1, index1) in item.userNotes"
  264. :key="index1"
  265. style="margin-top: 30rpx"
  266. @click="jumpNote(item1)"
  267. >
  268. <view style="display: flex">
  269. <view class="left_ti">
  270. <view>
  271. <image
  272. src="/static/icon/note2.png"
  273. v-if="noteId != item1.noteId"
  274. style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
  275. ></image>
  276. <image
  277. src="/static/icon/note1.png"
  278. v-if="noteId == item1.noteId"
  279. style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
  280. ></image>
  281. </view>
  282. <view
  283. class="title"
  284. style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
  285. >{{ $method.secondToDate(item1.noteSecond) }}</view
  286. >
  287. </view>
  288. <view style="margin-left: 10rpx">
  289. <view class="t2Content leftPadding">{{
  290. item1.sectionName
  291. }}</view>
  292. <view class="tBox2">{{ item1.noteText }}</view>
  293. </view>
  294. </view>
  295. </view>
  296. </view>
  297. </view>
  298. </view>
  299. <!--答疑 -->
  300. <view v-show="current == 3" class="Answering">
  301. <view
  302. v-for="(item, index) in answerList"
  303. :key="index"
  304. style="background-color: #ffffff"
  305. class="answer_item"
  306. >
  307. <view class="chat_box" @click.stop="clearCtx">
  308. <view style="display: flex; flex: 1">
  309. <view
  310. ><image
  311. :src="
  312. item.assignUserId > 0 && !item.realname
  313. ? '/static/logo_xcx.png'
  314. : $method.splitImgHost(item.avatar)
  315. "
  316. style="width: 64rpx; height: 64rpx"
  317. ></image
  318. ></view>
  319. <view style="margin-left: 15rpx">
  320. <view class="chat1">{{
  321. item.assignUserId > 0 && !item.realname
  322. ? "祥粤老师"
  323. : item.realname
  324. }}</view>
  325. <view class="chat2">{{
  326. $method.timestampToTime(item.createTime, false)
  327. }}</view>
  328. <view class="chat3">
  329. <text v-if="item.assignUserId > 0">回复</text>
  330. <text v-if="item.assignUserId > 0" style="color: #007aff"
  331. >@{{ item.assignRealname }}</text
  332. >
  333. <view style="word-break: break-all">{{
  334. item.answerText
  335. }}</view>
  336. </view>
  337. </view>
  338. </view>
  339. <view
  340. class="btnReply"
  341. @click.stop="replyContent(item)"
  342. v-if="item.userId != userInfo.userId"
  343. >回复</view
  344. >
  345. <view v-else class="btnDel" @click.stop="delContent(item)"
  346. >删除</view
  347. >
  348. </view>
  349. <u-line color="#D6D6DB" />
  350. </view>
  351. <view v-if="answerList.length == 0" style="text-align: center"
  352. >暂无记录</view
  353. >
  354. </view>
  355. <!--目录 -->
  356. <view v-show="current == 4">
  357. <view
  358. class="menuBox"
  359. v-for="(item, index) in reMenuList"
  360. :key="index"
  361. >
  362. <!--模块 -->
  363. <view v-if="item.type == 1"
  364. ><courseModule
  365. :orderGoodsId="orderGoodsId"
  366. :sectionMaxNum="goodsData.sectionMaxNum"
  367. :courseId="courseId"
  368. :goodsId="goodsId"
  369. :gradeId="gradeId"
  370. :isRebuild="true"
  371. :isBuy="true"
  372. :menuItem="item"
  373. :levelId="item.menuId"
  374. :goodsType="1"
  375. :menuAllList="menuAllList"
  376. :sectionItem="sectionItem"
  377. ></courseModule
  378. ></view>
  379. <!--章 -->
  380. <view v-if="item.type == 2">
  381. <courseChapter
  382. :orderGoodsId="orderGoodsId"
  383. :courseId="courseId"
  384. :sectionMaxNum="goodsData.sectionMaxNum"
  385. @playEnd="sectionPlayEnd($event, index)"
  386. :gradeId="gradeId"
  387. :goodsId="goodsId"
  388. :isRebuild="true"
  389. :isBuy="true"
  390. :menuItem="item"
  391. :levelId="'0-' + item.menuId"
  392. :goodsType="1"
  393. :menuAllList="menuAllList"
  394. ></courseChapter>
  395. </view>
  396. <!--节 -->
  397. <view v-if="item.type == 3">
  398. <courseSection
  399. :orderGoodsId="orderGoodsId"
  400. :courseId="courseId"
  401. :sectionMaxNum="goodsData.sectionMaxNum"
  402. @playEnd="sectionPlayEnd($event, index)"
  403. :gradeId="gradeId"
  404. :goodsId="goodsId"
  405. :isRebuild="true"
  406. :isBuy="true"
  407. :nextMenuItem="findMenuNextSection(index)"
  408. :menuItem="item"
  409. :levelId="'0-0-' + item.menuId"
  410. :goodsType="1"
  411. :testType="3"
  412. :menuAllList="menuAllList"
  413. ></courseSection>
  414. </view>
  415. </view>
  416. </view>
  417. </scroll-view>
  418. <!-- 底部固定按钮 -->
  419. <!-- 笔记的输入框 -->
  420. <template v-if="current == 2">
  421. <view
  422. class="inputBottom"
  423. v-if="!(isPlayRebuild > 0) && playChannelId == 0"
  424. :style="{ bottom: bottomHeight + 'px' }"
  425. >
  426. <view style="width: 10%"
  427. ><image
  428. src="/static/icon/note3.png"
  429. style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
  430. ></image
  431. ></view>
  432. <view style="width: 73%; height: 100%; padding: 10rpx 0">
  433. <input
  434. v-model="noteValue"
  435. height="60"
  436. fixed="true"
  437. placeholder="您可以在这里输入笔记内容"
  438. type="text"
  439. :custom-style="inputStyle"
  440. :adjust-position="false"
  441. class="input"
  442. @focus="focusNote"
  443. @blur="blurNote"
  444. />
  445. </view>
  446. <view
  447. style="
  448. color: #007aff;
  449. font-size: 30rpx;
  450. font-weight: bold;
  451. width: 15%;
  452. text-align: center;
  453. "
  454. @click="postNote"
  455. >提交</view
  456. >
  457. </view>
  458. </template>
  459. <!-- 答疑的输入框 -->
  460. <view
  461. v-if="current == 3"
  462. class="inputBottom"
  463. :style="{ bottom: bottomHeight + 'px' }"
  464. >
  465. <view class="flex_auto">
  466. <input
  467. v-model="ctxValue"
  468. height="60"
  469. fixed="true"
  470. :focus="isFocus"
  471. :placeholder="placeholder"
  472. type="text"
  473. :custom-style="inputStyle"
  474. :adjust-position="false"
  475. class="input"
  476. @focus="focusNote"
  477. @blur="blur"
  478. />
  479. </view>
  480. <view class="btn" @click="postContent">提交</view>
  481. </view>
  482. </view>
  483. <!-- 播放前拍照end -->
  484. <u-popup
  485. v-model="showSet"
  486. :mask-close-able="false"
  487. mode="center"
  488. border-radius="24"
  489. >
  490. <view
  491. style="
  492. align-items: center;
  493. padding: 0 40rpx;
  494. display: flex;
  495. flex-direction: column;
  496. justify-content: center;
  497. "
  498. >
  499. <view
  500. style="
  501. font-weight: bold;
  502. color: #333333;
  503. font-size: 30rpx;
  504. margin-top: 30rpx;
  505. "
  506. >温馨提示</view
  507. >
  508. <view
  509. style="
  510. width: 457rpx;
  511. color: #666666;
  512. font-size: 30rpx;
  513. margin-top: 30rpx;
  514. "
  515. >学习过程中需要拍照验证学员身份, 拍照功能需要使用您的相机。
  516. 是否授权使用?</view
  517. >
  518. <view style="margin: 40rpx 0">
  519. <button
  520. open-type="openSetting"
  521. @bindopensetting="openSetting"
  522. class="btnSet"
  523. >
  524. 去授权
  525. </button>
  526. </view>
  527. </view>
  528. </u-popup>
  529. <u-popup
  530. v-model="photoPopup"
  531. mode="bottom"
  532. border-radius="40"
  533. :mask-close-able="false"
  534. >
  535. <!-- 播放前拍照start -->
  536. <!-- :mask-close-able="false" -->
  537. <!-- style="bottom: 0; position: fixed; width: 100%; z-index: 999" -->
  538. <view v-if="photoPopup">
  539. <view class="photoBox">
  540. <view class="photoTop">
  541. <view class="sqzz" v-if="false"
  542. ><u-icon
  543. name="close"
  544. color="#333333"
  545. size="30"
  546. @click="closePhoto"
  547. ></u-icon
  548. ></view>
  549. <view class="centersq">请正视手机屏幕</view>
  550. <view class="sqzz"></view>
  551. </view>
  552. <view class="photoCenter">
  553. <view class="center_camera" v-if="photoPopup && isTaking">
  554. <!-- #ifdef MP-WEIXIN -->
  555. <camera
  556. device-position="front"
  557. flash="off"
  558. @error="error"
  559. style="width: 100%; height: 100%"
  560. >
  561. <!-- 加人脸框 -->
  562. <cover-view class="head_take">
  563. <cover-view class="headTake_up color"></cover-view>
  564. <cover-view class="headTake_minddle">
  565. <cover-view class="min_left color"></cover-view>
  566. <cover-view class="min_img"></cover-view>
  567. <cover-view class="min_right color"></cover-view>
  568. </cover-view>
  569. <cover-view class="headTake_down color"></cover-view>
  570. </cover-view>
  571. </camera>
  572. <!-- #endif -->
  573. <!-- #ifdef H5 -->
  574. <video
  575. :controls="false"
  576. id="video"
  577. width="400"
  578. height="300"
  579. class="photo_v"
  580. ></video>
  581. <view class="mask"></view>
  582. <!-- #endif -->
  583. </view>
  584. <view class="custom" v-if="!isTaking">
  585. <!-- #ifdef MP-WEIXIN -->
  586. <image :src="avatarUrl" mode=""></image>
  587. <!-- #endif -->
  588. <!-- #ifdef H5 -->
  589. <image :src="faceUrl" mode=""></image>
  590. <!-- #endif -->
  591. </view>
  592. </view>
  593. <view class="btns">
  594. <!-- <view class="btnResult" v-if="isTaking" @click="takePhoto"
  595. >拍照</view
  596. > -->
  597. <view v-if="isTaking" class="takePhoto_btn">
  598. <view style="width: 100rpx; height: 2rpx"></view>
  599. <view class="middle_btn" @click="takePhoto">
  600. <view class="square"></view>
  601. </view>
  602. <view class="rights" @click="takePhTips()">
  603. <text>拍照提示</text>
  604. <u-icon name="arrow-right" color="#FFFFFF" size="30"></u-icon>
  605. </view>
  606. </view>
  607. <view class="btnResult" v-if="!isTaking" @click="reTake">重拍</view>
  608. <view class="btnResult" v-if="!isTaking" @click="submit">确认</view>
  609. </view>
  610. </view>
  611. </view>
  612. </u-popup>
  613. <u-popup
  614. v-model="noticeShow"
  615. class="notice_modal"
  616. mode="center"
  617. border-radius="28"
  618. width="650rpx"
  619. height="622rpx"
  620. :mask-close-able="false"
  621. @close="closeNotice"
  622. >
  623. <view class="content">
  624. <view class="title">学员须知</view>
  625. <scroll-view scroll-y="true">
  626. <view
  627. class="text"
  628. v-html="
  629. goodsData.buyNote && goodsData.buyNote.replace(/\n|\r\n/g, '<br>')
  630. "
  631. >
  632. </view>
  633. </scroll-view>
  634. <view
  635. class="had_read"
  636. :class="{ gray: CountTo >= 0 }"
  637. @click="noticeConfirm()"
  638. >
  639. <text v-if="CountTo >= 0">请阅读学员须知,30s后可关闭</text>
  640. <text v-else>我已阅读学员须知</text>
  641. <text v-if="CountTo >= 0">{{ " " + CountTo + "s" }}</text>
  642. </view>
  643. </view>
  644. </u-popup>
  645. <u-modal
  646. v-model="showMark"
  647. title="提示"
  648. @confirm="markConfirm"
  649. @cancel="markCancel"
  650. confirm-text="复制学习网址"
  651. :show-cancel-button="true"
  652. cancel-text="关闭"
  653. >
  654. <view class="slot-content">
  655. <view>您的学习账号已经开通,请按照步骤操作,进行学习。</view>
  656. <view>1.复制学习地址:{{ markContent }}</view>
  657. <view>2.在【浏览器中】打开复制的学习网址</view>
  658. <view>3.打开学习网址后,选择【个人用户】进行登录</view>
  659. <view>(1)账号:您个人的身份证号码</view>
  660. <view>(2)密码:身份证号码,再加111111</view>
  661. </view>
  662. </u-modal>
  663. <!-- 切换课程弹窗 -->
  664. <u-popup
  665. v-model="toggleCourseShow"
  666. mode="bottom"
  667. border-radius="40"
  668. :mask-close-able="false"
  669. >
  670. <view class="popup_box">
  671. <view class="check_head">
  672. <view class="headers">
  673. <view class="grade">切换课程</view>
  674. <u-icon
  675. name="close"
  676. color="#9C9C9C"
  677. size="40"
  678. @click="closePop()"
  679. ></u-icon>
  680. </view>
  681. <view class="coruse_num">共{{ goodsTeacher.length }}门</view>
  682. <view class="menuSel">
  683. <scroll-view class="sub_sliper" scroll-x="true">
  684. <view
  685. v-for="(item, index) in subList"
  686. :key="index"
  687. style="margin-right: 50rpx; display: inline-block"
  688. >
  689. <view
  690. class="r_t1"
  691. :class="{ nactive: subIndex == index }"
  692. @click="cMenu(item, index)"
  693. >
  694. {{ item.subjectName }}
  695. </view>
  696. </view>
  697. </scroll-view>
  698. </view>
  699. </view>
  700. <view class="check_con">
  701. <scroll-view scroll-y="true" style="height: 700rpx">
  702. <view v-for="(courseItem, gTindex) in goodsTeacher" :key="gTindex">
  703. <view
  704. v-for="(item, index) in courseItem.courseList"
  705. :key="index"
  706. v-show="
  707. item.subjectId === newActiveSubjectId || !newActiveSubjectId
  708. "
  709. >
  710. <view class="course_items" v-if="item.show && item.show == 1">
  711. <view class="course_lefts">
  712. <view class="course_title">
  713. {{ item.courseName }}
  714. </view>
  715. <view
  716. v-if="courseItem.teaList && courseItem.teaList.length > 0"
  717. class="teacher_names"
  718. >
  719. <view
  720. v-for="(tea, tindex) in courseItem.teaList"
  721. :key="tindex"
  722. class="names"
  723. >{{ tea.aliasName }}</view
  724. >
  725. </view>
  726. <view class="course_pros">
  727. 学习进度
  728. <text>
  729. {{ item.stuAllNum + item.recordNum }}/{{
  730. item.secAllNum + item.examNum
  731. }}</text
  732. >
  733. </view>
  734. </view>
  735. <view
  736. class="course_rights"
  737. @click="jump(item, gTindex, 'jump')"
  738. >
  739. <view class="cicles">
  740. <u-icon
  741. name="arrow-right"
  742. color="#498AFE"
  743. size="20"
  744. ></u-icon>
  745. </view>
  746. <view class="intoStudy">进入学习</view>
  747. </view>
  748. </view>
  749. </view>
  750. </view>
  751. </scroll-view>
  752. </view>
  753. </view>
  754. </u-popup>
  755. <!-- 拍照提示 -->
  756. <popup-photo
  757. :popupPhotoShow.sync="popupPhotoShow"
  758. @takePhoto="toTakePhoto()"
  759. ></popup-photo>
  760. </view>
  761. </template>
  762. <script>
  763. import plv from "../static/polyv-sdk/index";
  764. import courseModule from "@/components/course/courseModule.vue";
  765. import courseChapter from "@/components/course/courseChapter.vue";
  766. import courseSection from "@/components/course/courseSection.vue";
  767. import handoutsBox from "@/components/course/handoutsBox.vue";
  768. import PopupPhoto from "@/components/popup/index.vue";
  769. import { mapGetters, mapMutations } from "vuex";
  770. var polyvPlayerContext = null;
  771. export default {
  772. components: {
  773. courseModule,
  774. courseChapter,
  775. courseSection,
  776. PopupPhoto,
  777. handoutsBox,
  778. },
  779. data() {
  780. return {
  781. markContent: "http://admin.zhujianpeixun.com/",
  782. showMark: false,
  783. hasStart: false,
  784. channelItem: null,
  785. lockTimer: null,
  786. orderGoodsId: 0,
  787. noticeShow: false,
  788. navShow: true,
  789. enableAutoRotation: true,
  790. seekTime: "",
  791. toastTimer: null,
  792. videoToastShow: false,
  793. initLiveOk: false,
  794. livePlay: false, //是否正在播放直播,不含暂停
  795. liveDuration: 0, //直播观看时长
  796. videoOption: {
  797. mode: "live",
  798. uid: "",
  799. cid: "",
  800. openId: "",
  801. isAutoChange: false,
  802. forceVideo: false,
  803. },
  804. liveDetail: {},
  805. showSet: false,
  806. startStatus: false,
  807. detail: {},
  808. courseId: 0,
  809. placeholder:
  810. "您可以在这里输入笔记内容\n还可以点击左侧图标为笔记加上时间标记",
  811. inputStyle: {
  812. background: "rgba(244, 244, 244, 0.98)",
  813. borderRadius: "24rpx",
  814. padding: "8rpx",
  815. marginBottom: "10rpx",
  816. },
  817. list: [],
  818. menuList: [],
  819. current: 0,
  820. vid: "",
  821. goodsId: 0,
  822. goodsData: {},
  823. photoPopup: false,
  824. goodsPlayConfig: null,
  825. autoplay: false,
  826. isAllowSeek: "no",
  827. playbackRate: [1.0],
  828. timer: null,
  829. goodsPhotographConfig: null,
  830. intervalTimeList: [], // 间隔拍照时长
  831. intervalTimeIndex: 0, //当前处于哪个时间段拍照
  832. playTime: 0, //页面播放时长,不含暂停
  833. currentTime: 0,
  834. avatarUrl: "",
  835. ossAvatarUrl: "",
  836. studyDuration: 0, // 当前视频时长
  837. gradeId: 0,
  838. chapterId: 0,
  839. moduleId: 0,
  840. reMenuList: [],
  841. answerList: [],
  842. assignUserId: 0,
  843. placeholder: "您可以在这里输入答疑内容",
  844. ctxValue: "",
  845. noteList: [],
  846. noteValue: "",
  847. noteId: 0,
  848. recordObj: 0,
  849. gradeDetail: {},
  850. isTaking: true, //是否正在拍照
  851. needSeek: false, //第一次播放是否需要跳转
  852. needProfileModal: false, //是否需要资料审核弹框
  853. liveObj: {},
  854. photoNum: 0,
  855. photoList: [], //拍照的时间点
  856. photoConfig: false, //是否配置好拍照次数
  857. photoIndex: 0, //当前位于拍照的区间下标 从0开始
  858. photoHistoryList: [], //已拍照历史的下标点
  859. sectionItem: {},
  860. businessData: {},
  861. showNotes: true,
  862. menuIndex: [],
  863. uploadLock: false, //上传图片
  864. isPlayRebuild: false, //是否正在播放重修视频
  865. isRebuild: false, //视频是否从重修目录点击
  866. isFocus: false,
  867. clearTimer: null,
  868. livingItem: "",
  869. option: null,
  870. muluStyle: false, //显示和隐藏目录样式
  871. bottomHeight: 0,
  872. toggleCourseShow: false, // 切换课程弹窗
  873. courseList: [], // 课程列表
  874. reStart: false, // 是否显示模块/章/节
  875. subList: [],
  876. subIndex: 0,
  877. goodsTeacher: [],
  878. teacherList: [],
  879. teacherIndex: 0,
  880. newActiveSubjectId: "", //当前选中ID
  881. compareFaceData: 0, // 拍照匹配相似度
  882. prendreAutoCarme: false, // 是否发起授权相机
  883. studyTimer: null, // 学习记录定时器
  884. CountTo: 30, // 倒计时
  885. handoutTipLength: 0,
  886. menuAllList: [],
  887. popupPhotoShow: false,
  888. curPlayIndex: 0, // 正在播放的节的下标
  889. // h5
  890. vodPlayerJs: "https://player.polyv.net/script/player.js",
  891. player: "",
  892. H5isAllowSeek: "on",
  893. // stream: null,
  894. faceUrl: "",
  895. erJianErZao: false,
  896. pauseTime: 0,
  897. pauseTimer: null,
  898. barTimer: null,
  899. isReach: false,
  900. };
  901. },
  902. computed: {
  903. ...mapGetters([
  904. "userInfo",
  905. "playSectionId",
  906. "playChannelId",
  907. "playVID",
  908. "config",
  909. ]),
  910. playSecIsLearn() {
  911. return this.sectionItem.learning != 1;
  912. },
  913. },
  914. watch: {
  915. showSet(n) {
  916. if (n) {
  917. // var polyvPlayerContext = this.selectComponent("#playerVideo")
  918. if (polyvPlayerContext) {
  919. // #ifdef MP-WEIXIN
  920. polyvPlayerContext.pause();
  921. // #endif
  922. // #ifdef H5
  923. polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
  924. // #endif
  925. }
  926. }
  927. },
  928. photoPopup(n) {
  929. if (n) {
  930. if (this.prendreAutoCarme) {
  931. this.photoPopup = false;
  932. }
  933. this.showSet && (this.photoPopup = false);
  934. }
  935. },
  936. },
  937. async onLoad(option) {
  938. if (option.isOther) {
  939. this.showMark = true;
  940. return;
  941. }
  942. !this.userInfo && this.$api.refreshUserInfo();
  943. option.informId && this.clickOfficial(option.informId);
  944. this.courseId = Number(option.id) || "";
  945. this.goodsId = Number(option.goodsId);
  946. this.orderGoodsId = Number(option.orderGoodsId) || "";
  947. this.gradeId = option.gradeId;
  948. this.option = option;
  949. if (this.option.skipPort) {
  950. await this.$method.skipLogin(this.option.skipPort);
  951. }
  952. if (this.$method.isGoLogin()) {
  953. return;
  954. }
  955. await getPlaySection()
  956. this.courseCourseList();
  957. },
  958. async onShow() {
  959. console.log("12123123");
  960. },
  961. onUnload() {
  962. console.log("onUnloadonUnloadonUnloadonUnload");
  963. this.originUnload();
  964. this.clears();
  965. },
  966. onHide() {
  967. this.originUnload();
  968. },
  969. mounted() {},
  970. methods: {
  971. ...mapMutations(["updateChapterOpen", "updateLiveLast"]),
  972. // 新增微信公众号模板消息点击数据
  973. clickOfficial(informId) {
  974. this.$http({
  975. url: "/data/click",
  976. method: "post",
  977. data: { informId },
  978. });
  979. },
  980. // 点击课程目录
  981. cMenu(item, index) {
  982. this.subIndex = index;
  983. this.newActiveSubjectId = item.subjectId;
  984. },
  985. courseCourseList() {
  986. // /course/courseList查询商品下的课程列表
  987. this.courseList = [];
  988. this.menuList = [];
  989. this.photoConfig = false;
  990. this.$api
  991. .courseCourseList({
  992. pageNum: 1,
  993. pageSize: 200,
  994. goodsId: this.goodsId,
  995. gradeId: this.gradeId,
  996. orderGoodsId: this.orderGoodsId,
  997. })
  998. .then((res) => {
  999. if (res.data.code == 200) {
  1000. console.log(res.data,res.data.rows)
  1001. this.courseList = res.data.rows;
  1002. // 科目
  1003. let allItem = [{ subjectId: 0, subjectName: "所有" }];
  1004. let ids = [];
  1005. const newArr = [];
  1006. this.courseList.forEach((item) => {
  1007. if (ids.indexOf(item.subjectId) == -1) {
  1008. ids.push(item.subjectId);
  1009. newArr.push(item);
  1010. }
  1011. });
  1012. this.subList = [...allItem, ...newArr];
  1013. if (res.data.rows.length) {
  1014. this.courseBusiness(res.data.rows[0].businessId);
  1015. }
  1016. if (res.data.total > 1) {
  1017. this.getUserWatchLast();
  1018. // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
  1019. } else if (res.data.total == 1) {
  1020. this.originOnShow();
  1021. this.originMounted();
  1022. }
  1023. }
  1024. });
  1025. },
  1026. /**
  1027. * 获取业务层次详情
  1028. */
  1029. courseBusiness(businessId) {
  1030. // '/app/common/course/business/'+data,
  1031. this.$api.courseBusiness(businessId).then((res) => {
  1032. this.businessData = res.data.data;
  1033. });
  1034. },
  1035. // 查询用户最后一次看的录播的信息
  1036. getPlaySection() {
  1037. return this.$http({
  1038. url: "/study/record/getUserWatchLast",
  1039. method: "get",
  1040. data: {
  1041. orderGoodsId: this.orderGoodsId,
  1042. },
  1043. }).then((res) => {
  1044. if (res.data.code == 200) {
  1045. this.sectionItem = res.data.data || {};
  1046. }
  1047. return Promise.resolve()
  1048. });
  1049. },
  1050. // 查询用户最后一次看的录播的信息
  1051. getUserWatchLast() {
  1052. this.$http({
  1053. url: "/study/record/getUserWatchLast",
  1054. method: "get",
  1055. data: {
  1056. orderGoodsId: this.orderGoodsId,
  1057. },
  1058. }).then((res) => {
  1059. if (res.data.code == 200) {
  1060. console.log(res.data)
  1061. this.sectionItem = res.data.data || {};
  1062. if (res.data.data && Object.keys(res.data.data).length) {
  1063. //有最后一次看的录播的信息
  1064. this.courseId = res.data.data.courseId;
  1065. // console.log('查询用户最后一次看的录播的信息', res.data, this.courseId)
  1066. } else {
  1067. this.courseId = this.courseList[0].courseId; // 没有观看记录默认一个课程
  1068. // this.toggleCourseShow = true
  1069. }
  1070. } else {
  1071. this.courseId = this.courseList[0].courseId; // 没有观看记录默认一个课程
  1072. }
  1073. this.originOnShow();
  1074. this.originMounted();
  1075. //获取商品双师资模板
  1076. this.getCourseTeacher(this.courseList);
  1077. });
  1078. },
  1079. getCourseTeacher(rows) {
  1080. this.goodsTeacher = [];
  1081. //获取商品双师资模板
  1082. this.$api
  1083. .courseTeacherList({
  1084. goodsId: this.goodsId,
  1085. })
  1086. .then((res1) => {
  1087. if (res1.data.data && res1.data.data.length > 0) {
  1088. //课程老师模板
  1089. let teacherTel = res1.data.data;
  1090. //商品课程
  1091. let courses = rows;
  1092. teacherTel.forEach((tea) => {
  1093. let dataList = [];
  1094. let teacherList = [];
  1095. courses.forEach((item) => {
  1096. let data = tea.courseList.filter(
  1097. (x) => x.courseId == item.courseId
  1098. );
  1099. if (data && data.length > 0) {
  1100. dataList.push(item);
  1101. teacherList = tea.courseList;
  1102. }
  1103. });
  1104. let result = {
  1105. teaList: teacherList,
  1106. courseList: dataList,
  1107. };
  1108. this.goodsTeacher.push(result);
  1109. });
  1110. if (this.goodsTeacher && this.goodsTeacher.length > 0) {
  1111. let courseIds = [];
  1112. this.goodsTeacher.forEach((item) => {
  1113. item.courseList.forEach((course) => {
  1114. courseIds.push(course.courseId);
  1115. });
  1116. });
  1117. if (courseIds.length > 0) {
  1118. courses.forEach((item) => {
  1119. if (!courseIds.includes(item.courseId)) {
  1120. let data = {
  1121. teaList: [],
  1122. courseList: [],
  1123. };
  1124. data.courseList.push(item);
  1125. this.goodsTeacher.push(data);
  1126. }
  1127. });
  1128. }
  1129. this.goodsTeacher.forEach((item) => {
  1130. if (item.courseList && item.courseList.length > 0) {
  1131. item.courseList[0].show = 1;
  1132. }
  1133. });
  1134. }
  1135. } else {
  1136. //没有双师资模板
  1137. rows.forEach((item) => {
  1138. item.show = 1;
  1139. let data = {
  1140. teaList: [],
  1141. courseList: [],
  1142. };
  1143. data.courseList.push(item);
  1144. this.goodsTeacher.push(data);
  1145. });
  1146. }
  1147. // console.log(this.goodsTeacher,'this.goodsTeacher', this.courseId);
  1148. this.goodsTeacher.forEach((item) => {
  1149. if (item.courseList.some((x) => x.courseId == this.courseId)) {
  1150. this.teacherList = item.teaList;
  1151. }
  1152. });
  1153. });
  1154. },
  1155. erJianErZaoPauseTip() {
  1156. if (this.playSecIsLearn && this.erJianErZao) {
  1157. this.pauseTime = Date.now();
  1158. this.pauseTimer = setInterval(() => {
  1159. console.log("暂停时间", Date.now() - this.pauseTime);
  1160. if (Date.now() - this.pauseTime > 15 * 60 * 1000) {
  1161. // 15 * 60 * 1000
  1162. let text = this.photoPopup ? "拍照停留" : "暂停";
  1163. this.photoPopup = false;
  1164. uni.showModal({
  1165. title: "提示",
  1166. showCancel: false,
  1167. content: `检测${text}时间过长,刷新当前页面`,
  1168. cancelText: "取消",
  1169. confirmText: "确定",
  1170. success: (res) => {
  1171. if (res.confirm) {
  1172. // #ifdef H5
  1173. location.reload();
  1174. // #endif
  1175. // #ifdef MP-WEIXIN
  1176. this.courseCourseList();
  1177. // #endif
  1178. }
  1179. },
  1180. });
  1181. this.clearPauseTimer();
  1182. }
  1183. }, 5000);
  1184. }
  1185. },
  1186. // 原来onshow里面的内容
  1187. originOnShow() {
  1188. this.getbaseprofiletplists().then((res) => {
  1189. this.courseDetail();
  1190. this.getGoodsDetail();
  1191. this.getAnswerList();
  1192. this.studyRecordMenuAllList();
  1193. // this.answerTimer = setInterval(() => {
  1194. // this.getAnswerList();
  1195. // }, 5000);
  1196. let noteSecond = Number(this.option.noteSecond);
  1197. // console.log('noteSecondnoteSecond:', noteSecond, this.option)
  1198. if (noteSecond > 0) {
  1199. //我的消息跳过来,播放节
  1200. let item = {
  1201. sectionId: Number(this.option.sectionId),
  1202. recordingUrl: this.option.recordingUrl,
  1203. noteSecond: noteSecond,
  1204. studyDuration: noteSecond,
  1205. };
  1206. let playNextId = `moduleId${this.option.moduleId}chapterId${
  1207. this.option.chapterId
  1208. }sectionId${this.option.sectionId}${
  1209. this.option.isRebuild ? "isRebuild" : ""
  1210. }`;
  1211. this.$store.commit("setPlaySectionId", {
  1212. playSectionId: item.sectionId || item.menuId,
  1213. });
  1214. this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
  1215. this.$store.commit("updatePlayNextId", playNextId);
  1216. this.playNoteVideo(item);
  1217. } else {
  1218. this.studyRecordQueryLiveLast();
  1219. }
  1220. });
  1221. },
  1222. // 原来的mouted内容
  1223. originMounted() {
  1224. uni.$on("changeSection", (oldSectionId) => {
  1225. console.log(
  1226. "切换课程-originMounted->playVID:",
  1227. this.playVID,
  1228. oldSectionId
  1229. );
  1230. this.studyTimer && clearInterval(this.studyTimer); // 清除定时器
  1231. this.clearPauseTimer();
  1232. this.hasStart = false;
  1233. this.photoConfig = false;
  1234. this.photoIndex = 0;
  1235. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  1236. if (polyvPlayerContext) {
  1237. //解决同个节视频切换问题
  1238. // #ifdef MP-WEIXIN
  1239. polyvPlayerContext.seek(0);
  1240. polyvPlayerContext.pause();
  1241. // #endif
  1242. // #ifdef H5
  1243. polyvPlayerContext.j2s_seekVideo(0);
  1244. polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
  1245. // #endif
  1246. }
  1247. //清除直播
  1248. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  1249. this.postStudyRecord(0, oldSectionId);
  1250. });
  1251. uni.$on("getSection", (item) => {
  1252. //清除直播
  1253. this.studyTimer && clearInterval(this.studyTimer);
  1254. this.hasStart = false;
  1255. this.isPlayRebuild = item.rebuild;
  1256. this.photoConfig = false;
  1257. this.photoIndex = 0;
  1258. this.sectionItem = item;
  1259. this.moduleId = item.moduleId || null;
  1260. this.chapterId = item.chapterId || null;
  1261. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  1262. this.$store.commit("setPlaySectionId", {
  1263. playSectionId: item.sectionId || item.menuId,
  1264. });
  1265. //获取拍照历史
  1266. this.getPhotoLastRecord();
  1267. this.playVideo(item);
  1268. });
  1269. uni.$on("levelId", (item) => {
  1270. let arr = item.split("-");
  1271. //点击节获取的各层级ID
  1272. this.moduleId = arr[0];
  1273. this.chapterId = arr[1];
  1274. });
  1275. uni.$on("getChannel", (item) => {
  1276. //清除录播
  1277. this.studyTimer && clearInterval(this.studyTimer);
  1278. this.hasStart = false;
  1279. this.$store.commit("setPlayVID", { playVID: null });
  1280. this.moduleId = item.moduleId;
  1281. this.chapterId = item.chapterId;
  1282. this.$store.commit("setPlaySectionId", {
  1283. playSectionId: item.sectionId || item.menuId,
  1284. });
  1285. this.getPhotoLastRecord();
  1286. this.playChannel(item);
  1287. this.channelItem = item;
  1288. });
  1289. uni.$on("isRebuild", (item) => {
  1290. this.isRebuild = item;
  1291. });
  1292. this.updateChapterOpen(true);
  1293. },
  1294. clearPauseTimer() {
  1295. if (this.pauseTimer) {
  1296. this.pauseTime = 0;
  1297. clearInterval(this.pauseTimer);
  1298. this.pauseTimer = null;
  1299. }
  1300. },
  1301. // 原来onUnload里面的内容
  1302. originUnload() {
  1303. if (this.playSectionId > 0 && this.hasStart) {
  1304. //退出提交记录
  1305. this.postStudyRecord();
  1306. }
  1307. //清除正在播放的节ID
  1308. // this.$store.commit('setPlayObj',null)
  1309. this.$store.commit("setPlaySectionId", { playSectionId: 0 });
  1310. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  1311. this.$store.commit("setPlayVID", { playVID: null });
  1312. this.closePlv();
  1313. //移除所有的事件监听器
  1314. uni.$off();
  1315. this.clearTimer && clearTimeout(this.clearTimer);
  1316. this.toastTimer && clearTimeout(this.toastTimer);
  1317. if (this.studyTimer) {
  1318. clearInterval(this.studyTimer);
  1319. this.hasStart = false;
  1320. }
  1321. this.clearPauseTimer();
  1322. if (this.barTimer) {
  1323. clearInterval(this.barTimer);
  1324. this.barTimer = null;
  1325. }
  1326. this.timer && clearInterval(this.timer);
  1327. if (this.lockTimer) {
  1328. clearInterval(this.lockTimer);
  1329. this.$api
  1330. .lockDelLock({
  1331. action: "jxjy",
  1332. uuid: this.$method.getUuid(),
  1333. })
  1334. .then((res) => {
  1335. uni.hideLoading();
  1336. });
  1337. }
  1338. },
  1339. changeCourses() {
  1340. this.toggleCourseShow = true;
  1341. },
  1342. closePop() {
  1343. this.toggleCourseShow = false;
  1344. },
  1345. async activeFunc(item, index) {
  1346. this.teacherIndex = index;
  1347. let findResult = "";
  1348. this.goodsTeacher.forEach((citem, index) => {
  1349. citem.courseList.forEach((e, e_index) => {
  1350. if (e.courseId == item.courseId) {
  1351. findResult = e;
  1352. }
  1353. });
  1354. });
  1355. this.jump(findResult, 1);
  1356. },
  1357. // 进入学习
  1358. async jump(item, index, type) {
  1359. // console.log('item------>', index,item,this.goodsTeacher)
  1360. if (index == 0) {
  1361. await this.nextCourses(item, type);
  1362. if (item.rebuild === 0) {
  1363. //未重修
  1364. this.$navTo.togo("/pages2/learn/details", {
  1365. id: item.courseId,
  1366. gradeId: item.gradeId,
  1367. goodsId: this.goodsId,
  1368. orderGoodsId: this.orderGoodsId,
  1369. });
  1370. return;
  1371. }
  1372. this.$api.courseDetail(item.courseId).then((res) => {
  1373. if (res.data.code == 200) {
  1374. // if (res.data.data.educationName == "继续教育") {
  1375. this.$api
  1376. .lockLockStatus({
  1377. action: "jxjy",
  1378. uuid: this.$method.getUuid(),
  1379. })
  1380. .then((res) => {
  1381. if (res.data.code == 200) {
  1382. //有其他端在操作,不能学习
  1383. uni.showToast({
  1384. icon: "none",
  1385. title: res.data.msg,
  1386. mask: true,
  1387. duration: 3000,
  1388. });
  1389. } else if (res.data.code == 500) {
  1390. //可以学习
  1391. // this.$navTo.togo("/pages3/polyv/detail", {
  1392. // id: item.courseId,
  1393. // goodsId: this.goodsId,
  1394. // orderGoodsId: this.orderGoodsId,
  1395. // });
  1396. this.courseId = item.courseId;
  1397. this.originOnShow();
  1398. this.originMounted();
  1399. }
  1400. });
  1401. }
  1402. });
  1403. } else {
  1404. if (this.businessData.goodsLearningOrder == 2) {
  1405. //学习顺序是从头到尾学习,没学完上一课不能学习下一课
  1406. let prevItem = this.courseList[index - 1]; //上一课
  1407. if (prevItem.stuAllNum == prevItem.secAllNum) {
  1408. await this.nextCourses(item, type);
  1409. if (item.rebuild === 0) {
  1410. //未重修
  1411. this.$navTo.togo("/pages2/learn/details", {
  1412. id: item.courseId,
  1413. gradeId: item.gradeId,
  1414. goodsId: this.goodsId,
  1415. orderGoodsId: this.orderGoodsId,
  1416. });
  1417. return;
  1418. }
  1419. this.$api.courseDetail(item.courseId).then((res) => {
  1420. if (res.data.code == 200) {
  1421. // if (res.data.data.educationName == "继续教育") {
  1422. this.$api
  1423. .lockLockStatus({
  1424. action: "jxjy",
  1425. uuid: this.$method.getUuid(),
  1426. })
  1427. .then((res) => {
  1428. if (res.data.code == 200) {
  1429. //有其他端在操作,不能学习
  1430. uni.showToast({
  1431. icon: "none",
  1432. title: res.data.msg,
  1433. duration: 2000,
  1434. });
  1435. } else if (res.data.code == 500) {
  1436. //可以学习
  1437. // this.$navTo.togo("/pages3/polyv/detail", {
  1438. // id: item.courseId,
  1439. // goodsId: this.goodsId,
  1440. // orderGoodsId: this.orderGoodsId,
  1441. // });
  1442. this.courseId = item.courseId;
  1443. this.originOnShow();
  1444. this.originMounted();
  1445. }
  1446. });
  1447. }
  1448. });
  1449. } else {
  1450. uni.showToast({
  1451. icon: "none",
  1452. title: "请按顺序学完上一课再学习这一课",
  1453. });
  1454. }
  1455. } else {
  1456. await this.nextCourses(item, type);
  1457. if (item.rebuild === 0) {
  1458. //未重修
  1459. this.$navTo.togo("/pages2/learn/details", {
  1460. id: item.courseId,
  1461. gradeId: item.gradeId,
  1462. goodsId: this.goodsId,
  1463. orderGoodsId: this.orderGoodsId,
  1464. });
  1465. return;
  1466. }
  1467. this.$api.courseDetail(item.courseId).then((res) => {
  1468. if (res.data.code == 200) {
  1469. // if (res.data.data.educationName == "继续教育") {
  1470. this.$api
  1471. .lockLockStatus({
  1472. action: "jxjy",
  1473. uuid: this.$method.getUuid(),
  1474. })
  1475. .then((res) => {
  1476. if (res.data.code == 200) {
  1477. //有其他端在操作,不能学习
  1478. uni.showToast({
  1479. icon: "none",
  1480. title: res.data.msg,
  1481. duration: 2000,
  1482. });
  1483. } else if (res.data.code == 500) {
  1484. //可以学习
  1485. // this.$navTo.togo("/pages3/polyv/detail", {
  1486. // id: item.courseId,
  1487. // goodsId: this.goodsId,
  1488. // orderGoodsId: this.orderGoodsId,
  1489. // });
  1490. this.courseId = item.courseId;
  1491. this.originOnShow();
  1492. this.originMounted();
  1493. }
  1494. });
  1495. }
  1496. });
  1497. }
  1498. }
  1499. },
  1500. async nextCourses(item, type) {
  1501. this.vid = "";
  1502. this.hasStart = true;
  1503. await this.originUnload();
  1504. if (type) {
  1505. this.teacherIndex = 0;
  1506. this.goodsTeacher.forEach((citem) => {
  1507. if (citem.courseList.some((x) => x.courseId == item.courseId)) {
  1508. this.teacherList = citem.teaList;
  1509. }
  1510. });
  1511. }
  1512. this.reStart = false;
  1513. this.courseId = item.courseId;
  1514. this.gradeId = item.gradeId;
  1515. this.toggleCourseShow = false;
  1516. },
  1517. clickLeft() {
  1518. // uni.navigateBack()
  1519. uni.switchTab({
  1520. url: "/pages/learn/index",
  1521. });
  1522. },
  1523. markCancel() {
  1524. uni.navigateBack({
  1525. delta: 1,
  1526. });
  1527. },
  1528. markConfirm() {
  1529. uni.setClipboardData({
  1530. data: this.markContent,
  1531. success: function () {
  1532. setTimeout(() => {
  1533. uni.navigateBack({
  1534. delta: 1,
  1535. });
  1536. }, 1000);
  1537. },
  1538. });
  1539. },
  1540. closeNotice() {
  1541. this.$api
  1542. .baseHandoutTip({
  1543. orderGoodsId: this.orderGoodsId,
  1544. })
  1545. .then((res) => {});
  1546. },
  1547. noticeConfirm() {
  1548. if (this.CountTo < 0) {
  1549. this.noticeShow = false;
  1550. if (this.handoutTipLength == 0 && this.goodsPlayConfig.autoPlay > 0) {
  1551. this.autoplay = true;
  1552. // var polyvPlayerContext = this.selectComponent("#playerVideo")
  1553. // #ifdef MP-WEIXIN
  1554. polyvPlayerContext.play();
  1555. // #endif
  1556. // #ifdef H5
  1557. polyvPlayerContext.j2s_resumeVideo();
  1558. // #endif
  1559. }
  1560. }
  1561. },
  1562. baseHandoutTipList() {
  1563. this.$api
  1564. .baseHandoutTipList({
  1565. orderGoodsId: this.orderGoodsId,
  1566. })
  1567. .then((res) => {
  1568. this.handoutTipLength = res.data.rows.length;
  1569. if (res.data.rows.length == 0) {
  1570. this.noticeShow = true;
  1571. if (this.CountTo == 30) {
  1572. var timer = setInterval(() => {
  1573. this.CountTo--;
  1574. if (this.CountTo < 0) {
  1575. clearInterval(timer);
  1576. }
  1577. }, 1000);
  1578. }
  1579. } else {
  1580. this.CountTo = -1;
  1581. if (this.goodsPlayConfig && this.goodsPlayConfig.autoPlay > 0) {
  1582. // #ifdef MP-WEIXIN
  1583. this.autoplay = true;
  1584. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1585. polyvPlayerContext.play();
  1586. // #endif
  1587. // #ifdef H5
  1588. // polyvPlayerContext.j2s_resumeVideo()
  1589. // #endif
  1590. }
  1591. }
  1592. });
  1593. },
  1594. /**
  1595. * 获取上次观看的直播
  1596. */
  1597. studyRecordGetLastLive() {
  1598. this.$api
  1599. .studyRecordGetLastLive({
  1600. orderGoodsId: this.orderGoodsId,
  1601. courseId: this.courseId,
  1602. })
  1603. .then((res) => {
  1604. this.updateLiveLast(res.data.data);
  1605. });
  1606. },
  1607. studyRecordQueryLiveLast() {
  1608. // /study/record/queryLiveLast
  1609. this.$api
  1610. .studyRecordQueryLiveLast({
  1611. gradeId: this.gradeId,
  1612. orderGoodsId: this.orderGoodsId,
  1613. courseId: this.courseId,
  1614. })
  1615. .then(async (res) => {
  1616. if (res.data.data) {
  1617. this.moduleId = res.data.data.moduleId;
  1618. this.chapterId = res.data.data.chapterId;
  1619. if (res.data.data.sectionType == 1) {
  1620. //录播
  1621. this.$store.commit("setPlaySectionId", {
  1622. playSectionId: res.data.data.sectionId,
  1623. });
  1624. this.$store.commit("setPlayVID", {
  1625. playVID: res.data.data.recordingUrl,
  1626. });
  1627. this.sectionItem = res.data.data;
  1628. await this.getPhotoLastRecord(); // 获取拍照历史
  1629. this.playVideo(res.data.data);
  1630. } else if (res.data.data.sectionType == 2) {
  1631. //直播
  1632. this.studyRecordGetLastLive();
  1633. } else if (res.data.data.sectionType == 3) {
  1634. //回放
  1635. this.$store.commit("setPlaySectionId", {
  1636. playSectionId: res.data.data.sectionId,
  1637. });
  1638. this.$store.commit("setPlayVID", {
  1639. playVID: res.data.data.recordingUrl,
  1640. });
  1641. this.sectionItem = res.data.data;
  1642. this.playVideo(res.data.data);
  1643. }
  1644. // 查询用户最后一次看的录播的信息
  1645. this.$http({
  1646. url: "/study/record/getUserWatchLast",
  1647. method: "get",
  1648. data: {
  1649. orderGoodsId: this.orderGoodsId,
  1650. },
  1651. }).then((res) => {
  1652. if (res.data.code == 200) {
  1653. this.sectionItem = res.data.data || {};
  1654. }
  1655. });
  1656. }
  1657. });
  1658. },
  1659. /**
  1660. * 模块大节播放完毕,刷新列表
  1661. */
  1662. sectionPlayEnd(isRebuild, index) {
  1663. if (this.reMenuList.length > 0) {
  1664. //有重修目录
  1665. if (isRebuild.isRebuild) {
  1666. //从重修点击
  1667. this.$api
  1668. .reMenuList({
  1669. orderGoodsId: this.orderGoodsId,
  1670. courseId: this.courseId,
  1671. rebuild: 1,
  1672. gradeId: this.gradeId,
  1673. })
  1674. .then((res) => {
  1675. if (res.data.code == 200) {
  1676. if (res.data.rows.length) {
  1677. res.data.rows[index].name = res.data.rows[index].menuName;
  1678. this.$set(this.reMenuList, index, res.data.rows[index]);
  1679. for (let i = 0; i < res.data.rows.length; i++) {
  1680. let item = res.data.rows[i];
  1681. item.down = true;
  1682. item.id = item.menuId;
  1683. item.name = item.menuName;
  1684. }
  1685. this.reMenuList = [];
  1686. this.$nextTick(() => {
  1687. this.reMenuList = res.data.rows;
  1688. // console.log(this.reMenuList,'this.reMenuList1')
  1689. });
  1690. } else {
  1691. this.reMenuList = [];
  1692. }
  1693. this.$nextTick(() => {
  1694. if (this.reMenuList.length > 0) {
  1695. this.list = [
  1696. {
  1697. name: "目录",
  1698. },
  1699. {
  1700. name: "讲义",
  1701. },
  1702. {
  1703. name: "笔记",
  1704. },
  1705. {
  1706. name: "答疑",
  1707. },
  1708. { name: "重修目录" },
  1709. ];
  1710. } else {
  1711. this.list = [
  1712. {
  1713. name: "目录",
  1714. },
  1715. {
  1716. name: "讲义",
  1717. },
  1718. {
  1719. name: "笔记",
  1720. },
  1721. {
  1722. name: "答疑",
  1723. },
  1724. ];
  1725. if (this.current == 4) {
  1726. this.current = 0;
  1727. }
  1728. }
  1729. });
  1730. }
  1731. });
  1732. this.$api
  1733. .reMenuList({
  1734. courseId: this.courseId,
  1735. gradeId: this.gradeId,
  1736. orderGoodsId: this.orderGoodsId,
  1737. })
  1738. .then((res) => {
  1739. if (res.data.code == 200) {
  1740. for (let i = 0; i < res.data.rows.length; i++) {
  1741. let item = res.data.rows[i];
  1742. item.down = true;
  1743. item.id = item.menuId;
  1744. item.name = item.menuName;
  1745. item.menuType = item.type;
  1746. }
  1747. this.menuList = [];
  1748. this.$nextTick(() => {
  1749. this.menuList = res.data.rows;
  1750. });
  1751. }
  1752. });
  1753. } else {
  1754. //从普通目录点击
  1755. this.$api
  1756. .reMenuList({
  1757. courseId: this.courseId,
  1758. gradeId: this.gradeId,
  1759. orderGoodsId: this.orderGoodsId,
  1760. })
  1761. .then((res) => {
  1762. if (res.data.code == 200) {
  1763. res.data.rows[index].name = res.data.rows[index].menuName;
  1764. res.data.rows[index].id = res.data.rows[index].menuId;
  1765. this.$set(this.menuList, index, res.data.rows[index]);
  1766. }
  1767. });
  1768. this.$api
  1769. .reMenuList({
  1770. orderGoodsId: this.orderGoodsId,
  1771. courseId: this.courseId,
  1772. rebuild: 1,
  1773. gradeId: this.gradeId,
  1774. })
  1775. .then((res) => {
  1776. if (res.data.code == 200) {
  1777. if (res.data.rows.length) {
  1778. // for (let i = 0; i < res.data.rows.length; i++) {
  1779. // let item = res.data.rows[i];
  1780. // item.down = true;
  1781. // item.id = item.menuId;
  1782. // item.name = item.menuName;
  1783. // }
  1784. // this.reMenuList = res.data.rows;
  1785. } else {
  1786. this.reMenuList = [];
  1787. }
  1788. this.$nextTick(() => {
  1789. if (this.reMenuList.length > 0) {
  1790. this.list = [
  1791. {
  1792. name: "目录",
  1793. },
  1794. {
  1795. name: "讲义",
  1796. },
  1797. {
  1798. name: "笔记",
  1799. },
  1800. {
  1801. name: "答疑",
  1802. },
  1803. { name: "重修目录" },
  1804. ];
  1805. } else {
  1806. this.list = [
  1807. {
  1808. name: "目录",
  1809. },
  1810. {
  1811. name: "讲义",
  1812. },
  1813. {
  1814. name: "笔记",
  1815. },
  1816. {
  1817. name: "答疑",
  1818. },
  1819. ];
  1820. if (this.current == 4) {
  1821. this.current = 0;
  1822. }
  1823. }
  1824. });
  1825. }
  1826. });
  1827. }
  1828. } else {
  1829. console.log("--模块大节播放完毕,刷新列表-");
  1830. //没有重修目录
  1831. this.$api
  1832. .reMenuList({
  1833. courseId: this.courseId,
  1834. gradeId: this.gradeId,
  1835. orderGoodsId: this.orderGoodsId,
  1836. })
  1837. .then((res) => {
  1838. if (res.data.code == 200) {
  1839. res.data.rows[index].name = res.data.rows[index].menuName;
  1840. res.data.rows[index].id = res.data.rows[index].menuId;
  1841. this.$set(this.menuList, index, res.data.rows[index]);
  1842. }
  1843. });
  1844. }
  1845. },
  1846. goLive(item) {
  1847. let moduleId = item.moduleId || 0;
  1848. let chapterId = item.chapterId || 0;
  1849. let sectionId = item.sectionId || item.menuId;
  1850. let uuid = new Date().valueOf() + "";
  1851. // buyCourse 是否购买课程:1是 0否
  1852. let encode = encodeURIComponent(
  1853. this.config.hostLive +
  1854. "/pages/live/index?token=" +
  1855. uni.getStorageSync("token") +
  1856. "&userInfo=" +
  1857. JSON.stringify(this.userInfo) +
  1858. "&channelId=" +
  1859. item.liveUrl +
  1860. "&gradeId=" +
  1861. this.gradeId +
  1862. "&courseId=" +
  1863. this.courseId +
  1864. "&goodsId=" +
  1865. this.goodsId +
  1866. "&orderGoodsId=" +
  1867. this.orderGoodsId +
  1868. "&sectionId=" +
  1869. sectionId +
  1870. "&chapterId=" +
  1871. chapterId +
  1872. "&moduleId=" +
  1873. moduleId +
  1874. "&buyCourse=1" +
  1875. "&ident=" +
  1876. uuid
  1877. );
  1878. uni.navigateTo({
  1879. url: `../../pages/webview/index?url=` + encode,
  1880. });
  1881. },
  1882. studyRecordMenuAllList() {
  1883. // study/record/menuAllList
  1884. this.$api
  1885. .studyRecordMenuAllList({
  1886. courseId: this.courseId,
  1887. gradeId: this.gradeId,
  1888. goodsId: this.goodsId,
  1889. })
  1890. .then((res) => {
  1891. let nowTime = Number(new Date().getTime() / 1000).toFixed(0);
  1892. if (res.data.data) {
  1893. this.menuAllList = res.data.data;
  1894. // console.log('======0', this.sectionItem);
  1895. this.livingItem = res.data.data.find(
  1896. (item) =>
  1897. item.liveStartTime <= nowTime && item.liveEndTime > nowTime
  1898. );
  1899. }
  1900. });
  1901. },
  1902. getbaseprofiletplists() {
  1903. return new Promise((resolve) => {
  1904. let self = this;
  1905. // #ifdef MP-WEIXIN
  1906. this.getCameraSetting();
  1907. // #endif
  1908. this.$api
  1909. .getbaseprofiletplists({
  1910. goodsId: self.goodsId,
  1911. orderGoodsId: this.orderGoodsId,
  1912. })
  1913. .then((res) => {
  1914. if (res.data.code === 200 && res.data.rows.length) {
  1915. if (res.data.rows[0].keyValue) {
  1916. self.$api.getbaseprofiletpId(self.goodsId).then((baseRes) => {
  1917. if (baseRes.data.code === 200) {
  1918. if (baseRes.data.data) {
  1919. // base/profile/tp/getInfo
  1920. self.$api
  1921. .getbaseprofiletpgetInfo({
  1922. goodsId: self.goodsId,
  1923. orderGoodsId: self.orderGoodsId,
  1924. })
  1925. .then((result) => {
  1926. if (result.data.code === 200) {
  1927. if (
  1928. !result.data.data ||
  1929. (result.data.data.status === 3 &&
  1930. result.data.data.changeStatus === 1)
  1931. ) {
  1932. if (!result.data.data) {
  1933. self.needProfileModal = true;
  1934. uni.showModal({
  1935. content: "请前往填写资料",
  1936. cancelText: "返回",
  1937. success: function (resultst) {
  1938. if (resultst.confirm) {
  1939. self.$navTo.togo("/pages2/verify/input", {
  1940. id: self.goodsId,
  1941. orderGoodsId: self.orderGoodsId,
  1942. });
  1943. }
  1944. if (resultst.cancel) {
  1945. uni.navigateBack();
  1946. }
  1947. },
  1948. });
  1949. } else {
  1950. self.needProfileModal = true;
  1951. uni.showModal({
  1952. content: "资料审核不通过,请前往重新填写",
  1953. cancelText: "返回",
  1954. success: function (resultst) {
  1955. if (resultst.confirm) {
  1956. self.$navTo.togo("/pages2/verify/input", {
  1957. id: self.goodsId,
  1958. orderGoodsId: self.orderGoodsId,
  1959. });
  1960. }
  1961. if (resultst.cancel) {
  1962. uni.navigateBack();
  1963. }
  1964. },
  1965. });
  1966. }
  1967. } else if (
  1968. result.data.data.status === 1 &&
  1969. JSON.parse(res.data.rows[0].keyValue2)[0]
  1970. ) {
  1971. self.$api
  1972. .getbaseprofileStampgetInfo({
  1973. goodsId: self.goodsId,
  1974. orderGoodsId: self.orderGoodsId,
  1975. })
  1976. .then((k) => {
  1977. if (k.data.code === 200) {
  1978. if (
  1979. !k.data.data ||
  1980. (k.data.data.status === 3 &&
  1981. k.data.data.changeStatus === 1)
  1982. ) {
  1983. if (!k.data.data) {
  1984. self.needProfileModal = true;
  1985. uni.showModal({
  1986. cancelText: "返回",
  1987. content: "请前往填写盖章资料",
  1988. success: function (resultst) {
  1989. if (resultst.confirm) {
  1990. self.$navTo.togo(
  1991. "/pages2/verify/input2",
  1992. {
  1993. id: self.goodsId,
  1994. orderGoodsId:
  1995. self.orderGoodsId,
  1996. }
  1997. );
  1998. }
  1999. if (resultst.cancel) {
  2000. uni.navigateBack();
  2001. }
  2002. },
  2003. });
  2004. } else {
  2005. self.needProfileModal = true;
  2006. uni.showModal({
  2007. cancelText: "返回",
  2008. content:
  2009. "资料盖章审核不通过,请前往重新填写",
  2010. success: function (resultst) {
  2011. if (resultst.confirm) {
  2012. self.$navTo.togo(
  2013. "/pages2/verify/input2",
  2014. {
  2015. id: self.goodsId,
  2016. orderGoodsId:
  2017. self.orderGoodsId,
  2018. }
  2019. );
  2020. }
  2021. if (resultst.cancel) {
  2022. uni.navigateBack();
  2023. }
  2024. },
  2025. });
  2026. }
  2027. } else {
  2028. resolve();
  2029. }
  2030. }
  2031. });
  2032. } else {
  2033. resolve();
  2034. }
  2035. }
  2036. });
  2037. } else {
  2038. resolve();
  2039. }
  2040. }
  2041. });
  2042. } else {
  2043. resolve();
  2044. }
  2045. } else {
  2046. resolve();
  2047. }
  2048. });
  2049. if (this.gradeId > 0) {
  2050. //提交完资料返回判断是否已开班
  2051. this.getGradeInfo();
  2052. }
  2053. });
  2054. },
  2055. // /**
  2056. // * 获取业务层次详情
  2057. // */
  2058. // courseBusiness() {
  2059. // this.$api.courseBusiness(this.goodsData.businessId).then((res) => {
  2060. // this.businessData = res.data.data;
  2061. // });
  2062. // },
  2063. /**
  2064. * 计算tabs宽度
  2065. */
  2066. itemWidth() {
  2067. return 100 / this.list.length + "%";
  2068. },
  2069. findMenuNextSection(index) {
  2070. for (let i = index + 1; i < this.reMenuList.length; i++) {
  2071. let item = this.reMenuList[i];
  2072. if (item.type == 3) {
  2073. return item;
  2074. }
  2075. }
  2076. return {};
  2077. },
  2078. loadedmetadata(event) {
  2079. if (this.hasStart) {
  2080. // 防止loadedmetadata事件第二次触发
  2081. return;
  2082. }
  2083. // #ifdef MP-WEIXIN
  2084. polyvPlayerContext = this.selectComponent("#playerVideo");
  2085. // #endif
  2086. this.hasStart = true;
  2087. uni.$off("playPause");
  2088. uni.$on("playPause", () => {
  2089. // #ifdef MP-WEIXIN
  2090. polyvPlayerContext.pause();
  2091. // #endif
  2092. // #ifdef H5
  2093. polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
  2094. // #endif
  2095. });
  2096. if (!this.recordObj.videoCurrentTime) {
  2097. //新视频直接提交一条观看记录
  2098. this.postStudyRecord(0);
  2099. }
  2100. this.studyTimer && clearInterval(this.studyTimer);
  2101. this.studyTimer = setInterval(() => {
  2102. this.postStudyRecord(0);
  2103. }, 15000);
  2104. },
  2105. getPhotoLastRecord() {
  2106. if (this.erJianErZao) {
  2107. return;
  2108. }
  2109. let self = this;
  2110. let data = {
  2111. sectionId: parseInt(self.playSectionId),
  2112. goodsId: parseInt(self.goodsId),
  2113. courseId: parseInt(self.courseId),
  2114. gradeId: parseInt(self.gradeId),
  2115. chapterId: parseInt(self.chapterId),
  2116. moduleId: parseInt(self.moduleId),
  2117. orderGoodsId: this.orderGoodsId,
  2118. };
  2119. // /course/photo/log/getLastInfo'
  2120. this.$api.getPhotoLastRecord(data).then((res) => {
  2121. if (res.data.code == 200) {
  2122. //清空历史数据
  2123. self.photoHistoryList = [];
  2124. this.photoIndex = 0;
  2125. self.photoList = [];
  2126. for (let i = 0; i < res.data.data.length; i++) {
  2127. //-2存储随机拍照数组
  2128. if (res.data.data[i].photoIndex == -2) {
  2129. self.photoList =
  2130. res.data.data[i].timeInterval &&
  2131. res.data.data[i].timeInterval.split(",");
  2132. } else {
  2133. self.photoHistoryList.push(res.data.data[i].photoIndex);
  2134. }
  2135. }
  2136. // console.log('7777', this.photoHistoryList, this.photoList);
  2137. }
  2138. });
  2139. },
  2140. //postTime 只提交随机时间
  2141. postCoursePhotoRecord(postTime = false) {
  2142. return new Promise((resolve, reject) => {
  2143. let currentTime = 0;
  2144. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2145. if (polyvPlayerContext) {
  2146. // #ifdef MP-WEIXIN
  2147. currentTime = polyvPlayerContext.getCurrentTime();
  2148. // #endif
  2149. // #ifdef H5
  2150. currentTime = polyvPlayerContext.j2s_getCurrentTime();
  2151. // #endif
  2152. }
  2153. let self = this;
  2154. let photoIndex = self.photoIndex;
  2155. let data = {
  2156. photo: self.ossAvatarUrl,
  2157. sectionId: parseInt(self.playSectionId),
  2158. goodsId: parseInt(self.goodsId),
  2159. courseId: parseInt(self.courseId),
  2160. photoTime: parseInt(currentTime > 0 ? currentTime : 0),
  2161. gradeId: parseInt(self.gradeId),
  2162. photoIndex: postTime ? -2 : parseInt(photoIndex), //从0算起,-2只提交随机时间
  2163. photoNum: parseInt(self.photoNum),
  2164. chapterId: parseInt(self.chapterId),
  2165. moduleId: parseInt(self.moduleId),
  2166. timeInterval: postTime ? self.photoList.join(",") : "",
  2167. orderGoodsId: this.orderGoodsId,
  2168. };
  2169. // console.log("提交接口", data);
  2170. this.$api
  2171. .coursePhotoRecord(data)
  2172. .then((res) => {
  2173. if (res.data.code == 200) {
  2174. resolve();
  2175. } else {
  2176. reject();
  2177. }
  2178. })
  2179. .catch((err) => {
  2180. reject();
  2181. });
  2182. });
  2183. },
  2184. randomNum(minNum, maxNum) {
  2185. switch (arguments.length) {
  2186. case 1:
  2187. return parseInt(Math.random() * minNum + 1, 10);
  2188. break;
  2189. case 2:
  2190. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  2191. break;
  2192. default:
  2193. return 0;
  2194. break;
  2195. }
  2196. },
  2197. //配置随机拍照时间
  2198. configPhoto() {
  2199. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2200. let totalVideoTime = 0;
  2201. let duration = 0;
  2202. // #ifdef MP-WEIXIN
  2203. totalVideoTime = polyvPlayerContext.getDuration();
  2204. duration = polyvPlayerContext.getCurrentTime();
  2205. // #endif
  2206. // #ifdef H5
  2207. totalVideoTime = polyvPlayerContext.j2s_getDuration();
  2208. duration = polyvPlayerContext.j2s_getCurrentTime();
  2209. // #endif
  2210. let photoNum = this.photoNum;
  2211. if (!this.photoConfig) {
  2212. this.photoConfig = true;
  2213. if (this.erJianErZao) {
  2214. this.photoList = this.randomConfig(totalVideoTime, duration);
  2215. return;
  2216. }
  2217. //没有历史拍照间隔数据
  2218. if (this.photoList.length == 0) {
  2219. if (totalVideoTime >= 900) {
  2220. //大于15分钟
  2221. if (photoNum == 1) {
  2222. //开头拍1张
  2223. this.photoList.push(0);
  2224. } else if (photoNum == 3) {
  2225. //拍3张
  2226. this.photoList.push(0); //开头拍一张
  2227. let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
  2228. let centerMinTime = centerTime - 300; //前后5分钟
  2229. let centerMaxTime = centerTime + 300;
  2230. let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
  2231. this.photoList.push(centerTakeTime); //中间拍一张
  2232. let endMaxTime = totalVideoTime - 60;
  2233. let endMinTime = totalVideoTime - 300;
  2234. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  2235. this.photoList.push(endTakeTime); //最后拍一张
  2236. }
  2237. } else {
  2238. //小于15分钟,只拍前后各一张
  2239. if (photoNum == 1) {
  2240. //开头拍1张
  2241. this.photoList.push(0);
  2242. } else if (photoNum == 3) {
  2243. this.photoList.push(1);
  2244. let centerTime = this.randomNum(
  2245. (1 / 3) * totalVideoTime,
  2246. (2 / 3) * totalVideoTime
  2247. );
  2248. this.photoList.push(centerTime);
  2249. let endTakeTime = this.randomNum(
  2250. (2 / 3) * totalVideoTime,
  2251. totalVideoTime
  2252. );
  2253. this.photoList.push(endTakeTime);
  2254. }
  2255. }
  2256. this.postCoursePhotoRecord(true); //提交随机拍照时间数组
  2257. }
  2258. //兼容已有观看历史
  2259. for (let i = 0; i < this.photoList.length - 1; i++) {
  2260. if (
  2261. this.photoList[i] < duration &&
  2262. this.photoList[i + 1] > duration
  2263. ) {
  2264. this.photoIndex = i + 1;
  2265. break;
  2266. }
  2267. if (duration > this.photoList[this.photoList.length - 1]) {
  2268. this.photoIndex = this.photoList.length - 1; //取最后一个下标
  2269. break;
  2270. }
  2271. }
  2272. }
  2273. },
  2274. // 随机拍摄时间
  2275. randomConfig(totalVideoTime, duration) {
  2276. this.photoHistoryList = [];
  2277. let photoList = [duration];
  2278. let pre = duration;
  2279. if (totalVideoTime > 300) {
  2280. while (pre <= totalVideoTime) {
  2281. pre += this.randomNum(780, 900);
  2282. pre <= totalVideoTime && photoList.push(pre);
  2283. }
  2284. if (totalVideoTime - 300 > photoList.slice(-1)[0]) {
  2285. photoList.push(this.randomNum(totalVideoTime - 180, totalVideoTime));
  2286. }
  2287. }
  2288. return photoList;
  2289. },
  2290. getLiveUid(channelId) {
  2291. let self = this;
  2292. return new Promise((resolve) => {
  2293. let data = {
  2294. channelId: channelId,
  2295. orderGoodsId: this.orderGoodsId,
  2296. };
  2297. self.$api.polyvSign(data).then((res) => {
  2298. resolve(res.data.data);
  2299. });
  2300. });
  2301. },
  2302. timeEventLiving() {
  2303. if (plv != null) {
  2304. if (this.livePlay) {
  2305. this.liveDuration = this.liveDuration + 1; //每隔1秒
  2306. if (this.liveDuration == 2) {
  2307. //直播第2秒拍照
  2308. if (
  2309. this.goodsPhotographConfig &&
  2310. this.goodsPhotographConfig.livephotograph == 1 &&
  2311. this.channelItem.learning != 1 &&
  2312. this.photoHistoryList.length == 0
  2313. ) {
  2314. //开启直播拍照
  2315. this.openPhoto();
  2316. } else {
  2317. this.postStudyRecord(0);
  2318. }
  2319. }
  2320. }
  2321. }
  2322. },
  2323. playerLiveStatusChange(e) {
  2324. const status = e.detail.status;
  2325. if (status === "live") {
  2326. //开始播放
  2327. if (this.timer) {
  2328. clearInterval(this.timer);
  2329. }
  2330. this.livePlay = true;
  2331. this.timer = setInterval(this.timeEventLiving, 1000); //定时器
  2332. }
  2333. if (status === "end") {
  2334. this.hasStart = false;
  2335. if (this.livePlay) {
  2336. //只有播放过的结束才提交,避免未开播触发结束
  2337. this.postStudyRecord(1);
  2338. }
  2339. this.livePlay = false;
  2340. // 未开始
  2341. }
  2342. },
  2343. closePlv() {
  2344. if (plv) {
  2345. plv.destroy();
  2346. }
  2347. },
  2348. playChannel(item) {
  2349. if (this.timer) {
  2350. clearInterval(this.timer);
  2351. }
  2352. this.startStatus = true;
  2353. this.initLive();
  2354. },
  2355. setLiveOption(status) {
  2356. const { userId, channelId, recordFileSimpleModel, playbackEnabled } =
  2357. this.detail;
  2358. const playRecordFile =
  2359. playbackEnabled && recordFileSimpleModel && status === "end";
  2360. this.videoOption = {
  2361. mode: "live",
  2362. uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
  2363. cid: this.playChannelId,
  2364. openId: this.userInfo.userAccount,
  2365. isAutoChange: false,
  2366. forceVideo: false,
  2367. };
  2368. },
  2369. async initLive() {
  2370. this.liveObj = await this.getLiveUid(this.playChannelId);
  2371. this.initLiveOk = true;
  2372. let optionsData = {};
  2373. optionsData.mode = "live";
  2374. optionsData.forceVideo = false;
  2375. optionsData.channelId = this.playChannelId; // 频道ID '2553128'
  2376. optionsData.openId = this.userInfo.userAccount; // 用户openId this.userInfo.userAccount 'oQ5eX5BCtSjkE1ct8CzvxGWgh0hQ'
  2377. optionsData.userId = this.liveObj.uid; // 2.0.0及以上版本的demo需要使用 userId 设置学员唯一id 'egsxlptzdq'
  2378. let self = this;
  2379. this.closePlv();
  2380. plv.init(optionsData).then(({ detail, chat }) => {
  2381. self.liveDetail = detail;
  2382. // 设置mode为live的videoOption
  2383. this.setLiveOption();
  2384. if (detail.isPPT) {
  2385. chat.on(chat.events.SLICESTART, () => {
  2386. // 开始直播
  2387. });
  2388. } else {
  2389. plv.api.getOrdinaryLiveStatus(detail.stream);
  2390. }
  2391. });
  2392. },
  2393. openSetting(res) {
  2394. console.log(res, 98);
  2395. },
  2396. getCameraSetting() {
  2397. const self = this;
  2398. // 不支持h5
  2399. wx.getSetting({
  2400. success: (res) => {
  2401. if (res.authSetting["scope.camera"]) {
  2402. // 用户已经授权
  2403. self.showSet = false;
  2404. this.prendreAutoCarme = false;
  2405. } else {
  2406. this.prendreAutoCarme = true;
  2407. // 用户还没有授权,向用户发起授权请求
  2408. wx.authorize({
  2409. scope: "scope.camera",
  2410. success: () => {
  2411. // 用户同意授权
  2412. self.showSet = false;
  2413. this.prendreAutoCarme = false;
  2414. },
  2415. fail: () => {
  2416. // 用户不同意授权
  2417. self.showSet = true;
  2418. },
  2419. });
  2420. }
  2421. },
  2422. fail: (res) => {},
  2423. });
  2424. },
  2425. studyNotice() {
  2426. this.noticeShow = true;
  2427. },
  2428. //播放笔记视频
  2429. async playNoteVideo(item) {
  2430. if (this.timer) {
  2431. clearInterval(this.timer);
  2432. }
  2433. if (this.vid) {
  2434. //切换视频
  2435. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2436. polyvPlayerContext.changeVid(item.recordingUrl);
  2437. } else {
  2438. this.vid = item.recordingUrl;
  2439. }
  2440. this.recordObj = { videoCurrentTime: item.noteSecond };
  2441. if (this.recordObj.videoCurrentTime) {
  2442. this.needSeek = true; //需要跳转到播放记录
  2443. }
  2444. this.startStatus = true;
  2445. //获取节笔记
  2446. this.getNoteList();
  2447. },
  2448. //正常播放视频
  2449. async playVideo(item) {
  2450. if (this.timer) {
  2451. clearInterval(this.timer);
  2452. }
  2453. // #ifdef H5
  2454. await this.clears();
  2455. // #endif
  2456. if (this.vid) {
  2457. //切换视频
  2458. polyvPlayerContext && polyvPlayerContext.changeVid(item.recordingUrl);
  2459. } else {
  2460. this.vid = item.recordingUrl;
  2461. }
  2462. this.recordObj = null;
  2463. this.recordObj = await this.getRecordLast();
  2464. this.needSeek = true; //跳转到播放记录
  2465. this.startStatus = true;
  2466. // #ifdef H5
  2467. await this.loadPlayerScript(this.loadPlayer);
  2468. // #endif
  2469. // 提交学习记录
  2470. // #ifdef MP-WEIXIN
  2471. this.postStudyRecord(0);
  2472. // #endif
  2473. //获取节笔记
  2474. this.getNoteList();
  2475. },
  2476. getRecordLast() {
  2477. return new Promise((resolve) => {
  2478. let data = {
  2479. gradeId:
  2480. this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
  2481. goodsId:
  2482. this.goodsId || this.goodsId == 0 ? Number(this.goodsId) : null,
  2483. sectionId: this.playSectionId || 0,
  2484. courseId:
  2485. this.courseId || this.courseId == 0 ? Number(this.courseId) : null,
  2486. chapterId: this.chapterId || 0,
  2487. moduleId: this.moduleId || 0,
  2488. orderGoodsId: this.orderGoodsId,
  2489. };
  2490. this.$api.recordLast(data).then((res) => {
  2491. resolve(res.data.data);
  2492. });
  2493. });
  2494. },
  2495. jumpNote(item) {
  2496. this.noteId = item.noteId;
  2497. //没视频播放
  2498. if (this.playSectionId == 0) {
  2499. this.$u.toast("即将跳到笔记位置");
  2500. this.$store.commit("setPlaySectionId", {
  2501. playSectionId: item.sectionId || item.menuId,
  2502. });
  2503. this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
  2504. this.playNoteVideo(item);
  2505. } else {
  2506. //正在看当前笔记视频
  2507. this.$u.toast("即将跳到笔记位置");
  2508. //跳到笔记时刻
  2509. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2510. // #ifdef MP-WEIXIN
  2511. polyvPlayerContext.seek(item.noteSecond);
  2512. polyvPlayerContext.play();
  2513. // #endif
  2514. // #ifdef H5
  2515. polyvPlayerContext.j2s_seekVideo(0);
  2516. polyvPlayerContext.j2s_resumeVideo();
  2517. // #endif
  2518. }
  2519. },
  2520. postNote() {
  2521. let self = this;
  2522. if (!(this.playSectionId > 0)) {
  2523. this.$u.toast("目前无播放视频");
  2524. return;
  2525. }
  2526. if (!this.noteValue) {
  2527. this.$u.toast("请输入内容");
  2528. return;
  2529. }
  2530. if (!this.gradeId) {
  2531. this.$u.toast("暂无班级数据");
  2532. return;
  2533. }
  2534. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2535. let noteDate = this.$method.getZeroTime();
  2536. let noteSecond = 0;
  2537. // #ifdef MP-WEIXIN
  2538. noteSecond = polyvPlayerContext.getCurrentTime();
  2539. // #endif
  2540. // #ifdef H5
  2541. noteSecond = polyvPlayerContext.j2s_getCurrentTime();
  2542. // #endif
  2543. if (!noteSecond) {
  2544. if (noteSecond == 0) {
  2545. //播放结束
  2546. // #ifdef MP-WEIXIN
  2547. noteSecond = polyvPlayerContext.getDuration();
  2548. // #endif
  2549. // #ifdef H5
  2550. noteSecond = polyvPlayerContext.j2s_getCurrentTime();
  2551. // #endif
  2552. }
  2553. if (!noteSecond) {
  2554. this.$u.toast("视频暂未开始");
  2555. return;
  2556. }
  2557. }
  2558. let data = {
  2559. gradeId: this.gradeId,
  2560. goodsId: this.goodsId,
  2561. sectionId: this.playSectionId,
  2562. courseId: this.courseId,
  2563. noteText: this.noteValue,
  2564. noteDate: noteDate,
  2565. noteSecond: noteSecond,
  2566. orderGoodsId: this.orderGoodsId,
  2567. };
  2568. this.$api.postNote(data).then((res) => {
  2569. if (res.data.code == 200) {
  2570. this.$u.toast("发布成功");
  2571. self.getNoteList();
  2572. this.noteValue = "";
  2573. }
  2574. });
  2575. },
  2576. getGradeInfo() {
  2577. let self = this;
  2578. this.$store.state.allowLoading = false;
  2579. this.$api.goodsGradeInfo(this.gradeId).then((res) => {
  2580. if (res.data.code == 200) {
  2581. self.gradeDetail = res.data.data;
  2582. if (self.needProfileModal) {
  2583. return;
  2584. }
  2585. if (self.gradeDetail.learningStatus == 2) {
  2586. uni.showModal({
  2587. showCancel: false,
  2588. confirmText: "确定",
  2589. content:
  2590. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  2591. success: function (resultst) {
  2592. uni.navigateBack();
  2593. },
  2594. });
  2595. }
  2596. if (
  2597. self.gradeDetail.learningStatus == 3 &&
  2598. Number(self.gradeDetail.learningTimeStart) >
  2599. Number(new Date() / 1000)
  2600. ) {
  2601. uni.showModal({
  2602. showCancel: false,
  2603. cancelText: "返回",
  2604. content:
  2605. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  2606. success: function (resultst) {
  2607. uni.navigateBack();
  2608. },
  2609. });
  2610. }
  2611. }
  2612. });
  2613. this.$store.state.allowLoading = true;
  2614. },
  2615. getNoteList() {
  2616. let self = this;
  2617. self.noteList = [];
  2618. let data = {
  2619. courseId: this.courseId,
  2620. gradeId: this.gradeId,
  2621. goodsId: this.goodsId,
  2622. orderGoodsId: this.orderGoodsId,
  2623. };
  2624. if (this.playSectionId > 0) {
  2625. data.sectionId = this.playSectionId;
  2626. }
  2627. this.$api.noteList(data).then((res) => {
  2628. if (res.data.code == 200) {
  2629. self.noteList = res.data.rows;
  2630. }
  2631. });
  2632. },
  2633. delAnswer(answerId) {
  2634. let self = this;
  2635. let data = {
  2636. answerId: answerId,
  2637. status: -1,
  2638. orderGoodsId: this.orderGoodsId,
  2639. };
  2640. this.$api.delAnswer(data).then((res) => {
  2641. if (res.data.code == 200) {
  2642. self.getAnswerList();
  2643. }
  2644. });
  2645. },
  2646. clearCtx() {
  2647. this.placeholder = "您可以在这里输入答疑内容";
  2648. this.ctxValue = "";
  2649. this.assignUserId = 0;
  2650. },
  2651. focusNote(event) {
  2652. this.bottomHeight = event.detail.height;
  2653. },
  2654. blurNote() {
  2655. this.bottomHeight = 0;
  2656. },
  2657. blur() {
  2658. this.bottomHeight = 0;
  2659. this.clearTimer = setTimeout(() => {
  2660. this.ctxValue = "";
  2661. this.isFocus = false;
  2662. this.assignUserId = 0;
  2663. this.placeholder = "您可以在这里输入答疑内容";
  2664. }, 2000);
  2665. },
  2666. replyContent(item) {
  2667. this.isFocus = true;
  2668. this.assignUserId = item.userId;
  2669. this.placeholder = "@" + item.realname;
  2670. },
  2671. delContent(item) {
  2672. this.delAnswer(item.answerId);
  2673. },
  2674. postAnswer() {
  2675. let self = this;
  2676. let data = {
  2677. courseId: this.courseId,
  2678. answerText: this.ctxValue,
  2679. goodsId: this.goodsId,
  2680. orderGoodsId: this.orderGoodsId,
  2681. };
  2682. if (this.assignUserId > 0) {
  2683. data.assignUserId = this.assignUserId;
  2684. }
  2685. this.$api.postAnswer(data).then((res) => {
  2686. if (res.data.code == 200) {
  2687. this.$u.toast("发布成功");
  2688. self.getAnswerList();
  2689. this.isFocus = false;
  2690. this.placeholder = "您可以在这里输入答疑内容";
  2691. this.ctxValue = "";
  2692. this.assignUserId = 0;
  2693. }
  2694. });
  2695. },
  2696. postContent() {
  2697. if (!this.ctxValue || this.ctxValue == "") {
  2698. this.$u.toast("请输入内容");
  2699. return;
  2700. }
  2701. this.postAnswer();
  2702. },
  2703. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  2704. let currentTime = 0;
  2705. let PlayDuration = 0;
  2706. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2707. if (polyvPlayerContext) {
  2708. // #ifdef MP-WEIXIN
  2709. currentTime = polyvPlayerContext.getCurrentTime(); //获取视频当前的播放时刻
  2710. PlayDuration = polyvPlayerContext.getVideoPlayDuration(); //本次看的时长
  2711. // #endif
  2712. // #ifdef H5
  2713. currentTime = polyvPlayerContext.j2s_getCurrentTime(); //当前视频播放时刻
  2714. PlayDuration = polyvPlayerContext.j2s_realPlayVideoTime(); //本次看的时长
  2715. // #endif
  2716. }
  2717. if (this.playChannelId > 0) {
  2718. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  2719. }
  2720. let self = this;
  2721. let data = {
  2722. fromPlat: 1, //来源平台 1小程序 2网站
  2723. photo: self.ossAvatarUrl,
  2724. sectionId: sectionId || 0,
  2725. goodsId: parseInt(self.goodsId),
  2726. courseId: parseInt(self.courseId),
  2727. orderGoodsId: this.orderGoodsId,
  2728. studyDuration: parseInt(
  2729. PlayDuration > 0 ? PlayDuration : self.studyDuration
  2730. ),
  2731. gradeId: parseInt(self.gradeId),
  2732. chapterId: this.chapterId || 0,
  2733. moduleId: this.moduleId || 0,
  2734. videoCurrentTime: parseInt(
  2735. currentTime > 0 ? currentTime : self.studyDuration
  2736. ),
  2737. };
  2738. if (this.ossAvatarUrl) {
  2739. data.similarity = this.compareFaceData; // 相似度
  2740. }
  2741. if (status > 0) {
  2742. data.status = status;
  2743. }
  2744. console.log(data, "记录参数");
  2745. return new Promise((resolve, reject) => {
  2746. this.$api
  2747. .studyRecord(data)
  2748. .then((res) => {
  2749. console.log(res, "记录返回");
  2750. let { code } = res.data;
  2751. if (code == 200) {
  2752. if (status > 0) {
  2753. this.studyRecordMenuAllList();
  2754. let moduleId = this.moduleId || 0;
  2755. let chapterId = this.chapterId || 0;
  2756. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  2757. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  2758. uni.$emit("playNext" + playNextIdisRebuild, {
  2759. fromRebuild: this.isRebuild,
  2760. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  2761. uni.$emit("playNext" + playNextId); //通知播放结束
  2762. }
  2763. self.ossAvatarUrl = "";
  2764. } else {
  2765. this.uploadLock = false;
  2766. uni.showToast({
  2767. icon: "none",
  2768. title: res.data.msg,
  2769. duration: 2000,
  2770. });
  2771. if (this.erJianErZao && code == 559) {
  2772. this.isReach = true;
  2773. this.openPhoto();
  2774. }
  2775. if (code == 559 || code == 588) {
  2776. reject("中断执行");
  2777. }
  2778. }
  2779. resolve();
  2780. })
  2781. .catch((err) => {
  2782. this.studyRecordMenuAllList();
  2783. });
  2784. });
  2785. },
  2786. uploadFile(options, int) {
  2787. var self = this;
  2788. return new Promise((resolve, reject) => {
  2789. var data = {
  2790. imageStatus: int,
  2791. gradeId: this.gradeId,
  2792. orderGoodsId: this.orderGoodsId,
  2793. };
  2794. self.$api.aliyunpolicy(data).then((res) => {
  2795. if (res.data.code != 200) {
  2796. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  2797. return;
  2798. }
  2799. var ossToken = res.data.data.resultContent;
  2800. if (ossToken.host == null || ossToken.host == undefined) {
  2801. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  2802. return;
  2803. }
  2804. let filePath = "";
  2805. // #ifdef H5
  2806. var localData = options; //dataUrl为base64位
  2807. let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
  2808. let length = base.length;
  2809. let url = new Uint8Array(length);
  2810. while (length--) {
  2811. url[length] = base.charCodeAt(length);
  2812. }
  2813. filePath = new File([url], "a.jpg", {
  2814. type: "image/jpg",
  2815. });
  2816. uni.uploadFile({
  2817. url: ossToken.host,
  2818. name: "file",
  2819. file: filePath,
  2820. fileType: "image",
  2821. header: {
  2822. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2823. },
  2824. formData: {
  2825. key: ossToken.dir,
  2826. OSSAccessKeyId: ossToken.accessid,
  2827. policy: ossToken.policy,
  2828. Signature: ossToken.signature,
  2829. callback: ossToken.callback,
  2830. success_action_status: 200,
  2831. },
  2832. success: (result) => {
  2833. this.$u.toast("上传成功");
  2834. self.ossAvatarUrl = ossToken.dir;
  2835. resolve();
  2836. },
  2837. fail: (error) => {
  2838. uni.showToast({
  2839. title: "上传接口报错,请重新拍照上传" + error,
  2840. icon: "none",
  2841. });
  2842. this.openPhoto();
  2843. return;
  2844. },
  2845. });
  2846. // #endif
  2847. // #ifdef MP-WEIXIN
  2848. uni.uploadFile({
  2849. url: ossToken.host,
  2850. name: "file",
  2851. filePath: options,
  2852. fileType: "image",
  2853. header: {
  2854. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2855. },
  2856. formData: {
  2857. key: ossToken.dir,
  2858. OSSAccessKeyId: ossToken.accessid,
  2859. policy: ossToken.policy,
  2860. Signature: ossToken.signature,
  2861. callback: ossToken.callback,
  2862. success_action_status: 200,
  2863. },
  2864. success: (result) => {
  2865. // if (result.statusCode === 200) {
  2866. this.$u.toast("上传成功");
  2867. self.ossAvatarUrl = ossToken.dir;
  2868. resolve();
  2869. },
  2870. fail: (error) => {
  2871. uni.showToast({
  2872. title: "上传接口报错,请重新拍照上传" + error,
  2873. icon: "none",
  2874. });
  2875. this.openPhoto();
  2876. return;
  2877. },
  2878. });
  2879. // #endif
  2880. });
  2881. });
  2882. },
  2883. imageInfos() {
  2884. var self = this;
  2885. return new Promise(async (resolve, reject) => {
  2886. // #ifdef MP-WEIXIN
  2887. uni.getImageInfo({
  2888. src: self.avatarUrl,
  2889. success: async (res) => {
  2890. let canvasWidth = res.width; //图片原始长宽
  2891. let canvasHeight = res.height;
  2892. if (canvasWidth > 2000 || canvasHeight > 2000) {
  2893. // h5不支持
  2894. uni.compressImage({
  2895. src: self.avatarUrl,
  2896. quality: 75,
  2897. width: "35%",
  2898. height: "35%",
  2899. success: async (rest) => {
  2900. const waitUpload = await self.uploadFile(
  2901. rest.tempFilePath,
  2902. 0
  2903. );
  2904. resolve(waitUpload);
  2905. },
  2906. });
  2907. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  2908. uni.compressImage({
  2909. src: self.avatarUrl,
  2910. quality: 75,
  2911. width: "50%",
  2912. height: "50%",
  2913. success: async (rest) => {
  2914. const waitUpload = await self.uploadFile(
  2915. rest.tempFilePath,
  2916. 0
  2917. );
  2918. resolve(waitUpload);
  2919. },
  2920. });
  2921. } else {
  2922. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  2923. resolve(waitUpload);
  2924. }
  2925. },
  2926. fail: (err) => {
  2927. this.$u.toast("图片上传失败");
  2928. },
  2929. });
  2930. // #endif
  2931. // #ifdef H5
  2932. const waitUpload = await this.uploadFile(this.faceUrl, 0);
  2933. resolve(waitUpload);
  2934. // #endif
  2935. });
  2936. },
  2937. timeEvent() {
  2938. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2939. if (polyvPlayerContext != null) {
  2940. // #ifdef MP-WEIXIN
  2941. this.playTime = polyvPlayerContext.getCurrentTime(); //播放时刻
  2942. // #endif
  2943. // #ifdef H5
  2944. this.playTime = polyvPlayerContext.j2s_getCurrentTime();
  2945. // #endif
  2946. this.configPhoto();
  2947. console.info(this.photoList, "photoList");
  2948. let photoTime = 0; //获取拍照秒数
  2949. for (let i = 0; i < this.photoList.length; i++) {
  2950. photoTime = Number(this.photoList[i]); //获取拍照秒数
  2951. if (photoTime < this.playTime && photoTime > this.playTime - 8) {
  2952. //3秒区间内才触发拍照,避免拉动滚动条
  2953. if (this.photoHistoryList.indexOf(i) < 0) {
  2954. //不存在拍照历史,没有重修过,没有学过,则拍照
  2955. //启动拍照
  2956. //暂停
  2957. console.log("去拍照");
  2958. // #ifdef MP-WEIXIN
  2959. polyvPlayerContext.exitFullScreen();
  2960. polyvPlayerContext.pause();
  2961. // #endif
  2962. // #ifdef H5
  2963. polyvPlayerContext.j2s_pauseVideo();
  2964. polyvPlayerContext.toggleFullscreen();
  2965. // #endif
  2966. this.photoIndex = i;
  2967. if (
  2968. uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
  2969. this.goodsId
  2970. ) {
  2971. this.openPhoto();
  2972. } else {
  2973. this.popupPhotoShow = true;
  2974. uni.setStorageSync(
  2975. `tabkePhotoShow${this.goodsId}`,
  2976. this.goodsId
  2977. ); // 本地缓存用来判断是否已经弹出过弹窗
  2978. }
  2979. }
  2980. }
  2981. }
  2982. }
  2983. },
  2984. closeToast() {
  2985. clearTimeout(this.toastTimer);
  2986. this.videoToastShow = false;
  2987. },
  2988. restart() {
  2989. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2990. // #ifdef MP-WEIXIN
  2991. polyvPlayerContext.seek(0);
  2992. // #endif
  2993. // #ifdef H5
  2994. polyvPlayerContext.j2s_seekVideo(0);
  2995. // #endif
  2996. clearTimeout(this.toastTimer);
  2997. this.videoToastShow = false;
  2998. },
  2999. // 新增用户视频学习日志
  3000. studyLog() {
  3001. this.$http({
  3002. url: "/user/study/log",
  3003. method: "post",
  3004. data: {
  3005. goodsId: this.goodsId,
  3006. courseId: this.courseId,
  3007. moduleId: this.moduleId || 0,
  3008. chapterId: this.chapterId || 0,
  3009. sectionId: this.playSectionId || 0,
  3010. fromPlat: 1, //来源平台 1小程序 2PC网站
  3011. goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  3012. orderGoodsId: this.orderGoodsId,
  3013. },
  3014. }).then((res) => {});
  3015. },
  3016. async onStateChange(newstate, oldstate) {
  3017. polyvPlayerContext = this.selectComponent("#playerVideo");
  3018. if (newstate.detail.newstate == "playing") {
  3019. if (this.needSeek) {
  3020. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  3021. if (this.recordObj.videoCurrentTime) {
  3022. polyvPlayerContext.seek(this.recordObj.videoCurrentTime);
  3023. this.seekTime = this.$method.secondToDate(
  3024. this.recordObj.videoCurrentTime
  3025. );
  3026. this.videoToastShow = true;
  3027. this.toastTimer = setTimeout(() => {
  3028. this.videoToastShow = false;
  3029. }, 3000);
  3030. } else {
  3031. polyvPlayerContext.seek(1); //避免相同节继续播放
  3032. }
  3033. polyvPlayerContext.play();
  3034. this.needSeek = false;
  3035. // 新增用户视频学习日志
  3036. this.studyLog();
  3037. // 提交学习记录
  3038. }
  3039. //开始播放
  3040. this.timer && clearInterval(this.timer);
  3041. if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
  3042. this.clearPauseTimer();
  3043. this.timer = setInterval(this.timeEvent, 1000); //定时器
  3044. }
  3045. }
  3046. if (newstate.detail.newstate == "pause") {
  3047. console.log("暂停");
  3048. this.erJianErZaoPauseTip();
  3049. clearInterval(this.timer);
  3050. //暂停提交记录
  3051. }
  3052. if (newstate.detail.newstate == "ended") {
  3053. clearInterval(this.timer);
  3054. uni.showToast({
  3055. icon: "none",
  3056. title: "播放完毕",
  3057. });
  3058. this.hasStart = false;
  3059. await this.postStudyRecord(1);
  3060. this.nextSection();
  3061. // uni.$emit('playNext') //播放重修下一节
  3062. }
  3063. },
  3064. //播放下一节
  3065. nextSection() {
  3066. console.log("播放下一节");
  3067. if (!this.menuAllList.length) {
  3068. return;
  3069. }
  3070. this.curPlayIndex = this.menuAllList.findIndex((item) => {
  3071. let i_sectionId = item.sectionId || 0;
  3072. let i_chapterId = item.chapterId || 0;
  3073. let i_moduleId = item.moduleId || 0;
  3074. return (
  3075. i_sectionId == this.playSectionId &&
  3076. i_chapterId == this.chapterId &&
  3077. i_moduleId == this.moduleId
  3078. );
  3079. });
  3080. let data = this.menuAllList[this.curPlayIndex + 1];
  3081. if (!data) {
  3082. //第二个弹窗
  3083. uni.showModal({
  3084. title: "温馨提示",
  3085. content: "当前最后一节视频已学完 请检查所有章节是否学习完成?",
  3086. showCancel: false,
  3087. success: (res) => {
  3088. if (res.confirm) {
  3089. }
  3090. },
  3091. });
  3092. } else {
  3093. uni.showModal({
  3094. title: "温馨提示",
  3095. content: "当前节视频已学完,继续学习下一节?",
  3096. success: async (res) => {
  3097. if (res.confirm) {
  3098. this.moduleId = data.moduleId;
  3099. this.chapterId = data.chapterId;
  3100. this.sectionId = data.sectionId;
  3101. if (data.sectionType == 1) {
  3102. //录播
  3103. this.$store.commit("setPlaySectionId", {
  3104. playSectionId: data.sectionId,
  3105. });
  3106. this.$store.commit("setPlayVID", {
  3107. playVID: data.recordingUrl,
  3108. });
  3109. this.hasStart = false;
  3110. this.photoConfig = false;
  3111. this.photoIndex = 0;
  3112. this.sectionItem = data;
  3113. await this.getPhotoLastRecord(); // 获取拍照历史
  3114. this.playVideo(data);
  3115. } else if (data.sectionType == 2) {
  3116. //直播
  3117. this.studyRecordGetLastLive();
  3118. } else if (data.sectionType == 3) {
  3119. //回放
  3120. this.$store.commit("setPlaySectionId", {
  3121. playSectionId: data.sectionId,
  3122. });
  3123. this.$store.commit("setPlayVID", {
  3124. playVID: data.recordingUrl,
  3125. });
  3126. this.sectionItem = data;
  3127. this.playVideo(data);
  3128. }
  3129. let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
  3130. this.$store.commit("updatePlayNextId", playNextId);
  3131. this.updateChapterOpen(true);
  3132. this.reStart = false;
  3133. this.getMenuList();
  3134. }
  3135. },
  3136. });
  3137. }
  3138. },
  3139. //拍照
  3140. openPhoto() {
  3141. if (polyvPlayerContext) {
  3142. // #ifdef MP-WEIXIN
  3143. polyvPlayerContext.exitFullScreen();
  3144. // #endif
  3145. // #ifdef H5
  3146. if (this.isFullScreen()) {
  3147. this.exitFullscreen();
  3148. }
  3149. // #endif
  3150. }
  3151. // #ifdef MP-WEIXIN
  3152. this.enableAutoRotation = false;
  3153. this.photoPopup = true;
  3154. this.isTaking = true;
  3155. uni.setKeepScreenOn({
  3156. keepScreenOn: true,
  3157. });
  3158. uni.authorize({
  3159. scope: "scope.camera",
  3160. success() {},
  3161. });
  3162. // #endif
  3163. // #ifdef H5
  3164. if (
  3165. (window.navigator.mediaDevices &&
  3166. window.navigator.mediaDevices.getUserMedia) ||
  3167. window.navigator.getUserMedia ||
  3168. window.navigator.webkitGetUserMedia ||
  3169. window.navigator.mozGetUserMedia
  3170. ) {
  3171. console.log("getUserMedia----");
  3172. // 调用用户媒体设备, 访问摄像头
  3173. this.getUserMedia(
  3174. {
  3175. video: {
  3176. width: 400,
  3177. height: 300,
  3178. },
  3179. },
  3180. this.photographSuccess,
  3181. this.photographError
  3182. );
  3183. } else {
  3184. console.log("1111没有摄像");
  3185. this.photographError();
  3186. }
  3187. // #endif
  3188. },
  3189. /**
  3190. * 人脸匹配
  3191. */
  3192. faceRecognition() {
  3193. return new Promise((resolve) => {
  3194. // #ifdef MP-WEIXIN
  3195. let fileSystem = uni.getFileSystemManager();
  3196. fileSystem.readFile({
  3197. filePath: `${this.avatarUrl}`,
  3198. encoding: "base64",
  3199. position: 0,
  3200. success: (res) => {
  3201. let base64 = "data:image/jpg;base64," + res.data;
  3202. // console.log('base64Data人脸识别参数:', {
  3203. // imageA: base64,
  3204. // orderGoodsId: this.orderGoodsId,
  3205. // gradeId: this.gradeId,
  3206. // })
  3207. this.CompareFace(base64, resolve);
  3208. },
  3209. fail(err) {
  3210. // this.$u.toast('人脸识别错误!')
  3211. console.error(err, "err-----人脸识别错误");
  3212. },
  3213. });
  3214. // #endif
  3215. // #ifdef H5
  3216. this.CompareFace(this.faceUrl, resolve);
  3217. // #endif
  3218. });
  3219. },
  3220. CompareFace(url, resolve) {
  3221. let timer = setTimeout(() => {
  3222. uni.showToast({
  3223. icon: "none",
  3224. title: "拍照超时,请重新拍照",
  3225. duration: 2000,
  3226. success: () => {
  3227. setTimeout(() => {
  3228. uni.navigateBack();
  3229. }, 1000);
  3230. },
  3231. });
  3232. }, 10 * 1000);
  3233. this.$api
  3234. .faceCertificationCompareFace({
  3235. imageA: url,
  3236. orderGoodsId: this.orderGoodsId,
  3237. gradeId: this.gradeId,
  3238. })
  3239. .then((res) => {
  3240. clearTimeout(timer);
  3241. console.log(res, "人脸识别成功res");
  3242. resolve(res.data.data);
  3243. })
  3244. .catch((err) => {
  3245. clearTimeout(timer);
  3246. // 当前网络延迟,
  3247. console.log("人脸识别错误:", err);
  3248. uni.showModal({
  3249. content: "当前网络延迟",
  3250. showCancel: false,
  3251. success: (resultst) => {
  3252. if (resultst.confirm) {
  3253. uni.navigateBack();
  3254. }
  3255. },
  3256. });
  3257. });
  3258. },
  3259. // 确定拍照
  3260. async submit() {
  3261. if (this.uploadLock) {
  3262. return;
  3263. }
  3264. this.uploadLock = true;
  3265. let compareFaceData = await this.faceRecognition();
  3266. console.log(compareFaceData, "compareFaceData");
  3267. this.compareFaceData = compareFaceData;
  3268. if (compareFaceData >= 80) {
  3269. const waitYS = await this.imageInfos();
  3270. this.postCoursePhotoRecord()
  3271. .then(async (res) => {
  3272. this.photoHistoryList.push(this.photoIndex);
  3273. // console.log('拍照确定提交', this.photoHistoryList);
  3274. this.postStudyRecord(); //提交记录
  3275. if (this.erJianErZao && this.isReach) {
  3276. console.log("1校验");
  3277. await this.postStudyRecord(1);
  3278. this.photoPopup = false;
  3279. this.uploadLock = false;
  3280. this.enableAutoRotation = true;
  3281. this.nextSection();
  3282. return;
  3283. }
  3284. //恢复播放
  3285. // #ifdef MP-WEIXIN
  3286. uni.setKeepScreenOn({
  3287. keepScreenOn: false,
  3288. });
  3289. // #endif
  3290. this.photoPopup = false;
  3291. this.uploadLock = false;
  3292. this.enableAutoRotation = true;
  3293. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  3294. if (polyvPlayerContext != null) {
  3295. // #ifdef MP-WEIXIN
  3296. polyvPlayerContext.play();
  3297. // #endif
  3298. // #ifdef H5
  3299. polyvPlayerContext.j2s_resumeVideo();
  3300. // #endif
  3301. }
  3302. })
  3303. .catch((err) => {
  3304. console.log("拍照记录接口的err", err);
  3305. uni.showToast({
  3306. title: "上传接口报错,请重新拍照上传" + err,
  3307. icon: "none",
  3308. });
  3309. this.uploadLock = false;
  3310. this.openPhoto();
  3311. });
  3312. } else {
  3313. uni.showToast({
  3314. title: "人脸匹配不通过,请重新拍照上传",
  3315. icon: "none",
  3316. duration: 2000,
  3317. });
  3318. setTimeout(() => {
  3319. this.uploadLock = false;
  3320. this.openPhoto();
  3321. }, 2000);
  3322. }
  3323. },
  3324. reTake() {
  3325. this.isTaking = true;
  3326. // #ifdef H5
  3327. this.faceUrl = "";
  3328. this.getUserMedia(
  3329. {
  3330. video: {
  3331. width: 400,
  3332. height: 300,
  3333. },
  3334. },
  3335. this.photographSuccess,
  3336. this.photographError
  3337. );
  3338. // #endif
  3339. },
  3340. toTakePhoto() {
  3341. this.popupPhotoShow = false;
  3342. this.openPhoto();
  3343. },
  3344. takePhTips() {
  3345. this.popupPhotoShow = true;
  3346. this.isTaking = false;
  3347. this.photoPopup = false;
  3348. this.enableAutoRotation = false;
  3349. },
  3350. //确认拍照
  3351. takePhoto() {
  3352. // #ifdef MP-WEIXIN
  3353. const ctx = uni.createCameraContext();
  3354. ctx.takePhoto({
  3355. quality: "high",
  3356. success: (res) => {
  3357. this.avatarUrl = res.tempImagePath;
  3358. console.log("开始拍照this.avatarUrl:", this.avatarUrl);
  3359. this.isTaking = false;
  3360. },
  3361. fail: (err) => {},
  3362. });
  3363. // #endif
  3364. // #ifdef H5
  3365. const canvas = document.createElement("canvas");
  3366. canvas.width = 400;
  3367. canvas.height = 400;
  3368. const context = canvas.getContext("2d");
  3369. const video = document.querySelector("video");
  3370. context.drawImage(video, 0, 0, 400, 400);
  3371. this.faceUrl = canvas.toDataURL("image/png");
  3372. this.isTaking = false;
  3373. // #endif
  3374. },
  3375. playError(e) {
  3376. console.log(e);
  3377. },
  3378. //拍照报错
  3379. error(e) {
  3380. console.log(e.detail);
  3381. },
  3382. //关闭相机
  3383. closePhoto() {
  3384. this.photoPopup = false;
  3385. self.enableAutoRotation = true;
  3386. },
  3387. /**
  3388. * 进入全屏
  3389. */
  3390. fullscreenchange(event) {
  3391. if (event.detail.direction == "vertical") {
  3392. this.navShow = true;
  3393. } else if (event.detail.direction == "horizontal") {
  3394. this.navShow = false;
  3395. }
  3396. },
  3397. checkFinishRequiredCourse() {
  3398. return this.$api
  3399. .checkFinishRequiredCourse({
  3400. businessId: this.goodsData.businessId,
  3401. goodsId: this.goodsId,
  3402. })
  3403. .then((res) => {
  3404. if (res.data.data > 0) {
  3405. uni.showModal({
  3406. showCancel: false,
  3407. confirmText: "确定",
  3408. content: "该业务层次下有未学完的商品,无法学习新商品!",
  3409. success: function (resultst) {
  3410. uni.navigateBack();
  3411. },
  3412. });
  3413. return Promise.reject();
  3414. }
  3415. return Promise.resolve();
  3416. });
  3417. },
  3418. getGoodsDetail() {
  3419. let self = this;
  3420. // '/goods/'+ data,
  3421. this.$api.goodsDetail(this.goodsId).then(async (res) => {
  3422. this.goodsData = res.data.data;
  3423. await this.checkFinishRequiredCourse();
  3424. if (self.goodsData.buyNote) {
  3425. this.baseHandoutTipList();
  3426. }
  3427. self.gradeId = self.goodsData.gradeId;
  3428. self.erJianErZao = self.goodsData.erJianErZao;
  3429. this.courseBusiness(this.goodsData.businessId);
  3430. self.getMenuList();
  3431. self.getReMenuList(); //获取重修目录
  3432. setTimeout(function () {
  3433. if (!self.needProfileModal) {
  3434. self.getGradeInfo();
  3435. }
  3436. }, 500);
  3437. //获取节笔记
  3438. this.getNoteList();
  3439. if (self.goodsData.goodsPlayConfig) {
  3440. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  3441. if (self.goodsPlayConfig.autoPlay > 0) {
  3442. // #ifdef H5
  3443. self.autoplay = true;
  3444. // #endif
  3445. }
  3446. if (self.goodsPlayConfig.drag > 0) {
  3447. // #ifdef MP-WEIXIN
  3448. self.isAllowSeek = "yes";
  3449. // #endif
  3450. // #ifdef H5
  3451. self.H5isAllowSeek = "off";
  3452. // #endif
  3453. }
  3454. if (self.goodsPlayConfig.speed > 0) {
  3455. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  3456. }
  3457. }
  3458. if (self.goodsData.goodsPhotographConfig) {
  3459. self.goodsPhotographConfig = JSON.parse(
  3460. self.goodsData.goodsPhotographConfig
  3461. );
  3462. if (self.goodsPhotographConfig.photoNum > 0) {
  3463. self.photoNum = self.goodsPhotographConfig.photoNum;
  3464. }
  3465. }
  3466. });
  3467. },
  3468. startVideo() {
  3469. this.startStatus = true;
  3470. },
  3471. getAnswerList() {
  3472. let self = this;
  3473. this.$api
  3474. .answerList({
  3475. courseId: this.courseId,
  3476. goodsId: this.goodsId,
  3477. orderGoodsId: this.orderGoodsId,
  3478. })
  3479. .then((res) => {
  3480. if (res.data.code == 200) {
  3481. self.answerList = res.data.rows;
  3482. }
  3483. });
  3484. },
  3485. getReMenuList() {
  3486. // console.log('重修的目录');
  3487. let self = this;
  3488. this.$api
  3489. .reMenuList({
  3490. orderGoodsId: this.orderGoodsId,
  3491. courseId: this.courseId,
  3492. rebuild: 1,
  3493. gradeId: this.gradeId,
  3494. })
  3495. .then((res) => {
  3496. if (res.data.code == 200) {
  3497. for (let i = 0; i < res.data.rows.length; i++) {
  3498. let item = res.data.rows[i];
  3499. item.down = true;
  3500. item.id = item.menuId;
  3501. item.name = item.menuName;
  3502. }
  3503. self.reMenuList = res.data.rows;
  3504. if (self.reMenuList.length > 0) {
  3505. this.showNotes = false;
  3506. self.list = [
  3507. {
  3508. name: "目录",
  3509. },
  3510. {
  3511. name: "讲义",
  3512. },
  3513. {
  3514. name: "笔记",
  3515. },
  3516. {
  3517. name: "答疑",
  3518. },
  3519. { name: "重修目录" },
  3520. ];
  3521. this.current = 0;
  3522. if (Object.keys(this.sectionItem).length) {
  3523. let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
  3524. this.$store.commit("updatePlayNextId", playNextIdisRebuild);
  3525. }
  3526. } else {
  3527. if (Object.keys(this.sectionItem).length) {
  3528. let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
  3529. this.$store.commit("updatePlayNextId", playNextId);
  3530. }
  3531. self.list = [
  3532. {
  3533. name: "目录",
  3534. },
  3535. {
  3536. name: "讲义",
  3537. },
  3538. {
  3539. name: "笔记",
  3540. },
  3541. {
  3542. name: "答疑",
  3543. },
  3544. ];
  3545. this.current = 0;
  3546. }
  3547. }
  3548. });
  3549. },
  3550. getMenuList() {
  3551. // console.log('menuList的目录');
  3552. let self = this;
  3553. // /course/menuList 查询课程目录结构列表
  3554. this.$api
  3555. .reMenuList({
  3556. courseId: this.courseId,
  3557. gradeId: this.gradeId,
  3558. orderGoodsId: this.orderGoodsId,
  3559. })
  3560. .then((res) => {
  3561. if (res.data.code == 200) {
  3562. for (let i = 0; i < res.data.rows.length; i++) {
  3563. let item = res.data.rows[i];
  3564. item.down = true;
  3565. item.id = item.menuId;
  3566. item.name = item.menuName;
  3567. item.menuType = item.type;
  3568. }
  3569. self.menuList = res.data.rows;
  3570. this.reStart = true;
  3571. for (let i = 0; i < res.data.rows.length; i++) {
  3572. if (res.data.rows[i].type == 1) {
  3573. // 模块
  3574. if (Object.keys(this.sectionItem).length) {
  3575. if (res.data.rows[i].menuId == this.sectionItem.moduleId) {
  3576. this.menuIndex = [i];
  3577. break;
  3578. }
  3579. } else {
  3580. this.menuIndex = [i];
  3581. break;
  3582. }
  3583. } else if (res.data.rows[i].type == 2) {
  3584. // 章
  3585. if (Object.keys(this.sectionItem).length) {
  3586. if (
  3587. res.data.rows[i].menuId == this.sectionItem.chapterId &&
  3588. (!this.sectionItem.moduleId ||
  3589. this.sectionItem.moduleId == 0)
  3590. ) {
  3591. this.menuIndex = [i];
  3592. break;
  3593. }
  3594. } else {
  3595. this.menuIndex = [i];
  3596. break;
  3597. }
  3598. }
  3599. }
  3600. // console.log('menuList: ---', this.menuList, 'menuIndex:', this.menuIndex);
  3601. }
  3602. });
  3603. },
  3604. courseDetail() {
  3605. let self = this;
  3606. // '/course/'+data,
  3607. this.$api.courseDetail(this.courseId).then((res) => {
  3608. if (res.data.code == 200) {
  3609. // if (res.data.data.educationName == "继续教育") {
  3610. this.$api
  3611. .lockLockAction({
  3612. action: "jxjy",
  3613. uuid: this.$method.getUuid(),
  3614. })
  3615. .then((res) => {});
  3616. this.lockTimer = setInterval(() => {
  3617. this.$api
  3618. .lockLockAction({
  3619. action: "jxjy",
  3620. uuid: this.$method.getUuid(),
  3621. })
  3622. .then((res) => {});
  3623. }, 10000);
  3624. // websocket.sendMsg("doCourse");
  3625. // }
  3626. self.detail = res.data.data;
  3627. }
  3628. });
  3629. },
  3630. open(item) {
  3631. item.showChildren = !item.showChildren;
  3632. },
  3633. change(index) {
  3634. this.current = index;
  3635. },
  3636. clickMulu() {
  3637. this.muluStyle = !this.muluStyle;
  3638. },
  3639. loadPlayerScript(callback) {
  3640. if (!window.polyvPlayer) {
  3641. const myScript = document.createElement("script");
  3642. myScript.setAttribute("src", this.vodPlayerJs);
  3643. myScript.onload = callback;
  3644. document.body.appendChild(myScript);
  3645. } else {
  3646. callback();
  3647. }
  3648. },
  3649. // 播放视频
  3650. loadPlayer() {
  3651. const polyvPlayer = window.polyvPlayer;
  3652. this.$api.polyvVideoSign(this.vid).then(async (res) => {
  3653. this.player = await polyvPlayer({
  3654. wrap: "#player",
  3655. width: "100%",
  3656. showLine: "off",
  3657. height: 218,
  3658. ban_history_time: "on",
  3659. vid: this.vid,
  3660. forceH5: true,
  3661. autoplay: this.autoplay, // 自动播放
  3662. ban_seek: this.H5isAllowSeek, // 是否禁止拖拽进度条
  3663. speed: this.playbackRate, // 倍数
  3664. teaser_show: 1,
  3665. tail_show: 1,
  3666. hideSwitchPlayer: true,
  3667. watchStartTime: this.recordObj.videoCurrentTime, // 播放开始时间,表示视频从第几秒开始播放,参数值需小于视频时长
  3668. ts: res.data.data.ts, // 移动播放加密视频需传入的时间戳。
  3669. sign: res.data.data.sign, // 移动端播放加密视频所需的签名
  3670. // playsafe: (vid, next) => { // PC端播放加密视频所需的授权凭证
  3671. // console.log('111111111111', vid);
  3672. // // this.$api.obtainpolyvvideopcsign(vid).then((res) => {
  3673. // // console.log('请求完后', res);
  3674. // // next(res.data.data);
  3675. // // });
  3676. // },
  3677. });
  3678. polyvPlayerContext = this.player;
  3679. this.player.on("s2j_onPlayStart", async (vid) => {
  3680. // 视频初次播放时触发
  3681. console.log("视频初次播放时触发:");
  3682. // #ifdef H5
  3683. // h5禁止拖动进度条
  3684. clearInterval(this.barTimer);
  3685. this.barTimer = null;
  3686. let originTime = this.recordObj.videoCurrentTime || 0;
  3687. if (this.H5isAllowSeek == "on" && !this.barTimer) {
  3688. this.barTimer = setInterval(function () {
  3689. const currentTime = polyvPlayerContext.j2s_getCurrentTime();
  3690. // console.log(currentTime, originTime)
  3691. if (
  3692. currentTime - originTime > 1 ||
  3693. currentTime - originTime < 0
  3694. ) {
  3695. polyvPlayerContext.j2s_seekVideo(originTime);
  3696. } else {
  3697. originTime = currentTime;
  3698. }
  3699. }, 500);
  3700. }
  3701. // #endif
  3702. this.loadedmetadata();
  3703. this.postStudyRecord(0);
  3704. });
  3705. this.player.on("s2j_onVideoPause", () => {
  3706. // 视频暂停时触发
  3707. console.log("视频暂停时触发", this.vid);
  3708. this.erJianErZaoPauseTip();
  3709. clearInterval(this.studyTimer);
  3710. clearInterval(this.timer);
  3711. });
  3712. this.player.on("s2j_onVideoPlay", () => {
  3713. // 视频初次播放或由暂停恢复播放时触发
  3714. console.log("视频初次播放或由暂停恢复播放时触发");
  3715. if (this.needSeek) {
  3716. if (this.recordObj.videoCurrentTime) {
  3717. this.seekTime = this.$method.secondToDate(
  3718. this.recordObj.videoCurrentTime
  3719. );
  3720. this.videoToastShow = true;
  3721. this.toastTimer = setTimeout(() => {
  3722. this.videoToastShow = false;
  3723. }, 3000);
  3724. }
  3725. this.needSeek = false;
  3726. // 新增用户视频学习日志
  3727. this.studyLog();
  3728. }
  3729. //开始播放
  3730. this.timer && clearInterval(this.timer);
  3731. if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
  3732. this.clearPauseTimer();
  3733. this.timer = setInterval(this.timeEvent, 1000); //定时器
  3734. }
  3735. this.studyTimer && clearInterval(this.studyTimer);
  3736. this.studyTimer = setInterval(() => {
  3737. this.postStudyRecord(0, this.playSectionId);
  3738. }, 15000);
  3739. });
  3740. this.player.on("s2j_onPlayOver", async () => {
  3741. // 当前视频播放完毕时触发
  3742. console.log("结束了结束了");
  3743. this.hasStart = false;
  3744. clearInterval(this.studyTimer);
  3745. clearInterval(this.timer);
  3746. uni.showToast({
  3747. icon: "none",
  3748. title: "播放完毕",
  3749. });
  3750. await this.postStudyRecord(1);
  3751. this.nextSection(); // 播放下一节
  3752. });
  3753. });
  3754. },
  3755. clears() {
  3756. return new Promise((resolve, reject) => {
  3757. this.vid = "";
  3758. this.player && this.player.destroy();
  3759. resolve();
  3760. });
  3761. },
  3762. /**
  3763. * 退出全屏
  3764. */
  3765. exitFullscreen() {
  3766. try {
  3767. var de = document;
  3768. // console.log(de);
  3769. if (de.exitFullscreen) {
  3770. de.exitFullscreen();
  3771. } else if (de.mozCancelFullScreen) {
  3772. de.mozCancelFullScreen();
  3773. } else if (de.webkitCancelFullScreen) {
  3774. de.webkitCancelFullScreen();
  3775. }
  3776. } catch (err) {}
  3777. },
  3778. fullele() {
  3779. return (
  3780. document.fullscreenElement ||
  3781. document.webkitFullscreenElement ||
  3782. document.msFullscreenElement ||
  3783. document.mozFullScreenElement ||
  3784. null
  3785. );
  3786. },
  3787. //判断是否全屏
  3788. isFullScreen() {
  3789. return !!(document.webkitIsFullScreen || this.fullele());
  3790. },
  3791. getUserMedia(constraints, success, error) {
  3792. console.log("getUserMedia===", constraints, "success:", success);
  3793. if (window.navigator.mediaDevices.getUserMedia) {
  3794. // 最新的标准API
  3795. window.navigator.mediaDevices
  3796. .getUserMedia(constraints)
  3797. .then(success)
  3798. .catch(error);
  3799. } else if (window.navigator.webkitGetUserMedia) {
  3800. // webkit核心浏览器
  3801. window.navigator.webkitGetUserMedia(constraints, success, error);
  3802. } else if (window.navigator.mozGetUserMedia) {
  3803. // firfox浏览器
  3804. window.navigator.mozGetUserMedia(constraints, success, error);
  3805. } else if (window.navigator.getUserMedia) {
  3806. // 旧版API
  3807. window.navigator.getUserMedia(constraints, success, error);
  3808. }
  3809. },
  3810. photographSuccess(stream) {
  3811. console.log("有摄像头---", stream);
  3812. this.photoPopup = true;
  3813. this.isTaking = true;
  3814. this.enableAutoRotation = false;
  3815. this.$nextTick(() => {
  3816. const video = document.querySelector("video");
  3817. console.log("video:", video);
  3818. video.srcObject = stream;
  3819. video.play();
  3820. });
  3821. },
  3822. photographError(err) {
  3823. console.log("没有摄像头:", err);
  3824. uni.showModal({
  3825. title: "提示",
  3826. content:
  3827. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  3828. cancelText: "取消",
  3829. confirmText: "确定",
  3830. success: (res) => {
  3831. if (res.confirm) {
  3832. uni.navigateBack();
  3833. } else if (res.cancel) {
  3834. }
  3835. },
  3836. });
  3837. },
  3838. },
  3839. };
  3840. </script>
  3841. <style lang="scss" scope>
  3842. @import "./css/detail.scss";
  3843. .top {
  3844. &__header {
  3845. position: relative;
  3846. width: 100%;
  3847. height: 150rpx;
  3848. padding: 24rpx 150rpx 24rpx 24rpx;
  3849. .img {
  3850. position: absolute;
  3851. left: 0;
  3852. top: 0;
  3853. width: 100%;
  3854. }
  3855. .note {
  3856. position: relative;
  3857. z-index: 10;
  3858. font-size: 24rpx;
  3859. font-family: PingFang SC;
  3860. font-weight: bold;
  3861. color: #efdbff;
  3862. }
  3863. .title {
  3864. position: relative;
  3865. z-index: 10;
  3866. font-size: 26rpx;
  3867. font-family: PingFang SC;
  3868. font-weight: bold;
  3869. color: #ffffff;
  3870. }
  3871. }
  3872. }
  3873. #top {
  3874. position: relative;
  3875. z-index: 99;
  3876. }
  3877. .polyv_detail {
  3878. display: flex;
  3879. flex-direction: column;
  3880. height: 100vh;
  3881. position: relative;
  3882. top: 0;
  3883. left: 0;
  3884. .pops {
  3885. position: absolute;
  3886. top: 0;
  3887. left: 0;
  3888. background: #ccc;
  3889. opacity: 0.5;
  3890. width: 100%;
  3891. height: 300rpx;
  3892. z-index: 9999;
  3893. }
  3894. .box {
  3895. flex: 1;
  3896. overflow: hidden;
  3897. margin: 16rpx 16rpx 100rpx 16rpx;
  3898. .box_in {
  3899. height: 100%;
  3900. }
  3901. }
  3902. .first_ml {
  3903. margin: 16rpx 16rpx 16rpx 16rpx;
  3904. }
  3905. }
  3906. .btnSet {
  3907. width: 440rpx;
  3908. height: 80rpx;
  3909. background: #007aff;
  3910. border-radius: 40rpx;
  3911. color: #ffffff;
  3912. font-size: 28rpx;
  3913. line-height: 80rpx;
  3914. }
  3915. .btnReply {
  3916. width: 80rpx;
  3917. height: 40rpx;
  3918. background: #e3f0ff;
  3919. border-radius: 16rpx;
  3920. text-align: center;
  3921. color: #007aff;
  3922. }
  3923. .btnDel {
  3924. width: 80rpx;
  3925. height: 40rpx;
  3926. background: #ffedf0;
  3927. border-radius: 16rpx;
  3928. text-align: center;
  3929. color: #ff2d55;
  3930. }
  3931. .btnReply {
  3932. width: 80rpx;
  3933. height: 40rpx;
  3934. background: #e3f0ff;
  3935. border-radius: 16rpx;
  3936. font-size: 24rpx;
  3937. }
  3938. .lecture-content {
  3939. background: #fff;
  3940. margin-top: 10rpx;
  3941. padding: 10rpx;
  3942. border-radius: 16rpx;
  3943. }
  3944. .photoBox {
  3945. width: 100%;
  3946. // background-color: #ffffff;
  3947. // border-radius: 24px 24px 0px 0px;
  3948. .photoTop {
  3949. width: 100%;
  3950. height: 74rpx;
  3951. border-radius: 20px 20px 0px 0px;
  3952. background-color: #ffffff;
  3953. display: flex;
  3954. align-items: center;
  3955. justify-content: center;
  3956. padding: 0rpx 38rpx;
  3957. .sqzz {
  3958. width: 28rpx;
  3959. height: 28rpx;
  3960. display: flex;
  3961. align-items: center;
  3962. justify-content: center;
  3963. }
  3964. .centersq {
  3965. color: #333;
  3966. font-size: 30rpx;
  3967. font-weight: 500;
  3968. }
  3969. }
  3970. .photoCenter {
  3971. width: 750rpx;
  3972. height: 75vh;
  3973. position: relative;
  3974. .center_camera {
  3975. width: 100%;
  3976. height: 75vh;
  3977. position: fixed;
  3978. .head_take {
  3979. width: 100%;
  3980. height: 75vh;
  3981. display: flex;
  3982. flex-direction: column;
  3983. }
  3984. .headTake_up {
  3985. width: 100%;
  3986. height: 100rpx;
  3987. }
  3988. .headTake_minddle {
  3989. display: flex;
  3990. .min_img {
  3991. width: 500rpx;
  3992. height: 550rpx;
  3993. }
  3994. .min_left,
  3995. .min_right {
  3996. flex: 1;
  3997. height: 550rpx;
  3998. }
  3999. }
  4000. .headTake_down {
  4001. width: 100%;
  4002. flex: 1;
  4003. }
  4004. .color {
  4005. background-color: #333;
  4006. opacity: 0.5;
  4007. }
  4008. .photo_v {
  4009. width: 100%;
  4010. height: 100%;
  4011. }
  4012. .mask {
  4013. width: 500rpx;
  4014. height: 550rpx;
  4015. position: absolute;
  4016. top: 100rpx;
  4017. left: 0;
  4018. right: 0;
  4019. bottom: 0;
  4020. margin: 0 auto;
  4021. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  4022. }
  4023. }
  4024. .custom {
  4025. width: 750rpx;
  4026. height: 75vh;
  4027. position: absolute;
  4028. z-index: 1000;
  4029. top: 0;
  4030. left: 0;
  4031. image {
  4032. width: 100%;
  4033. height: 100%;
  4034. }
  4035. }
  4036. }
  4037. .btns {
  4038. display: flex;
  4039. .takePhoto_btn {
  4040. width: 100%;
  4041. display: flex;
  4042. align-items: center;
  4043. justify-content: space-between;
  4044. background: #a9a7a9;
  4045. padding: 40rpx 26rpx;
  4046. .middle_btn {
  4047. width: 120rpx;
  4048. height: 120rpx;
  4049. border-radius: 40rpx;
  4050. border: 4rpx solid #ffffff;
  4051. display: flex;
  4052. align-items: center;
  4053. justify-content: center;
  4054. }
  4055. .square {
  4056. width: 96rpx;
  4057. height: 96rpx;
  4058. background: #ffffff;
  4059. border-radius: 28rpx;
  4060. }
  4061. .rights {
  4062. font-size: 32rpx;
  4063. font-weight: 500;
  4064. color: #ffffff;
  4065. }
  4066. }
  4067. .btnResult {
  4068. height: 100rpx;
  4069. flex: 1;
  4070. background-color: #07c160;
  4071. text-align: center;
  4072. line-height: 100rpx;
  4073. color: #fff;
  4074. font-size: 32rpx;
  4075. font-weight: bold;
  4076. }
  4077. }
  4078. }
  4079. .chat_box {
  4080. display: flex;
  4081. padding: 20rpx;
  4082. justify-content: space-between;
  4083. }
  4084. .chat3 {
  4085. font-size: 30rpx;
  4086. font-family: PingFang SC;
  4087. font-weight: 500;
  4088. color: #666666;
  4089. margin-top: 10rpx;
  4090. }
  4091. .chat2 {
  4092. font-size: 20rpx;
  4093. font-family: PingFang SC;
  4094. font-weight: 500;
  4095. color: #999999;
  4096. margin-top: 10rpx;
  4097. }
  4098. .chat1 {
  4099. font-size: 24rpx;
  4100. font-family: PingFang SC;
  4101. font-weight: 500;
  4102. color: #333333;
  4103. }
  4104. .leftPadding {
  4105. margin-left: 8rpx;
  4106. }
  4107. .t2Content {
  4108. font-size: 24rpx;
  4109. font-family: PingFang SC;
  4110. font-weight: bold;
  4111. color: #999999;
  4112. line-height: 48rpx;
  4113. }
  4114. .tBox2 {
  4115. display: flex;
  4116. padding-top: 10rpx;
  4117. color: #333333;
  4118. font-size: 30rpx;
  4119. font-weight: 400;
  4120. }
  4121. .tBox {
  4122. display: flex;
  4123. align-items: center;
  4124. padding-top: 10rpx;
  4125. }
  4126. .title {
  4127. font-size: 24rpx;
  4128. color: #999999;
  4129. }
  4130. .Answering {
  4131. .answer_item {
  4132. &:nth-child(2) {
  4133. border-radius: 16rpx 16rpx 0rpx 0rpx;
  4134. }
  4135. &:nth-last-child(1) {
  4136. border-radius: 0rpx 0rpx 16rpx 16rpx;
  4137. }
  4138. }
  4139. }
  4140. .inputBottom {
  4141. position: fixed;
  4142. left: 0;
  4143. bottom: 0;
  4144. background: #ffffff;
  4145. height: 98rpx;
  4146. display: flex;
  4147. align-items: center;
  4148. width: 100%;
  4149. .flex_auto {
  4150. flex: 1;
  4151. margin-left: 10%;
  4152. word-break: break-all;
  4153. // .input {
  4154. // height: 60rpx;
  4155. // }
  4156. }
  4157. .btn {
  4158. color: #007aff;
  4159. font-size: 30rpx;
  4160. font-weight: bold;
  4161. width: 15%;
  4162. text-align: center;
  4163. }
  4164. .input {
  4165. background: rgba(244, 244, 244, 0.98);
  4166. height: 60rpx;
  4167. border-radius: 24rpx;
  4168. margin-top: 12rpx;
  4169. }
  4170. }
  4171. .noteBox {
  4172. width: 100%;
  4173. background: #ffffff;
  4174. padding: 0rpx 10rpx 20rpx;
  4175. border-radius: 16rpx;
  4176. overflow: hidden;
  4177. .left_ti {
  4178. padding-top: 14rpx;
  4179. }
  4180. }
  4181. .dateBox {
  4182. width: 216rpx;
  4183. height: 48rpx;
  4184. background: #ffffff;
  4185. border-radius: 24rpx;
  4186. font-size: 24rpx;
  4187. color: #666666;
  4188. text-align: center;
  4189. line-height: 48rpx;
  4190. margin: 16rpx 0rpx 8rpx;
  4191. }
  4192. .t_content1 {
  4193. color: #007aff;
  4194. margin-left: 10rpx;
  4195. }
  4196. .tag1 {
  4197. border: 2rpx solid #007aff;
  4198. border-radius: 8rpx;
  4199. font-size: 20rpx;
  4200. color: #007aff;
  4201. padding: 5rpx;
  4202. }
  4203. .b_title {
  4204. color: #333333;
  4205. font-size: 30rpx;
  4206. font-weight: bold;
  4207. }
  4208. page {
  4209. background: #eaeef1;
  4210. }
  4211. .menuBox {
  4212. width: 100%;
  4213. background: #ffffff;
  4214. border-radius: 16rpx;
  4215. padding: 0rpx 20rpx;
  4216. margin-bottom: 20rpx;
  4217. }
  4218. .btnspric {
  4219. border-top: 1rpx solid #eee;
  4220. display: flex;
  4221. align-items: center;
  4222. justify-content: space-between;
  4223. height: 108rpx;
  4224. padding-left: 43rpx;
  4225. padding-right: 32rpx;
  4226. }
  4227. .btnspric > .lefprL {
  4228. font-size: 36rpx;
  4229. color: #0c141f;
  4230. font-weight: bold;
  4231. }
  4232. .btnspric > .lefprR {
  4233. padding: 0rpx 24rpx;
  4234. height: 60rpx;
  4235. line-height: 60rpx;
  4236. text-align: center;
  4237. color: #fff;
  4238. background: #32467b;
  4239. border-radius: 24rpx;
  4240. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  4241. }
  4242. .yhj,
  4243. .hdyhj {
  4244. padding: 24rpx 29rpx 24rpx 34rpx;
  4245. }
  4246. .yhj {
  4247. border-bottom: 16rpx solid #f9f9f9;
  4248. }
  4249. .yhjtit {
  4250. font-size: 30rpx;
  4251. color: #0c141f;
  4252. font-weight: 500;
  4253. margin-bottom: 14rpx;
  4254. }
  4255. .yhjList {
  4256. display: flex;
  4257. align-items: center;
  4258. justify-content: space-between;
  4259. margin-bottom: 14rpx;
  4260. }
  4261. .yhjList > .yhjLefts {
  4262. display: flex;
  4263. align-items: center;
  4264. }
  4265. .yhjLefts > .yhl {
  4266. color: #32467b;
  4267. font-size: 30rpx;
  4268. margin-right: 31rpx;
  4269. }
  4270. .yhjLefts > .yhbq {
  4271. font-size: 24rpx;
  4272. color: #ff9500;
  4273. border-radius: 18rpx;
  4274. background-color: rgba(255, 149, 0, 0.2);
  4275. border: 2rpx solid #ff9500;
  4276. height: 38rpx;
  4277. line-height: 38rpx;
  4278. padding: 0rpx 16rpx;
  4279. }
  4280. .ts {
  4281. font-size: 24rpx;
  4282. color: #999;
  4283. margin: 14rpx 0rpx;
  4284. padding-right: 29rpx;
  4285. padding-left: 34rpx;
  4286. }
  4287. .yh {
  4288. padding-top: 20rpx;
  4289. }
  4290. .yh > .yhtitle {
  4291. display: flex;
  4292. align-items: center;
  4293. justify-content: space-between;
  4294. padding-right: 29rpx;
  4295. padding-left: 34rpx;
  4296. }
  4297. .priceBxs {
  4298. display: flex;
  4299. align-items: center;
  4300. }
  4301. .priceBxs > .pricleft {
  4302. border-radius: 24rpx;
  4303. border: 1rpx solid #e91313;
  4304. background-color: rgba(233, 19, 19, 0.1);
  4305. padding: 0rpx 18rpx;
  4306. height: 49rpx;
  4307. line-height: 49rpx;
  4308. text-align: center;
  4309. font-size: 30rpx;
  4310. font-weight: 500;
  4311. color: #e91313;
  4312. margin-right: 13rpx;
  4313. }
  4314. .topBox {
  4315. padding: 32rpx 32rpx 24rpx;
  4316. border-bottom: 1rpx solid #eeeeee;
  4317. }
  4318. .topBox > .boldFonstType {
  4319. font-weight: 500;
  4320. font-size: 30rpx;
  4321. margin: 16rpx 0rpx 23rpx;
  4322. }
  4323. .topBox > .firstTopL {
  4324. display: flex;
  4325. align-items: center;
  4326. }
  4327. .topBox > .firstTopL > .imageBs {
  4328. width: 331rpx;
  4329. height: 160rpx;
  4330. border-radius: 6rpx;
  4331. overflow: hidden;
  4332. margin-right: 8rpx;
  4333. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  4334. }
  4335. .topBox > .firstTopL > .imageBs > image {
  4336. width: 100%;
  4337. height: 100%;
  4338. }
  4339. .topBox > .firstTopL > .textBs {
  4340. font-size: 30rpx;
  4341. font-weight: bold;
  4342. color: #0c141f;
  4343. }
  4344. .content {
  4345. padding: 24rpx;
  4346. text-align: left;
  4347. }
  4348. .catalogBox {
  4349. display: flex;
  4350. align-items: center;
  4351. flex-wrap: nowrap;
  4352. overflow-x: auto;
  4353. padding-left: 38rpx;
  4354. max-height: 305rpx;
  4355. overflow-y: auto;
  4356. transition: all 0.4s;
  4357. }
  4358. .catalogBox > .catalogA {
  4359. min-width: 200rpx;
  4360. height: 48rpx;
  4361. line-height: 48rpx;
  4362. // text-align: center;
  4363. border: 2rpx solid transparent;
  4364. white-space: nowrap;
  4365. text-overflow: ellipsis;
  4366. overflow: hidden;
  4367. word-break: break-all;
  4368. border-radius: 10rpx;
  4369. background: rgba(22, 119, 255, 0.05);
  4370. padding-left: 19rpx;
  4371. box-sizing: border-box;
  4372. padding-right: 15rpx;
  4373. margin-right: 16rpx;
  4374. margin-bottom: 20rpx;
  4375. margin-top: 15rpx;
  4376. font-size: 24rpx;
  4377. color: #666;
  4378. }
  4379. .catalogBox > .activesq {
  4380. border-color: #1677ff;
  4381. }
  4382. .changeCatalogBox {
  4383. display: block;
  4384. }
  4385. .catalogBox::-webkit-scrollbar {
  4386. display: none; /* Chrome Safari */
  4387. }
  4388. .price_t2 {
  4389. font-size: 18rpx;
  4390. font-family: PingFang SC;
  4391. font-weight: 500;
  4392. text-decoration: line-through;
  4393. color: #999999;
  4394. }
  4395. .price_t1 {
  4396. font-size: 33rpx;
  4397. font-family: PingFang SC;
  4398. font-weight: bold;
  4399. color: #e91313;
  4400. }
  4401. .sc_t {
  4402. font-size: 22rpx;
  4403. color: #000000;
  4404. }
  4405. .sc {
  4406. width: 29rpx;
  4407. height: 29rpx;
  4408. }
  4409. .buy {
  4410. width: 138rpx;
  4411. height: 48rpx;
  4412. line-height: 48rpx;
  4413. background: #32467b;
  4414. border-radius: 10rpx;
  4415. color: #ffffff;
  4416. font-size: 28rpx;
  4417. text-align: center;
  4418. vertical-align: middle;
  4419. position: absolute;
  4420. right: 30rpx;
  4421. }
  4422. .video_body {
  4423. padding-bottom: 96rpx;
  4424. }
  4425. .footer_tab {
  4426. position: fixed;
  4427. bottom: 0;
  4428. height: 96rpx;
  4429. width: 100%;
  4430. background-color: #ffffff;
  4431. }
  4432. .tj_box {
  4433. width: 50%;
  4434. display: inline-block;
  4435. text-align: center;
  4436. margin: 10rpx 0;
  4437. }
  4438. .teacher_t {
  4439. font-size: 24rpx;
  4440. font-family: PingFang SC;
  4441. font-weight: 400;
  4442. color: #666666;
  4443. line-height: 36rpx;
  4444. margin-left: 15rpx;
  4445. }
  4446. .teacher_img {
  4447. width: 87rpx;
  4448. height: 129rpx;
  4449. }
  4450. .t2 {
  4451. font-size: 24rpx;
  4452. font-family: PingFang SC;
  4453. color: #666666;
  4454. line-height: 36rpx;
  4455. margin: 15rpx;
  4456. }
  4457. .r_t2 {
  4458. width: 201rpx;
  4459. height: 49rpx;
  4460. background: rgba(22, 119, 255, 0.05);
  4461. border: 1rpx solid #32467b;
  4462. border-radius: 16rpx;
  4463. color: #666666;
  4464. font-size: 23rpx;
  4465. text-align: center;
  4466. display: flex;
  4467. align-items: center;
  4468. padding: 5rpx;
  4469. }
  4470. .scroll_box {
  4471. width: 100%;
  4472. height: 60rpx;
  4473. background: #ffffff;
  4474. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  4475. white-space: nowrap;
  4476. overflow: hidden;
  4477. margin: 15rpx 0;
  4478. }
  4479. .r_sliper {
  4480. padding: 0 20rpx;
  4481. }
  4482. .top_line {
  4483. width: 6rpx;
  4484. height: 22rpx;
  4485. background: #32467b;
  4486. margin-right: 10rpx;
  4487. }
  4488. .video_t2 {
  4489. font-size: 24rpx;
  4490. font-family: PingFang SC;
  4491. font-weight: 500;
  4492. color: #666666;
  4493. }
  4494. .video_play {
  4495. position: absolute;
  4496. width: 95rpx;
  4497. height: 95rpx;
  4498. top: 0;
  4499. left: 0;
  4500. right: 0;
  4501. bottom: 0;
  4502. margin: auto;
  4503. }
  4504. .video_box {
  4505. position: relative;
  4506. #playerVideo {
  4507. position: relative;
  4508. z-index: 99;
  4509. }
  4510. .video-toast {
  4511. position: absolute;
  4512. width: 686rpx;
  4513. height: 80rpx;
  4514. background: rgba(0, 0, 0, 0.6);
  4515. border-radius: 24rpx;
  4516. bottom: 100rpx;
  4517. left: 50%;
  4518. transform: translateX(-50%);
  4519. color: #fff;
  4520. display: flex;
  4521. font-size: 26rpx;
  4522. align-items: center;
  4523. overflow: visible;
  4524. z-index: 999;
  4525. &__text {
  4526. flex: 1;
  4527. margin-left: 40rpx;
  4528. }
  4529. &__btn {
  4530. width: 180rpx;
  4531. text-align: center;
  4532. border-left: 1rpx solid #fff;
  4533. }
  4534. }
  4535. .video-toast__close {
  4536. position: absolute;
  4537. right: 32rpx;
  4538. bottom: 184rpx;
  4539. width: 40rpx;
  4540. height: 40rpx;
  4541. line-height: 40rpx;
  4542. text-align: center;
  4543. background: rgba(0, 0, 0, 0.6);
  4544. border-radius: 50%;
  4545. color: rgba(255, 255, 255, 0.3);
  4546. }
  4547. }
  4548. .rotoct {
  4549. transform: rotate(90deg);
  4550. }
  4551. .slot-content {
  4552. padding: 0 20rpx;
  4553. }
  4554. .notice_modal {
  4555. .content {
  4556. width: 100%;
  4557. height: 100%;
  4558. padding: 56rpx 56rpx 56rpx 64rpx;
  4559. .title {
  4560. color: #222;
  4561. line-height: 40rpx;
  4562. font-size: 36rpx;
  4563. text-align: center;
  4564. font-weight: bold;
  4565. margin-bottom: 24rpx;
  4566. }
  4567. .text {
  4568. height: 340rpx;
  4569. line-height: 40rpx;
  4570. text-indent: 2em;
  4571. font-size: 32rpx;
  4572. color: #222;
  4573. }
  4574. .had_read {
  4575. width: 100%;
  4576. height: 88rpx;
  4577. line-height: 88rpx;
  4578. text-align: center;
  4579. background: #3577e8;
  4580. border-radius: 240rpx;
  4581. font-size: 32rpx;
  4582. font-weight: 500;
  4583. color: #fff;
  4584. margin-top: 20rpx;
  4585. &.gray {
  4586. background: #bbbec5;
  4587. }
  4588. }
  4589. }
  4590. }
  4591. .full_mulu {
  4592. position: absolute;
  4593. top: 100rpx;
  4594. right: 20rpx;
  4595. width: 700rpx;
  4596. height: 515rpx;
  4597. color: #333;
  4598. display: flex;
  4599. align-items: center;
  4600. justify-content: space-between;
  4601. z-index: 99999;
  4602. .mulus {
  4603. width: 623rpx;
  4604. // height: 515rpx;
  4605. height: 400rpx;
  4606. overflow-y: scroll;
  4607. // overflow: scroll;
  4608. }
  4609. .mulu_box_in {
  4610. background-color: #b7b7b7;
  4611. border-radius: 16rpx;
  4612. // transition: all 0.5s;
  4613. &::after {
  4614. content: "";
  4615. width: 0;
  4616. height: 0;
  4617. position: absolute;
  4618. top: 235rpx;
  4619. right: 27px;
  4620. border-top: 16rpx solid transparent;
  4621. border-right: 16rpx solid transparent;
  4622. border-left: 16rpx solid #b7b7b7;
  4623. border-bottom: 16rpx solid transparent;
  4624. }
  4625. }
  4626. .mulu_box_out {
  4627. // visibility: hidden;
  4628. display: none;
  4629. }
  4630. .menuBox_mulu {
  4631. // width: 100%;
  4632. background: #ffffff;
  4633. border-radius: 16rpx;
  4634. padding: 0rpx 20rpx;
  4635. margin-bottom: 20rpx;
  4636. }
  4637. .ml_img {
  4638. position: absolute;
  4639. right: 0;
  4640. top: 100rpx;
  4641. }
  4642. .items {
  4643. width: 620rpx;
  4644. height: 100rpx;
  4645. border: 1rpx solid red;
  4646. }
  4647. }
  4648. </style>