detail.vue 139 KB

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