detail.vue 136 KB

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