detail.vue 137 KB

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