detail.vue 140 KB

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