detail.vue 140 KB

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