detail.vue 135 KB

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