detail.vue 135 KB

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