detail.vue 140 KB

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