detail copy.vue 130 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498
  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. "config",
  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.config.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: `../../pages/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. this.getNoteList();
  2314. },
  2315. //正常播放视频
  2316. async playVideo(item) {
  2317. if (this.timer) {
  2318. clearInterval(this.timer);
  2319. }
  2320. // #ifdef H5
  2321. // await this.clears();
  2322. // #endif
  2323. this.vid = item.recordingUrl;
  2324. // #ifdef MP-WEIXIN
  2325. if (this.vid) {
  2326. polyvPlayerContext && polyvPlayerContext.changeVid(this.vid);
  2327. }
  2328. // #endif
  2329. this.recordObj = null;
  2330. this.recordObj = await this.getRecordLast();
  2331. this.needSeek = true; //跳转到播放记录
  2332. this.startStatus = true;
  2333. // #ifdef H5
  2334. await this.loadPlayerScript(this.loadPlayer);
  2335. // #endif
  2336. //获取节笔记
  2337. this.getNoteList();
  2338. },
  2339. getRecordLast() {
  2340. return new Promise((resolve) => {
  2341. let data = {
  2342. gradeId:
  2343. this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
  2344. goodsId:
  2345. this.goodsId || this.goodsId == 0 ? Number(this.goodsId) : null,
  2346. sectionId: this.playSectionId || 0,
  2347. courseId:
  2348. this.courseId || this.courseId == 0 ? Number(this.courseId) : null,
  2349. chapterId: this.chapterId || 0,
  2350. moduleId: this.moduleId || 0,
  2351. orderGoodsId: this.orderGoodsId,
  2352. };
  2353. this.$api.recordLast(data).then((res) => {
  2354. resolve(res.data.data);
  2355. });
  2356. });
  2357. },
  2358. jumpNote(item) {
  2359. this.noteId = item.noteId;
  2360. //没视频播放
  2361. if (this.playSectionId == 0) {
  2362. this.$u.toast("即将跳到笔记位置");
  2363. this.$store.commit("setPlaySectionId", {
  2364. playSectionId: item.sectionId || item.menuId,
  2365. });
  2366. this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
  2367. this.playNoteVideo(item);
  2368. } else {
  2369. //正在看当前笔记视频
  2370. this.$u.toast("即将跳到笔记位置");
  2371. //跳到笔记时刻
  2372. // #ifdef MP-WEIXIN
  2373. polyvPlayerContext.seek(item.noteSecond);
  2374. polyvPlayerContext.play();
  2375. // #endif
  2376. // #ifdef H5
  2377. polyvPlayerContext.j2s_seekVideo(0);
  2378. polyvPlayerContext.j2s_resumeVideo();
  2379. // #endif
  2380. }
  2381. },
  2382. postNote() {
  2383. let self = this;
  2384. if (!(this.playSectionId > 0)) {
  2385. this.$u.toast("目前无播放视频");
  2386. return;
  2387. }
  2388. if (!this.noteValue) {
  2389. this.$u.toast("请输入内容");
  2390. return;
  2391. }
  2392. if (!this.gradeId) {
  2393. this.$u.toast("暂无班级数据");
  2394. return;
  2395. }
  2396. let noteDate = this.$method.getZeroTime();
  2397. let noteSecond = 0;
  2398. // #ifdef MP-WEIXIN
  2399. noteSecond = polyvPlayerContext.getCurrentTime();
  2400. // #endif
  2401. // #ifdef H5
  2402. noteSecond = polyvPlayerContext.j2s_getCurrentTime();
  2403. // #endif
  2404. if (!noteSecond) {
  2405. if (noteSecond == 0) {
  2406. //播放结束
  2407. // #ifdef MP-WEIXIN
  2408. noteSecond = polyvPlayerContext.getDuration();
  2409. // #endif
  2410. // #ifdef H5
  2411. noteSecond = polyvPlayerContext.j2s_getCurrentTime();
  2412. // #endif
  2413. }
  2414. if (!noteSecond) {
  2415. this.$u.toast("视频暂未开始");
  2416. return;
  2417. }
  2418. }
  2419. let data = {
  2420. gradeId: this.gradeId,
  2421. goodsId: this.goodsId,
  2422. sectionId: this.playSectionId,
  2423. courseId: this.courseId,
  2424. noteText: this.noteValue,
  2425. noteDate: noteDate,
  2426. noteSecond: noteSecond,
  2427. orderGoodsId: this.orderGoodsId,
  2428. };
  2429. this.$api.postNote(data).then((res) => {
  2430. if (res.data.code == 200) {
  2431. this.$u.toast("发布成功");
  2432. self.getNoteList();
  2433. this.noteValue = "";
  2434. }
  2435. });
  2436. },
  2437. getGradeInfo() {
  2438. // 即刻 1 待定2 日期3
  2439. let self = this;
  2440. this.$store.state.allowLoading = false;
  2441. this.$api.goodsGradeInfo(this.gradeId).then((res) => {
  2442. if (res.data.code == 200) {
  2443. self.gradeDetail = res.data.data;
  2444. if (self.needProfileModal) {
  2445. return;
  2446. }
  2447. if (self.gradeDetail.learningStatus == 2) {
  2448. uni.showModal({
  2449. showCancel: false,
  2450. confirmText: "确定",
  2451. content:
  2452. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  2453. success: function (resultst) {
  2454. uni.navigateBack();
  2455. },
  2456. });
  2457. }
  2458. if (
  2459. self.gradeDetail.learningStatus == 3 &&
  2460. Number(self.gradeDetail.learningTimeStart) >
  2461. Number(new Date() / 1000)
  2462. ) {
  2463. uni.showModal({
  2464. showCancel: false,
  2465. cancelText: "返回",
  2466. content:
  2467. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  2468. success: function (resultst) {
  2469. uni.navigateBack();
  2470. },
  2471. });
  2472. }
  2473. }
  2474. });
  2475. this.$store.state.allowLoading = true;
  2476. },
  2477. getNoteList() {
  2478. if (this.current != 2) {
  2479. return;
  2480. }
  2481. this.noteList = [];
  2482. let data = {
  2483. courseId: this.courseId,
  2484. gradeId: this.gradeId,
  2485. goodsId: this.goodsId,
  2486. orderGoodsId: this.orderGoodsId,
  2487. };
  2488. if (this.playSectionId > 0) {
  2489. data.sectionId = this.playSectionId;
  2490. }
  2491. this.$api.noteList(data).then((res) => {
  2492. if (res.data.code == 200) {
  2493. this.noteList = res.data.rows;
  2494. }
  2495. });
  2496. },
  2497. delAnswer(answerId) {
  2498. let self = this;
  2499. let data = {
  2500. answerId: answerId,
  2501. status: -1,
  2502. orderGoodsId: this.orderGoodsId,
  2503. };
  2504. this.$api.delAnswer(data).then((res) => {
  2505. if (res.data.code == 200) {
  2506. self.getAnswerList();
  2507. }
  2508. });
  2509. },
  2510. clearCtx() {
  2511. this.placeholder = "您可以在这里输入答疑内容";
  2512. this.ctxValue = "";
  2513. this.assignUserId = 0;
  2514. },
  2515. focusNote(event) {
  2516. this.bottomHeight = event.detail.height;
  2517. },
  2518. blurNote() {
  2519. this.bottomHeight = 0;
  2520. },
  2521. blur() {
  2522. this.bottomHeight = 0;
  2523. this.clearTimer = setTimeout(() => {
  2524. this.ctxValue = "";
  2525. this.isFocus = false;
  2526. this.assignUserId = 0;
  2527. this.placeholder = "您可以在这里输入答疑内容";
  2528. }, 2000);
  2529. },
  2530. replyContent(item) {
  2531. this.isFocus = true;
  2532. this.assignUserId = item.userId;
  2533. this.placeholder = "@" + item.realname;
  2534. },
  2535. delContent(item) {
  2536. this.delAnswer(item.answerId);
  2537. },
  2538. postAnswer() {
  2539. let self = this;
  2540. let data = {
  2541. courseId: this.courseId,
  2542. answerText: this.ctxValue,
  2543. goodsId: this.goodsId,
  2544. orderGoodsId: this.orderGoodsId,
  2545. };
  2546. if (this.assignUserId > 0) {
  2547. data.assignUserId = this.assignUserId;
  2548. }
  2549. this.$api.postAnswer(data).then((res) => {
  2550. if (res.data.code == 200) {
  2551. this.$u.toast("发布成功");
  2552. self.getAnswerList();
  2553. this.isFocus = false;
  2554. this.placeholder = "您可以在这里输入答疑内容";
  2555. this.ctxValue = "";
  2556. this.assignUserId = 0;
  2557. }
  2558. });
  2559. },
  2560. postContent() {
  2561. if (!this.ctxValue || this.ctxValue == "") {
  2562. this.$u.toast("请输入内容");
  2563. return;
  2564. }
  2565. this.postAnswer();
  2566. },
  2567. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  2568. let currentTime = 0;
  2569. let PlayDuration = 0;
  2570. if (polyvPlayerContext) {
  2571. // #ifdef MP-WEIXIN
  2572. currentTime = polyvPlayerContext.getCurrentTime(); //获取视频当前的播放时刻
  2573. PlayDuration = polyvPlayerContext.getVideoPlayDuration(); //本次看的时长
  2574. // #endif
  2575. // #ifdef H5
  2576. currentTime = polyvPlayerContext.j2s_getCurrentTime(); //当前视频播放时刻
  2577. PlayDuration = polyvPlayerContext.j2s_realPlayVideoTime(); //本次看的时长
  2578. // #endif
  2579. }
  2580. if (currentTime < 10 && !this.ossAvatarUrl) {
  2581. return;
  2582. }
  2583. if (this.playChannelId > 0) {
  2584. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  2585. }
  2586. let self = this;
  2587. let data = {
  2588. fromPlat: 1, //来源平台 1小程序 2网站
  2589. photo: self.ossAvatarUrl,
  2590. sectionId: sectionId || 0,
  2591. goodsId: parseInt(self.goodsId),
  2592. courseId: parseInt(self.courseId),
  2593. orderGoodsId: this.orderGoodsId,
  2594. studyDuration: parseInt(
  2595. PlayDuration > 0 ? PlayDuration : self.studyDuration
  2596. ),
  2597. gradeId: parseInt(self.gradeId),
  2598. chapterId: this.chapterId || 0,
  2599. moduleId: this.moduleId || 0,
  2600. videoCurrentTime: parseInt(
  2601. currentTime > 0 ? currentTime : self.studyDuration
  2602. ),
  2603. erJianErZao: this.erJianErZao,
  2604. };
  2605. if (this.ossAvatarUrl) {
  2606. data.similarity = this.compareFaceData; // 相似度
  2607. }
  2608. if (status > 0) {
  2609. data.status = status;
  2610. }
  2611. console.log(data, "记录参数");
  2612. return new Promise((resolve, reject) => {
  2613. this.$api
  2614. .studyRecord(data)
  2615. .then((res) => {
  2616. console.log(res, "记录返回");
  2617. let { code, msg } = res.data;
  2618. if (code == 200) {
  2619. if (status > 0) {
  2620. this.studyRecordMenuAllList();
  2621. let moduleId = this.moduleId || 0;
  2622. let chapterId = this.chapterId || 0;
  2623. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  2624. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  2625. uni.$emit("playNext" + playNextIdisRebuild, {
  2626. fromRebuild: this.isRebuild,
  2627. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  2628. uni.$emit("playNext" + playNextId); //通知播放结束
  2629. }
  2630. self.ossAvatarUrl = "";
  2631. } else if (code == 600) {
  2632. uni.showModal({
  2633. showCancel: false,
  2634. title: "提示",
  2635. content: msg,
  2636. success: (resultst) => {
  2637. uni.navigateBack();
  2638. },
  2639. });
  2640. } else if (code == 558) {
  2641. this.CountTo1 = msg.split(",")[1];
  2642. this.noticeShow1 = true;
  2643. var timer = setInterval(() => {
  2644. this.CountTo1--;
  2645. if (this.CountTo1 < 0) {
  2646. this.noticeShow1 = false;
  2647. clearInterval(timer);
  2648. this.postStudyRecord(1);
  2649. }
  2650. }, 1000);
  2651. reject("中断执行");
  2652. } else {
  2653. this.uploadLock = false;
  2654. uni.showToast({
  2655. icon: "none",
  2656. title: res.data.msg,
  2657. duration: 2000,
  2658. });
  2659. if (this.erJianErZao && code == 559) {
  2660. this.isReach = true;
  2661. this.openPhoto();
  2662. }
  2663. if (code == 559 || code == 588) {
  2664. reject("中断执行");
  2665. }
  2666. }
  2667. resolve();
  2668. })
  2669. .catch((err) => {
  2670. this.studyRecordMenuAllList();
  2671. });
  2672. });
  2673. },
  2674. uploadFile(options, int) {
  2675. var self = this;
  2676. return new Promise((resolve, reject) => {
  2677. var data = {
  2678. imageStatus: int,
  2679. gradeId: this.gradeId,
  2680. orderGoodsId: this.orderGoodsId,
  2681. };
  2682. self.$api.aliyunpolicy(data).then((res) => {
  2683. if (res.data.code != 200) {
  2684. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  2685. return;
  2686. }
  2687. var ossToken = res.data.data.resultContent;
  2688. if (ossToken.host == null || ossToken.host == undefined) {
  2689. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  2690. return;
  2691. }
  2692. let filePath = "";
  2693. // #ifdef H5
  2694. var localData = options; //dataUrl为base64位
  2695. let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
  2696. let length = base.length;
  2697. let url = new Uint8Array(length);
  2698. while (length--) {
  2699. url[length] = base.charCodeAt(length);
  2700. }
  2701. filePath = new File([url], "a.jpg", {
  2702. type: "image/jpg",
  2703. });
  2704. uni.uploadFile({
  2705. url: ossToken.host,
  2706. name: "file",
  2707. file: filePath,
  2708. fileType: "image",
  2709. header: {
  2710. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2711. },
  2712. formData: {
  2713. key: ossToken.dir,
  2714. OSSAccessKeyId: ossToken.accessid,
  2715. policy: ossToken.policy,
  2716. Signature: ossToken.signature,
  2717. callback: ossToken.callback,
  2718. success_action_status: 200,
  2719. },
  2720. success: (result) => {
  2721. this.$u.toast("上传成功");
  2722. self.ossAvatarUrl = ossToken.dir;
  2723. resolve(ossToken.dir);
  2724. },
  2725. fail: (error) => {
  2726. uni.showToast({
  2727. title: "上传接口报错,请重新拍照上传" + error,
  2728. icon: "none",
  2729. });
  2730. this.openPhoto();
  2731. return;
  2732. },
  2733. });
  2734. // #endif
  2735. // #ifdef MP-WEIXIN
  2736. uni.uploadFile({
  2737. url: ossToken.host,
  2738. name: "file",
  2739. filePath: options,
  2740. fileType: "image",
  2741. header: {
  2742. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  2743. },
  2744. formData: {
  2745. key: ossToken.dir,
  2746. OSSAccessKeyId: ossToken.accessid,
  2747. policy: ossToken.policy,
  2748. Signature: ossToken.signature,
  2749. callback: ossToken.callback,
  2750. success_action_status: 200,
  2751. },
  2752. success: (result) => {
  2753. // if (result.statusCode === 200) {
  2754. this.$u.toast("上传成功");
  2755. self.ossAvatarUrl = ossToken.dir;
  2756. resolve(ossToken.dir);
  2757. },
  2758. fail: (error) => {
  2759. uni.showToast({
  2760. title: "上传接口报错,请重新拍照上传" + error,
  2761. icon: "none",
  2762. });
  2763. this.openPhoto();
  2764. return;
  2765. },
  2766. });
  2767. // #endif
  2768. });
  2769. });
  2770. },
  2771. imageInfos() {
  2772. var self = this;
  2773. return new Promise(async (resolve, reject) => {
  2774. let resPath = await myCompressImage(this.avatarUrl || this.faceUrl, 50);
  2775. const waitUpload = await self.uploadFile(resPath, 0);
  2776. resolve(waitUpload);
  2777. });
  2778. },
  2779. timeEvent() {
  2780. if (polyvPlayerContext != null) {
  2781. // #ifdef MP-WEIXIN
  2782. this.playTime = polyvPlayerContext.getCurrentTime(); //播放时刻
  2783. // #endif
  2784. // #ifdef H5
  2785. this.playTime = polyvPlayerContext.j2s_getCurrentTime();
  2786. // #endif
  2787. this.configPhoto();
  2788. console.info(this.photoList, "photoList");
  2789. let photoTime = 0; //获取拍照秒数
  2790. for (let i = 0; i < this.photoList.length; i++) {
  2791. photoTime = Number(this.photoList[i]); //获取拍照秒数
  2792. if (
  2793. (this.erJianErZao && !this.photoHistoryList.length) ||
  2794. (photoTime < this.playTime && photoTime > this.playTime - 8)
  2795. ) {
  2796. //3秒区间内才触发拍照,避免拉动滚动条
  2797. if (this.photoHistoryList.indexOf(i) < 0) {
  2798. //不存在拍照历史,没有重修过,没有学过,则拍照
  2799. //启动拍照
  2800. //暂停
  2801. console.log("去拍照");
  2802. // #ifdef MP-WEIXIN
  2803. polyvPlayerContext.exitFullScreen();
  2804. polyvPlayerContext.pause();
  2805. // #endif
  2806. // #ifdef H5
  2807. polyvPlayerContext.j2s_pauseVideo();
  2808. polyvPlayerContext.toggleFullscreen();
  2809. // #endif
  2810. this.photoIndex = i;
  2811. if (
  2812. uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
  2813. this.goodsId
  2814. ) {
  2815. return this.openPhoto();
  2816. } else {
  2817. this.popupPhotoShow = true;
  2818. uni.setStorageSync(
  2819. `tabkePhotoShow${this.goodsId}`,
  2820. this.goodsId
  2821. ); // 本地缓存用来判断是否已经弹出过弹窗
  2822. }
  2823. }
  2824. }
  2825. }
  2826. }
  2827. },
  2828. closeToast() {
  2829. clearTimeout(this.toastTimer);
  2830. this.videoToastShow = false;
  2831. },
  2832. restart() {
  2833. // #ifdef MP-WEIXIN
  2834. polyvPlayerContext.seek(0);
  2835. // #endif
  2836. // #ifdef H5
  2837. polyvPlayerContext.j2s_seekVideo(0);
  2838. // #endif
  2839. clearTimeout(this.toastTimer);
  2840. this.videoToastShow = false;
  2841. },
  2842. // 新增用户视频学习日志
  2843. studyLog() {
  2844. this.$http({
  2845. url: "/user/study/log",
  2846. method: "post",
  2847. data: {
  2848. goodsId: this.goodsId,
  2849. courseId: this.courseId,
  2850. moduleId: this.moduleId || 0,
  2851. chapterId: this.chapterId || 0,
  2852. sectionId: this.playSectionId || 0,
  2853. fromPlat: 1, //来源平台 1小程序 2PC网站
  2854. goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  2855. orderGoodsId: this.orderGoodsId,
  2856. },
  2857. }).then((res) => {});
  2858. },
  2859. async onStateChange(newstate, oldstate) {
  2860. polyvPlayerContext = this.selectComponent("#playerVideo");
  2861. if (newstate.detail.newstate == "playing") {
  2862. console.log("播放");
  2863. if (this.noticeShow) {
  2864. polyvPlayerContext.pause();
  2865. return;
  2866. }
  2867. if (this.needSeek) {
  2868. if (this.recordObj.videoCurrentTime) {
  2869. polyvPlayerContext.seek(this.recordObj.videoCurrentTime);
  2870. this.seekTime = this.$method.secondToDate(
  2871. this.recordObj.videoCurrentTime
  2872. );
  2873. this.videoToastShow = true;
  2874. this.toastTimer = setTimeout(() => {
  2875. this.videoToastShow = false;
  2876. }, 3000);
  2877. } else {
  2878. polyvPlayerContext.seek(1); //避免相同节继续播放
  2879. }
  2880. polyvPlayerContext.play();
  2881. this.needSeek = false;
  2882. // 新增用户视频学习日志
  2883. this.studyLog();
  2884. // 提交学习记录
  2885. }
  2886. //开始播放
  2887. this.timer && clearInterval(this.timer);
  2888. if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
  2889. this.clearPauseTimer();
  2890. this.isReach = false;
  2891. this.timer = setInterval(this.timeEvent, 1000); //定时器
  2892. }
  2893. }
  2894. if (newstate.detail.newstate == "pause") {
  2895. console.log("暂停");
  2896. this.erJianErZaoPauseTip();
  2897. clearInterval(this.timer);
  2898. //暂停提交记录
  2899. }
  2900. if (newstate.detail.newstate == "ended") {
  2901. clearInterval(this.timer);
  2902. uni.showToast({
  2903. icon: "none",
  2904. title: "播放完毕",
  2905. });
  2906. this.hasStart = false;
  2907. await this.postStudyRecord(1);
  2908. this.nextSection();
  2909. }
  2910. },
  2911. //播放下一节
  2912. nextSection() {
  2913. console.log("播放下一节");
  2914. if (!this.menuAllList.length) {
  2915. return;
  2916. }
  2917. this.curPlayIndex = this.menuAllList.findIndex((item) => {
  2918. let i_sectionId = item.sectionId || 0;
  2919. let i_chapterId = item.chapterId || 0;
  2920. let i_moduleId = item.moduleId || 0;
  2921. return (
  2922. i_sectionId == this.playSectionId &&
  2923. i_chapterId == this.chapterId &&
  2924. i_moduleId == this.moduleId
  2925. );
  2926. });
  2927. let data = this.menuAllList[this.curPlayIndex + 1];
  2928. if (!data) {
  2929. //第二个弹窗
  2930. uni.showModal({
  2931. title: "温馨提示",
  2932. content:
  2933. "恭喜您课程学习全部完成,教务会在1-3个工作日内完成学习初审,请耐心等待。",
  2934. showCancel: !this.erJianErZao,
  2935. success: (res) => {
  2936. if (res.confirm) {
  2937. uni.switchTab({
  2938. url: "/pages/learn/index",
  2939. });
  2940. }
  2941. },
  2942. });
  2943. } else {
  2944. if (data.doType == 2) {
  2945. if (data.studyStatus == 1) {
  2946. uni.showToast({
  2947. title: "试卷已合格!",
  2948. duration: 2000,
  2949. icon: "none",
  2950. });
  2951. return;
  2952. }
  2953. uni.showModal({
  2954. title: "温馨提示",
  2955. content: "当前节视频已学完,是否进入考试?",
  2956. success: (res) => {
  2957. if (res.confirm) {
  2958. this.toQuestionBank(data);
  2959. }
  2960. },
  2961. });
  2962. return;
  2963. }
  2964. uni.showModal({
  2965. title: "温馨提示",
  2966. content: "当前节视频已学完,继续学习下一节?",
  2967. success: async (res) => {
  2968. if (res.confirm) {
  2969. this.moduleId = data.moduleId;
  2970. this.chapterId = data.chapterId;
  2971. this.sectionId = data.sectionId;
  2972. if (data.sectionType == 1) {
  2973. //录播
  2974. this.$store.commit("setPlaySectionId", {
  2975. playSectionId: data.sectionId,
  2976. });
  2977. this.$store.commit("setPlayVID", {
  2978. playVID: data.recordingUrl,
  2979. });
  2980. this.hasStart = false;
  2981. this.photoConfig = false;
  2982. this.photoIndex = 0;
  2983. this.sectionItem = data;
  2984. await this.getPhotoLastRecord(); // 获取拍照历史
  2985. this.playVideo(data);
  2986. } else if (data.sectionType == 2) {
  2987. //直播
  2988. this.studyRecordGetLastLive();
  2989. } else if (data.sectionType == 3) {
  2990. //回放
  2991. this.$store.commit("setPlaySectionId", {
  2992. playSectionId: data.sectionId,
  2993. });
  2994. this.$store.commit("setPlayVID", {
  2995. playVID: data.recordingUrl,
  2996. });
  2997. this.sectionItem = data;
  2998. this.playVideo(data);
  2999. }
  3000. let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
  3001. this.$store.commit("updatePlayNextId", playNextId);
  3002. this.updateChapterOpen(true);
  3003. this.reStart = false;
  3004. this.getMenuList();
  3005. }
  3006. },
  3007. });
  3008. }
  3009. },
  3010. //拍照
  3011. openPhoto() {
  3012. if (polyvPlayerContext) {
  3013. // #ifdef MP-WEIXIN
  3014. polyvPlayerContext.exitFullScreen();
  3015. // #endif
  3016. // #ifdef H5
  3017. if (this.isFullScreen()) {
  3018. this.exitFullscreen();
  3019. }
  3020. // #endif
  3021. }
  3022. // #ifdef MP-WEIXIN
  3023. this.enableAutoRotation = false;
  3024. this.photoPopup = true;
  3025. this.isTaking = true;
  3026. uni.setKeepScreenOn({
  3027. keepScreenOn: true,
  3028. });
  3029. uni.authorize({
  3030. scope: "scope.camera",
  3031. success() {},
  3032. });
  3033. // #endif
  3034. // #ifdef H5
  3035. if (
  3036. (window.navigator.mediaDevices &&
  3037. window.navigator.mediaDevices.getUserMedia) ||
  3038. window.navigator.getUserMedia ||
  3039. window.navigator.webkitGetUserMedia ||
  3040. window.navigator.mozGetUserMedia
  3041. ) {
  3042. console.log("getUserMedia----");
  3043. // 调用用户媒体设备, 访问摄像头
  3044. this.getUserMedia(
  3045. {
  3046. video: {
  3047. width: 400,
  3048. height: 300,
  3049. facingMode: "user",
  3050. },
  3051. },
  3052. this.photographSuccess,
  3053. this.photographError
  3054. );
  3055. } else {
  3056. console.log("1111没有摄像");
  3057. this.photographError();
  3058. }
  3059. // #endif
  3060. },
  3061. /**
  3062. * 人脸匹配
  3063. */
  3064. faceRecognition() {
  3065. return new Promise((resolve) => {
  3066. // #ifdef MP-WEIXIN
  3067. let fileSystem = uni.getFileSystemManager();
  3068. fileSystem.readFile({
  3069. filePath: `${this.avatarUrl}`,
  3070. encoding: "base64",
  3071. position: 0,
  3072. success: (res) => {
  3073. let base64 = "data:image/jpg;base64," + res.data;
  3074. // console.log('base64Data人脸识别参数:', {
  3075. // imageA: base64,
  3076. // orderGoodsId: this.orderGoodsId,
  3077. // gradeId: this.gradeId,
  3078. // })
  3079. this.CompareFace(base64, resolve);
  3080. },
  3081. fail(err) {
  3082. // this.$u.toast('人脸识别错误!')
  3083. console.error(err, "err-----人脸识别错误");
  3084. },
  3085. });
  3086. // #endif
  3087. // #ifdef H5
  3088. this.CompareFace(this.faceUrl, resolve);
  3089. // #endif
  3090. });
  3091. },
  3092. CompareFace(url, resolve) {
  3093. let timer = setTimeout(() => {
  3094. uni.showToast({
  3095. icon: "none",
  3096. title: "拍照超时,请重新拍照",
  3097. duration: 2000,
  3098. success: () => {
  3099. setTimeout(() => {
  3100. uni.navigateBack();
  3101. }, 1000);
  3102. },
  3103. });
  3104. }, 10 * 1000);
  3105. this.$api
  3106. .faceCertificationCompareFace({
  3107. imageA: url,
  3108. orderGoodsId: this.orderGoodsId,
  3109. gradeId: this.gradeId,
  3110. })
  3111. .then((res) => {
  3112. clearTimeout(timer);
  3113. console.log(res, "人脸识别成功res");
  3114. resolve(res.data.data);
  3115. })
  3116. .catch((err) => {
  3117. clearTimeout(timer);
  3118. // 当前网络延迟,
  3119. console.log("人脸识别错误:", err);
  3120. uni.showModal({
  3121. content: "当前网络延迟",
  3122. showCancel: false,
  3123. success: (resultst) => {
  3124. if (resultst.confirm) {
  3125. uni.navigateBack();
  3126. }
  3127. },
  3128. });
  3129. });
  3130. },
  3131. // 确定拍照
  3132. async submit() {
  3133. if (this.uploadLock) {
  3134. return;
  3135. }
  3136. this.uploadLock = true;
  3137. let compareFaceData = await this.faceRecognition();
  3138. this.compareFaceData = compareFaceData;
  3139. if (compareFaceData >= 80) {
  3140. await this.imageInfos();
  3141. this.postCoursePhotoRecord()
  3142. .then(async (res) => {
  3143. this.photoHistoryList.push(this.photoIndex);
  3144. // console.log('拍照确定提交', this.photoHistoryList);
  3145. this.postStudyRecord(); //提交记录
  3146. if (this.erJianErZao && this.isReach) {
  3147. console.log("1校验");
  3148. await this.postStudyRecord(1);
  3149. this.photoPopup = false;
  3150. this.uploadLock = false;
  3151. this.enableAutoRotation = true;
  3152. this.nextSection();
  3153. return;
  3154. }
  3155. //恢复播放
  3156. // #ifdef MP-WEIXIN
  3157. uni.setKeepScreenOn({
  3158. keepScreenOn: false,
  3159. });
  3160. // #endif
  3161. this.photoPopup = false;
  3162. this.uploadLock = false;
  3163. this.enableAutoRotation = true;
  3164. if (polyvPlayerContext != null) {
  3165. // #ifdef MP-WEIXIN
  3166. polyvPlayerContext.play();
  3167. // #endif
  3168. // #ifdef H5
  3169. polyvPlayerContext.j2s_resumeVideo();
  3170. // #endif
  3171. }
  3172. })
  3173. .catch((err) => {
  3174. console.log("拍照记录接口的err", err);
  3175. uni.showToast({
  3176. title: "上传接口报错,请重新拍照上传" + err,
  3177. icon: "none",
  3178. });
  3179. this.uploadLock = false;
  3180. this.openPhoto();
  3181. });
  3182. } else {
  3183. uni.showToast({
  3184. title: "人脸匹配不通过,请重新拍照上传",
  3185. icon: "none",
  3186. duration: 2000,
  3187. });
  3188. setTimeout(() => {
  3189. this.uploadLock = false;
  3190. this.openPhoto();
  3191. }, 2000);
  3192. }
  3193. },
  3194. reTake() {
  3195. this.isTaking = true;
  3196. // #ifdef H5
  3197. this.faceUrl = "";
  3198. this.getUserMedia(
  3199. {
  3200. video: {
  3201. width: 400,
  3202. height: 300,
  3203. facingMode: "user",
  3204. },
  3205. },
  3206. this.photographSuccess,
  3207. this.photographError
  3208. );
  3209. // #endif
  3210. },
  3211. toTakePhoto() {
  3212. this.popupPhotoShow = false;
  3213. this.openPhoto();
  3214. },
  3215. takePhTips() {
  3216. this.popupPhotoShow = true;
  3217. this.isTaking = false;
  3218. this.photoPopup = false;
  3219. this.enableAutoRotation = false;
  3220. },
  3221. //确认拍照
  3222. takePhoto() {
  3223. // #ifdef MP-WEIXIN
  3224. const ctx = uni.createCameraContext();
  3225. ctx.takePhoto({
  3226. quality: "high",
  3227. success: (res) => {
  3228. this.avatarUrl = res.tempImagePath;
  3229. console.log("开始拍照this.avatarUrl:", this.avatarUrl);
  3230. this.isTaking = false;
  3231. },
  3232. fail: (err) => {},
  3233. });
  3234. // #endif
  3235. // #ifdef H5
  3236. const canvas = document.createElement("canvas");
  3237. canvas.width = 400;
  3238. canvas.height = 400;
  3239. const context = canvas.getContext("2d");
  3240. const box = document.querySelector(".photo_v");
  3241. const video = box.querySelector("video");
  3242. context.drawImage(video, 0, 0, 400, 400);
  3243. this.faceUrl = canvas.toDataURL("image/png");
  3244. this.isTaking = false;
  3245. // #endif
  3246. },
  3247. playError(e) {
  3248. console.log(e);
  3249. },
  3250. //拍照报错
  3251. error(e) {
  3252. console.log(e.detail);
  3253. },
  3254. //关闭相机
  3255. closePhoto() {
  3256. this.photoPopup = false;
  3257. this.enableAutoRotation = true;
  3258. },
  3259. /**
  3260. * 进入全屏
  3261. */
  3262. fullscreenchange(event) {
  3263. if (event.detail.direction == "vertical") {
  3264. this.navShow = true;
  3265. } else if (event.detail.direction == "horizontal") {
  3266. this.navShow = false;
  3267. }
  3268. },
  3269. checkFinishRequiredCourse() {
  3270. return this.$api
  3271. .checkFinishRequiredCourse({
  3272. businessId: this.goodsData.businessId,
  3273. goodsId: this.goodsId,
  3274. })
  3275. .then((res) => {
  3276. if (res.data.data > 0) {
  3277. uni.showModal({
  3278. showCancel: false,
  3279. confirmText: "确定",
  3280. content: "该业务层次下有未学完的商品,无法学习新商品!",
  3281. success: function (resultst) {
  3282. uni.navigateBack();
  3283. },
  3284. });
  3285. return Promise.reject();
  3286. }
  3287. return Promise.resolve();
  3288. });
  3289. },
  3290. getGoodsDetail() {
  3291. let self = this;
  3292. this.$api.goodsDetail(this.goodsId).then(async (res) => {
  3293. console.log(
  3294. "🚀 ~ file: detail.vue:3398 ~ this.$api.goodsDetail ~ res:",
  3295. res
  3296. );
  3297. this.goodsData = res.data.data;
  3298. this.option.periodWaitTime && (await this.checkFinishRequiredCourse());
  3299. if (this.goodsData.buyNote) {
  3300. this.baseHandoutTipList();
  3301. }
  3302. self.gradeId = self.goodsData.gradeId;
  3303. self.erJianErZao = self.goodsData.erJianErZao;
  3304. this.courseBusiness(this.goodsData.businessId);
  3305. self.getMenuList();
  3306. self.getReMenuList(); //获取重修目录
  3307. setTimeout(function () {
  3308. if (!self.needProfileModal) {
  3309. self.getGradeInfo();
  3310. }
  3311. }, 500);
  3312. //获取节笔记
  3313. this.getNoteList();
  3314. if (self.goodsData.goodsPlayConfig) {
  3315. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  3316. if (self.goodsPlayConfig.autoPlay > 0) {
  3317. self.autoplay = true;
  3318. }
  3319. if (self.goodsPlayConfig.drag > 0 && !self.erJianErZao) {
  3320. // #ifdef MP-WEIXIN
  3321. self.isAllowSeek = "yes";
  3322. // #endif
  3323. // #ifdef H5
  3324. self.H5isAllowSeek = "off";
  3325. // #endif
  3326. }
  3327. if (self.goodsPlayConfig.speed > 0) {
  3328. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  3329. }
  3330. }
  3331. if (self.goodsData.goodsPhotographConfig) {
  3332. self.goodsPhotographConfig = JSON.parse(
  3333. self.goodsData.goodsPhotographConfig
  3334. );
  3335. if (self.goodsPhotographConfig.photoNum > 0) {
  3336. self.photoNum = self.goodsPhotographConfig.photoNum;
  3337. }
  3338. }
  3339. });
  3340. },
  3341. startVideo() {
  3342. this.startStatus = true;
  3343. },
  3344. getAnswerList() {
  3345. this.$api
  3346. .answerList({
  3347. courseId: this.courseId,
  3348. goodsId: this.goodsId,
  3349. orderGoodsId: this.orderGoodsId,
  3350. })
  3351. .then((res) => {
  3352. if (res.data.code == 200) {
  3353. this.answerList = res.data.rows;
  3354. }
  3355. });
  3356. },
  3357. getReMenuList() {
  3358. let self = this;
  3359. this.$api
  3360. .reMenuList({
  3361. orderGoodsId: this.orderGoodsId,
  3362. courseId: this.courseId,
  3363. rebuild: 1,
  3364. gradeId: this.gradeId,
  3365. })
  3366. .then((res) => {
  3367. if (res.data.code == 200) {
  3368. for (let i = 0; i < res.data.rows.length; i++) {
  3369. let item = res.data.rows[i];
  3370. item.down = true;
  3371. item.id = item.menuId;
  3372. item.name = item.menuName;
  3373. }
  3374. self.reMenuList = res.data.rows;
  3375. this.current = 0;
  3376. if (self.reMenuList.length > 0) {
  3377. this.showNotes = false;
  3378. if (Object.keys(this.sectionItem).length) {
  3379. let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
  3380. this.$store.commit("updatePlayNextId", playNextIdisRebuild);
  3381. }
  3382. } else {
  3383. if (Object.keys(this.sectionItem).length) {
  3384. let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
  3385. this.$store.commit("updatePlayNextId", playNextId);
  3386. }
  3387. }
  3388. }
  3389. });
  3390. },
  3391. getMenuList() {
  3392. let self = this;
  3393. this.$api
  3394. .reMenuList({
  3395. courseId: this.courseId,
  3396. gradeId: this.gradeId,
  3397. orderGoodsId: this.orderGoodsId,
  3398. })
  3399. .then((res) => {
  3400. if (res.data.code == 200) {
  3401. for (let i = 0; i < res.data.rows.length; i++) {
  3402. let item = res.data.rows[i];
  3403. item.down = true;
  3404. item.id = item.menuId;
  3405. item.name = item.menuName;
  3406. item.menuType = item.type;
  3407. }
  3408. this.menuList = res.data.rows;
  3409. this.reStart = true;
  3410. }
  3411. });
  3412. },
  3413. courseDetail() {
  3414. this.$api.courseDetail(this.courseId).then((res) => {
  3415. if (res.data.code == 200) {
  3416. this.detail = res.data.data;
  3417. }
  3418. });
  3419. },
  3420. open(item) {
  3421. item.showChildren = !item.showChildren;
  3422. },
  3423. change(index) {
  3424. this.current = index;
  3425. if (index == 3) {
  3426. this.getAnswerList();
  3427. }
  3428. },
  3429. clickMulu() {
  3430. this.muluStyle = !this.muluStyle;
  3431. },
  3432. loadPlayerScript(callback) {
  3433. if (!window.polyvPlayer) {
  3434. const myScript = document.createElement("script");
  3435. myScript.setAttribute("src", this.vodPlayerJs);
  3436. myScript.onload = callback;
  3437. document.body.appendChild(myScript);
  3438. } else {
  3439. callback();
  3440. }
  3441. },
  3442. // 播放视频
  3443. loadPlayer() {
  3444. const polyvPlayer = window.polyvPlayer;
  3445. this.$api.polyvVideoSign(this.vid).then(async (res) => {
  3446. let option = {
  3447. showLine: "off",
  3448. ban_history_time: "on",
  3449. vid: this.vid,
  3450. forceH5: true,
  3451. autoplay: this.autoplay, // 自动播放
  3452. ban_seek: this.H5isAllowSeek, // 是否禁止拖拽进度条
  3453. speed: this.playbackRate, // 倍数
  3454. banSeekDeviation: 7, // 做兼容
  3455. teaser_show: 1,
  3456. tail_show: 1,
  3457. hideSwitchPlayer: true,
  3458. watchStartTime: this.recordObj.videoCurrentTime, // 播放开始时间,表示视频从第几秒开始播放,参数值需小于视频时长
  3459. ts: res.data.data.ts, // 移动播放加密视频需传入的时间戳。
  3460. sign: res.data.data.sign, // 移动端播放加密视频所需的签名
  3461. };
  3462. if (polyvPlayerContext) {
  3463. polyvPlayerContext.changeVid(option);
  3464. } else {
  3465. option = {
  3466. wrap: "#player",
  3467. width: "100%",
  3468. height: 218,
  3469. ...option,
  3470. };
  3471. polyvPlayerContext = await polyvPlayer(option);
  3472. }
  3473. polyvPlayerContext.on("s2j_onPlayStart", async (vid) => {
  3474. console.log("视频初次播放时触发:");
  3475. // #ifdef H5
  3476. // h5禁止拖动进度条
  3477. if (!this.$method.isWeixin()) {
  3478. this.clearBarTimer();
  3479. let originTime = this.recordObj.videoCurrentTime || 0;
  3480. if (this.H5isAllowSeek == "on") {
  3481. this.barTimer = setInterval(() => {
  3482. const currentTime = polyvPlayerContext.j2s_getCurrentTime();
  3483. if (
  3484. currentTime - originTime > 15 ||
  3485. currentTime - originTime < 0
  3486. ) {
  3487. polyvPlayerContext.j2s_seekVideo(originTime);
  3488. } else {
  3489. originTime = currentTime;
  3490. }
  3491. }, 2000);
  3492. }
  3493. }
  3494. // #endif
  3495. this.loadedmetadata();
  3496. });
  3497. polyvPlayerContext.on("s2j_onVideoPause", () => {
  3498. // 视频暂停时触发
  3499. console.log("视频暂停时触发", this.vid);
  3500. this.erJianErZaoPauseTip();
  3501. this.clearBarTimer();
  3502. clearInterval(this.studyTimer);
  3503. clearInterval(this.timer);
  3504. });
  3505. polyvPlayerContext.on("s2j_onVideoPlay", () => {
  3506. // 视频初次播放或由暂停恢复播放时触发
  3507. console.log("视频初次播放或由暂停恢复播放时触发");
  3508. if (this.noticeShow) {
  3509. polyvPlayerContext.j2s_pauseVideo();
  3510. return;
  3511. }
  3512. if (this.needSeek) {
  3513. if (this.recordObj.videoCurrentTime) {
  3514. this.seekTime = this.$method.secondToDate(
  3515. this.recordObj.videoCurrentTime
  3516. );
  3517. this.videoToastShow = true;
  3518. this.toastTimer = setTimeout(() => {
  3519. this.videoToastShow = false;
  3520. }, 3000);
  3521. }
  3522. this.needSeek = false;
  3523. // 新增用户视频学习日志
  3524. this.studyLog();
  3525. }
  3526. //开始播放
  3527. this.timer && clearInterval(this.timer);
  3528. if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
  3529. this.clearPauseTimer();
  3530. this.isReach = false;
  3531. this.timer = setInterval(this.timeEvent, 1000); //定时器
  3532. }
  3533. this.studyTimer && clearInterval(this.studyTimer);
  3534. this.studyTimer = setInterval(() => {
  3535. this.postStudyRecord(0, this.playSectionId);
  3536. }, 15000);
  3537. });
  3538. polyvPlayerContext.on("s2j_onPlayOver", async () => {
  3539. // 当前视频播放完毕时触发
  3540. this.hasStart = false;
  3541. this.clearBarTimer();
  3542. clearInterval(this.studyTimer);
  3543. clearInterval(this.timer);
  3544. uni.showToast({
  3545. icon: "none",
  3546. title: "播放完毕",
  3547. });
  3548. await this.postStudyRecord(1);
  3549. this.nextSection(); // 播放下一节
  3550. });
  3551. });
  3552. },
  3553. clears() {
  3554. return new Promise((resolve, reject) => {
  3555. this.vid = "";
  3556. polyvPlayerContext && polyvPlayerContext.destroy();
  3557. polyvPlayerContext = null;
  3558. resolve();
  3559. });
  3560. },
  3561. /**
  3562. * 退出全屏
  3563. */
  3564. exitFullscreen() {
  3565. try {
  3566. var de = document;
  3567. if (de.exitFullscreen) {
  3568. de.exitFullscreen();
  3569. } else if (de.mozCancelFullScreen) {
  3570. de.mozCancelFullScreen();
  3571. } else if (de.webkitCancelFullScreen) {
  3572. de.webkitCancelFullScreen();
  3573. }
  3574. } catch (err) {}
  3575. },
  3576. fullele() {
  3577. return (
  3578. document.fullscreenElement ||
  3579. document.webkitFullscreenElement ||
  3580. document.msFullscreenElement ||
  3581. document.mozFullScreenElement ||
  3582. null
  3583. );
  3584. },
  3585. //判断是否全屏
  3586. isFullScreen() {
  3587. return !!(document.webkitIsFullScreen || this.fullele());
  3588. },
  3589. getUserMedia(constraints, success, error) {
  3590. console.log("getUserMedia===", constraints, "success:", success);
  3591. if (window.navigator.mediaDevices.getUserMedia) {
  3592. // 最新的标准API
  3593. window.navigator.mediaDevices
  3594. .getUserMedia(constraints)
  3595. .then(success)
  3596. .catch(error);
  3597. } else if (window.navigator.webkitGetUserMedia) {
  3598. // webkit核心浏览器
  3599. window.navigator.webkitGetUserMedia(constraints, success, error);
  3600. } else if (window.navigator.mozGetUserMedia) {
  3601. // firfox浏览器
  3602. window.navigator.mozGetUserMedia(constraints, success, error);
  3603. } else if (window.navigator.getUserMedia) {
  3604. // 旧版API
  3605. window.navigator.getUserMedia(constraints, success, error);
  3606. }
  3607. },
  3608. photographSuccess(stream) {
  3609. console.log("有摄像头---", stream);
  3610. this.photoPopup = true;
  3611. this.isTaking = true;
  3612. this.enableAutoRotation = false;
  3613. this.$nextTick(() => {
  3614. const box = document.querySelector(".photo_v");
  3615. const video = box.querySelector("video");
  3616. console.log("video:", video);
  3617. video.srcObject = stream;
  3618. video.play();
  3619. });
  3620. },
  3621. photographError(err) {
  3622. console.log("没有摄像头:", err);
  3623. uni.showModal({
  3624. title: "提示",
  3625. content:
  3626. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  3627. cancelText: "取消",
  3628. confirmText: "确定",
  3629. success: (res) => {
  3630. if (res.confirm) {
  3631. uni.navigateBack();
  3632. } else if (res.cancel) {
  3633. }
  3634. },
  3635. });
  3636. },
  3637. },
  3638. };
  3639. </script>
  3640. <style lang="scss" scope>
  3641. @import "./css/detail.scss";
  3642. .top {
  3643. &__header {
  3644. position: relative;
  3645. width: 100%;
  3646. height: 150rpx;
  3647. padding: 24rpx 150rpx 24rpx 24rpx;
  3648. .img {
  3649. position: absolute;
  3650. left: 0;
  3651. top: 0;
  3652. width: 100%;
  3653. }
  3654. .note {
  3655. position: relative;
  3656. z-index: 10;
  3657. font-size: 24rpx;
  3658. font-family: PingFang SC;
  3659. font-weight: bold;
  3660. color: #efdbff;
  3661. }
  3662. .title {
  3663. position: relative;
  3664. z-index: 10;
  3665. font-size: 26rpx;
  3666. font-family: PingFang SC;
  3667. font-weight: bold;
  3668. color: #ffffff;
  3669. }
  3670. }
  3671. }
  3672. #top {
  3673. position: relative;
  3674. z-index: 99;
  3675. }
  3676. .polyv_detail {
  3677. display: flex;
  3678. flex-direction: column;
  3679. height: 100vh;
  3680. position: relative;
  3681. top: 0;
  3682. left: 0;
  3683. .pops {
  3684. position: absolute;
  3685. top: 0;
  3686. left: 0;
  3687. background: #ccc;
  3688. opacity: 0.5;
  3689. width: 100%;
  3690. height: 300rpx;
  3691. z-index: 9999;
  3692. }
  3693. .box {
  3694. flex: 1;
  3695. overflow: hidden;
  3696. margin: 16rpx 16rpx 100rpx 16rpx;
  3697. .box_in {
  3698. height: 100%;
  3699. }
  3700. }
  3701. .first_ml {
  3702. margin: 16rpx 16rpx 16rpx 16rpx;
  3703. }
  3704. }
  3705. .btnSet {
  3706. width: 440rpx;
  3707. height: 80rpx;
  3708. background: #007aff;
  3709. border-radius: 40rpx;
  3710. color: #ffffff;
  3711. font-size: 28rpx;
  3712. line-height: 80rpx;
  3713. }
  3714. .btnReply {
  3715. width: 80rpx;
  3716. height: 40rpx;
  3717. background: #e3f0ff;
  3718. border-radius: 16rpx;
  3719. text-align: center;
  3720. color: #007aff;
  3721. }
  3722. .btnDel {
  3723. width: 80rpx;
  3724. height: 40rpx;
  3725. background: #ffedf0;
  3726. border-radius: 16rpx;
  3727. text-align: center;
  3728. color: #ff2d55;
  3729. }
  3730. .btnReply {
  3731. width: 80rpx;
  3732. height: 40rpx;
  3733. background: #e3f0ff;
  3734. border-radius: 16rpx;
  3735. font-size: 24rpx;
  3736. }
  3737. .lecture-content {
  3738. background: #fff;
  3739. margin-top: 10rpx;
  3740. padding: 10rpx;
  3741. border-radius: 16rpx;
  3742. }
  3743. .photoBox {
  3744. width: 100%;
  3745. // background-color: #ffffff;
  3746. // border-radius: 24px 24px 0px 0px;
  3747. .photoTop {
  3748. width: 100%;
  3749. height: 74rpx;
  3750. border-radius: 20px 20px 0px 0px;
  3751. background-color: #ffffff;
  3752. display: flex;
  3753. align-items: center;
  3754. justify-content: center;
  3755. padding: 0rpx 38rpx;
  3756. .sqzz {
  3757. width: 28rpx;
  3758. height: 28rpx;
  3759. display: flex;
  3760. align-items: center;
  3761. justify-content: center;
  3762. }
  3763. .centersq {
  3764. color: #333;
  3765. font-size: 30rpx;
  3766. font-weight: 500;
  3767. }
  3768. }
  3769. .photoCenter {
  3770. width: 750rpx;
  3771. height: 75vh;
  3772. position: relative;
  3773. .center_camera {
  3774. width: 100%;
  3775. height: 75vh;
  3776. position: fixed;
  3777. .head_take {
  3778. width: 100%;
  3779. height: 75vh;
  3780. display: flex;
  3781. flex-direction: column;
  3782. }
  3783. .headTake_up {
  3784. width: 100%;
  3785. height: 100rpx;
  3786. }
  3787. .headTake_minddle {
  3788. display: flex;
  3789. .min_img {
  3790. width: 500rpx;
  3791. height: 550rpx;
  3792. }
  3793. .min_left,
  3794. .min_right {
  3795. flex: 1;
  3796. height: 550rpx;
  3797. }
  3798. }
  3799. .headTake_down {
  3800. width: 100%;
  3801. flex: 1;
  3802. }
  3803. .color {
  3804. background-color: #333;
  3805. opacity: 0.5;
  3806. }
  3807. .photo_v {
  3808. width: 100%;
  3809. height: 100%;
  3810. }
  3811. .mask {
  3812. width: 500rpx;
  3813. height: 550rpx;
  3814. position: absolute;
  3815. top: 100rpx;
  3816. left: 0;
  3817. right: 0;
  3818. bottom: 0;
  3819. margin: 0 auto;
  3820. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  3821. }
  3822. }
  3823. .custom {
  3824. width: 750rpx;
  3825. height: 75vh;
  3826. position: absolute;
  3827. z-index: 1000;
  3828. top: 0;
  3829. left: 0;
  3830. image {
  3831. width: 100%;
  3832. height: 100%;
  3833. }
  3834. }
  3835. }
  3836. .btns {
  3837. display: flex;
  3838. .takePhoto_btn {
  3839. width: 100%;
  3840. display: flex;
  3841. align-items: center;
  3842. justify-content: space-between;
  3843. background: #a9a7a9;
  3844. padding: 40rpx 26rpx;
  3845. .middle_btn {
  3846. width: 120rpx;
  3847. height: 120rpx;
  3848. border-radius: 40rpx;
  3849. border: 4rpx solid #ffffff;
  3850. display: flex;
  3851. align-items: center;
  3852. justify-content: center;
  3853. }
  3854. .square {
  3855. width: 96rpx;
  3856. height: 96rpx;
  3857. background: #ffffff;
  3858. border-radius: 28rpx;
  3859. }
  3860. .rights {
  3861. font-size: 32rpx;
  3862. font-weight: 500;
  3863. color: #ffffff;
  3864. }
  3865. }
  3866. .btnResult {
  3867. height: 100rpx;
  3868. flex: 1;
  3869. background-color: #07c160;
  3870. text-align: center;
  3871. line-height: 100rpx;
  3872. color: #fff;
  3873. font-size: 32rpx;
  3874. font-weight: bold;
  3875. }
  3876. }
  3877. }
  3878. .chat_box {
  3879. display: flex;
  3880. padding: 20rpx;
  3881. justify-content: space-between;
  3882. }
  3883. .chat3 {
  3884. font-size: 30rpx;
  3885. font-family: PingFang SC;
  3886. font-weight: 500;
  3887. color: #666666;
  3888. margin-top: 10rpx;
  3889. }
  3890. .chat2 {
  3891. font-size: 20rpx;
  3892. font-family: PingFang SC;
  3893. font-weight: 500;
  3894. color: #999999;
  3895. margin-top: 10rpx;
  3896. }
  3897. .chat1 {
  3898. font-size: 24rpx;
  3899. font-family: PingFang SC;
  3900. font-weight: 500;
  3901. color: #333333;
  3902. }
  3903. .leftPadding {
  3904. margin-left: 8rpx;
  3905. }
  3906. .t2Content {
  3907. font-size: 24rpx;
  3908. font-family: PingFang SC;
  3909. font-weight: bold;
  3910. color: #999999;
  3911. line-height: 48rpx;
  3912. }
  3913. .tBox2 {
  3914. display: flex;
  3915. padding-top: 10rpx;
  3916. color: #333333;
  3917. font-size: 30rpx;
  3918. font-weight: 400;
  3919. }
  3920. .tBox {
  3921. display: flex;
  3922. align-items: center;
  3923. padding-top: 10rpx;
  3924. }
  3925. .title {
  3926. font-size: 24rpx;
  3927. color: #999999;
  3928. }
  3929. .Answering {
  3930. .answer_item {
  3931. &:nth-child(2) {
  3932. border-radius: 16rpx 16rpx 0rpx 0rpx;
  3933. }
  3934. &:nth-last-child(1) {
  3935. border-radius: 0rpx 0rpx 16rpx 16rpx;
  3936. }
  3937. }
  3938. }
  3939. .inputBottom {
  3940. position: fixed;
  3941. left: 0;
  3942. bottom: 0;
  3943. background: #ffffff;
  3944. height: 98rpx;
  3945. display: flex;
  3946. align-items: center;
  3947. width: 100%;
  3948. .flex_auto {
  3949. flex: 1;
  3950. margin-left: 10%;
  3951. word-break: break-all;
  3952. // .input {
  3953. // height: 60rpx;
  3954. // }
  3955. }
  3956. .btn {
  3957. color: #007aff;
  3958. font-size: 30rpx;
  3959. font-weight: bold;
  3960. width: 15%;
  3961. text-align: center;
  3962. }
  3963. .input {
  3964. background: rgba(244, 244, 244, 0.98);
  3965. height: 60rpx;
  3966. border-radius: 24rpx;
  3967. margin-top: 12rpx;
  3968. }
  3969. }
  3970. .noteBox {
  3971. width: 100%;
  3972. background: #ffffff;
  3973. padding: 0rpx 10rpx 20rpx;
  3974. border-radius: 16rpx;
  3975. overflow: hidden;
  3976. .left_ti {
  3977. padding-top: 14rpx;
  3978. }
  3979. }
  3980. .dateBox {
  3981. width: 216rpx;
  3982. height: 48rpx;
  3983. background: #ffffff;
  3984. border-radius: 24rpx;
  3985. font-size: 24rpx;
  3986. color: #666666;
  3987. text-align: center;
  3988. line-height: 48rpx;
  3989. margin: 16rpx 0rpx 8rpx;
  3990. }
  3991. .t_content1 {
  3992. color: #007aff;
  3993. margin-left: 10rpx;
  3994. }
  3995. .tag1 {
  3996. border: 2rpx solid #007aff;
  3997. border-radius: 8rpx;
  3998. font-size: 20rpx;
  3999. color: #007aff;
  4000. padding: 5rpx;
  4001. }
  4002. .b_title {
  4003. color: #333333;
  4004. font-size: 30rpx;
  4005. font-weight: bold;
  4006. }
  4007. page {
  4008. background: #eaeef1;
  4009. }
  4010. .menuBox {
  4011. width: 100%;
  4012. background: #ffffff;
  4013. border-radius: 16rpx;
  4014. padding: 0rpx 20rpx;
  4015. margin-bottom: 20rpx;
  4016. }
  4017. .btnspric {
  4018. border-top: 1rpx solid #eee;
  4019. display: flex;
  4020. align-items: center;
  4021. justify-content: space-between;
  4022. height: 108rpx;
  4023. padding-left: 43rpx;
  4024. padding-right: 32rpx;
  4025. }
  4026. .btnspric > .lefprL {
  4027. font-size: 36rpx;
  4028. color: #0c141f;
  4029. font-weight: bold;
  4030. }
  4031. .btnspric > .lefprR {
  4032. padding: 0rpx 24rpx;
  4033. height: 60rpx;
  4034. line-height: 60rpx;
  4035. text-align: center;
  4036. color: #fff;
  4037. background: #32467b;
  4038. border-radius: 24rpx;
  4039. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  4040. }
  4041. .yhj,
  4042. .hdyhj {
  4043. padding: 24rpx 29rpx 24rpx 34rpx;
  4044. }
  4045. .yhj {
  4046. border-bottom: 16rpx solid #f9f9f9;
  4047. }
  4048. .yhjtit {
  4049. font-size: 30rpx;
  4050. color: #0c141f;
  4051. font-weight: 500;
  4052. margin-bottom: 14rpx;
  4053. }
  4054. .yhjList {
  4055. display: flex;
  4056. align-items: center;
  4057. justify-content: space-between;
  4058. margin-bottom: 14rpx;
  4059. }
  4060. .yhjList > .yhjLefts {
  4061. display: flex;
  4062. align-items: center;
  4063. }
  4064. .yhjLefts > .yhl {
  4065. color: #32467b;
  4066. font-size: 30rpx;
  4067. margin-right: 31rpx;
  4068. }
  4069. .yhjLefts > .yhbq {
  4070. font-size: 24rpx;
  4071. color: #ff9500;
  4072. border-radius: 18rpx;
  4073. background-color: rgba(255, 149, 0, 0.2);
  4074. border: 2rpx solid #ff9500;
  4075. height: 38rpx;
  4076. line-height: 38rpx;
  4077. padding: 0rpx 16rpx;
  4078. }
  4079. .ts {
  4080. font-size: 24rpx;
  4081. color: #999;
  4082. margin: 14rpx 0rpx;
  4083. padding-right: 29rpx;
  4084. padding-left: 34rpx;
  4085. }
  4086. .yh {
  4087. padding-top: 20rpx;
  4088. }
  4089. .yh > .yhtitle {
  4090. display: flex;
  4091. align-items: center;
  4092. justify-content: space-between;
  4093. padding-right: 29rpx;
  4094. padding-left: 34rpx;
  4095. }
  4096. .priceBxs {
  4097. display: flex;
  4098. align-items: center;
  4099. }
  4100. .priceBxs > .pricleft {
  4101. border-radius: 24rpx;
  4102. border: 1rpx solid #e91313;
  4103. background-color: rgba(233, 19, 19, 0.1);
  4104. padding: 0rpx 18rpx;
  4105. height: 49rpx;
  4106. line-height: 49rpx;
  4107. text-align: center;
  4108. font-size: 30rpx;
  4109. font-weight: 500;
  4110. color: #e91313;
  4111. margin-right: 13rpx;
  4112. }
  4113. .topBox {
  4114. padding: 32rpx 32rpx 24rpx;
  4115. border-bottom: 1rpx solid #eeeeee;
  4116. }
  4117. .topBox > .boldFonstType {
  4118. font-weight: 500;
  4119. font-size: 30rpx;
  4120. margin: 16rpx 0rpx 23rpx;
  4121. }
  4122. .topBox > .firstTopL {
  4123. display: flex;
  4124. align-items: center;
  4125. }
  4126. .topBox > .firstTopL > .imageBs {
  4127. width: 331rpx;
  4128. height: 160rpx;
  4129. border-radius: 6rpx;
  4130. overflow: hidden;
  4131. margin-right: 8rpx;
  4132. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  4133. }
  4134. .topBox > .firstTopL > .imageBs > image {
  4135. width: 100%;
  4136. height: 100%;
  4137. }
  4138. .topBox > .firstTopL > .textBs {
  4139. font-size: 30rpx;
  4140. font-weight: bold;
  4141. color: #0c141f;
  4142. }
  4143. .content {
  4144. padding: 24rpx;
  4145. text-align: left;
  4146. }
  4147. .catalogBox {
  4148. display: flex;
  4149. align-items: center;
  4150. flex-wrap: nowrap;
  4151. overflow-x: auto;
  4152. padding-left: 38rpx;
  4153. max-height: 305rpx;
  4154. overflow-y: auto;
  4155. transition: all 0.4s;
  4156. }
  4157. .catalogBox > .catalogA {
  4158. min-width: 200rpx;
  4159. height: 48rpx;
  4160. line-height: 48rpx;
  4161. // text-align: center;
  4162. border: 2rpx solid transparent;
  4163. white-space: nowrap;
  4164. text-overflow: ellipsis;
  4165. overflow: hidden;
  4166. word-break: break-all;
  4167. border-radius: 10rpx;
  4168. background: rgba(22, 119, 255, 0.05);
  4169. padding-left: 19rpx;
  4170. box-sizing: border-box;
  4171. padding-right: 15rpx;
  4172. margin-right: 16rpx;
  4173. margin-bottom: 20rpx;
  4174. margin-top: 15rpx;
  4175. font-size: 24rpx;
  4176. color: #666;
  4177. }
  4178. .catalogBox > .activesq {
  4179. border-color: #1677ff;
  4180. }
  4181. .changeCatalogBox {
  4182. display: block;
  4183. }
  4184. .catalogBox::-webkit-scrollbar {
  4185. display: none; /* Chrome Safari */
  4186. }
  4187. .price_t2 {
  4188. font-size: 18rpx;
  4189. font-family: PingFang SC;
  4190. font-weight: 500;
  4191. text-decoration: line-through;
  4192. color: #999999;
  4193. }
  4194. .price_t1 {
  4195. font-size: 33rpx;
  4196. font-family: PingFang SC;
  4197. font-weight: bold;
  4198. color: #e91313;
  4199. }
  4200. .sc_t {
  4201. font-size: 22rpx;
  4202. color: #000000;
  4203. }
  4204. .sc {
  4205. width: 29rpx;
  4206. height: 29rpx;
  4207. }
  4208. .buy {
  4209. width: 138rpx;
  4210. height: 48rpx;
  4211. line-height: 48rpx;
  4212. background: #32467b;
  4213. border-radius: 10rpx;
  4214. color: #ffffff;
  4215. font-size: 28rpx;
  4216. text-align: center;
  4217. vertical-align: middle;
  4218. position: absolute;
  4219. right: 30rpx;
  4220. }
  4221. .video_body {
  4222. padding-bottom: 96rpx;
  4223. }
  4224. .footer_tab {
  4225. position: fixed;
  4226. bottom: 0;
  4227. height: 96rpx;
  4228. width: 100%;
  4229. background-color: #ffffff;
  4230. }
  4231. .tj_box {
  4232. width: 50%;
  4233. display: inline-block;
  4234. text-align: center;
  4235. margin: 10rpx 0;
  4236. }
  4237. .teacher_t {
  4238. font-size: 24rpx;
  4239. font-family: PingFang SC;
  4240. font-weight: 400;
  4241. color: #666666;
  4242. line-height: 36rpx;
  4243. margin-left: 15rpx;
  4244. }
  4245. .teacher_img {
  4246. width: 87rpx;
  4247. height: 129rpx;
  4248. }
  4249. .t2 {
  4250. font-size: 24rpx;
  4251. font-family: PingFang SC;
  4252. color: #666666;
  4253. line-height: 36rpx;
  4254. margin: 15rpx;
  4255. }
  4256. .r_t2 {
  4257. width: 201rpx;
  4258. height: 49rpx;
  4259. background: rgba(22, 119, 255, 0.05);
  4260. border: 1rpx solid #32467b;
  4261. border-radius: 16rpx;
  4262. color: #666666;
  4263. font-size: 23rpx;
  4264. text-align: center;
  4265. display: flex;
  4266. align-items: center;
  4267. padding: 5rpx;
  4268. }
  4269. .scroll_box {
  4270. width: 100%;
  4271. height: 60rpx;
  4272. background: #ffffff;
  4273. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  4274. white-space: nowrap;
  4275. overflow: hidden;
  4276. margin: 15rpx 0;
  4277. }
  4278. .r_sliper {
  4279. padding: 0 20rpx;
  4280. }
  4281. .top_line {
  4282. width: 6rpx;
  4283. height: 22rpx;
  4284. background: #32467b;
  4285. margin-right: 10rpx;
  4286. }
  4287. .video_t2 {
  4288. font-size: 24rpx;
  4289. font-family: PingFang SC;
  4290. font-weight: 500;
  4291. color: #666666;
  4292. }
  4293. .video_play {
  4294. position: absolute;
  4295. width: 95rpx;
  4296. height: 95rpx;
  4297. top: 0;
  4298. left: 0;
  4299. right: 0;
  4300. bottom: 0;
  4301. margin: auto;
  4302. }
  4303. .video_box {
  4304. position: relative;
  4305. .video-toast {
  4306. position: absolute;
  4307. width: 686rpx;
  4308. height: 80rpx;
  4309. background: rgba(0, 0, 0, 0.6);
  4310. border-radius: 24rpx;
  4311. bottom: 100rpx;
  4312. left: 50%;
  4313. transform: translateX(-50%);
  4314. color: #fff;
  4315. display: flex;
  4316. font-size: 26rpx;
  4317. align-items: center;
  4318. overflow: visible;
  4319. z-index: 999;
  4320. &__text {
  4321. flex: 1;
  4322. margin-left: 40rpx;
  4323. }
  4324. &__btn {
  4325. width: 180rpx;
  4326. text-align: center;
  4327. border-left: 1rpx solid #fff;
  4328. }
  4329. }
  4330. .video-toast__close {
  4331. position: absolute;
  4332. right: 32rpx;
  4333. bottom: 184rpx;
  4334. width: 40rpx;
  4335. height: 40rpx;
  4336. line-height: 40rpx;
  4337. text-align: center;
  4338. background: rgba(0, 0, 0, 0.6);
  4339. border-radius: 50%;
  4340. color: rgba(255, 255, 255, 0.3);
  4341. }
  4342. }
  4343. .rotoct {
  4344. transform: rotate(90deg);
  4345. }
  4346. .slot-content {
  4347. padding: 0 20rpx;
  4348. }
  4349. .notice_modal {
  4350. .content {
  4351. width: 100%;
  4352. height: 100%;
  4353. padding: 56rpx 56rpx 56rpx 64rpx;
  4354. .title {
  4355. color: #222;
  4356. line-height: 40rpx;
  4357. font-size: 36rpx;
  4358. text-align: center;
  4359. font-weight: bold;
  4360. margin-bottom: 24rpx;
  4361. }
  4362. .text {
  4363. height: 340rpx;
  4364. line-height: 40rpx;
  4365. text-indent: 2em;
  4366. font-size: 32rpx;
  4367. color: #222;
  4368. }
  4369. .had_read {
  4370. width: 100%;
  4371. height: 88rpx;
  4372. line-height: 88rpx;
  4373. text-align: center;
  4374. background: #3577e8;
  4375. border-radius: 240rpx;
  4376. font-size: 32rpx;
  4377. font-weight: 500;
  4378. color: #fff;
  4379. margin-top: 20rpx;
  4380. &.gray {
  4381. background: #bbbec5;
  4382. }
  4383. }
  4384. }
  4385. }
  4386. .full_mulu {
  4387. position: absolute;
  4388. top: 100rpx;
  4389. right: 20rpx;
  4390. width: 700rpx;
  4391. height: 515rpx;
  4392. color: #333;
  4393. display: flex;
  4394. align-items: center;
  4395. justify-content: space-between;
  4396. z-index: 99999;
  4397. .mulus {
  4398. width: 623rpx;
  4399. // height: 515rpx;
  4400. height: 400rpx;
  4401. overflow-y: scroll;
  4402. // overflow: scroll;
  4403. }
  4404. .mulu_box_in {
  4405. background-color: #b7b7b7;
  4406. border-radius: 16rpx;
  4407. // transition: all 0.5s;
  4408. &::after {
  4409. content: "";
  4410. width: 0;
  4411. height: 0;
  4412. position: absolute;
  4413. top: 235rpx;
  4414. right: 27px;
  4415. border-top: 16rpx solid transparent;
  4416. border-right: 16rpx solid transparent;
  4417. border-left: 16rpx solid #b7b7b7;
  4418. border-bottom: 16rpx solid transparent;
  4419. }
  4420. }
  4421. .mulu_box_out {
  4422. // visibility: hidden;
  4423. display: none;
  4424. }
  4425. .menuBox_mulu {
  4426. // width: 100%;
  4427. background: #ffffff;
  4428. border-radius: 16rpx;
  4429. padding: 0rpx 20rpx;
  4430. margin-bottom: 20rpx;
  4431. }
  4432. .ml_img {
  4433. position: absolute;
  4434. right: 0;
  4435. top: 100rpx;
  4436. }
  4437. .items {
  4438. width: 620rpx;
  4439. height: 100rpx;
  4440. border: 1rpx solid red;
  4441. }
  4442. }
  4443. </style>