detail.vue 137 KB

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