detail.vue 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310
  1. <template>
  2. <view class="polyv_detail">
  3. <uni-nav-bar
  4. left-icon="back"
  5. :statusBar="true"
  6. fixed="true"
  7. :title="detail.courseName || '课程详情'"
  8. @clickLeft="clickLeft"
  9. ></uni-nav-bar>
  10. <view id="top">
  11. <view class="video_box" v-if="!startStatus">
  12. <image
  13. :src="$method.splitImgHost(goodsData.coverUrl)"
  14. mode="widthFix"
  15. style="width: 100%; height: 421rpx"
  16. ></image>
  17. </view>
  18. <view v-else>
  19. <my-player
  20. ref="player"
  21. :playVid="playVID"
  22. :autoplay="autoplay"
  23. :allowSeek="isAllowSeek"
  24. :playbackRate="playbackRate"
  25. :videoCurrentTime="recordObj.videoCurrentTime || 0"
  26. @playing="playing"
  27. @pause="pause"
  28. @ended="ended"
  29. @loadedmetadata="loadedmetadata"
  30. @timeupdate="timeupdate"
  31. @playerError="playerError"
  32. ></my-player>
  33. </view>
  34. <view class="course_name">
  35. <view class="course_titles">
  36. <view class="video_t1" :class="{ one: !goodsData.buyNote }">{{
  37. detail.courseName
  38. }}</view>
  39. <view class="notice_wrap" v-if="goodsData.buyNote">
  40. <view class="video_t1_t" @click="studyNotice"> 学员须知 </view>
  41. </view>
  42. <view
  43. class="toggle_course"
  44. v-if="goodsTeacher.length > 1"
  45. @click="changeCourses()"
  46. >
  47. <image
  48. class="img"
  49. src="/pages3/static/imgs/toggle.png"
  50. mode="widthFix"
  51. ></image>
  52. <view class="toggle_name">切换课程</view>
  53. <!-- courseTotal -->
  54. <view class="numbers">共{{ goodsTeacher.length }}门</view>
  55. </view>
  56. </view>
  57. </view>
  58. <u-line color="#D6D6DB" />
  59. <view>
  60. <view>
  61. <u-tabs
  62. :item-width="itemWidth()"
  63. :list="list"
  64. font-size="32"
  65. bar-width="24"
  66. :current="current"
  67. @change="change"
  68. active-color="#007AFF"
  69. ></u-tabs>
  70. </view>
  71. </view>
  72. <u-line color="#D6D6DB" />
  73. </view>
  74. <view class="box" :class="{ first_ml: current == 0 }">
  75. <scroll-view class="box_in" scroll-y="true">
  76. <!--目录 -->
  77. <view v-show="current == 0">
  78. <view
  79. class="top__header"
  80. v-if="livingItem"
  81. @click="goLive(livingItem)"
  82. >
  83. <image
  84. class="img"
  85. src="/pages3/static/imgs/live.png"
  86. mode="widthFix"
  87. ></image>
  88. <view class="note">正在直播中</view>
  89. <view class="title">{{ livingItem.sectionName }}</view>
  90. </view>
  91. <course-tree
  92. v-if="sectionItem.id || sectionItem.sectionId"
  93. :orderGoodsId="orderGoodsId"
  94. :sectionMaxNum="goodsData.sectionMaxNum"
  95. :courseId="courseId"
  96. :learningOrder="orderNum"
  97. :goodsId="goodsId"
  98. :gradeId="gradeId"
  99. :isRebuild="false"
  100. :isBuy="true"
  101. :goodsType="1"
  102. :menuAllList="menuAllList"
  103. :sectionItem="sectionItem"
  104. ></course-tree>
  105. </view>
  106. <!--讲义 -->
  107. <view v-show="current == 1">
  108. <handouts-box
  109. :handoutsId="goodsData.handoutsId"
  110. v-if="goodsData.handoutsId"
  111. ></handouts-box>
  112. </view>
  113. <!--笔记 -->
  114. <view v-if="current == 2">
  115. <note-Box
  116. :isPlayRebuild="sectionItem.rebuild"
  117. :refPlv="refPlv"
  118. @jumpNote="jumpNote"
  119. :params="params()"
  120. ></note-Box>
  121. </view>
  122. <!--答疑 -->
  123. <view v-show="current == 3">
  124. <answer-box
  125. :userId="userInfo ? userInfo.userId : 0"
  126. :params="params(['orderGoodsId', 'goodsId', 'courseId', 'gradeId'])"
  127. ></answer-box>
  128. </view>
  129. <!--目录 -->
  130. <view v-show="current == 4">
  131. <view
  132. class="menuBox"
  133. v-for="(item, index) in reMenuList"
  134. :key="index"
  135. >
  136. <!--模块 -->
  137. <view v-if="item.type == 1"
  138. ><courseModule
  139. :orderGoodsId="orderGoodsId"
  140. :sectionMaxNum="goodsData.sectionMaxNum"
  141. :courseId="courseId"
  142. :learningOrder="orderNum"
  143. :goodsId="goodsId"
  144. :gradeId="gradeId"
  145. :isRebuild="true"
  146. :isBuy="true"
  147. :menuItem="item"
  148. :levelId="item.menuId"
  149. :goodsType="1"
  150. :menuAllList="menuAllList"
  151. :sectionItem="sectionItem"
  152. ></courseModule
  153. ></view>
  154. <!--章 -->
  155. <view v-if="item.type == 2">
  156. <courseChapter
  157. :orderGoodsId="orderGoodsId"
  158. :courseId="courseId"
  159. :learningOrder="orderNum"
  160. :sectionMaxNum="goodsData.sectionMaxNum"
  161. @playEnd="sectionPlayEnd($event, index)"
  162. :gradeId="gradeId"
  163. :goodsId="goodsId"
  164. :isRebuild="true"
  165. :isBuy="true"
  166. :menuItem="item"
  167. :levelId="'0-' + item.menuId"
  168. :goodsType="1"
  169. :menuAllList="menuAllList"
  170. ></courseChapter>
  171. </view>
  172. <!--节 -->
  173. <view v-if="item.type == 3">
  174. <courseSection
  175. :orderGoodsId="orderGoodsId"
  176. :courseId="courseId"
  177. :learningOrder="orderNum"
  178. :sectionMaxNum="goodsData.sectionMaxNum"
  179. @playEnd="sectionPlayEnd($event, index)"
  180. :gradeId="gradeId"
  181. :goodsId="goodsId"
  182. :isRebuild="true"
  183. :isBuy="true"
  184. :nextMenuItem="findMenuNextSection(index)"
  185. :menuItem="item"
  186. :levelId="'0-0-' + item.menuId"
  187. :goodsType="1"
  188. :testType="3"
  189. :menuAllList="menuAllList"
  190. ></courseSection>
  191. </view>
  192. </view>
  193. </view>
  194. </scroll-view>
  195. </view>
  196. <!-- 播放前拍照end -->
  197. <u-popup
  198. v-model="showSet"
  199. :mask-close-able="false"
  200. mode="center"
  201. border-radius="24"
  202. >
  203. <view
  204. style="
  205. align-items: center;
  206. padding: 0 40rpx;
  207. display: flex;
  208. flex-direction: column;
  209. justify-content: center;
  210. "
  211. >
  212. <view
  213. style="
  214. font-weight: bold;
  215. color: #333333;
  216. font-size: 30rpx;
  217. margin-top: 30rpx;
  218. "
  219. >温馨提示</view
  220. >
  221. <view
  222. style="
  223. width: 457rpx;
  224. color: #666666;
  225. font-size: 30rpx;
  226. margin-top: 30rpx;
  227. "
  228. >学习过程中需要拍照验证学员身份, 拍照功能需要使用您的相机。
  229. 是否授权使用?</view
  230. >
  231. <view style="margin: 40rpx 0">
  232. <button
  233. open-type="openSetting"
  234. @bindopensetting="openSetting"
  235. class="btnSet"
  236. >
  237. 去授权
  238. </button>
  239. </view>
  240. </view>
  241. </u-popup>
  242. <u-popup
  243. v-model="photoPopup"
  244. mode="bottom"
  245. border-radius="40"
  246. :mask-close-able="false"
  247. >
  248. <!-- 播放前拍照start -->
  249. <!-- :mask-close-able="false" -->
  250. <!-- style="bottom: 0; position: fixed; width: 100%; z-index: 999" -->
  251. <view v-if="photoPopup">
  252. <view class="photoBox">
  253. <view class="photoTop">
  254. <view class="centersq">请正视手机屏幕</view>
  255. </view>
  256. <view class="photoCenter">
  257. <view class="center_camera" v-if="photoPopup && isTaking">
  258. <!-- #ifdef MP-WEIXIN -->
  259. <camera
  260. device-position="front"
  261. flash="off"
  262. @error="error"
  263. style="width: 100%; height: 100%"
  264. >
  265. <!-- 加人脸框 -->
  266. <cover-view class="head_take">
  267. <cover-view class="headTake_up color"></cover-view>
  268. <cover-view class="headTake_minddle">
  269. <cover-view class="min_left color"></cover-view>
  270. <cover-view class="min_img"></cover-view>
  271. <cover-view class="min_right color"></cover-view>
  272. </cover-view>
  273. <cover-view class="headTake_down color"></cover-view>
  274. </cover-view>
  275. </camera>
  276. <!-- #endif -->
  277. <!-- #ifdef H5 -->
  278. <video
  279. :controls="false"
  280. id="video"
  281. width="400"
  282. height="300"
  283. class="photo_v"
  284. ></video>
  285. <view class="mask"></view>
  286. <!-- #endif -->
  287. </view>
  288. <view class="custom" v-if="!isTaking">
  289. <!-- #ifdef MP-WEIXIN -->
  290. <image :src="avatarUrl" mode=""></image>
  291. <!-- #endif -->
  292. <!-- #ifdef H5 -->
  293. <image :src="faceUrl" mode=""></image>
  294. <!-- #endif -->
  295. </view>
  296. </view>
  297. <view class="btns">
  298. <!-- <view class="btnResult" v-if="isTaking" @click="takePhoto"
  299. >拍照</view
  300. > -->
  301. <view v-if="isTaking" class="takePhoto_btn">
  302. <view style="width: 100rpx; height: 2rpx"></view>
  303. <view class="middle_btn" @click="takePhoto">
  304. <view class="square"></view>
  305. </view>
  306. <view class="rights" @click="takePhTips()">
  307. <text>拍照提示</text>
  308. <u-icon name="arrow-right" color="#FFFFFF" size="30"></u-icon>
  309. </view>
  310. </view>
  311. <view class="btnResult" v-if="!isTaking" @click="reTake">重拍</view>
  312. <view class="btnResult" v-if="!isTaking" @click="submit">确认</view>
  313. </view>
  314. </view>
  315. </view>
  316. </u-popup>
  317. <u-popup
  318. v-model="noticeShow"
  319. class="notice_modal"
  320. mode="center"
  321. border-radius="28"
  322. width="650rpx"
  323. height="622rpx"
  324. :mask-close-able="false"
  325. @close="closeNotice"
  326. >
  327. <view class="content">
  328. <view class="title">学员须知</view>
  329. <scroll-view scroll-y="true">
  330. <view
  331. class="text"
  332. v-html="
  333. goodsData.buyNote && goodsData.buyNote.replace(/\n|\r\n/g, '<br>')
  334. "
  335. >
  336. </view>
  337. </scroll-view>
  338. <view
  339. class="had_read"
  340. :class="{ gray: CountTo >= 0 }"
  341. @click="noticeConfirm()"
  342. >
  343. <text v-if="CountTo >= 0">请阅读学员须知,30s后可关闭</text>
  344. <text v-else>我已阅读学员须知</text>
  345. <text v-if="CountTo >= 0">{{ " " + CountTo + "s" }}</text>
  346. </view>
  347. </view>
  348. </u-popup>
  349. <!-- 倒计时提交 -->
  350. <u-popup
  351. v-model="noticeShow1"
  352. class="notice_modal"
  353. mode="center"
  354. border-radius="28"
  355. width="650rpx"
  356. height="262rpx"
  357. :mask-close-able="false"
  358. >
  359. <view class="content">
  360. <view class="title">提示</view>
  361. <view class="had_read">
  362. <text v-if="CountTo1 >= 0">视频学习时长不达标,请等待</text>
  363. <text v-if="CountTo1 >= 0">{{ " " + CountTo1 + "s" }}</text>
  364. </view>
  365. </view>
  366. </u-popup>
  367. <u-modal
  368. v-model="showMark"
  369. title="提示"
  370. @confirm="markConfirm"
  371. @cancel="toBack"
  372. confirm-text="复制学习网址"
  373. :show-cancel-button="true"
  374. cancel-text="关闭"
  375. >
  376. <view class="slot-content">
  377. <view>您的学习账号已经开通,请按照步骤操作,进行学习。</view>
  378. <view>1.复制学习地址:{{ markContent }}</view>
  379. <view>2.在【浏览器中】打开复制的学习网址</view>
  380. <view>3.打开学习网址后,选择【个人用户】进行登录</view>
  381. <view>(1)账号:您个人的身份证号码</view>
  382. <view>(2)密码:身份证号码,再加111111</view>
  383. </view>
  384. </u-modal>
  385. <!-- 切换课程弹窗 -->
  386. <u-popup
  387. v-model="toggleCourseShow"
  388. mode="bottom"
  389. border-radius="40"
  390. :mask-close-able="false"
  391. >
  392. <view class="popup_box">
  393. <view class="check_head">
  394. <view class="headers">
  395. <view class="grade">切换课程</view>
  396. <u-icon
  397. name="close"
  398. color="#9C9C9C"
  399. size="40"
  400. @click="closePop()"
  401. ></u-icon>
  402. </view>
  403. <view class="coruse_num">共{{ goodsTeacher.length }}门</view>
  404. <view class="menuSel">
  405. <scroll-view class="sub_sliper" scroll-x="true">
  406. <view
  407. v-for="(item, index) in subList"
  408. :key="index"
  409. style="margin-right: 50rpx; display: inline-block"
  410. >
  411. <view
  412. class="r_t1"
  413. :class="{ nactive: subIndex == index }"
  414. @click="cMenu(item, index)"
  415. >
  416. {{ item.subjectName }}
  417. </view>
  418. </view>
  419. </scroll-view>
  420. </view>
  421. </view>
  422. <view class="check_con">
  423. <scroll-view scroll-y="true" style="height: 700rpx">
  424. <view v-for="(courseItem, gTindex) in goodsTeacher" :key="gTindex">
  425. <view
  426. v-for="(item, index) in courseItem.courseList"
  427. :key="index"
  428. v-show="
  429. item.subjectId === newActiveSubjectId || !newActiveSubjectId
  430. "
  431. >
  432. <view class="course_items" v-if="item.show && item.show == 1">
  433. <view class="course_lefts">
  434. <view class="course_title">
  435. {{ item.courseName }}
  436. </view>
  437. <view
  438. v-if="courseItem.teaList && courseItem.teaList.length > 0"
  439. class="teacher_names"
  440. >
  441. <view
  442. v-for="(tea, tindex) in courseItem.teaList"
  443. :key="tindex"
  444. class="names"
  445. >{{ tea.aliasName }}</view
  446. >
  447. </view>
  448. <view class="course_pros">
  449. 学习进度
  450. <text>
  451. {{ item.stuAllNum + item.recordNum }}/{{
  452. item.secAllNum + item.examNum
  453. }}</text
  454. >
  455. </view>
  456. </view>
  457. <view
  458. class="course_rights"
  459. @click="jump(item, gTindex, 'jump')"
  460. >
  461. <view class="cicles">
  462. <u-icon
  463. name="arrow-right"
  464. color="#498AFE"
  465. size="20"
  466. ></u-icon>
  467. </view>
  468. <view class="intoStudy">进入学习</view>
  469. </view>
  470. </view>
  471. </view>
  472. </view>
  473. </scroll-view>
  474. </view>
  475. </view>
  476. </u-popup>
  477. <!-- 拍照提示 -->
  478. <popup-photo
  479. :popupPhotoShow.sync="popupPhotoShow"
  480. @takePhoto="toTakePhoto()"
  481. ></popup-photo>
  482. </view>
  483. </template>
  484. <script>
  485. import plv from "../static/polyv-sdk/index";
  486. import courseModule from "@/components/course/courseModule.vue";
  487. import courseChapter from "@/components/course/courseChapter.vue";
  488. import courseSection from "@/components/course/courseSection.vue";
  489. import handoutsBox from "@/components/course/handoutsBox.vue";
  490. import courseTree from "@/components/course/courseTree.vue";
  491. import PopupPhoto from "@/components/popup/index.vue";
  492. import myCompressImage from "@/common/compressPhoto.js";
  493. import myPlayer from "@/components/myPlayer/polyvPlayer.vue";
  494. import noteBox from "@/components/course/noteBox.vue";
  495. import answerBox from "@/components/course/answerBox.vue";
  496. import { mapGetters, mapMutations } from "vuex";
  497. import { lockAction } from "../../utils/lock";
  498. export default {
  499. components: {
  500. courseModule,
  501. courseChapter,
  502. courseSection,
  503. PopupPhoto,
  504. handoutsBox,
  505. myPlayer,
  506. noteBox,
  507. answerBox,
  508. courseTree,
  509. },
  510. data() {
  511. return {
  512. markContent: "http://admin.zhujianpeixun.com/",
  513. showMark: false,
  514. hasStart: false,
  515. channelItem: null,
  516. lockTimer: null,
  517. orderGoodsId: 0,
  518. noticeShow: false,
  519. enableAutoRotation: true,
  520. seekTime: "",
  521. toastTimer: null,
  522. videoToastShow: false,
  523. showSet: false,
  524. startStatus: false,
  525. courseId: 0,
  526. menuList: [],
  527. current: 0,
  528. vid: "",
  529. goodsId: 0,
  530. goodsData: {},
  531. photoPopup: true,
  532. goodsPlayConfig: null,
  533. autoplay: false,
  534. isAllowSeek: "no",
  535. playbackRate: [1.0],
  536. timer: null,
  537. goodsPhotographConfig: null,
  538. intervalTimeList: [], // 间隔拍照时长
  539. intervalTimeIndex: 0, //当前处于哪个时间段拍照
  540. playTime: 0, //页面播放时长,不含暂停
  541. currentTime: 0,
  542. avatarUrl: "",
  543. ossAvatarUrl: "",
  544. studyDuration: 0, // 当前视频时长
  545. gradeId: 0,
  546. chapterId: 0,
  547. moduleId: 0,
  548. reMenuList: [],
  549. recordObj: {},
  550. isTaking: true, //是否正在拍照
  551. needSeek: false, //第一次播放是否需要跳转
  552. photoNum: 0,
  553. photoList: [], //拍照的时间点
  554. photoConfig: false, //是否配置好拍照次数
  555. photoIndex: 0, //当前位于拍照的区间下标 从0开始
  556. photoHistoryList: [], //已拍照历史的下标点
  557. sectionItem: {},
  558. showNotes: true,
  559. uploadLock: false, //上传图片
  560. isPlayRebuild: false, //是否正在播放重修视频needOpen
  561. isRebuild: false, //视频是否从重修目录点击
  562. clearTimer: null,
  563. livingItem: "",
  564. option: null,
  565. toggleCourseShow: false, // 切换课程弹窗
  566. courseList: [], // 课程列表
  567. subList: [],
  568. subIndex: 0,
  569. goodsTeacher: [],
  570. teacherList: [],
  571. teacherIndex: 0,
  572. newActiveSubjectId: "", //当前选中ID
  573. compareFaceData: 0, // 拍照匹配相似度
  574. prendreAutoCarme: false, // 是否发起授权相机
  575. studyTimer: null, // 学习记录定时器
  576. CountTo: 30, // 倒计时
  577. CountTo1: 0,
  578. handoutTipLength: 0,
  579. menuAllList: [],
  580. popupPhotoShow: false,
  581. curPlayIndex: 0, // 正在播放的节的下标
  582. faceUrl: "",
  583. erJianErZao: false,
  584. pauseTime: 0,
  585. pauseTimer: null,
  586. barTimer: null,
  587. isReach: false,
  588. noticeShow1: false,
  589. refPlv: null,
  590. };
  591. },
  592. computed: {
  593. ...mapGetters([
  594. "userInfo",
  595. "playSectionId",
  596. "playChannelId",
  597. "playVID",
  598. "config",
  599. ]),
  600. playSecIsLearn() {
  601. return this.sectionItem.learning != 1;
  602. },
  603. orderNum() {
  604. return 0;
  605. return this.goodsData.goodsLearningOrder;
  606. },
  607. list() {
  608. let list = [
  609. {
  610. name: "目录",
  611. },
  612. {
  613. name: "讲义",
  614. },
  615. {
  616. name: "笔记",
  617. },
  618. {
  619. name: "答疑",
  620. },
  621. ];
  622. if (this.reMenuList.length > 0) {
  623. list.push({ name: "重修目录" });
  624. }
  625. return list;
  626. },
  627. params: function () {
  628. return (keys = ["orderGoodsId", "goodsId", "courseId"]) => {
  629. let params = {};
  630. for (const key of keys) {
  631. params[key] = this[key];
  632. }
  633. return params;
  634. };
  635. },
  636. detail() {
  637. if (!this.courseId || !this.courseList.length) {
  638. return {};
  639. }
  640. return this.courseList.find((e) => e.courseId == this.courseId);
  641. },
  642. },
  643. watch: {
  644. showSet(n) {
  645. if (n) {
  646. if (polyvPlayerContext) {
  647. // #ifdef MP-WEIXIN
  648. polyvPlayerContext.pause();
  649. // #endif
  650. // #ifdef H5
  651. polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
  652. // #endif
  653. }
  654. }
  655. },
  656. photoPopup(n) {
  657. if (n) {
  658. if (this.prendreAutoCarme) {
  659. this.photoPopup = false;
  660. }
  661. this.showSet && (this.photoPopup = false);
  662. }
  663. },
  664. },
  665. async onLoad(option) {
  666. console.log(
  667. "🚀 ~ file: detail.vue:747 ~ onLoad ~ option:",
  668. option,
  669. this.$refs.player
  670. );
  671. if (option.isOther) {
  672. this.showMark = true;
  673. return;
  674. }
  675. this.option = option;
  676. let { skipPort, id, goodsId, orderGoodsId, gradeId, informId } = option;
  677. if (skipPort) {
  678. await this.$method.skipLogin(skipPort);
  679. }
  680. if (this.$method.isGoLogin()) {
  681. return;
  682. }
  683. this.courseId = Number(id) || "";
  684. this.goodsId = Number(goodsId);
  685. this.orderGoodsId = Number(orderGoodsId) || "";
  686. this.gradeId = gradeId;
  687. await this.isCanLearn();
  688. !this.userInfo && this.$api.refreshUserInfo();
  689. // 公众号模板消息的数据埋点
  690. informId && this.clickOfficial(informId);
  691. this.init();
  692. this.courseCourseList();
  693. },
  694. async onShow() {
  695. // this.closePhoto();
  696. },
  697. onUnload() {
  698. console.log("onUnloadonUnloadonUnloadonUnload");
  699. this.originUnload();
  700. this.clears();
  701. clearInterval(this.lockTimer);
  702. },
  703. onHide() {
  704. this.originUnload();
  705. },
  706. mounted() {},
  707. methods: {
  708. ...mapMutations(["updateChapterOpen", "updateLiveLast"]),
  709. init() {
  710. // #ifdef MP-WEIXIN
  711. this.getCameraSetting();
  712. this.isAllowSeek = "no";
  713. // #endif
  714. // #ifdef H5
  715. this.isAllowSeek = "on";
  716. // #endif
  717. // 锁
  718. lockAction();
  719. this.lockTimer = setInterval(lockAction, 10000);
  720. },
  721. // 新增微信公众号模板消息点击数据
  722. clickOfficial(informId) {
  723. this.$http({
  724. url: "/data/click",
  725. method: "post",
  726. data: { informId },
  727. });
  728. },
  729. // 点击课程目录
  730. cMenu(item, index) {
  731. this.subIndex = index;
  732. this.newActiveSubjectId = item.subjectId;
  733. },
  734. courseCourseList() {
  735. this.courseList = [];
  736. this.menuList = [];
  737. this.photoConfig = false;
  738. this.$api
  739. .courseCourseList({
  740. pageNum: 1,
  741. pageSize: 200,
  742. goodsId: this.goodsId,
  743. gradeId: this.gradeId,
  744. orderGoodsId: this.orderGoodsId,
  745. })
  746. .then((res) => {
  747. if (res.data.code == 200) {
  748. this.courseList = res.data.rows;
  749. // 科目
  750. let allItem = [{ subjectId: 0, subjectName: "所有" }];
  751. let ids = [];
  752. const newArr = [];
  753. this.courseList.forEach((item) => {
  754. if (ids.indexOf(item.subjectId) == -1) {
  755. ids.push(item.subjectId);
  756. newArr.push(item);
  757. }
  758. });
  759. this.subList = [...allItem, ...newArr];
  760. if (res.data.total > 1) {
  761. this.getUserWatchLast();
  762. } else {
  763. this.originOnShow();
  764. this.originMounted();
  765. }
  766. }
  767. });
  768. },
  769. // 查询用户最后一次看的录播的信息
  770. getUserWatchLast() {
  771. this.$http({
  772. url: "/study/record/getUserWatchLast",
  773. method: "get",
  774. data: {
  775. orderGoodsId: this.orderGoodsId,
  776. },
  777. }).then((res) => {
  778. console.log("🚀 ~ file: detail.vue:859 ~ getUserWatchLast ~ res:", res);
  779. if (res.data.code == 200 && res.data.data) {
  780. this.courseId = res.data.data.courseId;
  781. }
  782. if (!this.courseId) {
  783. this.courseId = this.courseList[0].courseId;
  784. }
  785. this.originOnShow();
  786. this.originMounted();
  787. //获取商品双师资模板
  788. this.getCourseTeacher(this.courseList);
  789. });
  790. },
  791. getCourseTeacher(rows) {
  792. this.goodsTeacher = [];
  793. //获取商品双师资模板
  794. this.$api
  795. .courseTeacherList({
  796. goodsId: this.goodsId,
  797. })
  798. .then((res1) => {
  799. if (res1.data.data && res1.data.data.length > 0) {
  800. //课程老师模板
  801. let teacherTel = res1.data.data;
  802. //商品课程
  803. let courses = rows;
  804. teacherTel.forEach((tea) => {
  805. let dataList = [];
  806. let teacherList = [];
  807. courses.forEach((item) => {
  808. let data = tea.courseList.filter(
  809. (x) => x.courseId == item.courseId
  810. );
  811. if (data && data.length > 0) {
  812. dataList.push(item);
  813. teacherList = tea.courseList;
  814. }
  815. });
  816. let result = {
  817. teaList: teacherList,
  818. courseList: dataList,
  819. };
  820. this.goodsTeacher.push(result);
  821. });
  822. if (this.goodsTeacher && this.goodsTeacher.length > 0) {
  823. let courseIds = [];
  824. this.goodsTeacher.forEach((item) => {
  825. item.courseList.forEach((course) => {
  826. courseIds.push(course.courseId);
  827. });
  828. });
  829. if (courseIds.length > 0) {
  830. courses.forEach((item) => {
  831. if (!courseIds.includes(item.courseId)) {
  832. let data = {
  833. teaList: [],
  834. courseList: [],
  835. };
  836. data.courseList.push(item);
  837. this.goodsTeacher.push(data);
  838. }
  839. });
  840. }
  841. this.goodsTeacher.forEach((item) => {
  842. if (item.courseList && item.courseList.length > 0) {
  843. item.courseList[0].show = 1;
  844. }
  845. });
  846. }
  847. } else {
  848. //没有双师资模板
  849. rows.forEach((item) => {
  850. item.show = 1;
  851. let data = {
  852. teaList: [],
  853. courseList: [],
  854. };
  855. data.courseList.push(item);
  856. this.goodsTeacher.push(data);
  857. });
  858. }
  859. this.goodsTeacher.forEach((item) => {
  860. if (item.courseList.some((x) => x.courseId == this.courseId)) {
  861. this.teacherList = item.teaList;
  862. }
  863. });
  864. });
  865. },
  866. erJianErZaoPauseTip() {
  867. if (this.playSecIsLearn && this.erJianErZao) {
  868. if (this.pauseTimer) {
  869. return;
  870. }
  871. this.pauseTime = Date.now();
  872. console.log("开启定时器");
  873. this.pauseTimer = setInterval(() => {
  874. console.log("暂停时间", Date.now() - this.pauseTime, this.pauseTime);
  875. if (Date.now() - this.pauseTime > 5 * 60 * 1000) {
  876. // 5 * 60 * 1000
  877. let text = this.photoPopup ? "拍照停留" : "暂停";
  878. this.photoPopup = false;
  879. uni.showModal({
  880. title: "提示",
  881. showCancel: false,
  882. content: `检测${text}时间过长,刷新当前页面`,
  883. cancelText: "取消",
  884. confirmText: "确定",
  885. success: (res) => {
  886. if (res.confirm) {
  887. // #ifdef H5
  888. location.reload();
  889. // #endif
  890. // #ifdef MP-WEIXIN
  891. this.courseCourseList();
  892. // #endif
  893. }
  894. },
  895. });
  896. this.clearPauseTimer();
  897. }
  898. }, 5000);
  899. }
  900. },
  901. // 原来onshow里面的内容
  902. async originOnShow() {
  903. this.getReMenuList();
  904. await this.studyRecordMenuAllList();
  905. // 消息过来 定位某个节
  906. if (this.option.noteSecond) {
  907. this.jumpNote({
  908. sectionType: 1,
  909. ...this.option,
  910. });
  911. return;
  912. }
  913. this.studyRecordQueryLiveLast();
  914. },
  915. // 原来的mouted内容
  916. originMounted() {
  917. uni.$on("changeSection", (oldSectionId) => {
  918. console.log(
  919. "切换课程-originMounted->playVID:",
  920. this.playVID,
  921. oldSectionId
  922. );
  923. this.studyTimer && clearInterval(this.studyTimer); // 清除定时器
  924. this.clearPauseTimer();
  925. this.hasStart = false;
  926. this.photoConfig = false;
  927. this.photoIndex = 0;
  928. //清除直播
  929. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  930. if (!this.refPlv) {
  931. this.refPlv = this.$refs.player;
  932. }
  933. this.postStudyRecord(0, oldSectionId);
  934. });
  935. uni.$on("getSection", (item) => {
  936. //清除直播
  937. this.studyTimer && clearInterval(this.studyTimer);
  938. this.hasStart = false;
  939. this.isPlayRebuild = item.rebuild;
  940. this.photoConfig = false;
  941. this.photoIndex = 0;
  942. this.sectionItem = item;
  943. this.moduleId = item.moduleId || null;
  944. this.chapterId = item.chapterId || null;
  945. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  946. //获取拍照历史
  947. this.getPhotoLastRecord();
  948. this.playVideo(item);
  949. });
  950. uni.$on("levelId", (item) => {
  951. let arr = item.split("-");
  952. //点击节获取的各层级ID
  953. this.moduleId = arr[0];
  954. this.chapterId = arr[1];
  955. });
  956. uni.$on("getChannel", (item) => {
  957. //清除录播
  958. this.studyTimer && clearInterval(this.studyTimer);
  959. this.hasStart = false;
  960. this.$store.commit("setPlayVID", { playVID: null });
  961. this.moduleId = item.moduleId;
  962. this.chapterId = item.chapterId;
  963. this.$store.commit("setPlaySectionId", {
  964. playSectionId: item.sectionId || item.menuId,
  965. });
  966. this.getPhotoLastRecord();
  967. this.playChannel(item);
  968. this.channelItem = item;
  969. });
  970. uni.$on("isRebuild", (item) => {
  971. this.isRebuild = item;
  972. });
  973. this.updateChapterOpen(true);
  974. },
  975. clearPauseTimer() {
  976. if (this.pauseTimer) {
  977. this.pauseTime = 0;
  978. clearInterval(this.pauseTimer);
  979. this.pauseTimer = null;
  980. }
  981. },
  982. clearBarTimer() {
  983. if (this.barTimer) {
  984. clearInterval(this.barTimer);
  985. this.barTimer = null;
  986. }
  987. },
  988. // 原来onUnload里面的内容
  989. originUnload() {
  990. if (this.playSectionId > 0 && this.hasStart) {
  991. //退出提交记录
  992. this.postStudyRecord();
  993. }
  994. //清除正在播放的节ID
  995. // this.$store.commit('setPlayObj',null)
  996. this.$store.commit("setPlaySectionId", { playSectionId: 0 });
  997. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  998. this.$store.commit("setPlayVID", { playVID: null });
  999. this.closePlv();
  1000. //移除所有的事件监听器
  1001. uni.$off();
  1002. this.clearTimer && clearTimeout(this.clearTimer);
  1003. this.toastTimer && clearTimeout(this.toastTimer);
  1004. if (this.studyTimer) {
  1005. clearInterval(this.studyTimer);
  1006. this.hasStart = false;
  1007. }
  1008. this.clearPauseTimer();
  1009. this.clearBarTimer();
  1010. if (this.lockTimer) {
  1011. clearInterval(this.lockTimer);
  1012. this.$api
  1013. .lockDelLock({
  1014. action: "jxjy",
  1015. uuid: this.$method.getUuid(),
  1016. })
  1017. .then((res) => {
  1018. uni.hideLoading();
  1019. });
  1020. }
  1021. },
  1022. changeCourses() {
  1023. this.toggleCourseShow = true;
  1024. },
  1025. closePop() {
  1026. this.toggleCourseShow = false;
  1027. },
  1028. async activeFunc(item, index) {
  1029. this.teacherIndex = index;
  1030. let findResult = "";
  1031. this.goodsTeacher.forEach((citem, index) => {
  1032. citem.courseList.forEach((e, e_index) => {
  1033. if (e.courseId == item.courseId) {
  1034. findResult = e;
  1035. }
  1036. });
  1037. });
  1038. this.jump(findResult, 1);
  1039. },
  1040. // 进入学习
  1041. async jump(item, index, type) {
  1042. if (this.courseId === item.courseId) {
  1043. this.toggleCourseShow = false;
  1044. return;
  1045. }
  1046. if (this.orderNum == 2 && index != 0) {
  1047. let prevItem = this.courseList[index - 1];
  1048. if (
  1049. prevItem.stuAllNum + prevItem.recordNum <
  1050. prevItem.secAllNum + prevItem.examNum
  1051. ) {
  1052. uni.showToast({
  1053. icon: "none",
  1054. title: "请按顺序学完上一课再学习这一课",
  1055. });
  1056. return;
  1057. }
  1058. }
  1059. // 打回 需重修
  1060. if (item.rebuild === 0) {
  1061. this.$navTo.togo("/pages2/learn/details", {
  1062. id: item.courseId,
  1063. gradeId: item.gradeId,
  1064. goodsId: this.goodsId,
  1065. orderGoodsId: this.orderGoodsId,
  1066. });
  1067. return;
  1068. }
  1069. if (type) {
  1070. this.teacherIndex = 0;
  1071. this.goodsTeacher.forEach((citem) => {
  1072. if (citem.courseList.some((x) => x.courseId == item.courseId)) {
  1073. this.teacherList = citem.teaList;
  1074. }
  1075. });
  1076. }
  1077. this.sectionItem = {};
  1078. this.toggleCourseShow = false;
  1079. this.courseId = item.courseId;
  1080. this.originOnShow();
  1081. },
  1082. async nextCourses(item, type) {
  1083. this.vid = "";
  1084. this.hasStart = true;
  1085. await this.originUnload();
  1086. this.courseId = item.courseId;
  1087. this.gradeId = item.gradeId;
  1088. this.toggleCourseShow = false;
  1089. },
  1090. clickLeft() {
  1091. // uni.navigateBack()
  1092. uni.switchTab({
  1093. url: "/pages/learn/index",
  1094. });
  1095. },
  1096. toBack(delta = 1) {
  1097. uni.navigateBack({
  1098. delta,
  1099. });
  1100. },
  1101. markConfirm() {
  1102. uni.setClipboardData({
  1103. data: this.markContent,
  1104. success: () => {
  1105. setTimeout(this.toBack, 1000);
  1106. },
  1107. });
  1108. },
  1109. closeNotice() {
  1110. this.$api
  1111. .baseHandoutTip({
  1112. orderGoodsId: this.orderGoodsId,
  1113. })
  1114. .then((res) => {});
  1115. },
  1116. noticeConfirm() {
  1117. if (this.CountTo < 0) {
  1118. this.noticeShow = false;
  1119. if (this.handoutTipLength == 0 && this.goodsPlayConfig.autoPlay > 0) {
  1120. this.autoplay = true;
  1121. this.refPlv.resumeVideo();
  1122. }
  1123. }
  1124. },
  1125. baseHandoutTipList() {
  1126. this.$api
  1127. .baseHandoutTipList({
  1128. orderGoodsId: this.orderGoodsId,
  1129. })
  1130. .then((res) => {
  1131. this.handoutTipLength = res.data.rows.length;
  1132. if (res.data.rows.length == 0) {
  1133. this.noticeShow = true;
  1134. if (this.CountTo == 30) {
  1135. var timer = setInterval(() => {
  1136. this.CountTo--;
  1137. if (this.CountTo < 0) {
  1138. clearInterval(timer);
  1139. }
  1140. }, 1000);
  1141. }
  1142. } else {
  1143. this.CountTo = -1;
  1144. }
  1145. });
  1146. },
  1147. /**
  1148. * 获取上次观看的直播
  1149. */
  1150. studyRecordGetLastLive() {
  1151. this.$api
  1152. .studyRecordGetLastLive({
  1153. orderGoodsId: this.orderGoodsId,
  1154. courseId: this.courseId,
  1155. })
  1156. .then((res) => {
  1157. this.updateLiveLast(res.data.data);
  1158. });
  1159. },
  1160. async initPlayVideo(sectionItem) {
  1161. this.moduleId = sectionItem.moduleId;
  1162. this.chapterId = sectionItem.chapterId;
  1163. if (sectionItem.sectionType == 1) {
  1164. //录播
  1165. await this.getPhotoLastRecord(); // 获取拍照历史
  1166. this.playVideo(sectionItem);
  1167. } else if (sectionItem.sectionType == 2) {
  1168. //直播
  1169. this.studyRecordGetLastLive();
  1170. } else if (sectionItem.sectionType == 3) {
  1171. //回放
  1172. this.playVideo(sectionItem);
  1173. } else if (sectionItem.doType == 2) {
  1174. uni.showModal({
  1175. title: "温馨提示",
  1176. content: "当前节视频已学完,是否进入考试?",
  1177. success: (res) => {
  1178. if (res.confirm) {
  1179. this.toQuestionBank(sectionItem);
  1180. }
  1181. },
  1182. });
  1183. return;
  1184. }
  1185. },
  1186. toQuestionBank(sectionItem) {
  1187. uni.navigateTo({
  1188. url:
  1189. "/pages2/class/questionBank?courseId=" +
  1190. this.courseId +
  1191. "&gradeId=" +
  1192. this.gradeId +
  1193. "&isFromVideo=1&id=" +
  1194. sectionItem.id +
  1195. "&goodsid=" +
  1196. this.goodsId +
  1197. "&moduleId=" +
  1198. (sectionItem.moduleId || 0) +
  1199. "&chapterId=" +
  1200. (sectionItem.chapterId || 0) +
  1201. "&orderGoodsId=" +
  1202. this.orderGoodsId +
  1203. "&type=" +
  1204. (sectionItem.type == 4 ? 1 : 3) +
  1205. "&learning=" +
  1206. sectionItem.studyStatus +
  1207. "&isBackVideo=" +
  1208. 1,
  1209. });
  1210. },
  1211. studyRecordQueryLiveLast() {
  1212. // /study/record/queryLiveLast
  1213. this.$api
  1214. .studyRecordQueryLiveLast({
  1215. gradeId: this.gradeId,
  1216. orderGoodsId: this.orderGoodsId,
  1217. courseId: this.courseId,
  1218. })
  1219. .then((res) => {
  1220. let { data } = res.data;
  1221. if (!data.sectionId) {
  1222. data = this.menuAllList[0];
  1223. } else {
  1224. // if (data.learning == 1 && this.orderNum == 2) {
  1225. // let next = this.menuAllList.find((e) => e.studyStatus != 1);
  1226. // next && (data = next);
  1227. // }
  1228. }
  1229. this.initPlayVideo(data);
  1230. });
  1231. },
  1232. /**
  1233. * 模块大节播放完毕,刷新列表
  1234. */
  1235. sectionPlayEnd(isRebuild, index) {
  1236. if (this.reMenuList.length > 0) {
  1237. //有重修目录
  1238. if (isRebuild.isRebuild) {
  1239. //从重修点击
  1240. this.$api
  1241. .reMenuList({
  1242. orderGoodsId: this.orderGoodsId,
  1243. courseId: this.courseId,
  1244. rebuild: 1,
  1245. gradeId: this.gradeId,
  1246. })
  1247. .then((res) => {
  1248. if (res.data.code == 200) {
  1249. if (res.data.rows.length) {
  1250. res.data.rows[index].name = res.data.rows[index].menuName;
  1251. this.$set(this.reMenuList, index, res.data.rows[index]);
  1252. for (let i = 0; i < res.data.rows.length; i++) {
  1253. let item = res.data.rows[i];
  1254. item.down = true;
  1255. item.id = item.menuId;
  1256. item.name = item.menuName;
  1257. }
  1258. this.reMenuList = [];
  1259. this.$nextTick(() => {
  1260. this.reMenuList = res.data.rows;
  1261. // console.log(this.reMenuList,'this.reMenuList1')
  1262. });
  1263. } else {
  1264. this.reMenuList = [];
  1265. }
  1266. }
  1267. });
  1268. this.$api
  1269. .reMenuList({
  1270. courseId: this.courseId,
  1271. gradeId: this.gradeId,
  1272. orderGoodsId: this.orderGoodsId,
  1273. })
  1274. .then((res) => {
  1275. if (res.data.code == 200) {
  1276. for (let i = 0; i < res.data.rows.length; i++) {
  1277. let item = res.data.rows[i];
  1278. item.down = true;
  1279. item.id = item.menuId;
  1280. item.name = item.menuName;
  1281. item.menuType = item.type;
  1282. }
  1283. this.menuList = [];
  1284. this.$nextTick(() => {
  1285. this.menuList = res.data.rows;
  1286. });
  1287. }
  1288. });
  1289. } else {
  1290. //从普通目录点击
  1291. this.$api
  1292. .reMenuList({
  1293. courseId: this.courseId,
  1294. gradeId: this.gradeId,
  1295. orderGoodsId: this.orderGoodsId,
  1296. })
  1297. .then((res) => {
  1298. if (res.data.code == 200) {
  1299. res.data.rows[index].name = res.data.rows[index].menuName;
  1300. res.data.rows[index].id = res.data.rows[index].menuId;
  1301. this.$set(this.menuList, index, res.data.rows[index]);
  1302. }
  1303. });
  1304. this.$api
  1305. .reMenuList({
  1306. orderGoodsId: this.orderGoodsId,
  1307. courseId: this.courseId,
  1308. rebuild: 1,
  1309. gradeId: this.gradeId,
  1310. })
  1311. .then((res) => {
  1312. if (res.data.code == 200) {
  1313. if (res.data.rows.length) {
  1314. // for (let i = 0; i < res.data.rows.length; i++) {
  1315. // let item = res.data.rows[i];
  1316. // item.down = true;
  1317. // item.id = item.menuId;
  1318. // item.name = item.menuName;
  1319. // }
  1320. // this.reMenuList = res.data.rows;
  1321. } else {
  1322. this.reMenuList = [];
  1323. }
  1324. }
  1325. });
  1326. }
  1327. } else {
  1328. console.log("--模块大节播放完毕,刷新列表-");
  1329. //没有重修目录
  1330. this.$api
  1331. .reMenuList({
  1332. courseId: this.courseId,
  1333. gradeId: this.gradeId,
  1334. orderGoodsId: this.orderGoodsId,
  1335. })
  1336. .then((res) => {
  1337. if (res.data.code == 200) {
  1338. res.data.rows[index].name = res.data.rows[index].menuName;
  1339. res.data.rows[index].id = res.data.rows[index].menuId;
  1340. this.$set(this.menuList, index, res.data.rows[index]);
  1341. }
  1342. });
  1343. }
  1344. },
  1345. goLive(item) {
  1346. let moduleId = item.moduleId || 0;
  1347. let chapterId = item.chapterId || 0;
  1348. let sectionId = item.sectionId || item.menuId;
  1349. let uuid = new Date().valueOf() + "";
  1350. // buyCourse 是否购买课程:1是 0否
  1351. let encode = encodeURIComponent(
  1352. this.config.hostLive +
  1353. "/pages/live/index?token=" +
  1354. uni.getStorageSync("token") +
  1355. "&userInfo=" +
  1356. JSON.stringify(this.userInfo) +
  1357. "&channelId=" +
  1358. item.liveUrl +
  1359. "&gradeId=" +
  1360. this.gradeId +
  1361. "&courseId=" +
  1362. this.courseId +
  1363. "&goodsId=" +
  1364. this.goodsId +
  1365. "&orderGoodsId=" +
  1366. this.orderGoodsId +
  1367. "&sectionId=" +
  1368. sectionId +
  1369. "&chapterId=" +
  1370. chapterId +
  1371. "&moduleId=" +
  1372. moduleId +
  1373. "&buyCourse=1" +
  1374. "&ident=" +
  1375. uuid
  1376. );
  1377. uni.navigateTo({
  1378. url: `../../pages/webview/index?url=` + encode,
  1379. });
  1380. },
  1381. studyRecordMenuAllList() {
  1382. // study/record/menuAllList
  1383. return this.$api
  1384. .studMenuAllList({
  1385. courseId: this.courseId,
  1386. gradeId: this.gradeId,
  1387. goodsId: this.goodsId,
  1388. })
  1389. .then((res) => {
  1390. let nowTime = Number(new Date().getTime() / 1000).toFixed(0);
  1391. if (res.data.data) {
  1392. this.menuAllList = res.data.data.filter(
  1393. (e) => e.doType != 1 || (e.doType == 2 && e.studyStatus == 1)
  1394. );
  1395. this.livingItem = res.data.data.find(
  1396. (item) =>
  1397. item.liveStartTime <= nowTime && item.liveEndTime > nowTime
  1398. );
  1399. }
  1400. return Promise.resolve();
  1401. });
  1402. },
  1403. async getbaseprofiletplists() {
  1404. let {
  1405. data: { code, rows },
  1406. } = await this.$api.getbaseprofiletplists({
  1407. goodsId: this.goodsId,
  1408. orderGoodsId: this.orderGoodsId,
  1409. });
  1410. if (code === 200 && rows.length && rows[0].keyValue) {
  1411. let baseRes = await this.$api.getbaseprofiletpId(this.goodsId);
  1412. if (baseRes.data.code === 200 && baseRes.data.data) {
  1413. let {
  1414. data: { code, data },
  1415. } = await this.$api.getbaseprofiletpgetInfo({
  1416. goodsId: this.goodsId,
  1417. orderGoodsId: this.orderGoodsId,
  1418. });
  1419. if (
  1420. code === 200 &&
  1421. (!data || (data.status === 3 && data.changeStatus === 1))
  1422. ) {
  1423. uni.showModal({
  1424. content: !data
  1425. ? "请前往填写资料"
  1426. : "资料审核不通过,请前往重新填写",
  1427. cancelText: "返回",
  1428. success: (resultst) => {
  1429. if (resultst.confirm) {
  1430. this.$navTo.togo("/pages2/verify/input", {
  1431. id: this.goodsId,
  1432. orderGoodsId: this.orderGoodsId,
  1433. });
  1434. }
  1435. if (resultst.cancel) {
  1436. uni.navigateBack();
  1437. }
  1438. },
  1439. });
  1440. return Promise.reject();
  1441. } else if (data.status === 1 && JSON.parse(rows[0].keyValue2)[0]) {
  1442. let {
  1443. data: { code, data },
  1444. } = await this.$api.getbaseprofileStampgetInfo({
  1445. goodsId: this.goodsId,
  1446. orderGoodsId: this.orderGoodsId,
  1447. });
  1448. if (
  1449. code === 200 &&
  1450. (!data || (data.status === 3 && data.changeStatus === 1))
  1451. ) {
  1452. uni.showModal({
  1453. content: !data
  1454. ? "请前往填写盖章资料"
  1455. : "资料盖章审核不通过,请前往重新填写",
  1456. cancelText: "返回",
  1457. success: (resultst) => {
  1458. if (resultst.confirm) {
  1459. this.$navTo.togo("/pages2/verify/input2", {
  1460. id: this.goodsId,
  1461. orderGoodsId: this.orderGoodsId,
  1462. });
  1463. }
  1464. if (resultst.cancel) {
  1465. uni.navigateBack();
  1466. }
  1467. },
  1468. });
  1469. return Promise.reject();
  1470. }
  1471. }
  1472. }
  1473. }
  1474. return Promise.resolve();
  1475. },
  1476. async isCanLearn() {
  1477. await this.getbaseprofiletplists();
  1478. await this.getGradeInfo();
  1479. await this.getGoodsDetail();
  1480. },
  1481. /**
  1482. * 计算tabs宽度
  1483. */
  1484. itemWidth() {
  1485. return 100 / this.list.length + "%";
  1486. },
  1487. findMenuNextSection(index) {
  1488. for (let i = index + 1; i < this.reMenuList.length; i++) {
  1489. let item = this.reMenuList[i];
  1490. if (item.type == 3) {
  1491. return item;
  1492. }
  1493. }
  1494. return {};
  1495. },
  1496. loadedmetadata(event) {
  1497. this.refPlv = this.$refs.player;
  1498. },
  1499. getPhotoLastRecord() {
  1500. if (this.erJianErZao || !this.playSecIsLearn || this.photoNum <= 0) {
  1501. return;
  1502. }
  1503. let self = this;
  1504. let data = {
  1505. sectionId: parseInt(self.playSectionId),
  1506. goodsId: parseInt(self.goodsId),
  1507. courseId: parseInt(self.courseId),
  1508. gradeId: parseInt(self.gradeId),
  1509. chapterId: parseInt(self.chapterId),
  1510. moduleId: parseInt(self.moduleId),
  1511. orderGoodsId: this.orderGoodsId,
  1512. };
  1513. // /course/photo/log/getLastInfo'
  1514. this.$api.getPhotoLastRecord(data).then((res) => {
  1515. if (res.data.code == 200) {
  1516. //清空历史数据
  1517. self.photoHistoryList = [];
  1518. this.photoIndex = 0;
  1519. self.photoList = [];
  1520. for (let i = 0; i < res.data.data.length; i++) {
  1521. //-2存储随机拍照数组
  1522. if (res.data.data[i].photoIndex == -2) {
  1523. self.photoList =
  1524. res.data.data[i].timeInterval &&
  1525. res.data.data[i].timeInterval.split(",");
  1526. } else {
  1527. self.photoHistoryList.push(res.data.data[i].photoIndex);
  1528. }
  1529. }
  1530. // console.log('7777', this.photoHistoryList, this.photoList);
  1531. }
  1532. });
  1533. },
  1534. //postTime 只提交随机时间
  1535. postCoursePhotoRecord(postTime = false) {
  1536. return new Promise((resolve, reject) => {
  1537. let currentTime = 0;
  1538. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  1539. if (polyvPlayerContext) {
  1540. // #ifdef MP-WEIXIN
  1541. currentTime = polyvPlayerContext.getCurrentTime();
  1542. // #endif
  1543. // #ifdef H5
  1544. currentTime = polyvPlayerContext.j2s_getCurrentTime();
  1545. // #endif
  1546. }
  1547. let self = this;
  1548. let photoIndex = self.photoIndex;
  1549. let data = {
  1550. photo: self.ossAvatarUrl,
  1551. sectionId: parseInt(self.playSectionId),
  1552. goodsId: parseInt(self.goodsId),
  1553. courseId: parseInt(self.courseId),
  1554. photoTime: parseInt(currentTime > 0 ? currentTime : 0),
  1555. gradeId: parseInt(self.gradeId),
  1556. photoIndex: postTime ? -2 : parseInt(photoIndex), //从0算起,-2只提交随机时间
  1557. photoNum: parseInt(self.photoNum),
  1558. chapterId: parseInt(self.chapterId),
  1559. moduleId: parseInt(self.moduleId),
  1560. timeInterval: postTime ? self.photoList.join(",") : "",
  1561. orderGoodsId: this.orderGoodsId,
  1562. };
  1563. // console.log("提交接口", data);
  1564. this.$api
  1565. .coursePhotoRecord(data)
  1566. .then((res) => {
  1567. if (res.data.code == 200) {
  1568. resolve();
  1569. } else {
  1570. reject();
  1571. }
  1572. })
  1573. .catch((err) => {
  1574. reject();
  1575. });
  1576. });
  1577. },
  1578. randomNum(minNum, maxNum) {
  1579. switch (arguments.length) {
  1580. case 1:
  1581. return parseInt(Math.random() * minNum + 1, 10);
  1582. break;
  1583. case 2:
  1584. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  1585. break;
  1586. default:
  1587. return 0;
  1588. break;
  1589. }
  1590. },
  1591. //配置随机拍照时间
  1592. configPhoto() {
  1593. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  1594. let totalVideoTime = 0;
  1595. let duration = 0;
  1596. // #ifdef MP-WEIXIN
  1597. totalVideoTime = polyvPlayerContext.getDuration();
  1598. duration = polyvPlayerContext.getCurrentTime();
  1599. // #endif
  1600. // #ifdef H5
  1601. totalVideoTime = polyvPlayerContext.j2s_getDuration();
  1602. duration = polyvPlayerContext.j2s_getCurrentTime();
  1603. // #endif
  1604. let photoNum = this.photoNum;
  1605. if (!this.photoConfig) {
  1606. this.photoConfig = true;
  1607. if (this.erJianErZao) {
  1608. this.photoList = this.randomConfig(totalVideoTime, duration);
  1609. return;
  1610. }
  1611. //没有历史拍照间隔数据
  1612. if (this.photoList.length == 0) {
  1613. if (totalVideoTime >= 900) {
  1614. //大于15分钟
  1615. if (photoNum == 1) {
  1616. //开头拍1张
  1617. this.photoList.push(0);
  1618. } else if (photoNum == 3) {
  1619. //拍3张
  1620. this.photoList.push(0); //开头拍一张
  1621. let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
  1622. let centerMinTime = centerTime - 300; //前后5分钟
  1623. let centerMaxTime = centerTime + 300;
  1624. let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
  1625. this.photoList.push(centerTakeTime); //中间拍一张
  1626. let endMaxTime = totalVideoTime - 60;
  1627. let endMinTime = totalVideoTime - 300;
  1628. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  1629. this.photoList.push(endTakeTime); //最后拍一张
  1630. }
  1631. } else {
  1632. //小于15分钟,只拍前后各一张
  1633. if (photoNum == 1) {
  1634. //开头拍1张
  1635. this.photoList.push(0);
  1636. } else if (photoNum == 3) {
  1637. this.photoList.push(1);
  1638. let centerTime = this.randomNum(
  1639. (1 / 3) * totalVideoTime,
  1640. (2 / 3) * totalVideoTime
  1641. );
  1642. this.photoList.push(centerTime);
  1643. let endTakeTime = this.randomNum(
  1644. (2 / 3) * totalVideoTime,
  1645. totalVideoTime
  1646. );
  1647. this.photoList.push(endTakeTime);
  1648. }
  1649. }
  1650. this.postCoursePhotoRecord(true); //提交随机拍照时间数组
  1651. }
  1652. //兼容已有观看历史
  1653. for (let i = 0; i < this.photoList.length - 1; i++) {
  1654. if (
  1655. this.photoList[i] < duration &&
  1656. this.photoList[i + 1] > duration
  1657. ) {
  1658. this.photoIndex = i + 1;
  1659. break;
  1660. }
  1661. if (duration > this.photoList[this.photoList.length - 1]) {
  1662. this.photoIndex = this.photoList.length - 1; //取最后一个下标
  1663. break;
  1664. }
  1665. }
  1666. }
  1667. },
  1668. // 随机拍摄时间
  1669. randomConfig(totalVideoTime, duration) {
  1670. this.photoHistoryList = [];
  1671. let photoList = [duration];
  1672. let pre = duration;
  1673. if (totalVideoTime > 300) {
  1674. while (pre <= totalVideoTime) {
  1675. pre += this.randomNum(780, 900);
  1676. pre <= totalVideoTime && photoList.push(pre);
  1677. }
  1678. if (totalVideoTime - 300 > photoList.slice(-1)[0]) {
  1679. photoList.push(this.randomNum(totalVideoTime - 180, totalVideoTime));
  1680. }
  1681. }
  1682. return photoList;
  1683. },
  1684. closePlv() {
  1685. if (plv) {
  1686. plv.destroy();
  1687. }
  1688. },
  1689. openSetting(res) {
  1690. console.log(res, 98);
  1691. },
  1692. getCameraSetting() {
  1693. const self = this;
  1694. // 不支持h5
  1695. wx.getSetting({
  1696. success: (res) => {
  1697. if (res.authSetting["scope.camera"]) {
  1698. // 用户已经授权
  1699. self.showSet = false;
  1700. this.prendreAutoCarme = false;
  1701. } else {
  1702. this.prendreAutoCarme = true;
  1703. // 用户还没有授权,向用户发起授权请求
  1704. wx.authorize({
  1705. scope: "scope.camera",
  1706. success: () => {
  1707. // 用户同意授权
  1708. self.showSet = false;
  1709. this.prendreAutoCarme = false;
  1710. },
  1711. fail: () => {
  1712. // 用户不同意授权
  1713. self.showSet = true;
  1714. },
  1715. });
  1716. }
  1717. },
  1718. fail: (res) => {},
  1719. });
  1720. },
  1721. studyNotice() {
  1722. this.noticeShow = true;
  1723. },
  1724. //正常播放视频
  1725. async playVideo(item) {
  1726. this.sectionItem = item;
  1727. console.log(this.sectionItem, "this.sectionItem");
  1728. if (this.timer) {
  1729. clearInterval(this.timer);
  1730. }
  1731. this.recordObj = item.videoCurrentTime
  1732. ? { videoCurrentTime: item.videoCurrentTime }
  1733. : await this.getRecordLast(item);
  1734. this.$store.commit("setPlayVID", {
  1735. playVID: item.recordingUrl,
  1736. });
  1737. this.$store.commit("setPlaySectionId", {
  1738. playSectionId: item.sectionId,
  1739. });
  1740. this.startStatus = true;
  1741. if (this.refPlv) {
  1742. this.refPlv.changeVid({
  1743. vid: item.recordingUrl,
  1744. videoCurrentTime: this.recordObj.videoCurrentTime,
  1745. });
  1746. }
  1747. },
  1748. getRecordLast(sectionItem) {
  1749. let { chapterId, sectionId, courseId, moduleId } = sectionItem;
  1750. return new Promise((resolve) => {
  1751. let data = {
  1752. gradeId:
  1753. this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
  1754. goodsId:
  1755. this.goodsId || this.goodsId == 0 ? Number(this.goodsId) : null,
  1756. sectionId: sectionId || 0,
  1757. courseId: courseId || courseId == 0 ? Number(courseId) : null,
  1758. chapterId: chapterId || 0,
  1759. moduleId: moduleId || 0,
  1760. orderGoodsId: this.orderGoodsId,
  1761. };
  1762. this.$api.recordLast(data).then((res) => {
  1763. resolve(res.data.data);
  1764. });
  1765. });
  1766. },
  1767. jumpNote(item) {
  1768. this.$u.toast("即将跳到笔记位置");
  1769. if (this.playSectionId != item.sectionId) {
  1770. this.initPlayVideo({
  1771. sectionType: 1,
  1772. ...item,
  1773. videoCurrentTime: Number(item.noteSecond),
  1774. });
  1775. } else {
  1776. this.refPlv.seekVideo(item.noteSecond);
  1777. }
  1778. },
  1779. getGradeInfo() {
  1780. // 即刻 1 待定2 日期3
  1781. return this.$api.goodsGradeInfo(this.gradeId).then((res) => {
  1782. if (res.data.code == 200) {
  1783. let { data } = res.data;
  1784. if (
  1785. data.learningStatus == 2 ||
  1786. (data.learningStatus == 3 &&
  1787. Number(data.learningTimeStart) > Number(new Date() / 1000))
  1788. ) {
  1789. uni.showModal({
  1790. showCancel: false,
  1791. confirmText: "确定",
  1792. content:
  1793. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  1794. success: function (resultst) {
  1795. uni.navigateBack();
  1796. },
  1797. });
  1798. return Promise.reject(123);
  1799. }
  1800. }
  1801. });
  1802. },
  1803. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  1804. if (!this.refPlv) {
  1805. return;
  1806. }
  1807. let currentTime = this.refPlv.playCurrentTime();
  1808. let PlayDuration = this.refPlv.playVideoTime();
  1809. if (currentTime < 10 && !this.ossAvatarUrl) {
  1810. return;
  1811. }
  1812. if (this.playChannelId > 0) {
  1813. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  1814. }
  1815. let self = this;
  1816. let data = {
  1817. fromPlat: 1, //来源平台 1小程序 2网站
  1818. photo: self.ossAvatarUrl,
  1819. sectionId: sectionId || 0,
  1820. goodsId: parseInt(self.goodsId),
  1821. courseId: parseInt(self.courseId),
  1822. orderGoodsId: this.orderGoodsId,
  1823. studyDuration: parseInt(
  1824. PlayDuration > 0 ? PlayDuration : self.studyDuration
  1825. ),
  1826. gradeId: parseInt(self.gradeId),
  1827. chapterId: this.chapterId || 0,
  1828. moduleId: this.moduleId || 0,
  1829. videoCurrentTime: parseInt(
  1830. currentTime > 0 ? currentTime : self.studyDuration
  1831. ),
  1832. erJianErZao: this.erJianErZao,
  1833. };
  1834. if (this.ossAvatarUrl) {
  1835. data.similarity = this.compareFaceData; // 相似度
  1836. }
  1837. if (status > 0) {
  1838. data.status = status;
  1839. }
  1840. console.log(data, "记录参数");
  1841. return new Promise((resolve, reject) => {
  1842. this.$api
  1843. .studyRecord(data)
  1844. .then((res) => {
  1845. console.log(res, "记录返回");
  1846. let { code, msg } = res.data;
  1847. if (code == 200) {
  1848. if (status > 0) {
  1849. this.studyRecordMenuAllList();
  1850. let moduleId = this.moduleId || 0;
  1851. let chapterId = this.chapterId || 0;
  1852. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  1853. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  1854. uni.$emit("playNext" + playNextIdisRebuild, {
  1855. fromRebuild: this.isRebuild,
  1856. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  1857. uni.$emit("playNext" + playNextId); //通知播放结束
  1858. }
  1859. self.ossAvatarUrl = "";
  1860. } else if (code == 600) {
  1861. uni.showModal({
  1862. showCancel: false,
  1863. title: "提示",
  1864. content: msg,
  1865. success: (resultst) => {
  1866. uni.navigateBack();
  1867. },
  1868. });
  1869. } else if (code == 558) {
  1870. this.CountTo1 = msg.split(",")[1];
  1871. this.noticeShow1 = true;
  1872. var timer = setInterval(() => {
  1873. this.CountTo1--;
  1874. if (this.CountTo1 < 0) {
  1875. this.noticeShow1 = false;
  1876. clearInterval(timer);
  1877. this.postStudyRecord(1);
  1878. }
  1879. }, 1000);
  1880. reject("中断执行");
  1881. } else {
  1882. this.uploadLock = false;
  1883. uni.showToast({
  1884. icon: "none",
  1885. title: res.data.msg,
  1886. duration: 2000,
  1887. });
  1888. if (this.erJianErZao && code == 559) {
  1889. this.isReach = true;
  1890. this.openPhoto();
  1891. }
  1892. if (code == 559 || code == 588) {
  1893. reject("中断执行");
  1894. }
  1895. }
  1896. resolve();
  1897. })
  1898. .catch((err) => {
  1899. this.studyRecordMenuAllList();
  1900. });
  1901. });
  1902. },
  1903. uploadFile(options, int) {
  1904. var self = this;
  1905. return new Promise((resolve, reject) => {
  1906. var data = {
  1907. imageStatus: int,
  1908. gradeId: this.gradeId,
  1909. orderGoodsId: this.orderGoodsId,
  1910. };
  1911. self.$api.aliyunpolicy(data).then((res) => {
  1912. if (res.data.code != 200) {
  1913. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1914. return;
  1915. }
  1916. var ossToken = res.data.data.resultContent;
  1917. if (ossToken.host == null || ossToken.host == undefined) {
  1918. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1919. return;
  1920. }
  1921. let filePath = "";
  1922. // #ifdef H5
  1923. var localData = options; //dataUrl为base64位
  1924. let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
  1925. let length = base.length;
  1926. let url = new Uint8Array(length);
  1927. while (length--) {
  1928. url[length] = base.charCodeAt(length);
  1929. }
  1930. filePath = new File([url], "a.jpg", {
  1931. type: "image/jpg",
  1932. });
  1933. uni.uploadFile({
  1934. url: ossToken.host,
  1935. name: "file",
  1936. file: filePath,
  1937. fileType: "image",
  1938. header: {
  1939. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1940. },
  1941. formData: {
  1942. key: ossToken.dir,
  1943. OSSAccessKeyId: ossToken.accessid,
  1944. policy: ossToken.policy,
  1945. Signature: ossToken.signature,
  1946. callback: ossToken.callback,
  1947. success_action_status: 200,
  1948. },
  1949. success: (result) => {
  1950. this.$u.toast("上传成功");
  1951. self.ossAvatarUrl = ossToken.dir;
  1952. resolve(ossToken.dir);
  1953. },
  1954. fail: (error) => {
  1955. uni.showToast({
  1956. title: "上传接口报错,请重新拍照上传" + error,
  1957. icon: "none",
  1958. });
  1959. this.openPhoto();
  1960. return;
  1961. },
  1962. });
  1963. // #endif
  1964. // #ifdef MP-WEIXIN
  1965. uni.uploadFile({
  1966. url: ossToken.host,
  1967. name: "file",
  1968. filePath: options,
  1969. fileType: "image",
  1970. header: {
  1971. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1972. },
  1973. formData: {
  1974. key: ossToken.dir,
  1975. OSSAccessKeyId: ossToken.accessid,
  1976. policy: ossToken.policy,
  1977. Signature: ossToken.signature,
  1978. callback: ossToken.callback,
  1979. success_action_status: 200,
  1980. },
  1981. success: (result) => {
  1982. // if (result.statusCode === 200) {
  1983. this.$u.toast("上传成功");
  1984. self.ossAvatarUrl = ossToken.dir;
  1985. resolve(ossToken.dir);
  1986. },
  1987. fail: (error) => {
  1988. uni.showToast({
  1989. title: "上传接口报错,请重新拍照上传" + error,
  1990. icon: "none",
  1991. });
  1992. this.openPhoto();
  1993. return;
  1994. },
  1995. });
  1996. // #endif
  1997. });
  1998. });
  1999. },
  2000. imageInfos() {
  2001. var self = this;
  2002. return new Promise(async (resolve, reject) => {
  2003. let resPath = await myCompressImage(this.avatarUrl || this.faceUrl, 50);
  2004. const waitUpload = await self.uploadFile(resPath, 0);
  2005. resolve(waitUpload);
  2006. });
  2007. },
  2008. timeEvent(playTime) {
  2009. this.configPhoto();
  2010. let photoTime = 0; //获取拍照秒数
  2011. for (let i = 0; i < this.photoList.length; i++) {
  2012. photoTime = Number(this.photoList[i]); //获取拍照秒数
  2013. if (
  2014. (this.erJianErZao && !this.photoHistoryList.length) ||
  2015. (photoTime < playTime && photoTime > playTime - 8)
  2016. ) {
  2017. //3秒区间内才触发拍照,避免拉动滚动条
  2018. if (this.photoHistoryList.indexOf(i) < 0) {
  2019. //不存在拍照历史,没有重修过,没有学过,则拍照
  2020. //启动拍照
  2021. //暂停
  2022. console.log("去拍照");
  2023. this.refPlv.playPause();
  2024. this.refPlv.exitFullScreen();
  2025. this.photoIndex = i;
  2026. if (
  2027. uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
  2028. this.goodsId
  2029. ) {
  2030. return this.openPhoto();
  2031. } else {
  2032. this.popupPhotoShow = true;
  2033. uni.setStorageSync(`tabkePhotoShow${this.goodsId}`, this.goodsId); // 本地缓存用来判断是否已经弹出过弹窗
  2034. }
  2035. }
  2036. }
  2037. }
  2038. },
  2039. closeToast() {
  2040. clearTimeout(this.toastTimer);
  2041. this.videoToastShow = false;
  2042. },
  2043. // 新增用户视频学习日志
  2044. studyLog() {
  2045. this.$http({
  2046. url: "/user/study/log",
  2047. method: "post",
  2048. data: {
  2049. goodsId: this.goodsId,
  2050. courseId: this.courseId,
  2051. moduleId: this.moduleId || 0,
  2052. chapterId: this.chapterId || 0,
  2053. sectionId: this.playSectionId || 0,
  2054. fromPlat: 1, //来源平台 1小程序 2PC网站
  2055. goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  2056. orderGoodsId: this.orderGoodsId,
  2057. },
  2058. }).then((res) => {});
  2059. },
  2060. timeupdate(time) {
  2061. // console.log("播放中", time);
  2062. this.clearPauseTimer();
  2063. if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
  2064. this.isReach = false;
  2065. this.timeEvent();
  2066. }
  2067. },
  2068. playing() {
  2069. console.log("playing");
  2070. if (this.noticeShow) {
  2071. this.refPlv.playPause();
  2072. return;
  2073. }
  2074. this.studyLog();
  2075. if (!this.recordObj.videoCurrentTime) {
  2076. this.postStudyRecord(0);
  2077. }
  2078. this.studyTimer && clearInterval(this.studyTimer);
  2079. this.studyTimer = setInterval(() => {
  2080. this.postStudyRecord(0);
  2081. }, 15000);
  2082. },
  2083. pause() {
  2084. this.erJianErZaoPauseTip();
  2085. clearInterval(this.timer);
  2086. clearInterval(this.studyTimer);
  2087. },
  2088. async ended() {
  2089. this.hasStart = false;
  2090. uni.showToast({
  2091. icon: "none",
  2092. title: "播放完毕",
  2093. });
  2094. clearInterval(this.timer);
  2095. clearInterval(this.studyTimer);
  2096. await this.postStudyRecord(1);
  2097. this.nextSection();
  2098. },
  2099. playerError() {
  2100. console.log(46546);
  2101. },
  2102. //播放下一节
  2103. nextSection() {
  2104. console.log("播放下一节");
  2105. if (!this.menuAllList.length) {
  2106. return;
  2107. }
  2108. this.curPlayIndex = this.menuAllList.findIndex((item) => {
  2109. let i_sectionId = item.sectionId || 0;
  2110. let i_chapterId = item.chapterId || 0;
  2111. let i_moduleId = item.moduleId || 0;
  2112. return (
  2113. i_sectionId == this.playSectionId &&
  2114. i_chapterId == this.chapterId &&
  2115. i_moduleId == this.moduleId
  2116. );
  2117. });
  2118. let data = this.menuAllList[this.curPlayIndex + 1];
  2119. if (!data) {
  2120. //第二个弹窗
  2121. uni.showModal({
  2122. title: "温馨提示",
  2123. content:
  2124. "恭喜您课程学习全部完成,教务会在1-3个工作日内完成学习初审,请耐心等待。",
  2125. showCancel: !this.erJianErZao,
  2126. success: (res) => {
  2127. if (res.confirm) {
  2128. uni.switchTab({
  2129. url: "/pages/learn/index",
  2130. });
  2131. }
  2132. },
  2133. });
  2134. } else {
  2135. if (data.doType == 2) {
  2136. if (data.studyStatus == 1) {
  2137. uni.showToast({
  2138. title: "试卷已合格!",
  2139. duration: 2000,
  2140. icon: "none",
  2141. });
  2142. return;
  2143. }
  2144. uni.showModal({
  2145. title: "温馨提示",
  2146. content: "当前节视频已学完,是否进入考试?",
  2147. success: (res) => {
  2148. if (res.confirm) {
  2149. this.toQuestionBank(data);
  2150. }
  2151. },
  2152. });
  2153. return;
  2154. }
  2155. uni.showModal({
  2156. title: "温馨提示",
  2157. content: "当前节视频已学完,继续学习下一节?",
  2158. success: async (res) => {
  2159. if (res.confirm) {
  2160. this.moduleId = data.moduleId;
  2161. this.chapterId = data.chapterId;
  2162. this.sectionId = data.sectionId;
  2163. if (data.sectionType == 1) {
  2164. //录播
  2165. this.$store.commit("setPlaySectionId", {
  2166. playSectionId: data.sectionId,
  2167. });
  2168. this.$store.commit("setPlayVID", {
  2169. playVID: data.recordingUrl,
  2170. });
  2171. this.hasStart = false;
  2172. this.photoConfig = false;
  2173. this.photoIndex = 0;
  2174. this.sectionItem = data;
  2175. await this.getPhotoLastRecord(); // 获取拍照历史
  2176. this.playVideo(data);
  2177. } else if (data.sectionType == 2) {
  2178. //直播
  2179. this.studyRecordGetLastLive();
  2180. } else if (data.sectionType == 3) {
  2181. //回放
  2182. this.$store.commit("setPlaySectionId", {
  2183. playSectionId: data.sectionId,
  2184. });
  2185. this.$store.commit("setPlayVID", {
  2186. playVID: data.recordingUrl,
  2187. });
  2188. this.sectionItem = data;
  2189. this.playVideo(data);
  2190. }
  2191. let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
  2192. this.$store.commit("updatePlayNextId", playNextId);
  2193. this.updateChapterOpen(true);
  2194. }
  2195. },
  2196. });
  2197. }
  2198. },
  2199. //拍照
  2200. openPhoto() {
  2201. if (polyvPlayerContext) {
  2202. // #ifdef MP-WEIXIN
  2203. polyvPlayerContext.exitFullScreen();
  2204. // #endif
  2205. // #ifdef H5
  2206. if (this.isFullScreen()) {
  2207. this.exitFullscreen();
  2208. }
  2209. // #endif
  2210. }
  2211. // #ifdef MP-WEIXIN
  2212. this.enableAutoRotation = false;
  2213. this.photoPopup = true;
  2214. this.isTaking = true;
  2215. uni.setKeepScreenOn({
  2216. keepScreenOn: true,
  2217. });
  2218. uni.authorize({
  2219. scope: "scope.camera",
  2220. success() {},
  2221. });
  2222. // #endif
  2223. // #ifdef H5
  2224. if (
  2225. (window.navigator.mediaDevices &&
  2226. window.navigator.mediaDevices.getUserMedia) ||
  2227. window.navigator.getUserMedia ||
  2228. window.navigator.webkitGetUserMedia ||
  2229. window.navigator.mozGetUserMedia
  2230. ) {
  2231. console.log("getUserMedia----");
  2232. // 调用用户媒体设备, 访问摄像头
  2233. this.getUserMedia(
  2234. {
  2235. video: {
  2236. width: 400,
  2237. height: 300,
  2238. facingMode: "user",
  2239. },
  2240. },
  2241. this.photographSuccess,
  2242. this.photographError
  2243. );
  2244. } else {
  2245. console.log("1111没有摄像");
  2246. this.photographError();
  2247. }
  2248. // #endif
  2249. },
  2250. /**
  2251. * 人脸匹配
  2252. */
  2253. faceRecognition() {
  2254. return new Promise((resolve) => {
  2255. // #ifdef MP-WEIXIN
  2256. let fileSystem = uni.getFileSystemManager();
  2257. fileSystem.readFile({
  2258. filePath: `${this.avatarUrl}`,
  2259. encoding: "base64",
  2260. position: 0,
  2261. success: (res) => {
  2262. let base64 = "data:image/jpg;base64," + res.data;
  2263. // console.log('base64Data人脸识别参数:', {
  2264. // imageA: base64,
  2265. // orderGoodsId: this.orderGoodsId,
  2266. // gradeId: this.gradeId,
  2267. // })
  2268. this.CompareFace(base64, resolve);
  2269. },
  2270. fail(err) {
  2271. // this.$u.toast('人脸识别错误!')
  2272. console.error(err, "err-----人脸识别错误");
  2273. },
  2274. });
  2275. // #endif
  2276. // #ifdef H5
  2277. this.CompareFace(this.faceUrl, resolve);
  2278. // #endif
  2279. });
  2280. },
  2281. CompareFace(url, resolve) {
  2282. let timer = setTimeout(() => {
  2283. uni.showToast({
  2284. icon: "none",
  2285. title: "拍照超时,请重新拍照",
  2286. duration: 2000,
  2287. success: () => {
  2288. setTimeout(() => {
  2289. uni.navigateBack();
  2290. }, 1000);
  2291. },
  2292. });
  2293. }, 10 * 1000);
  2294. this.$api
  2295. .faceCertificationCompareFace({
  2296. imageA: url,
  2297. orderGoodsId: this.orderGoodsId,
  2298. gradeId: this.gradeId,
  2299. })
  2300. .then((res) => {
  2301. clearTimeout(timer);
  2302. console.log(res, "人脸识别成功res");
  2303. resolve(res.data.data);
  2304. })
  2305. .catch((err) => {
  2306. clearTimeout(timer);
  2307. // 当前网络延迟,
  2308. console.log("人脸识别错误:", err);
  2309. uni.showModal({
  2310. content: "当前网络延迟",
  2311. showCancel: false,
  2312. success: (resultst) => {
  2313. if (resultst.confirm) {
  2314. uni.navigateBack();
  2315. }
  2316. },
  2317. });
  2318. });
  2319. },
  2320. // 确定拍照
  2321. async submit() {
  2322. if (this.uploadLock) {
  2323. return;
  2324. }
  2325. this.uploadLock = true;
  2326. let compareFaceData = await this.faceRecognition();
  2327. this.compareFaceData = compareFaceData;
  2328. if (compareFaceData >= 80) {
  2329. await this.imageInfos();
  2330. this.postCoursePhotoRecord()
  2331. .then(async (res) => {
  2332. this.photoHistoryList.push(this.photoIndex);
  2333. // console.log('拍照确定提交', this.photoHistoryList);
  2334. this.postStudyRecord(); //提交记录
  2335. if (this.erJianErZao && this.isReach) {
  2336. console.log("1校验");
  2337. await this.postStudyRecord(1);
  2338. this.photoPopup = false;
  2339. this.uploadLock = false;
  2340. this.enableAutoRotation = true;
  2341. this.nextSection();
  2342. return;
  2343. }
  2344. //恢复播放
  2345. // #ifdef MP-WEIXIN
  2346. uni.setKeepScreenOn({
  2347. keepScreenOn: false,
  2348. });
  2349. // #endif
  2350. this.photoPopup = false;
  2351. this.uploadLock = false;
  2352. this.enableAutoRotation = true;
  2353. this.refPlv.resumeVideo();
  2354. })
  2355. .catch((err) => {
  2356. console.log("拍照记录接口的err", err);
  2357. uni.showToast({
  2358. title: "上传接口报错,请重新拍照上传" + err,
  2359. icon: "none",
  2360. });
  2361. this.uploadLock = false;
  2362. this.openPhoto();
  2363. });
  2364. } else {
  2365. uni.showToast({
  2366. title: "人脸匹配不通过,请重新拍照上传",
  2367. icon: "none",
  2368. duration: 2000,
  2369. });
  2370. setTimeout(() => {
  2371. this.uploadLock = false;
  2372. this.openPhoto();
  2373. }, 2000);
  2374. }
  2375. },
  2376. reTake() {
  2377. this.isTaking = true;
  2378. // #ifdef H5
  2379. this.faceUrl = "";
  2380. this.getUserMedia(
  2381. {
  2382. video: {
  2383. width: 400,
  2384. height: 300,
  2385. facingMode: "user",
  2386. },
  2387. },
  2388. this.photographSuccess,
  2389. this.photographError
  2390. );
  2391. // #endif
  2392. },
  2393. toTakePhoto() {
  2394. this.popupPhotoShow = false;
  2395. this.openPhoto();
  2396. },
  2397. takePhTips() {
  2398. this.popupPhotoShow = true;
  2399. this.isTaking = false;
  2400. this.photoPopup = false;
  2401. this.enableAutoRotation = false;
  2402. },
  2403. //确认拍照
  2404. takePhoto() {
  2405. // #ifdef MP-WEIXIN
  2406. const ctx = uni.createCameraContext();
  2407. ctx.takePhoto({
  2408. quality: "high",
  2409. success: (res) => {
  2410. this.avatarUrl = res.tempImagePath;
  2411. console.log("开始拍照this.avatarUrl:", this.avatarUrl);
  2412. this.isTaking = false;
  2413. },
  2414. fail: (err) => {},
  2415. });
  2416. // #endif
  2417. // #ifdef H5
  2418. const canvas = document.createElement("canvas");
  2419. canvas.width = 400;
  2420. canvas.height = 400;
  2421. const context = canvas.getContext("2d");
  2422. const box = document.querySelector(".photo_v");
  2423. const video = box.querySelector("video");
  2424. context.drawImage(video, 0, 0, 400, 400);
  2425. this.faceUrl = canvas.toDataURL("image/png");
  2426. this.isTaking = false;
  2427. // #endif
  2428. },
  2429. playError(e) {
  2430. console.log(e);
  2431. },
  2432. //拍照报错
  2433. error(e) {
  2434. console.log(e.detail);
  2435. },
  2436. //关闭相机
  2437. closePhoto() {
  2438. this.photoPopup = false;
  2439. this.enableAutoRotation = true;
  2440. },
  2441. async userConfirmInfoDetail() {
  2442. let info = await this.$api.userConfirmInfoDetail({
  2443. orderGoodsId: this.orderGoodsId,
  2444. });
  2445. if (!info.data.data || info.data.data.pushInfo !== 1) {
  2446. uni.showModal({
  2447. showCancel: false,
  2448. title: "提示",
  2449. content: "开通信息推送不成功,无法进入学习!",
  2450. success: (resultst) => {
  2451. uni.navigateBack();
  2452. },
  2453. });
  2454. return Promise.reject();
  2455. }
  2456. },
  2457. checkFinishRequiredCourse() {
  2458. return this.$api
  2459. .checkFinishRequiredCourse({
  2460. businessId: this.goodsData.businessId,
  2461. goodsId: this.goodsId,
  2462. })
  2463. .then((res) => {
  2464. if (res.data.data > 0) {
  2465. uni.showModal({
  2466. showCancel: false,
  2467. confirmText: "确定",
  2468. content: "该业务层次下有未学完的商品,无法学习新商品!",
  2469. success: function (resultst) {
  2470. uni.navigateBack();
  2471. },
  2472. });
  2473. return Promise.reject();
  2474. }
  2475. return Promise.resolve();
  2476. });
  2477. },
  2478. async getGoodsDetail() {
  2479. let { data } = await this.$api.goodsDetail(this.goodsId);
  2480. this.goodsData = data.data;
  2481. this.erJianErZao = this.goodsData.erJianErZao;
  2482. this.erJianErZao && (await this.userConfirmInfoDetail());
  2483. this.option.periodWaitTime && (await this.checkFinishRequiredCourse());
  2484. this.goodsData.buyNote && this.baseHandoutTipList();
  2485. this.gradeId = this.goodsData.gradeId;
  2486. if (this.goodsData.goodsPlayConfig) {
  2487. this.goodsPlayConfig = JSON.parse(this.goodsData.goodsPlayConfig);
  2488. if (this.goodsPlayConfig.autoPlay > 0) {
  2489. this.autoplay = true;
  2490. }
  2491. if (this.goodsPlayConfig.drag > 0 && !this.erJianErZao) {
  2492. // #ifdef MP-WEIXIN
  2493. this.isAllowSeek = "yes";
  2494. // #endif
  2495. // #ifdef H5
  2496. this.isAllowSeek = "off";
  2497. // #endif
  2498. }
  2499. if (this.goodsPlayConfig.speed > 0) {
  2500. this.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  2501. }
  2502. }
  2503. if (this.goodsData.goodsPhotographConfig) {
  2504. this.goodsPhotographConfig = JSON.parse(
  2505. this.goodsData.goodsPhotographConfig
  2506. );
  2507. if (this.goodsPhotographConfig.photoNum > 0) {
  2508. this.photoNum = this.goodsPhotographConfig.photoNum;
  2509. }
  2510. }
  2511. },
  2512. getReMenuList() {
  2513. let self = this;
  2514. this.$api
  2515. .reMenuList({
  2516. orderGoodsId: this.orderGoodsId,
  2517. courseId: this.courseId,
  2518. rebuild: 1,
  2519. gradeId: this.gradeId,
  2520. })
  2521. .then((res) => {
  2522. if (res.data.code == 200) {
  2523. for (let i = 0; i < res.data.rows.length; i++) {
  2524. let item = res.data.rows[i];
  2525. item.down = true;
  2526. item.id = item.menuId;
  2527. item.name = item.menuName;
  2528. }
  2529. self.reMenuList = res.data.rows;
  2530. this.current = 0;
  2531. if (self.reMenuList.length > 0) {
  2532. this.showNotes = false;
  2533. if (Object.keys(this.sectionItem).length) {
  2534. let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
  2535. this.$store.commit("updatePlayNextId", playNextIdisRebuild);
  2536. }
  2537. } else {
  2538. if (Object.keys(this.sectionItem).length) {
  2539. let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
  2540. this.$store.commit("updatePlayNextId", playNextId);
  2541. }
  2542. }
  2543. }
  2544. });
  2545. },
  2546. courseDetail() {
  2547. this.$api.courseDetail(this.courseId).then((res) => {
  2548. if (res.data.code == 200) {
  2549. this.detail = res.data.data;
  2550. }
  2551. });
  2552. },
  2553. open(item) {
  2554. item.showChildren = !item.showChildren;
  2555. },
  2556. change(index) {
  2557. this.current = index;
  2558. },
  2559. clears() {
  2560. return new Promise((resolve, reject) => {
  2561. this.vid = "";
  2562. polyvPlayerContext && polyvPlayerContext.destroy();
  2563. polyvPlayerContext = null;
  2564. resolve();
  2565. });
  2566. },
  2567. /**
  2568. * 退出全屏
  2569. */
  2570. exitFullscreen() {
  2571. try {
  2572. var de = document;
  2573. if (de.exitFullscreen) {
  2574. de.exitFullscreen();
  2575. } else if (de.mozCancelFullScreen) {
  2576. de.mozCancelFullScreen();
  2577. } else if (de.webkitCancelFullScreen) {
  2578. de.webkitCancelFullScreen();
  2579. }
  2580. } catch (err) {}
  2581. },
  2582. fullele() {
  2583. return (
  2584. document.fullscreenElement ||
  2585. document.webkitFullscreenElement ||
  2586. document.msFullscreenElement ||
  2587. document.mozFullScreenElement ||
  2588. null
  2589. );
  2590. },
  2591. //判断是否全屏
  2592. isFullScreen() {
  2593. return !!(document.webkitIsFullScreen || this.fullele());
  2594. },
  2595. getUserMedia(constraints, success, error) {
  2596. console.log("getUserMedia===", constraints, "success:", success);
  2597. if (window.navigator.mediaDevices.getUserMedia) {
  2598. // 最新的标准API
  2599. window.navigator.mediaDevices
  2600. .getUserMedia(constraints)
  2601. .then(success)
  2602. .catch(error);
  2603. } else if (window.navigator.webkitGetUserMedia) {
  2604. // webkit核心浏览器
  2605. window.navigator.webkitGetUserMedia(constraints, success, error);
  2606. } else if (window.navigator.mozGetUserMedia) {
  2607. // firfox浏览器
  2608. window.navigator.mozGetUserMedia(constraints, success, error);
  2609. } else if (window.navigator.getUserMedia) {
  2610. // 旧版API
  2611. window.navigator.getUserMedia(constraints, success, error);
  2612. }
  2613. },
  2614. photographSuccess(stream) {
  2615. console.log("有摄像头---", stream);
  2616. this.photoPopup = true;
  2617. this.isTaking = true;
  2618. this.enableAutoRotation = false;
  2619. this.$nextTick(() => {
  2620. const box = document.querySelector(".photo_v");
  2621. const video = box.querySelector("video");
  2622. video.srcObject = stream;
  2623. video.play();
  2624. });
  2625. },
  2626. photographError(err) {
  2627. console.log("没有摄像头:", err);
  2628. uni.showModal({
  2629. title: "提示",
  2630. content:
  2631. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  2632. cancelText: "取消",
  2633. confirmText: "确定",
  2634. success: (res) => {
  2635. if (res.confirm) {
  2636. uni.navigateBack();
  2637. } else if (res.cancel) {
  2638. }
  2639. },
  2640. });
  2641. },
  2642. },
  2643. };
  2644. </script>
  2645. <style lang="scss" scope>
  2646. @import "./css/detail.scss";
  2647. .top {
  2648. &__header {
  2649. position: relative;
  2650. width: 100%;
  2651. height: 150rpx;
  2652. padding: 24rpx 150rpx 24rpx 24rpx;
  2653. .img {
  2654. position: absolute;
  2655. left: 0;
  2656. top: 0;
  2657. width: 100%;
  2658. }
  2659. .note {
  2660. position: relative;
  2661. z-index: 10;
  2662. font-size: 24rpx;
  2663. font-family: PingFang SC;
  2664. font-weight: bold;
  2665. color: #efdbff;
  2666. }
  2667. .title {
  2668. position: relative;
  2669. z-index: 10;
  2670. font-size: 26rpx;
  2671. font-family: PingFang SC;
  2672. font-weight: bold;
  2673. color: #ffffff;
  2674. }
  2675. }
  2676. }
  2677. #top {
  2678. position: relative;
  2679. z-index: 99;
  2680. }
  2681. .polyv_detail {
  2682. display: flex;
  2683. flex-direction: column;
  2684. height: 100vh;
  2685. position: relative;
  2686. top: 0;
  2687. left: 0;
  2688. .pops {
  2689. position: absolute;
  2690. top: 0;
  2691. left: 0;
  2692. background: #ccc;
  2693. opacity: 0.5;
  2694. width: 100%;
  2695. height: 300rpx;
  2696. z-index: 9999;
  2697. }
  2698. .box {
  2699. flex: 1;
  2700. overflow: hidden;
  2701. margin: 16rpx 16rpx 100rpx 16rpx;
  2702. .box_in {
  2703. height: 100%;
  2704. }
  2705. }
  2706. .first_ml {
  2707. margin: 16rpx 16rpx 16rpx 16rpx;
  2708. }
  2709. }
  2710. .btnSet {
  2711. width: 440rpx;
  2712. height: 80rpx;
  2713. background: #007aff;
  2714. border-radius: 40rpx;
  2715. color: #ffffff;
  2716. font-size: 28rpx;
  2717. line-height: 80rpx;
  2718. }
  2719. .lecture-content {
  2720. background: #fff;
  2721. margin-top: 10rpx;
  2722. padding: 10rpx;
  2723. border-radius: 16rpx;
  2724. }
  2725. .photoBox {
  2726. width: 100%;
  2727. // background-color: #ffffff;
  2728. // border-radius: 24px 24px 0px 0px;
  2729. .photoTop {
  2730. width: 100%;
  2731. height: 74rpx;
  2732. border-radius: 20px 20px 0px 0px;
  2733. background-color: #ffffff;
  2734. display: flex;
  2735. align-items: center;
  2736. justify-content: center;
  2737. padding: 0rpx 38rpx;
  2738. .centersq {
  2739. color: #333;
  2740. font-size: 30rpx;
  2741. font-weight: 500;
  2742. }
  2743. }
  2744. .photoCenter {
  2745. width: 750rpx;
  2746. height: 75vh;
  2747. position: relative;
  2748. .center_camera {
  2749. width: 100%;
  2750. height: 75vh;
  2751. position: fixed;
  2752. .head_take {
  2753. width: 100%;
  2754. height: 75vh;
  2755. display: flex;
  2756. flex-direction: column;
  2757. }
  2758. .headTake_up {
  2759. width: 100%;
  2760. height: 100rpx;
  2761. }
  2762. .headTake_minddle {
  2763. display: flex;
  2764. .min_img {
  2765. width: 500rpx;
  2766. height: 550rpx;
  2767. }
  2768. .min_left,
  2769. .min_right {
  2770. flex: 1;
  2771. height: 550rpx;
  2772. }
  2773. }
  2774. .headTake_down {
  2775. width: 100%;
  2776. flex: 1;
  2777. }
  2778. .color {
  2779. background-color: #333;
  2780. opacity: 0.5;
  2781. }
  2782. .photo_v {
  2783. width: 100%;
  2784. height: 100%;
  2785. }
  2786. .mask {
  2787. width: 500rpx;
  2788. height: 550rpx;
  2789. position: absolute;
  2790. top: 100rpx;
  2791. left: 0;
  2792. right: 0;
  2793. bottom: 0;
  2794. margin: 0 auto;
  2795. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  2796. }
  2797. }
  2798. .custom {
  2799. width: 750rpx;
  2800. height: 75vh;
  2801. position: absolute;
  2802. z-index: 1000;
  2803. top: 0;
  2804. left: 0;
  2805. image {
  2806. width: 100%;
  2807. height: 100%;
  2808. }
  2809. }
  2810. }
  2811. .btns {
  2812. display: flex;
  2813. .takePhoto_btn {
  2814. width: 100%;
  2815. display: flex;
  2816. align-items: center;
  2817. justify-content: space-between;
  2818. background: #a9a7a9;
  2819. padding: 40rpx 26rpx;
  2820. .middle_btn {
  2821. width: 120rpx;
  2822. height: 120rpx;
  2823. border-radius: 40rpx;
  2824. border: 4rpx solid #ffffff;
  2825. display: flex;
  2826. align-items: center;
  2827. justify-content: center;
  2828. }
  2829. .square {
  2830. width: 96rpx;
  2831. height: 96rpx;
  2832. background: #ffffff;
  2833. border-radius: 28rpx;
  2834. }
  2835. .rights {
  2836. font-size: 32rpx;
  2837. font-weight: 500;
  2838. color: #ffffff;
  2839. }
  2840. }
  2841. .btnResult {
  2842. height: 100rpx;
  2843. flex: 1;
  2844. background-color: #07c160;
  2845. text-align: center;
  2846. line-height: 100rpx;
  2847. color: #fff;
  2848. font-size: 32rpx;
  2849. font-weight: bold;
  2850. }
  2851. }
  2852. }
  2853. .tBox {
  2854. display: flex;
  2855. align-items: center;
  2856. padding-top: 10rpx;
  2857. }
  2858. .title {
  2859. font-size: 24rpx;
  2860. color: #999999;
  2861. }
  2862. .t_content1 {
  2863. color: #007aff;
  2864. margin-left: 10rpx;
  2865. }
  2866. .tag1 {
  2867. border: 2rpx solid #007aff;
  2868. border-radius: 8rpx;
  2869. font-size: 20rpx;
  2870. color: #007aff;
  2871. padding: 5rpx;
  2872. }
  2873. .b_title {
  2874. color: #333333;
  2875. font-size: 30rpx;
  2876. font-weight: bold;
  2877. }
  2878. page {
  2879. background: #eaeef1;
  2880. }
  2881. .menuBox {
  2882. width: 100%;
  2883. background: #ffffff;
  2884. border-radius: 16rpx;
  2885. padding: 0rpx 20rpx;
  2886. margin-bottom: 20rpx;
  2887. }
  2888. .btnspric {
  2889. border-top: 1rpx solid #eee;
  2890. display: flex;
  2891. align-items: center;
  2892. justify-content: space-between;
  2893. height: 108rpx;
  2894. padding-left: 43rpx;
  2895. padding-right: 32rpx;
  2896. }
  2897. .btnspric > .lefprL {
  2898. font-size: 36rpx;
  2899. color: #0c141f;
  2900. font-weight: bold;
  2901. }
  2902. .btnspric > .lefprR {
  2903. padding: 0rpx 24rpx;
  2904. height: 60rpx;
  2905. line-height: 60rpx;
  2906. text-align: center;
  2907. color: #fff;
  2908. background: #32467b;
  2909. border-radius: 24rpx;
  2910. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2911. }
  2912. .yhj,
  2913. .hdyhj {
  2914. padding: 24rpx 29rpx 24rpx 34rpx;
  2915. }
  2916. .yhj {
  2917. border-bottom: 16rpx solid #f9f9f9;
  2918. }
  2919. .yhjtit {
  2920. font-size: 30rpx;
  2921. color: #0c141f;
  2922. font-weight: 500;
  2923. margin-bottom: 14rpx;
  2924. }
  2925. .yhjList {
  2926. display: flex;
  2927. align-items: center;
  2928. justify-content: space-between;
  2929. margin-bottom: 14rpx;
  2930. }
  2931. .yhjList > .yhjLefts {
  2932. display: flex;
  2933. align-items: center;
  2934. }
  2935. .yhjLefts > .yhl {
  2936. color: #32467b;
  2937. font-size: 30rpx;
  2938. margin-right: 31rpx;
  2939. }
  2940. .yhjLefts > .yhbq {
  2941. font-size: 24rpx;
  2942. color: #ff9500;
  2943. border-radius: 18rpx;
  2944. background-color: rgba(255, 149, 0, 0.2);
  2945. border: 2rpx solid #ff9500;
  2946. height: 38rpx;
  2947. line-height: 38rpx;
  2948. padding: 0rpx 16rpx;
  2949. }
  2950. .ts {
  2951. font-size: 24rpx;
  2952. color: #999;
  2953. margin: 14rpx 0rpx;
  2954. padding-right: 29rpx;
  2955. padding-left: 34rpx;
  2956. }
  2957. .yh {
  2958. padding-top: 20rpx;
  2959. }
  2960. .yh > .yhtitle {
  2961. display: flex;
  2962. align-items: center;
  2963. justify-content: space-between;
  2964. padding-right: 29rpx;
  2965. padding-left: 34rpx;
  2966. }
  2967. .priceBxs {
  2968. display: flex;
  2969. align-items: center;
  2970. }
  2971. .priceBxs > .pricleft {
  2972. border-radius: 24rpx;
  2973. border: 1rpx solid #e91313;
  2974. background-color: rgba(233, 19, 19, 0.1);
  2975. padding: 0rpx 18rpx;
  2976. height: 49rpx;
  2977. line-height: 49rpx;
  2978. text-align: center;
  2979. font-size: 30rpx;
  2980. font-weight: 500;
  2981. color: #e91313;
  2982. margin-right: 13rpx;
  2983. }
  2984. .topBox {
  2985. padding: 32rpx 32rpx 24rpx;
  2986. border-bottom: 1rpx solid #eeeeee;
  2987. }
  2988. .topBox > .boldFonstType {
  2989. font-weight: 500;
  2990. font-size: 30rpx;
  2991. margin: 16rpx 0rpx 23rpx;
  2992. }
  2993. .topBox > .firstTopL {
  2994. display: flex;
  2995. align-items: center;
  2996. }
  2997. .topBox > .firstTopL > .imageBs {
  2998. width: 331rpx;
  2999. height: 160rpx;
  3000. border-radius: 6rpx;
  3001. overflow: hidden;
  3002. margin-right: 8rpx;
  3003. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  3004. }
  3005. .topBox > .firstTopL > .imageBs > image {
  3006. width: 100%;
  3007. height: 100%;
  3008. }
  3009. .topBox > .firstTopL > .textBs {
  3010. font-size: 30rpx;
  3011. font-weight: bold;
  3012. color: #0c141f;
  3013. }
  3014. .content {
  3015. padding: 24rpx;
  3016. text-align: left;
  3017. }
  3018. .catalogBox {
  3019. display: flex;
  3020. align-items: center;
  3021. flex-wrap: nowrap;
  3022. overflow-x: auto;
  3023. padding-left: 38rpx;
  3024. max-height: 305rpx;
  3025. overflow-y: auto;
  3026. transition: all 0.4s;
  3027. }
  3028. .catalogBox > .catalogA {
  3029. min-width: 200rpx;
  3030. height: 48rpx;
  3031. line-height: 48rpx;
  3032. // text-align: center;
  3033. border: 2rpx solid transparent;
  3034. white-space: nowrap;
  3035. text-overflow: ellipsis;
  3036. overflow: hidden;
  3037. word-break: break-all;
  3038. border-radius: 10rpx;
  3039. background: rgba(22, 119, 255, 0.05);
  3040. padding-left: 19rpx;
  3041. box-sizing: border-box;
  3042. padding-right: 15rpx;
  3043. margin-right: 16rpx;
  3044. margin-bottom: 20rpx;
  3045. margin-top: 15rpx;
  3046. font-size: 24rpx;
  3047. color: #666;
  3048. }
  3049. .catalogBox > .activesq {
  3050. border-color: #1677ff;
  3051. }
  3052. .changeCatalogBox {
  3053. display: block;
  3054. }
  3055. .catalogBox::-webkit-scrollbar {
  3056. display: none; /* Chrome Safari */
  3057. }
  3058. .price_t2 {
  3059. font-size: 18rpx;
  3060. font-family: PingFang SC;
  3061. font-weight: 500;
  3062. text-decoration: line-through;
  3063. color: #999999;
  3064. }
  3065. .price_t1 {
  3066. font-size: 33rpx;
  3067. font-family: PingFang SC;
  3068. font-weight: bold;
  3069. color: #e91313;
  3070. }
  3071. .sc_t {
  3072. font-size: 22rpx;
  3073. color: #000000;
  3074. }
  3075. .sc {
  3076. width: 29rpx;
  3077. height: 29rpx;
  3078. }
  3079. .buy {
  3080. width: 138rpx;
  3081. height: 48rpx;
  3082. line-height: 48rpx;
  3083. background: #32467b;
  3084. border-radius: 10rpx;
  3085. color: #ffffff;
  3086. font-size: 28rpx;
  3087. text-align: center;
  3088. vertical-align: middle;
  3089. position: absolute;
  3090. right: 30rpx;
  3091. }
  3092. .video_body {
  3093. padding-bottom: 96rpx;
  3094. }
  3095. .footer_tab {
  3096. position: fixed;
  3097. bottom: 0;
  3098. height: 96rpx;
  3099. width: 100%;
  3100. background-color: #ffffff;
  3101. }
  3102. .tj_box {
  3103. width: 50%;
  3104. display: inline-block;
  3105. text-align: center;
  3106. margin: 10rpx 0;
  3107. }
  3108. .teacher_t {
  3109. font-size: 24rpx;
  3110. font-family: PingFang SC;
  3111. font-weight: 400;
  3112. color: #666666;
  3113. line-height: 36rpx;
  3114. margin-left: 15rpx;
  3115. }
  3116. .teacher_img {
  3117. width: 87rpx;
  3118. height: 129rpx;
  3119. }
  3120. .t2 {
  3121. font-size: 24rpx;
  3122. font-family: PingFang SC;
  3123. color: #666666;
  3124. line-height: 36rpx;
  3125. margin: 15rpx;
  3126. }
  3127. .r_t2 {
  3128. width: 201rpx;
  3129. height: 49rpx;
  3130. background: rgba(22, 119, 255, 0.05);
  3131. border: 1rpx solid #32467b;
  3132. border-radius: 16rpx;
  3133. color: #666666;
  3134. font-size: 23rpx;
  3135. text-align: center;
  3136. display: flex;
  3137. align-items: center;
  3138. padding: 5rpx;
  3139. }
  3140. .scroll_box {
  3141. width: 100%;
  3142. height: 60rpx;
  3143. background: #ffffff;
  3144. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  3145. white-space: nowrap;
  3146. overflow: hidden;
  3147. margin: 15rpx 0;
  3148. }
  3149. .r_sliper {
  3150. padding: 0 20rpx;
  3151. }
  3152. .top_line {
  3153. width: 6rpx;
  3154. height: 22rpx;
  3155. background: #32467b;
  3156. margin-right: 10rpx;
  3157. }
  3158. .video_t2 {
  3159. font-size: 24rpx;
  3160. font-family: PingFang SC;
  3161. font-weight: 500;
  3162. color: #666666;
  3163. }
  3164. .video_play {
  3165. position: absolute;
  3166. width: 95rpx;
  3167. height: 95rpx;
  3168. top: 0;
  3169. left: 0;
  3170. right: 0;
  3171. bottom: 0;
  3172. margin: auto;
  3173. }
  3174. .video_box {
  3175. position: relative;
  3176. }
  3177. .rotoct {
  3178. transform: rotate(90deg);
  3179. }
  3180. .slot-content {
  3181. padding: 0 20rpx;
  3182. }
  3183. .notice_modal {
  3184. .content {
  3185. width: 100%;
  3186. height: 100%;
  3187. padding: 56rpx 56rpx 56rpx 64rpx;
  3188. .title {
  3189. color: #222;
  3190. line-height: 40rpx;
  3191. font-size: 36rpx;
  3192. text-align: center;
  3193. font-weight: bold;
  3194. margin-bottom: 24rpx;
  3195. }
  3196. .text {
  3197. height: 340rpx;
  3198. line-height: 40rpx;
  3199. text-indent: 2em;
  3200. font-size: 32rpx;
  3201. color: #222;
  3202. }
  3203. .had_read {
  3204. width: 100%;
  3205. height: 88rpx;
  3206. line-height: 88rpx;
  3207. text-align: center;
  3208. background: #3577e8;
  3209. border-radius: 240rpx;
  3210. font-size: 32rpx;
  3211. font-weight: 500;
  3212. color: #fff;
  3213. margin-top: 20rpx;
  3214. &.gray {
  3215. background: #bbbec5;
  3216. }
  3217. }
  3218. }
  3219. }
  3220. .full_mulu {
  3221. position: absolute;
  3222. top: 100rpx;
  3223. right: 20rpx;
  3224. width: 700rpx;
  3225. height: 515rpx;
  3226. color: #333;
  3227. display: flex;
  3228. align-items: center;
  3229. justify-content: space-between;
  3230. z-index: 99999;
  3231. .mulus {
  3232. width: 623rpx;
  3233. // height: 515rpx;
  3234. height: 400rpx;
  3235. overflow-y: scroll;
  3236. // overflow: scroll;
  3237. }
  3238. .mulu_box_in {
  3239. background-color: #b7b7b7;
  3240. border-radius: 16rpx;
  3241. // transition: all 0.5s;
  3242. &::after {
  3243. content: "";
  3244. width: 0;
  3245. height: 0;
  3246. position: absolute;
  3247. top: 235rpx;
  3248. right: 27px;
  3249. border-top: 16rpx solid transparent;
  3250. border-right: 16rpx solid transparent;
  3251. border-left: 16rpx solid #b7b7b7;
  3252. border-bottom: 16rpx solid transparent;
  3253. }
  3254. }
  3255. .mulu_box_out {
  3256. // visibility: hidden;
  3257. display: none;
  3258. }
  3259. .menuBox_mulu {
  3260. // width: 100%;
  3261. background: #ffffff;
  3262. border-radius: 16rpx;
  3263. padding: 0rpx 20rpx;
  3264. margin-bottom: 20rpx;
  3265. }
  3266. .ml_img {
  3267. position: absolute;
  3268. right: 0;
  3269. top: 100rpx;
  3270. }
  3271. .items {
  3272. width: 620rpx;
  3273. height: 100rpx;
  3274. border: 1rpx solid red;
  3275. }
  3276. }
  3277. </style>