detail.vue 134 KB

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