detail.vue 94 KB

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