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. if (this.erJianErZao) {
  2191. this.photoList = this.randomConfig(totalVideoTime, duration);
  2192. return;
  2193. }
  2194. //没有历史拍照间隔数据
  2195. if (this.photoList.length == 0) {
  2196. if (totalVideoTime >= 900) {
  2197. //大于15分钟
  2198. if (photoNum == 1) {
  2199. //开头拍1张
  2200. this.photoList.push(0);
  2201. } else if (photoNum == 3) {
  2202. //拍3张
  2203. this.photoList.push(0); //开头拍一张
  2204. let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
  2205. let centerMinTime = centerTime - 300; //前后5分钟
  2206. let centerMaxTime = centerTime + 300;
  2207. let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
  2208. this.photoList.push(centerTakeTime); //中间拍一张
  2209. let endMaxTime = totalVideoTime - 60;
  2210. let endMinTime = totalVideoTime - 300;
  2211. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  2212. this.photoList.push(endTakeTime); //最后拍一张
  2213. }
  2214. } else {
  2215. //小于15分钟,只拍前后各一张
  2216. if (photoNum == 1) {
  2217. //开头拍1张
  2218. this.photoList.push(0);
  2219. } else if (photoNum == 3) {
  2220. this.photoList.push(1);
  2221. let centerTime = this.randomNum(
  2222. (1 / 3) * totalVideoTime,
  2223. (2 / 3) * totalVideoTime
  2224. );
  2225. this.photoList.push(centerTime);
  2226. let endTakeTime = this.randomNum(
  2227. (2 / 3) * totalVideoTime,
  2228. totalVideoTime
  2229. );
  2230. this.photoList.push(endTakeTime);
  2231. }
  2232. }
  2233. this.postCoursePhotoRecord(true); //提交随机拍照时间数组
  2234. }
  2235. //兼容已有观看历史
  2236. for (let i = 0; i < this.photoList.length - 1; i++) {
  2237. if (
  2238. this.photoList[i] < duration &&
  2239. this.photoList[i + 1] > duration
  2240. ) {
  2241. this.photoIndex = i + 1;
  2242. break;
  2243. }
  2244. if (duration > this.photoList[this.photoList.length - 1]) {
  2245. this.photoIndex = this.photoList.length - 1; //取最后一个下标
  2246. break;
  2247. }
  2248. }
  2249. }
  2250. },
  2251. // 随机拍摄时间
  2252. randomConfig(totalVideoTime, duration) {
  2253. // // #ifdef MP-WEIXIN
  2254. // let totalVideoTime = polyvPlayerContext.getDuration();
  2255. // let duration = polyvPlayerContext.getCurrentTime();
  2256. // // #endif
  2257. // // #ifdef H5
  2258. // let totalVideoTime = polyvPlayerContext.j2s_getDuration();
  2259. // let duration = polyvPlayerContext.j2s_getCurrentTime();
  2260. // // #endif
  2261. this.photoHistoryList = [];
  2262. let photoList = [duration];
  2263. let pre = duration;
  2264. if (totalVideoTime > 300) {
  2265. while (pre <= totalVideoTime) {
  2266. pre += this.randomNum(780, 900);
  2267. pre <= totalVideoTime && photoList.push(pre);
  2268. }
  2269. if (totalVideoTime - 300 > photoList.slice(-1)[0]) {
  2270. photoList.push(this.randomNum(totalVideoTime - 180, totalVideoTime));
  2271. }
  2272. }
  2273. return photoList;
  2274. },
  2275. getLiveUid(channelId) {
  2276. let self = this;
  2277. return new Promise((resolve) => {
  2278. let data = {
  2279. channelId: channelId,
  2280. orderGoodsId: this.orderGoodsId,
  2281. };
  2282. self.$api.polyvSign(data).then((res) => {
  2283. resolve(res.data.data);
  2284. });
  2285. });
  2286. },
  2287. timeEventLiving() {
  2288. if (plv != null) {
  2289. if (this.livePlay) {
  2290. this.liveDuration = this.liveDuration + 1; //每隔1秒
  2291. if (this.liveDuration == 2) {
  2292. //直播第2秒拍照
  2293. if (
  2294. this.goodsPhotographConfig &&
  2295. this.goodsPhotographConfig.livephotograph == 1 &&
  2296. this.channelItem.learning != 1 &&
  2297. this.photoHistoryList.length == 0
  2298. ) {
  2299. //开启直播拍照
  2300. this.openPhoto();
  2301. } else {
  2302. this.postStudyRecord(0);
  2303. }
  2304. }
  2305. }
  2306. }
  2307. },
  2308. playerLiveStatusChange(e) {
  2309. const status = e.detail.status;
  2310. if (status === "live") {
  2311. //开始播放
  2312. if (this.timer) {
  2313. clearInterval(this.timer);
  2314. }
  2315. this.livePlay = true;
  2316. this.timer = setInterval(this.timeEventLiving, 1000); //定时器
  2317. }
  2318. if (status === "end") {
  2319. this.hasStart = false;
  2320. if (this.livePlay) {
  2321. //只有播放过的结束才提交,避免未开播触发结束
  2322. this.postStudyRecord(1);
  2323. }
  2324. this.livePlay = false;
  2325. // 未开始
  2326. }
  2327. },
  2328. closePlv() {
  2329. if (plv) {
  2330. plv.destroy();
  2331. }
  2332. },
  2333. playChannel(item) {
  2334. if (this.timer) {
  2335. clearInterval(this.timer);
  2336. }
  2337. this.startStatus = true;
  2338. this.initLive();
  2339. },
  2340. setLiveOption(status) {
  2341. const { userId, channelId, recordFileSimpleModel, playbackEnabled } =
  2342. this.detail;
  2343. const playRecordFile =
  2344. playbackEnabled && recordFileSimpleModel && status === "end";
  2345. this.videoOption = {
  2346. mode: "live",
  2347. uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
  2348. cid: this.playChannelId,
  2349. openId: this.userInfo.userAccount,
  2350. isAutoChange: false,
  2351. forceVideo: false,
  2352. };
  2353. },
  2354. async initLive() {
  2355. this.liveObj = await this.getLiveUid(this.playChannelId);
  2356. this.initLiveOk = true;
  2357. let optionsData = {};
  2358. optionsData.mode = "live";
  2359. optionsData.forceVideo = false;
  2360. optionsData.channelId = this.playChannelId; // 频道ID '2553128'
  2361. optionsData.openId = this.userInfo.userAccount; // 用户openId this.userInfo.userAccount 'oQ5eX5BCtSjkE1ct8CzvxGWgh0hQ'
  2362. optionsData.userId = this.liveObj.uid; // 2.0.0及以上版本的demo需要使用 userId 设置学员唯一id 'egsxlptzdq'
  2363. let self = this;
  2364. this.closePlv();
  2365. plv.init(optionsData).then(({ detail, chat }) => {
  2366. self.liveDetail = detail;
  2367. // 设置mode为live的videoOption
  2368. this.setLiveOption();
  2369. if (detail.isPPT) {
  2370. chat.on(chat.events.SLICESTART, () => {
  2371. // 开始直播
  2372. });
  2373. } else {
  2374. plv.api.getOrdinaryLiveStatus(detail.stream);
  2375. }
  2376. });
  2377. },
  2378. openSetting(res) {
  2379. console.log(res, 98);
  2380. },
  2381. getCameraSetting() {
  2382. const self = this;
  2383. // 不支持h5
  2384. wx.getSetting({
  2385. success: (res) => {
  2386. if (res.authSetting["scope.camera"]) {
  2387. // 用户已经授权
  2388. self.showSet = false;
  2389. this.prendreAutoCarme = false;
  2390. } else {
  2391. this.prendreAutoCarme = true;
  2392. // 用户还没有授权,向用户发起授权请求
  2393. wx.authorize({
  2394. scope: "scope.camera",
  2395. success: () => {
  2396. // 用户同意授权
  2397. self.showSet = false;
  2398. this.prendreAutoCarme = false;
  2399. },
  2400. fail: () => {
  2401. // 用户不同意授权
  2402. self.showSet = true;
  2403. },
  2404. });
  2405. }
  2406. },
  2407. fail: (res) => {},
  2408. });
  2409. },
  2410. studyNotice() {
  2411. this.noticeShow = true;
  2412. },
  2413. //播放笔记视频
  2414. async playNoteVideo(item) {
  2415. if (this.timer) {
  2416. clearInterval(this.timer);
  2417. }
  2418. if (this.vid) {
  2419. //切换视频
  2420. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2421. polyvPlayerContext.changeVid(item.recordingUrl);
  2422. } else {
  2423. this.vid = item.recordingUrl;
  2424. }
  2425. this.recordObj = { videoCurrentTime: item.noteSecond };
  2426. if (this.recordObj.videoCurrentTime) {
  2427. this.needSeek = true; //需要跳转到播放记录
  2428. }
  2429. this.startStatus = true;
  2430. //获取节笔记
  2431. this.getNoteList();
  2432. },
  2433. //正常播放视频
  2434. async playVideo(item) {
  2435. if (this.timer) {
  2436. clearInterval(this.timer);
  2437. }
  2438. // #ifdef H5
  2439. await this.clears();
  2440. // #endif
  2441. if (this.vid) {
  2442. //切换视频
  2443. polyvPlayerContext && polyvPlayerContext.changeVid(item.recordingUrl);
  2444. } else {
  2445. this.vid = item.recordingUrl;
  2446. }
  2447. this.recordObj = null;
  2448. this.recordObj = await this.getRecordLast();
  2449. this.needSeek = true; //跳转到播放记录
  2450. this.startStatus = true;
  2451. // #ifdef H5
  2452. await this.loadPlayerScript(this.loadPlayer);
  2453. // #endif
  2454. // 提交学习记录
  2455. // #ifdef MP-WEIXIN
  2456. this.postStudyRecord(0);
  2457. // #endif
  2458. //获取节笔记
  2459. this.getNoteList();
  2460. },
  2461. getRecordLast() {
  2462. return new Promise((resolve) => {
  2463. let data = {
  2464. gradeId:
  2465. this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
  2466. goodsId:
  2467. this.goodsId || this.goodsId == 0 ? Number(this.goodsId) : null,
  2468. sectionId: this.playSectionId || 0,
  2469. courseId:
  2470. this.courseId || this.courseId == 0 ? Number(this.courseId) : null,
  2471. chapterId: this.chapterId || 0,
  2472. moduleId: this.moduleId || 0,
  2473. orderGoodsId: this.orderGoodsId,
  2474. };
  2475. this.$api.recordLast(data).then((res) => {
  2476. resolve(res.data.data);
  2477. });
  2478. });
  2479. },
  2480. jumpNote(item) {
  2481. this.noteId = item.noteId;
  2482. //没视频播放
  2483. if (this.playSectionId == 0) {
  2484. this.$u.toast("即将跳到笔记位置");
  2485. this.$store.commit("setPlaySectionId", {
  2486. playSectionId: item.sectionId || item.menuId,
  2487. });
  2488. this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
  2489. this.playNoteVideo(item);
  2490. } else {
  2491. //正在看当前笔记视频
  2492. this.$u.toast("即将跳到笔记位置");
  2493. //跳到笔记时刻
  2494. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2495. // #ifdef MP-WEIXIN
  2496. polyvPlayerContext.seek(item.noteSecond);
  2497. polyvPlayerContext.play();
  2498. // #endif
  2499. // #ifdef H5
  2500. polyvPlayerContext.j2s_seekVideo(0);
  2501. polyvPlayerContext.j2s_resumeVideo();
  2502. // #endif
  2503. }
  2504. },
  2505. postNote() {
  2506. let self = this;
  2507. if (!(this.playSectionId > 0)) {
  2508. this.$u.toast("目前无播放视频");
  2509. return;
  2510. }
  2511. if (!this.noteValue) {
  2512. this.$u.toast("请输入内容");
  2513. return;
  2514. }
  2515. if (!this.gradeId) {
  2516. this.$u.toast("暂无班级数据");
  2517. return;
  2518. }
  2519. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2520. let noteDate = this.$method.getZeroTime();
  2521. let noteSecond = 0;
  2522. // #ifdef MP-WEIXIN
  2523. noteSecond = polyvPlayerContext.getCurrentTime();
  2524. // #endif
  2525. // #ifdef H5
  2526. noteSecond = polyvPlayerContext.j2s_getCurrentTime();
  2527. // #endif
  2528. if (!noteSecond) {
  2529. if (noteSecond == 0) {
  2530. //播放结束
  2531. // #ifdef MP-WEIXIN
  2532. noteSecond = polyvPlayerContext.getDuration();
  2533. // #endif
  2534. // #ifdef H5
  2535. noteSecond = polyvPlayerContext.j2s_getCurrentTime();
  2536. // #endif
  2537. }
  2538. if (!noteSecond) {
  2539. this.$u.toast("视频暂未开始");
  2540. return;
  2541. }
  2542. }
  2543. let data = {
  2544. gradeId: this.gradeId,
  2545. goodsId: this.goodsId,
  2546. sectionId: this.playSectionId,
  2547. courseId: this.courseId,
  2548. noteText: this.noteValue,
  2549. noteDate: noteDate,
  2550. noteSecond: noteSecond,
  2551. orderGoodsId: this.orderGoodsId,
  2552. };
  2553. this.$api.postNote(data).then((res) => {
  2554. if (res.data.code == 200) {
  2555. this.$u.toast("发布成功");
  2556. self.getNoteList();
  2557. this.noteValue = "";
  2558. }
  2559. });
  2560. },
  2561. getGradeInfo() {
  2562. let self = this;
  2563. this.$store.state.allowLoading = false;
  2564. this.$api.goodsGradeInfo(this.gradeId).then((res) => {
  2565. if (res.data.code == 200) {
  2566. self.gradeDetail = res.data.data;
  2567. if (self.needProfileModal) {
  2568. return;
  2569. }
  2570. if (self.gradeDetail.learningStatus == 2) {
  2571. uni.showModal({
  2572. showCancel: false,
  2573. confirmText: "确定",
  2574. content:
  2575. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  2576. success: function (resultst) {
  2577. uni.navigateBack();
  2578. },
  2579. });
  2580. }
  2581. if (
  2582. self.gradeDetail.learningStatus == 3 &&
  2583. Number(self.gradeDetail.learningTimeStart) >
  2584. Number(new Date() / 1000)
  2585. ) {
  2586. uni.showModal({
  2587. showCancel: false,
  2588. cancelText: "返回",
  2589. content:
  2590. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  2591. success: function (resultst) {
  2592. uni.navigateBack();
  2593. },
  2594. });
  2595. }
  2596. }
  2597. });
  2598. this.$store.state.allowLoading = true;
  2599. },
  2600. getNoteList() {
  2601. let self = this;
  2602. self.noteList = [];
  2603. let data = {
  2604. courseId: this.courseId,
  2605. gradeId: this.gradeId,
  2606. goodsId: this.goodsId,
  2607. orderGoodsId: this.orderGoodsId,
  2608. };
  2609. if (this.playSectionId > 0) {
  2610. data.sectionId = this.playSectionId;
  2611. }
  2612. this.$api.noteList(data).then((res) => {
  2613. if (res.data.code == 200) {
  2614. self.noteList = res.data.rows;
  2615. }
  2616. });
  2617. },
  2618. delAnswer(answerId) {
  2619. let self = this;
  2620. let data = {
  2621. answerId: answerId,
  2622. status: -1,
  2623. orderGoodsId: this.orderGoodsId,
  2624. };
  2625. this.$api.delAnswer(data).then((res) => {
  2626. if (res.data.code == 200) {
  2627. self.getAnswerList();
  2628. }
  2629. });
  2630. },
  2631. clearCtx() {
  2632. this.placeholder = "您可以在这里输入答疑内容";
  2633. this.ctxValue = "";
  2634. this.assignUserId = 0;
  2635. },
  2636. focusNote(event) {
  2637. this.bottomHeight = event.detail.height;
  2638. },
  2639. blurNote() {
  2640. this.bottomHeight = 0;
  2641. },
  2642. blur() {
  2643. this.bottomHeight = 0;
  2644. this.clearTimer = setTimeout(() => {
  2645. this.ctxValue = "";
  2646. this.isFocus = false;
  2647. this.assignUserId = 0;
  2648. this.placeholder = "您可以在这里输入答疑内容";
  2649. }, 2000);
  2650. },
  2651. replyContent(item) {
  2652. this.isFocus = true;
  2653. this.assignUserId = item.userId;
  2654. this.placeholder = "@" + item.realname;
  2655. },
  2656. delContent(item) {
  2657. this.delAnswer(item.answerId);
  2658. },
  2659. postAnswer() {
  2660. let self = this;
  2661. let data = {
  2662. courseId: this.courseId,
  2663. answerText: this.ctxValue,
  2664. goodsId: this.goodsId,
  2665. orderGoodsId: this.orderGoodsId,
  2666. };
  2667. if (this.assignUserId > 0) {
  2668. data.assignUserId = this.assignUserId;
  2669. }
  2670. this.$api.postAnswer(data).then((res) => {
  2671. if (res.data.code == 200) {
  2672. this.$u.toast("发布成功");
  2673. self.getAnswerList();
  2674. this.isFocus = false;
  2675. this.placeholder = "您可以在这里输入答疑内容";
  2676. this.ctxValue = "";
  2677. this.assignUserId = 0;
  2678. }
  2679. });
  2680. },
  2681. postContent() {
  2682. if (!this.ctxValue || this.ctxValue == "") {
  2683. this.$u.toast("请输入内容");
  2684. return;
  2685. }
  2686. this.postAnswer();
  2687. },
  2688. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  2689. let currentTime = 0;
  2690. let PlayDuration = 0;
  2691. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2692. if (polyvPlayerContext) {
  2693. // #ifdef MP-WEIXIN
  2694. currentTime = polyvPlayerContext.getCurrentTime(); //获取视频当前的播放时刻
  2695. PlayDuration = polyvPlayerContext.getVideoPlayDuration(); //本次看的时长
  2696. // #endif
  2697. // #ifdef H5
  2698. currentTime = polyvPlayerContext.j2s_getCurrentTime(); //当前视频播放时刻
  2699. PlayDuration = polyvPlayerContext.j2s_realPlayVideoTime(); //本次看的时长
  2700. // #endif
  2701. }
  2702. if (this.playChannelId > 0) {
  2703. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  2704. }
  2705. let self = this;
  2706. let data = {
  2707. fromPlat: 1, //来源平台 1小程序 2网站
  2708. photo: self.ossAvatarUrl,
  2709. sectionId: sectionId || 0,
  2710. goodsId: parseInt(self.goodsId),
  2711. courseId: parseInt(self.courseId),
  2712. orderGoodsId: this.orderGoodsId,
  2713. studyDuration: parseInt(
  2714. PlayDuration > 0 ? PlayDuration : self.studyDuration
  2715. ),
  2716. gradeId: parseInt(self.gradeId),
  2717. chapterId: this.chapterId || 0,
  2718. moduleId: this.moduleId || 0,
  2719. videoCurrentTime: parseInt(
  2720. currentTime > 0 ? currentTime : self.studyDuration
  2721. ),
  2722. };
  2723. if (this.ossAvatarUrl) {
  2724. data.similarity = this.compareFaceData; // 相似度
  2725. }
  2726. if (status > 0) {
  2727. data.status = status;
  2728. }
  2729. // console.log("提交接口:", data,'sectionId:', sectionId,'chapterId:', self.chapterId,'moduleId:', self.moduleId, 'courseId:', this.courseId);
  2730. this.$api
  2731. .studyRecord(data)
  2732. .then((res) => {
  2733. if (res.data.code == 200) {
  2734. if (status > 0) {
  2735. this.studyRecordMenuAllList();
  2736. let moduleId = this.moduleId || 0;
  2737. let chapterId = this.chapterId || 0;
  2738. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  2739. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  2740. uni.$emit("playNext" + playNextIdisRebuild, {
  2741. fromRebuild: this.isRebuild,
  2742. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  2743. uni.$emit("playNext" + playNextId); //通知播放结束
  2744. }
  2745. self.ossAvatarUrl = "";
  2746. } else {
  2747. this.uploadLock = false;
  2748. uni.showToast({
  2749. icon: "none",
  2750. title: res.data.msg,
  2751. });
  2752. }
  2753. })
  2754. .catch((err) => {
  2755. this.studyRecordMenuAllList();
  2756. });
  2757. },
  2758. uploadFile(options, int) {
  2759. var self = this;
  2760. return new Promise((resolve, reject) => {
  2761. var data = {
  2762. imageStatus: int,
  2763. gradeId: this.gradeId,
  2764. orderGoodsId: this.orderGoodsId,
  2765. };
  2766. self.$api.aliyunpolicy(data).then((res) => {
  2767. if (res.data.code != 200) {
  2768. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  2769. return;
  2770. }
  2771. var ossToken = res.data.data.resultContent;
  2772. if (ossToken.host == null || ossToken.host == undefined) {
  2773. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  2774. return;
  2775. }
  2776. let filePath = "";
  2777. // #ifdef H5
  2778. var localData = options; //dataUrl为base64位
  2779. let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
  2780. let length = base.length;
  2781. let url = new Uint8Array(length);
  2782. while (length--) {
  2783. url[length] = base.charCodeAt(length);
  2784. }
  2785. filePath = new File([url], "a.jpg", {
  2786. type: "image/jpg",
  2787. });
  2788. uni.uploadFile({
  2789. url: ossToken.host,
  2790. name: "file",
  2791. file: filePath,
  2792. fileType: "image",
  2793. header: {
  2794. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2795. },
  2796. formData: {
  2797. key: ossToken.dir,
  2798. OSSAccessKeyId: ossToken.accessid,
  2799. policy: ossToken.policy,
  2800. Signature: ossToken.signature,
  2801. callback: ossToken.callback,
  2802. success_action_status: 200,
  2803. },
  2804. success: (result) => {
  2805. this.$u.toast("上传成功");
  2806. self.ossAvatarUrl = ossToken.dir;
  2807. resolve();
  2808. },
  2809. fail: (error) => {
  2810. uni.showToast({
  2811. title: "上传接口报错,请重新拍照上传" + error,
  2812. icon: "none",
  2813. });
  2814. this.openPhoto();
  2815. return;
  2816. },
  2817. });
  2818. // #endif
  2819. // #ifdef MP-WEIXIN
  2820. uni.uploadFile({
  2821. url: ossToken.host,
  2822. name: "file",
  2823. filePath: options,
  2824. fileType: "image",
  2825. header: {
  2826. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2827. },
  2828. formData: {
  2829. key: ossToken.dir,
  2830. OSSAccessKeyId: ossToken.accessid,
  2831. policy: ossToken.policy,
  2832. Signature: ossToken.signature,
  2833. callback: ossToken.callback,
  2834. success_action_status: 200,
  2835. },
  2836. success: (result) => {
  2837. // if (result.statusCode === 200) {
  2838. this.$u.toast("上传成功");
  2839. self.ossAvatarUrl = ossToken.dir;
  2840. resolve();
  2841. },
  2842. fail: (error) => {
  2843. uni.showToast({
  2844. title: "上传接口报错,请重新拍照上传" + error,
  2845. icon: "none",
  2846. });
  2847. this.openPhoto();
  2848. return;
  2849. },
  2850. });
  2851. // #endif
  2852. });
  2853. });
  2854. },
  2855. imageInfos() {
  2856. var self = this;
  2857. return new Promise(async (resolve, reject) => {
  2858. // #ifdef MP-WEIXIN
  2859. uni.getImageInfo({
  2860. src: self.avatarUrl,
  2861. success: async (res) => {
  2862. let canvasWidth = res.width; //图片原始长宽
  2863. let canvasHeight = res.height;
  2864. if (canvasWidth > 2000 || canvasHeight > 2000) {
  2865. // h5不支持
  2866. uni.compressImage({
  2867. src: self.avatarUrl,
  2868. quality: 75,
  2869. width: "35%",
  2870. height: "35%",
  2871. success: async (rest) => {
  2872. const waitUpload = await self.uploadFile(
  2873. rest.tempFilePath,
  2874. 0
  2875. );
  2876. resolve(waitUpload);
  2877. },
  2878. });
  2879. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  2880. uni.compressImage({
  2881. src: self.avatarUrl,
  2882. quality: 75,
  2883. width: "50%",
  2884. height: "50%",
  2885. success: async (rest) => {
  2886. const waitUpload = await self.uploadFile(
  2887. rest.tempFilePath,
  2888. 0
  2889. );
  2890. resolve(waitUpload);
  2891. },
  2892. });
  2893. } else {
  2894. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  2895. resolve(waitUpload);
  2896. }
  2897. },
  2898. fail: (err) => {
  2899. this.$u.toast("图片上传失败");
  2900. },
  2901. });
  2902. // #endif
  2903. // #ifdef H5
  2904. const waitUpload = await this.uploadFile(this.faceUrl, 0);
  2905. resolve(waitUpload);
  2906. // #endif
  2907. });
  2908. },
  2909. timeEvent() {
  2910. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2911. if (polyvPlayerContext != null) {
  2912. // #ifdef MP-WEIXIN
  2913. this.playTime = polyvPlayerContext.getCurrentTime(); //播放时刻
  2914. // #endif
  2915. // #ifdef H5
  2916. this.playTime = polyvPlayerContext.j2s_getCurrentTime();
  2917. // #endif
  2918. this.configPhoto();
  2919. console.info(this.photoList, "photoList");
  2920. let photoTime = 0; //获取拍照秒数
  2921. for (let i = 0; i < this.photoList.length; i++) {
  2922. photoTime = Number(this.photoList[i]); //获取拍照秒数
  2923. if (photoTime < this.playTime && photoTime > this.playTime - 8) {
  2924. //3秒区间内才触发拍照,避免拉动滚动条
  2925. if (this.photoHistoryList.indexOf(i) < 0) {
  2926. //不存在拍照历史,没有重修过,没有学过,则拍照
  2927. //启动拍照
  2928. //暂停
  2929. console.log("去拍照");
  2930. // #ifdef MP-WEIXIN
  2931. polyvPlayerContext.exitFullScreen();
  2932. polyvPlayerContext.pause();
  2933. // #endif
  2934. // #ifdef H5
  2935. polyvPlayerContext.j2s_pauseVideo();
  2936. polyvPlayerContext.toggleFullscreen();
  2937. // #endif
  2938. this.photoIndex = i;
  2939. if (
  2940. uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
  2941. this.goodsId
  2942. ) {
  2943. this.openPhoto();
  2944. } else {
  2945. this.popupPhotoShow = true;
  2946. uni.setStorageSync(
  2947. `tabkePhotoShow${this.goodsId}`,
  2948. this.goodsId
  2949. ); // 本地缓存用来判断是否已经弹出过弹窗
  2950. }
  2951. }
  2952. }
  2953. }
  2954. }
  2955. },
  2956. closeToast() {
  2957. clearTimeout(this.toastTimer);
  2958. this.videoToastShow = false;
  2959. },
  2960. restart() {
  2961. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2962. // #ifdef MP-WEIXIN
  2963. polyvPlayerContext.seek(0);
  2964. // #endif
  2965. // #ifdef H5
  2966. polyvPlayerContext.j2s_seekVideo(0);
  2967. // #endif
  2968. clearTimeout(this.toastTimer);
  2969. this.videoToastShow = false;
  2970. },
  2971. // 新增用户视频学习日志
  2972. studyLog() {
  2973. this.$http({
  2974. url: "/user/study/log",
  2975. method: "post",
  2976. data: {
  2977. goodsId: this.goodsId,
  2978. courseId: this.courseId,
  2979. moduleId: this.moduleId || 0,
  2980. chapterId: this.chapterId || 0,
  2981. sectionId: this.playSectionId || 0,
  2982. fromPlat: 1, //来源平台 1小程序 2PC网站
  2983. goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  2984. orderGoodsId: this.orderGoodsId,
  2985. },
  2986. }).then((res) => {});
  2987. },
  2988. onStateChange(newstate, oldstate) {
  2989. polyvPlayerContext = this.selectComponent("#playerVideo");
  2990. if (newstate.detail.newstate == "playing") {
  2991. if (this.needSeek) {
  2992. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  2993. if (this.recordObj.videoCurrentTime) {
  2994. polyvPlayerContext.seek(this.recordObj.videoCurrentTime);
  2995. this.seekTime = this.$method.secondToDate(
  2996. this.recordObj.videoCurrentTime
  2997. );
  2998. this.videoToastShow = true;
  2999. this.toastTimer = setTimeout(() => {
  3000. this.videoToastShow = false;
  3001. }, 3000);
  3002. } else {
  3003. polyvPlayerContext.seek(1); //避免相同节继续播放
  3004. }
  3005. polyvPlayerContext.play();
  3006. this.needSeek = false;
  3007. // 新增用户视频学习日志
  3008. this.studyLog();
  3009. // 提交学习记录
  3010. }
  3011. //开始播放
  3012. this.timer && clearInterval(this.timer);
  3013. if (
  3014. this.sectionItem.learning != 1 &&
  3015. (this.erJianErZao || this.photoNum > 0)
  3016. ) {
  3017. this.timer = setInterval(this.timeEvent, 1000); //定时器
  3018. }
  3019. }
  3020. if (newstate.detail.newstate == "pause") {
  3021. this.pauseTime = Date.now();
  3022. console.log("小程序暂停",this.pauseTime);
  3023. clearInterval(this.timer);
  3024. }
  3025. if (newstate.detail.newstate == "ended") {
  3026. clearInterval(this.timer);
  3027. uni.showToast({
  3028. icon: "none",
  3029. title: "播放完毕",
  3030. });
  3031. this.hasStart = false;
  3032. this.postStudyRecord(1);
  3033. this.nextSection();
  3034. }
  3035. },
  3036. //播放下一节
  3037. nextSection() {
  3038. if (!this.menuAllList.length) {
  3039. return;
  3040. }
  3041. this.curPlayIndex = this.menuAllList.findIndex((item) => {
  3042. let i_sectionId = item.sectionId || 0;
  3043. let i_chapterId = item.chapterId || 0;
  3044. let i_moduleId = item.moduleId || 0;
  3045. return (
  3046. i_sectionId == this.playSectionId &&
  3047. i_chapterId == this.chapterId &&
  3048. i_moduleId == this.moduleId
  3049. );
  3050. });
  3051. let data = this.menuAllList[this.curPlayIndex + 1];
  3052. if (!data) {
  3053. //第二个弹窗
  3054. uni.showModal({
  3055. title: "温馨提示",
  3056. content: "当前最后一节视频已学完 请检查所有章节是否学习完成?",
  3057. showCancel: false,
  3058. success: (res) => {
  3059. if (res.confirm) {
  3060. }
  3061. },
  3062. });
  3063. } else {
  3064. uni.showModal({
  3065. title: "温馨提示",
  3066. content: "当前节视频已学完,继续学习下一节?",
  3067. success: async (res) => {
  3068. if (res.confirm) {
  3069. this.moduleId = data.moduleId;
  3070. this.chapterId = data.chapterId;
  3071. this.sectionId = data.sectionId;
  3072. if (data.sectionType == 1) {
  3073. //录播
  3074. this.$store.commit("setPlaySectionId", {
  3075. playSectionId: data.sectionId,
  3076. });
  3077. this.$store.commit("setPlayVID", {
  3078. playVID: data.recordingUrl,
  3079. });
  3080. this.hasStart = false;
  3081. this.photoConfig = false;
  3082. this.photoIndex = 0;
  3083. this.sectionItem = data;
  3084. await this.getPhotoLastRecord(); // 获取拍照历史
  3085. this.playVideo(data);
  3086. } else if (data.sectionType == 2) {
  3087. //直播
  3088. this.studyRecordGetLastLive();
  3089. } else if (data.sectionType == 3) {
  3090. //回放
  3091. this.$store.commit("setPlaySectionId", {
  3092. playSectionId: data.sectionId,
  3093. });
  3094. this.$store.commit("setPlayVID", {
  3095. playVID: data.recordingUrl,
  3096. });
  3097. this.sectionItem = data;
  3098. this.playVideo(data);
  3099. }
  3100. let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
  3101. this.$store.commit("updatePlayNextId", playNextId);
  3102. this.updateChapterOpen(true);
  3103. this.reStart = false;
  3104. this.getMenuList();
  3105. }
  3106. },
  3107. });
  3108. }
  3109. },
  3110. //拍照
  3111. openPhoto() {
  3112. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  3113. if (polyvPlayerContext) {
  3114. // #ifdef MP-WEIXIN
  3115. polyvPlayerContext.exitFullScreen();
  3116. // #endif
  3117. // #ifdef H5
  3118. if (this.isFullScreen()) {
  3119. this.exitFullscreen();
  3120. }
  3121. // #endif
  3122. }
  3123. // #ifdef MP-WEIXIN
  3124. this.enableAutoRotation = false;
  3125. this.photoPopup = true;
  3126. this.isTaking = true;
  3127. uni.setKeepScreenOn({
  3128. keepScreenOn: true,
  3129. });
  3130. uni.authorize({
  3131. scope: "scope.camera",
  3132. success() {},
  3133. });
  3134. // #endif
  3135. // #ifdef H5
  3136. if (
  3137. (window.navigator.mediaDevices &&
  3138. window.navigator.mediaDevices.getUserMedia) ||
  3139. window.navigator.getUserMedia ||
  3140. window.navigator.webkitGetUserMedia ||
  3141. window.navigator.mozGetUserMedia
  3142. ) {
  3143. console.log("getUserMedia----");
  3144. // 调用用户媒体设备, 访问摄像头
  3145. this.getUserMedia(
  3146. {
  3147. video: {
  3148. width: 400,
  3149. height: 300,
  3150. },
  3151. },
  3152. this.photographSuccess,
  3153. this.photographError
  3154. );
  3155. } else {
  3156. console.log("1111没有摄像");
  3157. this.photographError();
  3158. }
  3159. // #endif
  3160. },
  3161. /**
  3162. * 人脸匹配
  3163. */
  3164. faceRecognition() {
  3165. return new Promise((resolve) => {
  3166. // #ifdef MP-WEIXIN
  3167. let fileSystem = uni.getFileSystemManager();
  3168. fileSystem.readFile({
  3169. filePath: `${this.avatarUrl}`,
  3170. encoding: "base64",
  3171. position: 0,
  3172. success: (res) => {
  3173. let base64 = "data:image/jpg;base64," + res.data;
  3174. // console.log('base64Data人脸识别参数:', {
  3175. // imageA: base64,
  3176. // orderGoodsId: this.orderGoodsId,
  3177. // gradeId: this.gradeId,
  3178. // })
  3179. this.CompareFace(base64, resolve);
  3180. },
  3181. fail(err) {
  3182. // this.$u.toast('人脸识别错误!')
  3183. console.error(err, "err-----人脸识别错误");
  3184. },
  3185. });
  3186. // #endif
  3187. // #ifdef H5
  3188. this.CompareFace(this.faceUrl, resolve);
  3189. // #endif
  3190. });
  3191. },
  3192. CompareFace(url, resolve) {
  3193. let timer = setTimeout(() => {
  3194. uni.showToast({
  3195. icon: "none",
  3196. title: "拍照超时,请重新拍照",
  3197. duration: 2000,
  3198. success: () => {
  3199. setTimeout(() => {
  3200. uni.navigateBack();
  3201. }, 1000);
  3202. },
  3203. });
  3204. }, 10 * 1000);
  3205. this.$api
  3206. .faceCertificationCompareFace({
  3207. imageA: url,
  3208. orderGoodsId: this.orderGoodsId,
  3209. gradeId: this.gradeId,
  3210. })
  3211. .then((res) => {
  3212. clearTimeout(timer);
  3213. console.log(res, "人脸识别成功res");
  3214. resolve(res.data.data);
  3215. })
  3216. .catch((err) => {
  3217. clearTimeout(timer);
  3218. // 当前网络延迟,
  3219. console.log("人脸识别错误:", err);
  3220. uni.showModal({
  3221. content: "当前网络延迟",
  3222. showCancel: false,
  3223. success: (resultst) => {
  3224. if (resultst.confirm) {
  3225. uni.navigateBack();
  3226. }
  3227. },
  3228. });
  3229. });
  3230. },
  3231. // 确定拍照
  3232. async submit() {
  3233. if (this.uploadLock) {
  3234. return;
  3235. }
  3236. this.uploadLock = true;
  3237. let compareFaceData = await this.faceRecognition();
  3238. console.log(compareFaceData, "compareFaceData");
  3239. this.compareFaceData = compareFaceData;
  3240. if (compareFaceData >= 80) {
  3241. const waitYS = await this.imageInfos();
  3242. this.postCoursePhotoRecord()
  3243. .then((res) => {
  3244. this.photoHistoryList.push(this.photoIndex);
  3245. // console.log('拍照确定提交', this.photoHistoryList);
  3246. this.postStudyRecord(); //提交记录
  3247. //恢复播放
  3248. // #ifdef MP-WEIXIN
  3249. uni.setKeepScreenOn({
  3250. keepScreenOn: false,
  3251. });
  3252. // #endif
  3253. this.photoPopup = false;
  3254. this.uploadLock = false;
  3255. this.enableAutoRotation = true;
  3256. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  3257. if (polyvPlayerContext != null) {
  3258. // #ifdef MP-WEIXIN
  3259. polyvPlayerContext.play();
  3260. // #endif
  3261. // #ifdef H5
  3262. polyvPlayerContext.j2s_resumeVideo();
  3263. // #endif
  3264. }
  3265. })
  3266. .catch((err) => {
  3267. console.log("拍照记录接口的err", err);
  3268. uni.showToast({
  3269. title: "上传接口报错,请重新拍照上传" + err,
  3270. icon: "none",
  3271. });
  3272. this.uploadLock = false;
  3273. this.openPhoto();
  3274. });
  3275. } else {
  3276. uni.showToast({
  3277. title: "人脸匹配不通过,请重新拍照上传",
  3278. icon: "none",
  3279. duration: 2000,
  3280. });
  3281. setTimeout(() => {
  3282. this.uploadLock = false;
  3283. this.openPhoto();
  3284. }, 2000);
  3285. }
  3286. },
  3287. reTake() {
  3288. this.isTaking = true;
  3289. // #ifdef H5
  3290. this.faceUrl = "";
  3291. this.getUserMedia({
  3292. video: {
  3293. width: 400,
  3294. height: 300,
  3295. },
  3296. });
  3297. // #endif
  3298. },
  3299. toTakePhoto() {
  3300. this.popupPhotoShow = false;
  3301. this.openPhoto();
  3302. },
  3303. takePhTips() {
  3304. this.popupPhotoShow = true;
  3305. this.isTaking = false;
  3306. this.photoPopup = false;
  3307. this.enableAutoRotation = false;
  3308. },
  3309. //确认拍照
  3310. takePhoto() {
  3311. // #ifdef MP-WEIXIN
  3312. const ctx = uni.createCameraContext();
  3313. ctx.takePhoto({
  3314. quality: "high",
  3315. success: (res) => {
  3316. this.avatarUrl = res.tempImagePath;
  3317. console.log("开始拍照this.avatarUrl:", this.avatarUrl);
  3318. this.isTaking = false;
  3319. },
  3320. fail: (err) => {},
  3321. });
  3322. // #endif
  3323. // #ifdef H5
  3324. const canvas = document.createElement("canvas");
  3325. canvas.width = 400;
  3326. canvas.height = 400;
  3327. const context = canvas.getContext("2d");
  3328. const video = document.querySelector("video");
  3329. context.drawImage(video, 0, 0, 400, 400);
  3330. this.faceUrl = canvas.toDataURL("image/png");
  3331. this.isTaking = false;
  3332. // #endif
  3333. },
  3334. playError(e) {
  3335. console.log(e);
  3336. },
  3337. //拍照报错
  3338. error(e) {
  3339. console.log(e.detail);
  3340. },
  3341. //关闭相机
  3342. closePhoto() {
  3343. this.photoPopup = false;
  3344. self.enableAutoRotation = true;
  3345. },
  3346. /**
  3347. * 进入全屏
  3348. */
  3349. fullscreenchange(event) {
  3350. if (event.detail.direction == "vertical") {
  3351. this.navShow = true;
  3352. } else if (event.detail.direction == "horizontal") {
  3353. this.navShow = false;
  3354. }
  3355. },
  3356. getGoodsDetail() {
  3357. let self = this;
  3358. // '/goods/'+ data,
  3359. this.$api.goodsDetail(this.goodsId).then((res) => {
  3360. this.goodsData = res.data.data;
  3361. if (self.goodsData.buyNote) {
  3362. this.baseHandoutTipList();
  3363. }
  3364. self.gradeId = self.goodsData.gradeId;
  3365. this.courseBusiness(this.goodsData.businessId);
  3366. this.courseHandouts();
  3367. self.getMenuList();
  3368. self.getReMenuList(); //获取重修目录
  3369. setTimeout(function () {
  3370. if (!self.needProfileModal) {
  3371. self.getGradeInfo();
  3372. }
  3373. }, 500);
  3374. //获取节笔记
  3375. this.getNoteList();
  3376. if (self.goodsData.goodsPlayConfig) {
  3377. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  3378. if (self.goodsPlayConfig.autoPlay > 0) {
  3379. // #ifdef H5
  3380. self.autoplay = true;
  3381. // #endif
  3382. }
  3383. if (self.goodsPlayConfig.drag > 0) {
  3384. // #ifdef MP-WEIXIN
  3385. self.isAllowSeek = "yes";
  3386. // #endif
  3387. // #ifdef H5
  3388. this.H5isAllowSeek = "off";
  3389. // #endif
  3390. }
  3391. if (self.goodsPlayConfig.speed > 0) {
  3392. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  3393. }
  3394. }
  3395. self.erJianErZao = self.goodsData.erJianErZao;
  3396. if (self.goodsData.goodsPhotographConfig) {
  3397. self.goodsPhotographConfig = JSON.parse(
  3398. self.goodsData.goodsPhotographConfig
  3399. );
  3400. if (self.goodsPhotographConfig.photoNum > 0) {
  3401. self.photoNum = self.goodsPhotographConfig.photoNum;
  3402. }
  3403. }
  3404. });
  3405. },
  3406. startVideo() {
  3407. this.startStatus = true;
  3408. },
  3409. getAnswerList() {
  3410. let self = this;
  3411. this.$api
  3412. .answerList({
  3413. courseId: this.courseId,
  3414. goodsId: this.goodsId,
  3415. orderGoodsId: this.orderGoodsId,
  3416. })
  3417. .then((res) => {
  3418. if (res.data.code == 200) {
  3419. self.answerList = res.data.rows;
  3420. }
  3421. });
  3422. },
  3423. getReMenuList() {
  3424. // console.log('重修的目录');
  3425. let self = this;
  3426. this.$api
  3427. .reMenuList({
  3428. orderGoodsId: this.orderGoodsId,
  3429. courseId: this.courseId,
  3430. rebuild: 1,
  3431. gradeId: this.gradeId,
  3432. })
  3433. .then((res) => {
  3434. if (res.data.code == 200) {
  3435. for (let i = 0; i < res.data.rows.length; i++) {
  3436. let item = res.data.rows[i];
  3437. item.down = true;
  3438. item.id = item.menuId;
  3439. item.name = item.menuName;
  3440. }
  3441. self.reMenuList = res.data.rows;
  3442. if (self.reMenuList.length > 0) {
  3443. this.showNotes = false;
  3444. self.list = [
  3445. {
  3446. name: "目录",
  3447. },
  3448. {
  3449. name: "讲义",
  3450. },
  3451. {
  3452. name: "笔记",
  3453. },
  3454. {
  3455. name: "答疑",
  3456. },
  3457. { name: "重修目录" },
  3458. ];
  3459. this.current = 0;
  3460. if (Object.keys(this.sectionItem).length) {
  3461. let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
  3462. this.$store.commit("updatePlayNextId", playNextIdisRebuild);
  3463. }
  3464. } else {
  3465. if (Object.keys(this.sectionItem).length) {
  3466. let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
  3467. this.$store.commit("updatePlayNextId", playNextId);
  3468. }
  3469. self.list = [
  3470. {
  3471. name: "目录",
  3472. },
  3473. {
  3474. name: "讲义",
  3475. },
  3476. {
  3477. name: "笔记",
  3478. },
  3479. {
  3480. name: "答疑",
  3481. },
  3482. ];
  3483. this.current = 0;
  3484. }
  3485. }
  3486. });
  3487. },
  3488. getMenuList() {
  3489. // console.log('menuList的目录');
  3490. let self = this;
  3491. // /course/menuList 查询课程目录结构列表
  3492. this.$api
  3493. .reMenuList({
  3494. courseId: this.courseId,
  3495. gradeId: this.gradeId,
  3496. orderGoodsId: this.orderGoodsId,
  3497. })
  3498. .then((res) => {
  3499. if (res.data.code == 200) {
  3500. for (let i = 0; i < res.data.rows.length; i++) {
  3501. let item = res.data.rows[i];
  3502. item.down = true;
  3503. item.id = item.menuId;
  3504. item.name = item.menuName;
  3505. item.menuType = item.type;
  3506. }
  3507. self.menuList = res.data.rows;
  3508. this.reStart = true;
  3509. for (let i = 0; i < res.data.rows.length; i++) {
  3510. if (res.data.rows[i].type == 1) {
  3511. // 模块
  3512. if (Object.keys(this.sectionItem).length) {
  3513. if (res.data.rows[i].menuId == this.sectionItem.moduleId) {
  3514. this.menuIndex = [i];
  3515. break;
  3516. }
  3517. } else {
  3518. this.menuIndex = [i];
  3519. break;
  3520. }
  3521. } else if (res.data.rows[i].type == 2) {
  3522. // 章
  3523. if (Object.keys(this.sectionItem).length) {
  3524. if (
  3525. res.data.rows[i].menuId == this.sectionItem.chapterId &&
  3526. (!this.sectionItem.moduleId ||
  3527. this.sectionItem.moduleId == 0)
  3528. ) {
  3529. this.menuIndex = [i];
  3530. break;
  3531. }
  3532. } else {
  3533. this.menuIndex = [i];
  3534. break;
  3535. }
  3536. }
  3537. }
  3538. // console.log('menuList: ---', this.menuList, 'menuIndex:', this.menuIndex);
  3539. }
  3540. });
  3541. },
  3542. courseDetail() {
  3543. let self = this;
  3544. // '/course/'+data,
  3545. this.$api.courseDetail(this.courseId).then((res) => {
  3546. if (res.data.code == 200) {
  3547. // if (res.data.data.educationName == "继续教育") {
  3548. this.$api
  3549. .lockLockAction({
  3550. action: "jxjy",
  3551. uuid: this.$method.getUuid(),
  3552. })
  3553. .then((res) => {});
  3554. this.lockTimer = setInterval(() => {
  3555. this.$api
  3556. .lockLockAction({
  3557. action: "jxjy",
  3558. uuid: this.$method.getUuid(),
  3559. })
  3560. .then((res) => {});
  3561. }, 10000);
  3562. // websocket.sendMsg("doCourse");
  3563. // }
  3564. self.detail = res.data.data;
  3565. }
  3566. });
  3567. },
  3568. open(item) {
  3569. item.showChildren = !item.showChildren;
  3570. },
  3571. change(index) {
  3572. this.current = index;
  3573. },
  3574. openDocument(item) {
  3575. let url = this.$method.splitImgHost(item.url);
  3576. // #ifdef H5
  3577. window.location.href = url;
  3578. // #endif
  3579. // #ifdef MP-WEIXIN
  3580. this.downLoading = true;
  3581. uni.downloadFile({
  3582. url: url,
  3583. success: (res) => {
  3584. var filePath = res.tempFilePath;
  3585. // h5不支持
  3586. uni.openDocument({
  3587. filePath: filePath,
  3588. fileType: "pdf",
  3589. showMenu: item.canDownload == 1 ? true : false,
  3590. success: (res) => {
  3591. this.downLoading = false;
  3592. uni.setStorageSync("current", this.current);
  3593. },
  3594. fail: (err) => {
  3595. this.downLoading = false;
  3596. uni.showToast({
  3597. icon: "none",
  3598. title: "文档地址错误",
  3599. });
  3600. },
  3601. });
  3602. },
  3603. fail: (err) => {
  3604. this.downLoading = false;
  3605. uni.showModal({
  3606. title: "提示",
  3607. content: "文档错误," + err.errMsg,
  3608. showCancel: false,
  3609. });
  3610. },
  3611. });
  3612. // #endif
  3613. },
  3614. clickMulu() {
  3615. this.muluStyle = !this.muluStyle;
  3616. },
  3617. loadPlayerScript(callback) {
  3618. if (!window.polyvPlayer) {
  3619. const myScript = document.createElement("script");
  3620. myScript.setAttribute("src", this.vodPlayerJs);
  3621. myScript.onload = callback;
  3622. document.body.appendChild(myScript);
  3623. } else {
  3624. callback();
  3625. }
  3626. },
  3627. // 播放视频
  3628. loadPlayer() {
  3629. const polyvPlayer = window.polyvPlayer;
  3630. console.log(
  3631. "h5开始",
  3632. polyvPlayer,
  3633. this.recordObj.videoCurrentTime,
  3634. 666,
  3635. this.vid
  3636. );
  3637. this.$api.polyvVideoSign(this.vid).then(async (res) => {
  3638. console.log("播放凭证res", res);
  3639. this.player = await polyvPlayer({
  3640. wrap: "#player",
  3641. width: "100%",
  3642. showLine: "off",
  3643. height: 218,
  3644. ban_history_time: "on",
  3645. vid: this.vid,
  3646. forceH5: true,
  3647. autoplay: this.autoplay, // 自动播放
  3648. ban_seek: this.H5isAllowSeek, // 是否禁止拖拽进度条
  3649. speed: this.playbackRate, // 倍数
  3650. teaser_show: 1,
  3651. tail_show: 1,
  3652. hideSwitchPlayer: true,
  3653. watchStartTime: this.recordObj.videoCurrentTime, // 播放开始时间,表示视频从第几秒开始播放,参数值需小于视频时长
  3654. ts: res.data.data.ts, // 移动播放加密视频需传入的时间戳。
  3655. sign: res.data.data.sign, // 移动端播放加密视频所需的签名
  3656. // playsafe: (vid, next) => { // PC端播放加密视频所需的授权凭证
  3657. // console.log('111111111111', vid);
  3658. // // this.$api.obtainpolyvvideopcsign(vid).then((res) => {
  3659. // // console.log('请求完后', res);
  3660. // // next(res.data.data);
  3661. // // });
  3662. // },
  3663. });
  3664. polyvPlayerContext = this.player;
  3665. console.log("this.player:", this.player);
  3666. this.player.on("s2j_onPlayStart", (vid) => {
  3667. // 视频初次播放时触发
  3668. console.log("视频初次播放时触发:");
  3669. this.loadedmetadata();
  3670. this.postStudyRecord(0);
  3671. });
  3672. this.player.on("s2j_onVideoPause", () => {
  3673. // 视频暂停时触发
  3674. console.log("视频暂停时触发", this.vid);
  3675. clearInterval(this.studyTimer);
  3676. clearInterval(this.timer);
  3677. });
  3678. this.player.on("s2j_onVideoPlay", () => {
  3679. // 视频初次播放或由暂停恢复播放时触发
  3680. console.log("视频初次播放或由暂停恢复播放时触发");
  3681. if (this.needSeek) {
  3682. if (this.recordObj.videoCurrentTime) {
  3683. this.seekTime = this.$method.secondToDate(
  3684. this.recordObj.videoCurrentTime
  3685. );
  3686. this.videoToastShow = true;
  3687. this.toastTimer = setTimeout(() => {
  3688. this.videoToastShow = false;
  3689. }, 3000);
  3690. }
  3691. this.needSeek = false;
  3692. // 新增用户视频学习日志
  3693. this.studyLog();
  3694. }
  3695. //开始播放
  3696. this.timer && clearInterval(this.timer);
  3697. if (
  3698. this.sectionItem.learning != 1 &&
  3699. (this.erJianErZao || this.photoNum > 0)
  3700. ) {
  3701. this.timer = setInterval(this.timeEvent, 1000); //定时器
  3702. }
  3703. this.studyTimer && clearInterval(this.studyTimer);
  3704. this.studyTimer = setInterval(() => {
  3705. this.postStudyRecord(0, this.playSectionId);
  3706. }, 15000);
  3707. });
  3708. this.player.on("s2j_onPlayOver", () => {
  3709. // 当前视频播放完毕时触发
  3710. console.log("结束了结束了");
  3711. this.hasStart = false;
  3712. clearInterval(this.studyTimer);
  3713. clearInterval(this.timer);
  3714. uni.showToast({
  3715. icon: "none",
  3716. title: "播放完毕",
  3717. });
  3718. this.postStudyRecord(1);
  3719. this.nextSection(); // 播放下一节
  3720. });
  3721. });
  3722. },
  3723. clears() {
  3724. return new Promise((resolve, reject) => {
  3725. this.vid = "";
  3726. this.player && this.player.destroy();
  3727. resolve();
  3728. });
  3729. },
  3730. /**
  3731. * 退出全屏
  3732. */
  3733. exitFullscreen() {
  3734. try {
  3735. var de = document;
  3736. // console.log(de);
  3737. if (de.exitFullscreen) {
  3738. de.exitFullscreen();
  3739. } else if (de.mozCancelFullScreen) {
  3740. de.mozCancelFullScreen();
  3741. } else if (de.webkitCancelFullScreen) {
  3742. de.webkitCancelFullScreen();
  3743. }
  3744. } catch (err) {}
  3745. },
  3746. fullele() {
  3747. return (
  3748. document.fullscreenElement ||
  3749. document.webkitFullscreenElement ||
  3750. document.msFullscreenElement ||
  3751. document.mozFullScreenElement ||
  3752. null
  3753. );
  3754. },
  3755. //判断是否全屏
  3756. isFullScreen() {
  3757. return !!(document.webkitIsFullScreen || this.fullele());
  3758. },
  3759. getUserMedia(constraints, success, error) {
  3760. console.log("getUserMedia===", constraints, "success:", success);
  3761. if (window.navigator.mediaDevices.getUserMedia) {
  3762. // 最新的标准API
  3763. window.navigator.mediaDevices
  3764. .getUserMedia(constraints)
  3765. .then(success)
  3766. .catch(error);
  3767. } else if (window.navigator.webkitGetUserMedia) {
  3768. // webkit核心浏览器
  3769. window.navigator.webkitGetUserMedia(constraints, success, error);
  3770. } else if (window.navigator.mozGetUserMedia) {
  3771. // firfox浏览器
  3772. window.navigator.mozGetUserMedia(constraints, success, error);
  3773. } else if (window.navigator.getUserMedia) {
  3774. // 旧版API
  3775. window.navigator.getUserMedia(constraints, success, error);
  3776. }
  3777. },
  3778. photographSuccess(stream) {
  3779. console.log("有摄像头---", stream);
  3780. this.photoPopup = true;
  3781. this.isTaking = true;
  3782. this.enableAutoRotation = false;
  3783. this.$nextTick(() => {
  3784. const video = document.querySelector("video");
  3785. console.log("video:", video);
  3786. video.srcObject = stream;
  3787. video.play();
  3788. });
  3789. },
  3790. photographError(err) {
  3791. console.log("没有摄像头:", err);
  3792. uni.showModal({
  3793. title: "提示",
  3794. content:
  3795. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  3796. cancelText: "取消",
  3797. confirmText: "确定",
  3798. success: (res) => {
  3799. if (res.confirm) {
  3800. uni.navigateBack();
  3801. } else if (res.cancel) {
  3802. }
  3803. },
  3804. });
  3805. },
  3806. },
  3807. };
  3808. </script>
  3809. <style lang="scss" scope>
  3810. @import "./css/detail.scss";
  3811. .top {
  3812. &__header {
  3813. position: relative;
  3814. width: 100%;
  3815. height: 150rpx;
  3816. padding: 24rpx 150rpx 24rpx 24rpx;
  3817. .img {
  3818. position: absolute;
  3819. left: 0;
  3820. top: 0;
  3821. width: 100%;
  3822. }
  3823. .note {
  3824. position: relative;
  3825. z-index: 10;
  3826. font-size: 24rpx;
  3827. font-family: PingFang SC;
  3828. font-weight: bold;
  3829. color: #efdbff;
  3830. }
  3831. .title {
  3832. position: relative;
  3833. z-index: 10;
  3834. font-size: 26rpx;
  3835. font-family: PingFang SC;
  3836. font-weight: bold;
  3837. color: #ffffff;
  3838. }
  3839. }
  3840. }
  3841. #top {
  3842. position: relative;
  3843. z-index: 99;
  3844. }
  3845. .polyv_detail {
  3846. display: flex;
  3847. flex-direction: column;
  3848. height: 100vh;
  3849. position: relative;
  3850. top: 0;
  3851. left: 0;
  3852. .pops {
  3853. position: absolute;
  3854. top: 0;
  3855. left: 0;
  3856. background: #ccc;
  3857. opacity: 0.5;
  3858. width: 100%;
  3859. height: 300rpx;
  3860. z-index: 9999;
  3861. }
  3862. .box {
  3863. flex: 1;
  3864. overflow: hidden;
  3865. margin: 16rpx 16rpx 100rpx 16rpx;
  3866. .box_in {
  3867. height: 100%;
  3868. }
  3869. }
  3870. .first_ml {
  3871. margin: 16rpx 16rpx 16rpx 16rpx;
  3872. }
  3873. }
  3874. .btnSet {
  3875. width: 440rpx;
  3876. height: 80rpx;
  3877. background: #007aff;
  3878. border-radius: 40rpx;
  3879. color: #ffffff;
  3880. font-size: 28rpx;
  3881. line-height: 80rpx;
  3882. }
  3883. .btnReply {
  3884. width: 80rpx;
  3885. height: 40rpx;
  3886. background: #e3f0ff;
  3887. border-radius: 16rpx;
  3888. text-align: center;
  3889. color: #007aff;
  3890. }
  3891. .btnDel {
  3892. width: 80rpx;
  3893. height: 40rpx;
  3894. background: #ffedf0;
  3895. border-radius: 16rpx;
  3896. text-align: center;
  3897. color: #ff2d55;
  3898. }
  3899. .btnReply {
  3900. width: 80rpx;
  3901. height: 40rpx;
  3902. background: #e3f0ff;
  3903. border-radius: 16rpx;
  3904. font-size: 24rpx;
  3905. }
  3906. .lecture-box {
  3907. display: flex;
  3908. align-items: center;
  3909. height: 80rpx;
  3910. background: #ffffff;
  3911. border-radius: 16rpx 16rpx 16rpx 16rpx;
  3912. margin-bottom: 20rpx;
  3913. .title {
  3914. padding: 10rpx;
  3915. flex: 1;
  3916. overflow: hidden;
  3917. text-overflow: ellipsis;
  3918. white-space: nowrap;
  3919. color: #333;
  3920. font-weight: bold;
  3921. font-size: 32rpx;
  3922. }
  3923. .btn {
  3924. display: flex;
  3925. align-items: center;
  3926. justify-content: center;
  3927. width: 80rpx;
  3928. height: 80rpx;
  3929. background: #ffffff;
  3930. box-shadow: -4rpx 0rpx 4rpx 0rpx rgba(0, 0, 0, 0.1);
  3931. border-radius: 16rpx 16rpx 16rpx 16rpx;
  3932. }
  3933. @keyframes rotation {
  3934. from {
  3935. -webkit-transform: rotate(0deg);
  3936. }
  3937. to {
  3938. -webkit-transform: rotate(360deg);
  3939. }
  3940. }
  3941. .loading_down {
  3942. transform: rotate(360deg);
  3943. animation: rotation 3s linear infinite;
  3944. }
  3945. }
  3946. .lecture-content {
  3947. background: #fff;
  3948. margin-top: 10rpx;
  3949. padding: 10rpx;
  3950. border-radius: 16rpx;
  3951. }
  3952. .photoBox {
  3953. width: 100%;
  3954. // background-color: #ffffff;
  3955. // border-radius: 24px 24px 0px 0px;
  3956. .photoTop {
  3957. width: 100%;
  3958. height: 74rpx;
  3959. border-radius: 20px 20px 0px 0px;
  3960. background-color: #ffffff;
  3961. display: flex;
  3962. align-items: center;
  3963. justify-content: center;
  3964. padding: 0rpx 38rpx;
  3965. .sqzz {
  3966. width: 28rpx;
  3967. height: 28rpx;
  3968. display: flex;
  3969. align-items: center;
  3970. justify-content: center;
  3971. }
  3972. .centersq {
  3973. color: #333;
  3974. font-size: 30rpx;
  3975. font-weight: 500;
  3976. }
  3977. }
  3978. .photoCenter {
  3979. width: 750rpx;
  3980. height: 75vh;
  3981. position: relative;
  3982. .center_camera {
  3983. width: 100%;
  3984. height: 75vh;
  3985. position: fixed;
  3986. .head_take {
  3987. width: 100%;
  3988. height: 75vh;
  3989. display: flex;
  3990. flex-direction: column;
  3991. }
  3992. .headTake_up {
  3993. width: 100%;
  3994. height: 100rpx;
  3995. }
  3996. .headTake_minddle {
  3997. display: flex;
  3998. .min_img {
  3999. width: 500rpx;
  4000. height: 550rpx;
  4001. }
  4002. .min_left,
  4003. .min_right {
  4004. flex: 1;
  4005. height: 550rpx;
  4006. }
  4007. }
  4008. .headTake_down {
  4009. width: 100%;
  4010. flex: 1;
  4011. }
  4012. .color {
  4013. background-color: #333;
  4014. opacity: 0.5;
  4015. }
  4016. .photo_v {
  4017. width: 100%;
  4018. height: 100%;
  4019. }
  4020. .mask {
  4021. width: 500rpx;
  4022. height: 550rpx;
  4023. position: absolute;
  4024. top: 100rpx;
  4025. left: 0;
  4026. right: 0;
  4027. bottom: 0;
  4028. margin: 0 auto;
  4029. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  4030. }
  4031. }
  4032. .custom {
  4033. width: 750rpx;
  4034. height: 75vh;
  4035. position: absolute;
  4036. z-index: 1000;
  4037. top: 0;
  4038. left: 0;
  4039. image {
  4040. width: 100%;
  4041. height: 100%;
  4042. }
  4043. }
  4044. }
  4045. .btns {
  4046. display: flex;
  4047. .takePhoto_btn {
  4048. width: 100%;
  4049. display: flex;
  4050. align-items: center;
  4051. justify-content: space-between;
  4052. background: #a9a7a9;
  4053. padding: 40rpx 26rpx;
  4054. .middle_btn {
  4055. width: 120rpx;
  4056. height: 120rpx;
  4057. border-radius: 40rpx;
  4058. border: 4rpx solid #ffffff;
  4059. display: flex;
  4060. align-items: center;
  4061. justify-content: center;
  4062. }
  4063. .square {
  4064. width: 96rpx;
  4065. height: 96rpx;
  4066. background: #ffffff;
  4067. border-radius: 28rpx;
  4068. }
  4069. .rights {
  4070. font-size: 32rpx;
  4071. font-weight: 500;
  4072. color: #ffffff;
  4073. }
  4074. }
  4075. .btnResult {
  4076. height: 100rpx;
  4077. flex: 1;
  4078. background-color: #07c160;
  4079. text-align: center;
  4080. line-height: 100rpx;
  4081. color: #fff;
  4082. font-size: 32rpx;
  4083. font-weight: bold;
  4084. }
  4085. }
  4086. }
  4087. .chat_box {
  4088. display: flex;
  4089. padding: 20rpx;
  4090. justify-content: space-between;
  4091. }
  4092. .chat3 {
  4093. font-size: 30rpx;
  4094. font-family: PingFang SC;
  4095. font-weight: 500;
  4096. color: #666666;
  4097. margin-top: 10rpx;
  4098. }
  4099. .chat2 {
  4100. font-size: 20rpx;
  4101. font-family: PingFang SC;
  4102. font-weight: 500;
  4103. color: #999999;
  4104. margin-top: 10rpx;
  4105. }
  4106. .chat1 {
  4107. font-size: 24rpx;
  4108. font-family: PingFang SC;
  4109. font-weight: 500;
  4110. color: #333333;
  4111. }
  4112. .leftPadding {
  4113. margin-left: 8rpx;
  4114. }
  4115. .t2Content {
  4116. font-size: 24rpx;
  4117. font-family: PingFang SC;
  4118. font-weight: bold;
  4119. color: #999999;
  4120. line-height: 48rpx;
  4121. }
  4122. .tBox2 {
  4123. display: flex;
  4124. padding-top: 10rpx;
  4125. color: #333333;
  4126. font-size: 30rpx;
  4127. font-weight: 400;
  4128. }
  4129. .tBox {
  4130. display: flex;
  4131. align-items: center;
  4132. padding-top: 10rpx;
  4133. }
  4134. .title {
  4135. font-size: 24rpx;
  4136. color: #999999;
  4137. }
  4138. .Answering {
  4139. .answer_item {
  4140. &:nth-child(2) {
  4141. border-radius: 16rpx 16rpx 0rpx 0rpx;
  4142. }
  4143. &:nth-last-child(1) {
  4144. border-radius: 0rpx 0rpx 16rpx 16rpx;
  4145. }
  4146. }
  4147. }
  4148. .inputBottom {
  4149. position: fixed;
  4150. left: 0;
  4151. bottom: 0;
  4152. background: #ffffff;
  4153. height: 98rpx;
  4154. display: flex;
  4155. align-items: center;
  4156. width: 100%;
  4157. .flex_auto {
  4158. flex: 1;
  4159. margin-left: 10%;
  4160. word-break: break-all;
  4161. // .input {
  4162. // height: 60rpx;
  4163. // }
  4164. }
  4165. .btn {
  4166. color: #007aff;
  4167. font-size: 30rpx;
  4168. font-weight: bold;
  4169. width: 15%;
  4170. text-align: center;
  4171. }
  4172. .input {
  4173. background: rgba(244, 244, 244, 0.98);
  4174. height: 60rpx;
  4175. border-radius: 24rpx;
  4176. margin-top: 12rpx;
  4177. }
  4178. }
  4179. .noteBox {
  4180. width: 100%;
  4181. background: #ffffff;
  4182. padding: 0rpx 10rpx 20rpx;
  4183. border-radius: 16rpx;
  4184. overflow: hidden;
  4185. .left_ti {
  4186. padding-top: 14rpx;
  4187. }
  4188. }
  4189. .dateBox {
  4190. width: 216rpx;
  4191. height: 48rpx;
  4192. background: #ffffff;
  4193. border-radius: 24rpx;
  4194. font-size: 24rpx;
  4195. color: #666666;
  4196. text-align: center;
  4197. line-height: 48rpx;
  4198. margin: 16rpx 0rpx 8rpx;
  4199. }
  4200. .t_content1 {
  4201. color: #007aff;
  4202. margin-left: 10rpx;
  4203. }
  4204. .tag1 {
  4205. border: 2rpx solid #007aff;
  4206. border-radius: 8rpx;
  4207. font-size: 20rpx;
  4208. color: #007aff;
  4209. padding: 5rpx;
  4210. }
  4211. .b_title {
  4212. color: #333333;
  4213. font-size: 30rpx;
  4214. font-weight: bold;
  4215. }
  4216. page {
  4217. background: #eaeef1;
  4218. }
  4219. .menuBox {
  4220. width: 100%;
  4221. background: #ffffff;
  4222. border-radius: 16rpx;
  4223. padding: 0rpx 20rpx;
  4224. margin-bottom: 20rpx;
  4225. }
  4226. .btnspric {
  4227. border-top: 1rpx solid #eee;
  4228. display: flex;
  4229. align-items: center;
  4230. justify-content: space-between;
  4231. height: 108rpx;
  4232. padding-left: 43rpx;
  4233. padding-right: 32rpx;
  4234. }
  4235. .btnspric > .lefprL {
  4236. font-size: 36rpx;
  4237. color: #0c141f;
  4238. font-weight: bold;
  4239. }
  4240. .btnspric > .lefprR {
  4241. padding: 0rpx 24rpx;
  4242. height: 60rpx;
  4243. line-height: 60rpx;
  4244. text-align: center;
  4245. color: #fff;
  4246. background: #32467b;
  4247. border-radius: 24rpx;
  4248. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  4249. }
  4250. .yhj,
  4251. .hdyhj {
  4252. padding: 24rpx 29rpx 24rpx 34rpx;
  4253. }
  4254. .yhj {
  4255. border-bottom: 16rpx solid #f9f9f9;
  4256. }
  4257. .yhjtit {
  4258. font-size: 30rpx;
  4259. color: #0c141f;
  4260. font-weight: 500;
  4261. margin-bottom: 14rpx;
  4262. }
  4263. .yhjList {
  4264. display: flex;
  4265. align-items: center;
  4266. justify-content: space-between;
  4267. margin-bottom: 14rpx;
  4268. }
  4269. .yhjList > .yhjLefts {
  4270. display: flex;
  4271. align-items: center;
  4272. }
  4273. .yhjLefts > .yhl {
  4274. color: #32467b;
  4275. font-size: 30rpx;
  4276. margin-right: 31rpx;
  4277. }
  4278. .yhjLefts > .yhbq {
  4279. font-size: 24rpx;
  4280. color: #ff9500;
  4281. border-radius: 18rpx;
  4282. background-color: rgba(255, 149, 0, 0.2);
  4283. border: 2rpx solid #ff9500;
  4284. height: 38rpx;
  4285. line-height: 38rpx;
  4286. padding: 0rpx 16rpx;
  4287. }
  4288. .ts {
  4289. font-size: 24rpx;
  4290. color: #999;
  4291. margin: 14rpx 0rpx;
  4292. padding-right: 29rpx;
  4293. padding-left: 34rpx;
  4294. }
  4295. .yh {
  4296. padding-top: 20rpx;
  4297. }
  4298. .yh > .yhtitle {
  4299. display: flex;
  4300. align-items: center;
  4301. justify-content: space-between;
  4302. padding-right: 29rpx;
  4303. padding-left: 34rpx;
  4304. }
  4305. .priceBxs {
  4306. display: flex;
  4307. align-items: center;
  4308. }
  4309. .priceBxs > .pricleft {
  4310. border-radius: 24rpx;
  4311. border: 1rpx solid #e91313;
  4312. background-color: rgba(233, 19, 19, 0.1);
  4313. padding: 0rpx 18rpx;
  4314. height: 49rpx;
  4315. line-height: 49rpx;
  4316. text-align: center;
  4317. font-size: 30rpx;
  4318. font-weight: 500;
  4319. color: #e91313;
  4320. margin-right: 13rpx;
  4321. }
  4322. .topBox {
  4323. padding: 32rpx 32rpx 24rpx;
  4324. border-bottom: 1rpx solid #eeeeee;
  4325. }
  4326. .topBox > .boldFonstType {
  4327. font-weight: 500;
  4328. font-size: 30rpx;
  4329. margin: 16rpx 0rpx 23rpx;
  4330. }
  4331. .topBox > .firstTopL {
  4332. display: flex;
  4333. align-items: center;
  4334. }
  4335. .topBox > .firstTopL > .imageBs {
  4336. width: 331rpx;
  4337. height: 160rpx;
  4338. border-radius: 6rpx;
  4339. overflow: hidden;
  4340. margin-right: 8rpx;
  4341. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  4342. }
  4343. .topBox > .firstTopL > .imageBs > image {
  4344. width: 100%;
  4345. height: 100%;
  4346. }
  4347. .topBox > .firstTopL > .textBs {
  4348. font-size: 30rpx;
  4349. font-weight: bold;
  4350. color: #0c141f;
  4351. }
  4352. .content {
  4353. padding: 24rpx;
  4354. text-align: left;
  4355. }
  4356. .catalogBox {
  4357. display: flex;
  4358. align-items: center;
  4359. flex-wrap: nowrap;
  4360. overflow-x: auto;
  4361. padding-left: 38rpx;
  4362. max-height: 305rpx;
  4363. overflow-y: auto;
  4364. transition: all 0.4s;
  4365. }
  4366. .catalogBox > .catalogA {
  4367. min-width: 200rpx;
  4368. height: 48rpx;
  4369. line-height: 48rpx;
  4370. // text-align: center;
  4371. border: 2rpx solid transparent;
  4372. white-space: nowrap;
  4373. text-overflow: ellipsis;
  4374. overflow: hidden;
  4375. word-break: break-all;
  4376. border-radius: 10rpx;
  4377. background: rgba(22, 119, 255, 0.05);
  4378. padding-left: 19rpx;
  4379. box-sizing: border-box;
  4380. padding-right: 15rpx;
  4381. margin-right: 16rpx;
  4382. margin-bottom: 20rpx;
  4383. margin-top: 15rpx;
  4384. font-size: 24rpx;
  4385. color: #666;
  4386. }
  4387. .catalogBox > .activesq {
  4388. border-color: #1677ff;
  4389. }
  4390. .changeCatalogBox {
  4391. display: block;
  4392. }
  4393. .catalogBox::-webkit-scrollbar {
  4394. display: none; /* Chrome Safari */
  4395. }
  4396. .price_t2 {
  4397. font-size: 18rpx;
  4398. font-family: PingFang SC;
  4399. font-weight: 500;
  4400. text-decoration: line-through;
  4401. color: #999999;
  4402. }
  4403. .price_t1 {
  4404. font-size: 33rpx;
  4405. font-family: PingFang SC;
  4406. font-weight: bold;
  4407. color: #e91313;
  4408. }
  4409. .sc_t {
  4410. font-size: 22rpx;
  4411. color: #000000;
  4412. }
  4413. .sc {
  4414. width: 29rpx;
  4415. height: 29rpx;
  4416. }
  4417. .buy {
  4418. width: 138rpx;
  4419. height: 48rpx;
  4420. line-height: 48rpx;
  4421. background: #32467b;
  4422. border-radius: 10rpx;
  4423. color: #ffffff;
  4424. font-size: 28rpx;
  4425. text-align: center;
  4426. vertical-align: middle;
  4427. position: absolute;
  4428. right: 30rpx;
  4429. }
  4430. .video_body {
  4431. padding-bottom: 96rpx;
  4432. }
  4433. .footer_tab {
  4434. position: fixed;
  4435. bottom: 0;
  4436. height: 96rpx;
  4437. width: 100%;
  4438. background-color: #ffffff;
  4439. }
  4440. .tj_box {
  4441. width: 50%;
  4442. display: inline-block;
  4443. text-align: center;
  4444. margin: 10rpx 0;
  4445. }
  4446. .teacher_t {
  4447. font-size: 24rpx;
  4448. font-family: PingFang SC;
  4449. font-weight: 400;
  4450. color: #666666;
  4451. line-height: 36rpx;
  4452. margin-left: 15rpx;
  4453. }
  4454. .teacher_img {
  4455. width: 87rpx;
  4456. height: 129rpx;
  4457. }
  4458. .t2 {
  4459. font-size: 24rpx;
  4460. font-family: PingFang SC;
  4461. color: #666666;
  4462. line-height: 36rpx;
  4463. margin: 15rpx;
  4464. }
  4465. .r_t2 {
  4466. width: 201rpx;
  4467. height: 49rpx;
  4468. background: rgba(22, 119, 255, 0.05);
  4469. border: 1rpx solid #32467b;
  4470. border-radius: 16rpx;
  4471. color: #666666;
  4472. font-size: 23rpx;
  4473. text-align: center;
  4474. display: flex;
  4475. align-items: center;
  4476. padding: 5rpx;
  4477. }
  4478. .scroll_box {
  4479. width: 100%;
  4480. height: 60rpx;
  4481. background: #ffffff;
  4482. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  4483. white-space: nowrap;
  4484. overflow: hidden;
  4485. margin: 15rpx 0;
  4486. }
  4487. .r_sliper {
  4488. padding: 0 20rpx;
  4489. }
  4490. .top_line {
  4491. width: 6rpx;
  4492. height: 22rpx;
  4493. background: #32467b;
  4494. margin-right: 10rpx;
  4495. }
  4496. .video_t2 {
  4497. font-size: 24rpx;
  4498. font-family: PingFang SC;
  4499. font-weight: 500;
  4500. color: #666666;
  4501. }
  4502. .video_play {
  4503. position: absolute;
  4504. width: 95rpx;
  4505. height: 95rpx;
  4506. top: 0;
  4507. left: 0;
  4508. right: 0;
  4509. bottom: 0;
  4510. margin: auto;
  4511. }
  4512. .video_box {
  4513. position: relative;
  4514. #playerVideo {
  4515. position: relative;
  4516. z-index: 99;
  4517. }
  4518. .video-toast {
  4519. position: absolute;
  4520. width: 686rpx;
  4521. height: 80rpx;
  4522. background: rgba(0, 0, 0, 0.6);
  4523. border-radius: 24rpx;
  4524. bottom: 100rpx;
  4525. left: 50%;
  4526. transform: translateX(-50%);
  4527. color: #fff;
  4528. display: flex;
  4529. font-size: 26rpx;
  4530. align-items: center;
  4531. overflow: visible;
  4532. z-index: 999;
  4533. &__text {
  4534. flex: 1;
  4535. margin-left: 40rpx;
  4536. }
  4537. &__btn {
  4538. width: 180rpx;
  4539. text-align: center;
  4540. border-left: 1rpx solid #fff;
  4541. }
  4542. }
  4543. .video-toast__close {
  4544. position: absolute;
  4545. right: 32rpx;
  4546. bottom: 184rpx;
  4547. width: 40rpx;
  4548. height: 40rpx;
  4549. line-height: 40rpx;
  4550. text-align: center;
  4551. background: rgba(0, 0, 0, 0.6);
  4552. border-radius: 50%;
  4553. color: rgba(255, 255, 255, 0.3);
  4554. }
  4555. }
  4556. .rotoct {
  4557. transform: rotate(90deg);
  4558. }
  4559. .slot-content {
  4560. padding: 0 20rpx;
  4561. }
  4562. .notice_modal {
  4563. .content {
  4564. width: 100%;
  4565. height: 100%;
  4566. padding: 56rpx 56rpx 56rpx 64rpx;
  4567. .title {
  4568. color: #222;
  4569. line-height: 40rpx;
  4570. font-size: 36rpx;
  4571. text-align: center;
  4572. font-weight: bold;
  4573. margin-bottom: 24rpx;
  4574. }
  4575. .text {
  4576. height: 340rpx;
  4577. line-height: 40rpx;
  4578. text-indent: 2em;
  4579. font-size: 32rpx;
  4580. color: #222;
  4581. }
  4582. .had_read {
  4583. width: 100%;
  4584. height: 88rpx;
  4585. line-height: 88rpx;
  4586. text-align: center;
  4587. background: #3577e8;
  4588. border-radius: 240rpx;
  4589. font-size: 32rpx;
  4590. font-weight: 500;
  4591. color: #fff;
  4592. margin-top: 20rpx;
  4593. &.gray {
  4594. background: #bbbec5;
  4595. }
  4596. }
  4597. }
  4598. }
  4599. .full_mulu {
  4600. position: absolute;
  4601. top: 100rpx;
  4602. right: 20rpx;
  4603. width: 700rpx;
  4604. height: 515rpx;
  4605. color: #333;
  4606. display: flex;
  4607. align-items: center;
  4608. justify-content: space-between;
  4609. z-index: 99999;
  4610. .mulus {
  4611. width: 623rpx;
  4612. // height: 515rpx;
  4613. height: 400rpx;
  4614. overflow-y: scroll;
  4615. // overflow: scroll;
  4616. }
  4617. .mulu_box_in {
  4618. background-color: #b7b7b7;
  4619. border-radius: 16rpx;
  4620. // transition: all 0.5s;
  4621. &::after {
  4622. content: "";
  4623. width: 0;
  4624. height: 0;
  4625. position: absolute;
  4626. top: 235rpx;
  4627. right: 27px;
  4628. border-top: 16rpx solid transparent;
  4629. border-right: 16rpx solid transparent;
  4630. border-left: 16rpx solid #b7b7b7;
  4631. border-bottom: 16rpx solid transparent;
  4632. }
  4633. }
  4634. .mulu_box_out {
  4635. // visibility: hidden;
  4636. display: none;
  4637. }
  4638. .menuBox_mulu {
  4639. // width: 100%;
  4640. background: #ffffff;
  4641. border-radius: 16rpx;
  4642. padding: 0rpx 20rpx;
  4643. margin-bottom: 20rpx;
  4644. }
  4645. .ml_img {
  4646. position: absolute;
  4647. right: 0;
  4648. top: 100rpx;
  4649. }
  4650. .items {
  4651. width: 620rpx;
  4652. height: 100rpx;
  4653. border: 1rpx solid red;
  4654. }
  4655. }
  4656. </style>