detail copy.vue 130 KB

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