detail copy.vue 130 KB

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