detail.vue 136 KB

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