detail.vue 136 KB

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