detail.vue 140 KB

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