detail.vue 136 KB

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