detail.vue 94 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326
  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. // 打回 需重修
  1069. if (item.rebuild === 0) {
  1070. this.$navTo.togo("/pages2/learn/details", {
  1071. id: item.courseId,
  1072. gradeId: item.gradeId,
  1073. goodsId: this.goodsId,
  1074. orderGoodsId: this.orderGoodsId,
  1075. });
  1076. return;
  1077. }
  1078. if (type) {
  1079. this.teacherIndex = 0;
  1080. this.goodsTeacher.forEach((citem) => {
  1081. if (citem.courseList.some((x) => x.courseId == item.courseId)) {
  1082. this.teacherList = citem.teaList;
  1083. }
  1084. });
  1085. }
  1086. this.sectionItem = {};
  1087. this.toggleCourseShow = false;
  1088. this.courseId = item.courseId;
  1089. this.originOnShow();
  1090. },
  1091. async nextCourses(item, type) {
  1092. this.vid = "";
  1093. this.hasStart = true;
  1094. await this.originUnload();
  1095. this.courseId = item.courseId;
  1096. this.gradeId = item.gradeId;
  1097. this.toggleCourseShow = false;
  1098. },
  1099. clickLeft() {
  1100. // uni.navigateBack()
  1101. uni.switchTab({
  1102. url: "/pages/learn/index",
  1103. });
  1104. },
  1105. toBack(delta = 1) {
  1106. uni.navigateBack({
  1107. delta,
  1108. });
  1109. },
  1110. markConfirm() {
  1111. uni.setClipboardData({
  1112. data: this.markContent,
  1113. success: () => {
  1114. setTimeout(this.toBack, 1000);
  1115. },
  1116. });
  1117. },
  1118. closeNotice() {
  1119. this.$api
  1120. .baseHandoutTip({
  1121. orderGoodsId: this.orderGoodsId,
  1122. })
  1123. .then((res) => {});
  1124. },
  1125. noticeConfirm() {
  1126. if (this.CountTo < 0) {
  1127. this.noticeShow = false;
  1128. if (this.handoutTipLength == 0 && this.goodsPlayConfig.autoPlay > 0) {
  1129. this.autoplay = true;
  1130. this.refPlv.resumeVideo();
  1131. }
  1132. }
  1133. },
  1134. baseHandoutTipList() {
  1135. this.$api
  1136. .baseHandoutTipList({
  1137. orderGoodsId: this.orderGoodsId,
  1138. })
  1139. .then((res) => {
  1140. this.handoutTipLength = res.data.rows.length;
  1141. if (res.data.rows.length == 0) {
  1142. this.noticeShow = true;
  1143. if (this.CountTo == 30) {
  1144. var timer = setInterval(() => {
  1145. this.CountTo--;
  1146. if (this.CountTo < 0) {
  1147. clearInterval(timer);
  1148. }
  1149. }, 1000);
  1150. }
  1151. } else {
  1152. this.CountTo = -1;
  1153. }
  1154. });
  1155. },
  1156. /**
  1157. * 获取上次观看的直播
  1158. */
  1159. studyRecordGetLastLive() {
  1160. this.$api
  1161. .studyRecordGetLastLive({
  1162. orderGoodsId: this.orderGoodsId,
  1163. courseId: this.courseId,
  1164. })
  1165. .then((res) => {
  1166. this.updateLiveLast(res.data.data);
  1167. });
  1168. },
  1169. async initPlayVideo(sectionItem) {
  1170. this.moduleId = sectionItem.moduleId;
  1171. this.chapterId = sectionItem.chapterId;
  1172. if (sectionItem.sectionType == 1) {
  1173. //录播
  1174. await this.getPhotoLastRecord(); // 获取拍照历史
  1175. this.playVideo(sectionItem);
  1176. } else if (sectionItem.sectionType == 2) {
  1177. //直播
  1178. this.studyRecordGetLastLive();
  1179. } else if (sectionItem.sectionType == 3) {
  1180. //回放
  1181. this.playVideo(sectionItem);
  1182. } else if (sectionItem.doType == 2) {
  1183. uni.showModal({
  1184. title: "温馨提示",
  1185. content: "当前节视频已学完,是否进入考试?",
  1186. success: (res) => {
  1187. if (res.confirm) {
  1188. this.toQuestionBank(sectionItem);
  1189. }
  1190. },
  1191. });
  1192. return;
  1193. }
  1194. },
  1195. toQuestionBank(sectionItem) {
  1196. uni.navigateTo({
  1197. url:
  1198. "/pages2/class/questionBank?courseId=" +
  1199. this.courseId +
  1200. "&gradeId=" +
  1201. this.gradeId +
  1202. "&isFromVideo=1&id=" +
  1203. sectionItem.id +
  1204. "&goodsid=" +
  1205. this.goodsId +
  1206. "&moduleId=" +
  1207. (sectionItem.moduleId || 0) +
  1208. "&chapterId=" +
  1209. (sectionItem.chapterId || 0) +
  1210. "&orderGoodsId=" +
  1211. this.orderGoodsId +
  1212. "&type=" +
  1213. (sectionItem.type == 4 ? 1 : 3) +
  1214. "&learning=" +
  1215. sectionItem.studyStatus +
  1216. "&isBackVideo=" +
  1217. 1,
  1218. });
  1219. },
  1220. studyRecordQueryLiveLast() {
  1221. // /study/record/queryLiveLast
  1222. this.$api
  1223. .studyRecordQueryLiveLast({
  1224. gradeId: this.gradeId,
  1225. orderGoodsId: this.orderGoodsId,
  1226. courseId: this.courseId,
  1227. })
  1228. .then((res) => {
  1229. let { data } = res.data;
  1230. if (!data.sectionId) {
  1231. data = this.menuAllList[0];
  1232. } else {
  1233. // if (data.learning == 1 && this.orderNum == 2) {
  1234. // let next = this.menuAllList.find((e) => e.studyStatus != 1);
  1235. // next && (data = next);
  1236. // }
  1237. }
  1238. this.initPlayVideo(data);
  1239. });
  1240. },
  1241. /**
  1242. * 模块大节播放完毕,刷新列表
  1243. */
  1244. sectionPlayEnd(isRebuild, index) {
  1245. if (this.reMenuList.length > 0) {
  1246. //有重修目录
  1247. if (isRebuild.isRebuild) {
  1248. //从重修点击
  1249. this.$api
  1250. .reMenuList({
  1251. orderGoodsId: this.orderGoodsId,
  1252. courseId: this.courseId,
  1253. rebuild: 1,
  1254. gradeId: this.gradeId,
  1255. })
  1256. .then((res) => {
  1257. if (res.data.code == 200) {
  1258. if (res.data.rows.length) {
  1259. res.data.rows[index].name = res.data.rows[index].menuName;
  1260. this.$set(this.reMenuList, index, res.data.rows[index]);
  1261. for (let i = 0; i < res.data.rows.length; i++) {
  1262. let item = res.data.rows[i];
  1263. item.down = true;
  1264. item.id = item.menuId;
  1265. item.name = item.menuName;
  1266. }
  1267. this.reMenuList = [];
  1268. this.$nextTick(() => {
  1269. this.reMenuList = res.data.rows;
  1270. // console.log(this.reMenuList,'this.reMenuList1')
  1271. });
  1272. } else {
  1273. this.reMenuList = [];
  1274. }
  1275. }
  1276. });
  1277. this.$api
  1278. .reMenuList({
  1279. courseId: this.courseId,
  1280. gradeId: this.gradeId,
  1281. orderGoodsId: this.orderGoodsId,
  1282. })
  1283. .then((res) => {
  1284. if (res.data.code == 200) {
  1285. for (let i = 0; i < res.data.rows.length; i++) {
  1286. let item = res.data.rows[i];
  1287. item.down = true;
  1288. item.id = item.menuId;
  1289. item.name = item.menuName;
  1290. item.menuType = item.type;
  1291. }
  1292. this.menuList = [];
  1293. this.$nextTick(() => {
  1294. this.menuList = res.data.rows;
  1295. });
  1296. }
  1297. });
  1298. } else {
  1299. //从普通目录点击
  1300. this.$api
  1301. .reMenuList({
  1302. courseId: this.courseId,
  1303. gradeId: this.gradeId,
  1304. orderGoodsId: this.orderGoodsId,
  1305. })
  1306. .then((res) => {
  1307. if (res.data.code == 200) {
  1308. res.data.rows[index].name = res.data.rows[index].menuName;
  1309. res.data.rows[index].id = res.data.rows[index].menuId;
  1310. this.$set(this.menuList, index, res.data.rows[index]);
  1311. }
  1312. });
  1313. this.$api
  1314. .reMenuList({
  1315. orderGoodsId: this.orderGoodsId,
  1316. courseId: this.courseId,
  1317. rebuild: 1,
  1318. gradeId: this.gradeId,
  1319. })
  1320. .then((res) => {
  1321. if (res.data.code == 200) {
  1322. if (res.data.rows.length) {
  1323. // for (let i = 0; i < res.data.rows.length; i++) {
  1324. // let item = res.data.rows[i];
  1325. // item.down = true;
  1326. // item.id = item.menuId;
  1327. // item.name = item.menuName;
  1328. // }
  1329. // this.reMenuList = res.data.rows;
  1330. } else {
  1331. this.reMenuList = [];
  1332. }
  1333. }
  1334. });
  1335. }
  1336. } else {
  1337. console.log("--模块大节播放完毕,刷新列表-");
  1338. //没有重修目录
  1339. this.$api
  1340. .reMenuList({
  1341. courseId: this.courseId,
  1342. gradeId: this.gradeId,
  1343. orderGoodsId: this.orderGoodsId,
  1344. })
  1345. .then((res) => {
  1346. if (res.data.code == 200) {
  1347. res.data.rows[index].name = res.data.rows[index].menuName;
  1348. res.data.rows[index].id = res.data.rows[index].menuId;
  1349. this.$set(this.menuList, index, res.data.rows[index]);
  1350. }
  1351. });
  1352. }
  1353. },
  1354. goLive(item) {
  1355. let moduleId = item.moduleId || 0;
  1356. let chapterId = item.chapterId || 0;
  1357. let sectionId = item.sectionId || item.menuId;
  1358. let uuid = new Date().valueOf() + "";
  1359. // buyCourse 是否购买课程:1是 0否
  1360. let encode = encodeURIComponent(
  1361. this.config.hostLive +
  1362. "/pages/live/index?token=" +
  1363. uni.getStorageSync("token") +
  1364. "&userInfo=" +
  1365. JSON.stringify(this.userInfo) +
  1366. "&channelId=" +
  1367. item.liveUrl +
  1368. "&gradeId=" +
  1369. this.gradeId +
  1370. "&courseId=" +
  1371. this.courseId +
  1372. "&goodsId=" +
  1373. this.goodsId +
  1374. "&orderGoodsId=" +
  1375. this.orderGoodsId +
  1376. "&sectionId=" +
  1377. sectionId +
  1378. "&chapterId=" +
  1379. chapterId +
  1380. "&moduleId=" +
  1381. moduleId +
  1382. "&buyCourse=1" +
  1383. "&ident=" +
  1384. uuid
  1385. );
  1386. uni.navigateTo({
  1387. url: `../../pages/webview/index?url=` + encode,
  1388. });
  1389. },
  1390. studyRecordMenuAllList() {
  1391. // study/record/menuAllList
  1392. return this.$api
  1393. .studMenuAllList({
  1394. courseId: this.courseId,
  1395. gradeId: this.gradeId,
  1396. goodsId: this.goodsId,
  1397. })
  1398. .then((res) => {
  1399. let nowTime = Number(new Date().getTime() / 1000).toFixed(0);
  1400. if (res.data.data) {
  1401. this.menuAllList = res.data.data.filter(
  1402. (e) => e.doType != 1 || (e.doType == 2 && e.studyStatus == 1)
  1403. );
  1404. this.livingItem = res.data.data.find(
  1405. (item) =>
  1406. item.liveStartTime <= nowTime && item.liveEndTime > nowTime
  1407. );
  1408. }
  1409. return Promise.resolve();
  1410. });
  1411. },
  1412. async getbaseprofiletplists() {
  1413. let {
  1414. data: { code, rows },
  1415. } = await this.$api.getbaseprofiletplists({
  1416. goodsId: this.goodsId,
  1417. orderGoodsId: this.orderGoodsId,
  1418. });
  1419. if (code === 200 && rows.length && rows[0].keyValue) {
  1420. let baseRes = await this.$api.getbaseprofiletpId(this.goodsId);
  1421. if (baseRes.data.code === 200 && baseRes.data.data) {
  1422. let {
  1423. data: { code, data },
  1424. } = await this.$api.getbaseprofiletpgetInfo({
  1425. goodsId: this.goodsId,
  1426. orderGoodsId: this.orderGoodsId,
  1427. });
  1428. if (
  1429. code === 200 &&
  1430. (!data || (data.status === 3 && data.changeStatus === 1))
  1431. ) {
  1432. uni.showModal({
  1433. content: !data
  1434. ? "请前往填写资料"
  1435. : "资料审核不通过,请前往重新填写",
  1436. cancelText: "返回",
  1437. success: (resultst) => {
  1438. if (resultst.confirm) {
  1439. this.$navTo.togo("/pages2/verify/input", {
  1440. id: this.goodsId,
  1441. orderGoodsId: this.orderGoodsId,
  1442. });
  1443. }
  1444. if (resultst.cancel) {
  1445. uni.navigateBack();
  1446. }
  1447. },
  1448. });
  1449. return Promise.reject();
  1450. } else if (data.status === 1 && JSON.parse(rows[0].keyValue2)[0]) {
  1451. let {
  1452. data: { code, data },
  1453. } = await this.$api.getbaseprofileStampgetInfo({
  1454. goodsId: this.goodsId,
  1455. orderGoodsId: this.orderGoodsId,
  1456. });
  1457. if (
  1458. code === 200 &&
  1459. (!data || (data.status === 3 && data.changeStatus === 1))
  1460. ) {
  1461. uni.showModal({
  1462. content: !data
  1463. ? "请前往填写盖章资料"
  1464. : "资料盖章审核不通过,请前往重新填写",
  1465. cancelText: "返回",
  1466. success: (resultst) => {
  1467. if (resultst.confirm) {
  1468. this.$navTo.togo("/pages2/verify/input2", {
  1469. id: this.goodsId,
  1470. orderGoodsId: this.orderGoodsId,
  1471. });
  1472. }
  1473. if (resultst.cancel) {
  1474. uni.navigateBack();
  1475. }
  1476. },
  1477. });
  1478. return Promise.reject();
  1479. }
  1480. }
  1481. }
  1482. }
  1483. return Promise.resolve();
  1484. },
  1485. async isCanLearn() {
  1486. await this.getbaseprofiletplists();
  1487. await this.getGradeInfo();
  1488. await this.getGoodsDetail();
  1489. },
  1490. /**
  1491. * 计算tabs宽度
  1492. */
  1493. itemWidth() {
  1494. return 100 / this.list.length + "%";
  1495. },
  1496. findMenuNextSection(index) {
  1497. for (let i = index + 1; i < this.reMenuList.length; i++) {
  1498. let item = this.reMenuList[i];
  1499. if (item.type == 3) {
  1500. return item;
  1501. }
  1502. }
  1503. return {};
  1504. },
  1505. loadedmetadata(event) {
  1506. this.refPlv = this.$refs.player;
  1507. },
  1508. getPhotoLastRecord() {
  1509. if (this.erJianErZao || !this.playSecIsLearn || this.photoNum <= 0) {
  1510. return;
  1511. }
  1512. let self = this;
  1513. let data = {
  1514. sectionId: parseInt(self.playSectionId),
  1515. goodsId: parseInt(self.goodsId),
  1516. courseId: parseInt(self.courseId),
  1517. gradeId: parseInt(self.gradeId),
  1518. chapterId: parseInt(self.chapterId),
  1519. moduleId: parseInt(self.moduleId),
  1520. orderGoodsId: this.orderGoodsId,
  1521. };
  1522. // /course/photo/log/getLastInfo'
  1523. this.$api.getPhotoLastRecord(data).then((res) => {
  1524. if (res.data.code == 200) {
  1525. //清空历史数据
  1526. self.photoHistoryList = [];
  1527. this.photoIndex = 0;
  1528. self.photoList = [];
  1529. for (let i = 0; i < res.data.data.length; i++) {
  1530. //-2存储随机拍照数组
  1531. if (res.data.data[i].photoIndex == -2) {
  1532. self.photoList =
  1533. res.data.data[i].timeInterval &&
  1534. res.data.data[i].timeInterval.split(",");
  1535. } else {
  1536. self.photoHistoryList.push(res.data.data[i].photoIndex);
  1537. }
  1538. }
  1539. // console.log('7777', this.photoHistoryList, this.photoList);
  1540. }
  1541. });
  1542. },
  1543. //postTime 只提交随机时间
  1544. postCoursePhotoRecord(postTime = false) {
  1545. return new Promise((resolve, reject) => {
  1546. let currentTime = 0;
  1547. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  1548. if (polyvPlayerContext) {
  1549. // #ifdef MP-WEIXIN
  1550. currentTime = polyvPlayerContext.getCurrentTime();
  1551. // #endif
  1552. // #ifdef H5
  1553. currentTime = polyvPlayerContext.j2s_getCurrentTime();
  1554. // #endif
  1555. }
  1556. let self = this;
  1557. let photoIndex = self.photoIndex;
  1558. let data = {
  1559. photo: self.ossAvatarUrl,
  1560. sectionId: parseInt(self.playSectionId),
  1561. goodsId: parseInt(self.goodsId),
  1562. courseId: parseInt(self.courseId),
  1563. photoTime: parseInt(currentTime > 0 ? currentTime : 0),
  1564. gradeId: parseInt(self.gradeId),
  1565. photoIndex: postTime ? -2 : parseInt(photoIndex), //从0算起,-2只提交随机时间
  1566. photoNum: parseInt(self.photoNum),
  1567. chapterId: parseInt(self.chapterId),
  1568. moduleId: parseInt(self.moduleId),
  1569. timeInterval: postTime ? self.photoList.join(",") : "",
  1570. orderGoodsId: this.orderGoodsId,
  1571. };
  1572. // console.log("提交接口", data);
  1573. this.$api
  1574. .coursePhotoRecord(data)
  1575. .then((res) => {
  1576. if (res.data.code == 200) {
  1577. resolve();
  1578. } else {
  1579. reject();
  1580. }
  1581. })
  1582. .catch((err) => {
  1583. reject();
  1584. });
  1585. });
  1586. },
  1587. randomNum(minNum, maxNum) {
  1588. switch (arguments.length) {
  1589. case 1:
  1590. return parseInt(Math.random() * minNum + 1, 10);
  1591. break;
  1592. case 2:
  1593. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  1594. break;
  1595. default:
  1596. return 0;
  1597. break;
  1598. }
  1599. },
  1600. //配置随机拍照时间
  1601. configPhoto() {
  1602. // var polyvPlayerContext = this.selectComponent("#playerVideo");
  1603. let totalVideoTime = 0;
  1604. let duration = 0;
  1605. // #ifdef MP-WEIXIN
  1606. totalVideoTime = polyvPlayerContext.getDuration();
  1607. duration = polyvPlayerContext.getCurrentTime();
  1608. // #endif
  1609. // #ifdef H5
  1610. totalVideoTime = polyvPlayerContext.j2s_getDuration();
  1611. duration = polyvPlayerContext.j2s_getCurrentTime();
  1612. // #endif
  1613. let photoNum = this.photoNum;
  1614. if (!this.photoConfig) {
  1615. this.photoConfig = true;
  1616. if (this.erJianErZao) {
  1617. this.photoList = this.randomConfig(totalVideoTime, duration);
  1618. return;
  1619. }
  1620. //没有历史拍照间隔数据
  1621. if (this.photoList.length == 0) {
  1622. if (totalVideoTime >= 900) {
  1623. //大于15分钟
  1624. if (photoNum == 1) {
  1625. //开头拍1张
  1626. this.photoList.push(0);
  1627. } else if (photoNum == 3) {
  1628. //拍3张
  1629. this.photoList.push(0); //开头拍一张
  1630. let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
  1631. let centerMinTime = centerTime - 300; //前后5分钟
  1632. let centerMaxTime = centerTime + 300;
  1633. let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
  1634. this.photoList.push(centerTakeTime); //中间拍一张
  1635. let endMaxTime = totalVideoTime - 60;
  1636. let endMinTime = totalVideoTime - 300;
  1637. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  1638. this.photoList.push(endTakeTime); //最后拍一张
  1639. }
  1640. } else {
  1641. //小于15分钟,只拍前后各一张
  1642. if (photoNum == 1) {
  1643. //开头拍1张
  1644. this.photoList.push(0);
  1645. } else if (photoNum == 3) {
  1646. this.photoList.push(1);
  1647. let centerTime = this.randomNum(
  1648. (1 / 3) * totalVideoTime,
  1649. (2 / 3) * totalVideoTime
  1650. );
  1651. this.photoList.push(centerTime);
  1652. let endTakeTime = this.randomNum(
  1653. (2 / 3) * totalVideoTime,
  1654. totalVideoTime
  1655. );
  1656. this.photoList.push(endTakeTime);
  1657. }
  1658. }
  1659. this.postCoursePhotoRecord(true); //提交随机拍照时间数组
  1660. }
  1661. //兼容已有观看历史
  1662. for (let i = 0; i < this.photoList.length - 1; i++) {
  1663. if (
  1664. this.photoList[i] < duration &&
  1665. this.photoList[i + 1] > duration
  1666. ) {
  1667. this.photoIndex = i + 1;
  1668. break;
  1669. }
  1670. if (duration > this.photoList[this.photoList.length - 1]) {
  1671. this.photoIndex = this.photoList.length - 1; //取最后一个下标
  1672. break;
  1673. }
  1674. }
  1675. }
  1676. },
  1677. // 随机拍摄时间
  1678. randomConfig(totalVideoTime, duration) {
  1679. this.photoHistoryList = [];
  1680. let photoList = [duration];
  1681. let pre = duration;
  1682. if (totalVideoTime > 300) {
  1683. while (pre <= totalVideoTime) {
  1684. pre += this.randomNum(780, 900);
  1685. pre <= totalVideoTime && photoList.push(pre);
  1686. }
  1687. if (totalVideoTime - 300 > photoList.slice(-1)[0]) {
  1688. photoList.push(this.randomNum(totalVideoTime - 180, totalVideoTime));
  1689. }
  1690. }
  1691. return photoList;
  1692. },
  1693. closePlv() {
  1694. if (plv) {
  1695. plv.destroy();
  1696. }
  1697. },
  1698. openSetting(res) {
  1699. console.log(res, 98);
  1700. },
  1701. getCameraSetting() {
  1702. const self = this;
  1703. // 不支持h5
  1704. wx.getSetting({
  1705. success: (res) => {
  1706. if (res.authSetting["scope.camera"]) {
  1707. // 用户已经授权
  1708. self.showSet = false;
  1709. this.prendreAutoCarme = false;
  1710. } else {
  1711. this.prendreAutoCarme = true;
  1712. // 用户还没有授权,向用户发起授权请求
  1713. wx.authorize({
  1714. scope: "scope.camera",
  1715. success: () => {
  1716. // 用户同意授权
  1717. self.showSet = false;
  1718. this.prendreAutoCarme = false;
  1719. },
  1720. fail: () => {
  1721. // 用户不同意授权
  1722. self.showSet = true;
  1723. },
  1724. });
  1725. }
  1726. },
  1727. fail: (res) => {},
  1728. });
  1729. },
  1730. studyNotice() {
  1731. this.noticeShow = true;
  1732. },
  1733. //正常播放视频
  1734. async playVideo(item) {
  1735. this.sectionItem = item;
  1736. console.log(this.sectionItem, "this.sectionItem");
  1737. if (this.timer) {
  1738. clearInterval(this.timer);
  1739. }
  1740. this.recordObj = item.videoCurrentTime
  1741. ? { videoCurrentTime: item.videoCurrentTime }
  1742. : await this.getRecordLast(item);
  1743. this.$store.commit("setPlayVID", {
  1744. playVID: item.recordingUrl,
  1745. });
  1746. this.$store.commit("setPlaySectionId", {
  1747. playSectionId: item.sectionId,
  1748. });
  1749. this.startStatus = true;
  1750. if (this.refPlv) {
  1751. this.refPlv.changeVid({
  1752. vid: item.recordingUrl,
  1753. videoCurrentTime: this.recordObj.videoCurrentTime,
  1754. });
  1755. }
  1756. },
  1757. getRecordLast(sectionItem) {
  1758. let { chapterId, sectionId, courseId, moduleId } = sectionItem;
  1759. return new Promise((resolve) => {
  1760. let data = {
  1761. gradeId:
  1762. this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
  1763. goodsId:
  1764. this.goodsId || this.goodsId == 0 ? Number(this.goodsId) : null,
  1765. sectionId: sectionId || 0,
  1766. courseId: courseId || courseId == 0 ? Number(courseId) : null,
  1767. chapterId: chapterId || 0,
  1768. moduleId: moduleId || 0,
  1769. orderGoodsId: this.orderGoodsId,
  1770. };
  1771. this.$api.recordLast(data).then((res) => {
  1772. resolve(res.data.data);
  1773. });
  1774. });
  1775. },
  1776. jumpNote(item) {
  1777. this.$u.toast("即将跳到笔记位置");
  1778. if (this.playSectionId != item.sectionId) {
  1779. this.initPlayVideo({
  1780. sectionType: 1,
  1781. ...item,
  1782. videoCurrentTime: Number(item.noteSecond),
  1783. });
  1784. } else {
  1785. this.refPlv.seekVideo(item.noteSecond);
  1786. }
  1787. },
  1788. getGradeInfo() {
  1789. // 即刻 1 待定2 日期3
  1790. return this.$api.goodsGradeInfo(this.gradeId).then((res) => {
  1791. if (res.data.code == 200) {
  1792. let { data } = res.data;
  1793. if (
  1794. data.learningStatus == 2 ||
  1795. (data.learningStatus == 3 &&
  1796. Number(data.learningTimeStart) > Number(new Date() / 1000))
  1797. ) {
  1798. uni.showModal({
  1799. showCancel: false,
  1800. confirmText: "确定",
  1801. content:
  1802. "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
  1803. success: function (resultst) {
  1804. uni.navigateBack();
  1805. },
  1806. });
  1807. return Promise.reject(123);
  1808. }
  1809. }
  1810. });
  1811. },
  1812. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  1813. if (!this.refPlv) {
  1814. return;
  1815. }
  1816. let currentTime = this.refPlv.playCurrentTime();
  1817. let PlayDuration = this.refPlv.playVideoTime();
  1818. if (currentTime < 10 && !this.ossAvatarUrl) {
  1819. return;
  1820. }
  1821. if (this.playChannelId > 0) {
  1822. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  1823. }
  1824. let self = this;
  1825. let data = {
  1826. fromPlat: 1, //来源平台 1小程序 2网站
  1827. photo: self.ossAvatarUrl,
  1828. sectionId: sectionId || 0,
  1829. goodsId: parseInt(self.goodsId),
  1830. courseId: parseInt(self.courseId),
  1831. orderGoodsId: this.orderGoodsId,
  1832. studyDuration: parseInt(
  1833. PlayDuration > 0 ? PlayDuration : self.studyDuration
  1834. ),
  1835. gradeId: parseInt(self.gradeId),
  1836. chapterId: this.chapterId || 0,
  1837. moduleId: this.moduleId || 0,
  1838. videoCurrentTime: parseInt(
  1839. currentTime > 0 ? currentTime : self.studyDuration
  1840. ),
  1841. erJianErZao: this.erJianErZao,
  1842. };
  1843. if (this.ossAvatarUrl) {
  1844. data.similarity = this.compareFaceData; // 相似度
  1845. }
  1846. if (status > 0) {
  1847. data.status = status;
  1848. }
  1849. console.log(data, "记录参数");
  1850. return new Promise((resolve, reject) => {
  1851. this.$api
  1852. .studyRecord(data)
  1853. .then((res) => {
  1854. console.log(res, "记录返回");
  1855. let { code, msg } = res.data;
  1856. if (code == 200) {
  1857. if (status > 0) {
  1858. this.studyRecordMenuAllList();
  1859. let moduleId = this.moduleId || 0;
  1860. let chapterId = this.chapterId || 0;
  1861. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  1862. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  1863. uni.$emit("playNext" + playNextIdisRebuild, {
  1864. fromRebuild: this.isRebuild,
  1865. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  1866. uni.$emit("playNext" + playNextId); //通知播放结束
  1867. }
  1868. self.ossAvatarUrl = "";
  1869. } else if (code == 600) {
  1870. uni.showModal({
  1871. showCancel: false,
  1872. title: "提示",
  1873. content: msg,
  1874. success: (resultst) => {
  1875. uni.navigateBack();
  1876. },
  1877. });
  1878. } else if (code == 558) {
  1879. this.CountTo1 = msg.split(",")[1];
  1880. this.noticeShow1 = true;
  1881. var timer = setInterval(() => {
  1882. this.CountTo1--;
  1883. if (this.CountTo1 < 0) {
  1884. this.noticeShow1 = false;
  1885. clearInterval(timer);
  1886. this.postStudyRecord(1);
  1887. }
  1888. }, 1000);
  1889. reject("中断执行");
  1890. } else {
  1891. this.uploadLock = false;
  1892. uni.showToast({
  1893. icon: "none",
  1894. title: res.data.msg,
  1895. duration: 2000,
  1896. });
  1897. if (this.erJianErZao && code == 559) {
  1898. this.isReach = true;
  1899. this.openPhoto();
  1900. }
  1901. if (code == 559 || code == 588) {
  1902. reject("中断执行");
  1903. }
  1904. }
  1905. resolve();
  1906. })
  1907. .catch((err) => {
  1908. this.studyRecordMenuAllList();
  1909. });
  1910. });
  1911. },
  1912. uploadFile(options, int) {
  1913. var self = this;
  1914. return new Promise((resolve, reject) => {
  1915. var data = {
  1916. imageStatus: int,
  1917. gradeId: this.gradeId,
  1918. orderGoodsId: this.orderGoodsId,
  1919. };
  1920. self.$api.aliyunpolicy(data).then((res) => {
  1921. if (res.data.code != 200) {
  1922. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1923. return;
  1924. }
  1925. var ossToken = res.data.data.resultContent;
  1926. if (ossToken.host == null || ossToken.host == undefined) {
  1927. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1928. return;
  1929. }
  1930. let filePath = "";
  1931. // #ifdef H5
  1932. var localData = options; //dataUrl为base64位
  1933. let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
  1934. let length = base.length;
  1935. let url = new Uint8Array(length);
  1936. while (length--) {
  1937. url[length] = base.charCodeAt(length);
  1938. }
  1939. filePath = new File([url], "a.jpg", {
  1940. type: "image/jpg",
  1941. });
  1942. uni.uploadFile({
  1943. url: ossToken.host,
  1944. name: "file",
  1945. file: filePath,
  1946. fileType: "image",
  1947. header: {
  1948. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1949. },
  1950. formData: {
  1951. key: ossToken.dir,
  1952. OSSAccessKeyId: ossToken.accessid,
  1953. policy: ossToken.policy,
  1954. Signature: ossToken.signature,
  1955. callback: ossToken.callback,
  1956. success_action_status: 200,
  1957. },
  1958. success: (result) => {
  1959. this.$u.toast("上传成功");
  1960. self.ossAvatarUrl = ossToken.dir;
  1961. resolve(ossToken.dir);
  1962. },
  1963. fail: (error) => {
  1964. uni.showToast({
  1965. title: "上传接口报错,请重新拍照上传" + error,
  1966. icon: "none",
  1967. });
  1968. this.openPhoto();
  1969. return;
  1970. },
  1971. });
  1972. // #endif
  1973. // #ifdef MP-WEIXIN
  1974. uni.uploadFile({
  1975. url: ossToken.host,
  1976. name: "file",
  1977. filePath: options,
  1978. fileType: "image",
  1979. header: {
  1980. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1981. },
  1982. formData: {
  1983. key: ossToken.dir,
  1984. OSSAccessKeyId: ossToken.accessid,
  1985. policy: ossToken.policy,
  1986. Signature: ossToken.signature,
  1987. callback: ossToken.callback,
  1988. success_action_status: 200,
  1989. },
  1990. success: (result) => {
  1991. // if (result.statusCode === 200) {
  1992. this.$u.toast("上传成功");
  1993. self.ossAvatarUrl = ossToken.dir;
  1994. resolve(ossToken.dir);
  1995. },
  1996. fail: (error) => {
  1997. uni.showToast({
  1998. title: "上传接口报错,请重新拍照上传" + error,
  1999. icon: "none",
  2000. });
  2001. this.openPhoto();
  2002. return;
  2003. },
  2004. });
  2005. // #endif
  2006. });
  2007. });
  2008. },
  2009. imageInfos() {
  2010. var self = this;
  2011. return new Promise(async (resolve, reject) => {
  2012. let resPath = await myCompressImage(this.avatarUrl || this.faceUrl, 50);
  2013. const waitUpload = await self.uploadFile(resPath, 0);
  2014. resolve(waitUpload);
  2015. });
  2016. },
  2017. timeEvent(playTime) {
  2018. this.configPhoto();
  2019. let photoTime = 0; //获取拍照秒数
  2020. for (let i = 0; i < this.photoList.length; i++) {
  2021. photoTime = Number(this.photoList[i]); //获取拍照秒数
  2022. if (
  2023. (this.erJianErZao && !this.photoHistoryList.length) ||
  2024. (photoTime < playTime && photoTime > playTime - 8)
  2025. ) {
  2026. //3秒区间内才触发拍照,避免拉动滚动条
  2027. if (this.photoHistoryList.indexOf(i) < 0) {
  2028. //不存在拍照历史,没有重修过,没有学过,则拍照
  2029. //启动拍照
  2030. //暂停
  2031. console.log("去拍照");
  2032. this.refPlv.playPause();
  2033. this.refPlv.exitFullScreen();
  2034. this.photoIndex = i;
  2035. if (
  2036. uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
  2037. this.goodsId
  2038. ) {
  2039. return this.openPhoto();
  2040. } else {
  2041. this.popupPhotoShow = true;
  2042. uni.setStorageSync(`tabkePhotoShow${this.goodsId}`, this.goodsId); // 本地缓存用来判断是否已经弹出过弹窗
  2043. }
  2044. }
  2045. }
  2046. }
  2047. },
  2048. closeToast() {
  2049. clearTimeout(this.toastTimer);
  2050. this.videoToastShow = false;
  2051. },
  2052. // 新增用户视频学习日志
  2053. studyLog() {
  2054. this.$http({
  2055. url: "/user/study/log",
  2056. method: "post",
  2057. data: {
  2058. goodsId: this.goodsId,
  2059. courseId: this.courseId,
  2060. moduleId: this.moduleId || 0,
  2061. chapterId: this.chapterId || 0,
  2062. sectionId: this.playSectionId || 0,
  2063. fromPlat: 1, //来源平台 1小程序 2PC网站
  2064. goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  2065. orderGoodsId: this.orderGoodsId,
  2066. },
  2067. }).then((res) => {});
  2068. },
  2069. timeupdate(time) {
  2070. // console.log("播放中", time);
  2071. this.clearPauseTimer();
  2072. if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
  2073. this.isReach = false;
  2074. this.timeEvent();
  2075. }
  2076. },
  2077. playing() {
  2078. console.log("playing");
  2079. if (this.noticeShow) {
  2080. this.refPlv.playPause();
  2081. return;
  2082. }
  2083. this.studyLog();
  2084. if (!this.recordObj.videoCurrentTime) {
  2085. this.postStudyRecord(0);
  2086. }
  2087. this.studyTimer && clearInterval(this.studyTimer);
  2088. this.studyTimer = setInterval(() => {
  2089. this.postStudyRecord(0);
  2090. }, 15000);
  2091. },
  2092. pause() {
  2093. this.erJianErZaoPauseTip();
  2094. clearInterval(this.timer);
  2095. clearInterval(this.studyTimer);
  2096. },
  2097. async ended() {
  2098. this.hasStart = false;
  2099. uni.showToast({
  2100. icon: "none",
  2101. title: "播放完毕",
  2102. });
  2103. clearInterval(this.timer);
  2104. clearInterval(this.studyTimer);
  2105. await this.postStudyRecord(1);
  2106. this.nextSection();
  2107. },
  2108. playerError() {
  2109. console.log(46546);
  2110. },
  2111. //播放下一节
  2112. nextSection() {
  2113. console.log("播放下一节");
  2114. if (!this.menuAllList.length) {
  2115. return;
  2116. }
  2117. this.curPlayIndex = this.menuAllList.findIndex((item) => {
  2118. let i_sectionId = item.sectionId || 0;
  2119. let i_chapterId = item.chapterId || 0;
  2120. let i_moduleId = item.moduleId || 0;
  2121. return (
  2122. i_sectionId == this.playSectionId &&
  2123. i_chapterId == this.chapterId &&
  2124. i_moduleId == this.moduleId
  2125. );
  2126. });
  2127. let data = this.menuAllList[this.curPlayIndex + 1];
  2128. if (!data) {
  2129. //第二个弹窗
  2130. uni.showModal({
  2131. title: "温馨提示",
  2132. content:
  2133. "恭喜您课程学习全部完成,教务会在1-3个工作日内完成学习初审,请耐心等待。",
  2134. showCancel: !this.erJianErZao,
  2135. success: (res) => {
  2136. if (res.confirm) {
  2137. uni.switchTab({
  2138. url: "/pages/learn/index",
  2139. });
  2140. }
  2141. },
  2142. });
  2143. } else {
  2144. if (data.doType == 2) {
  2145. if (data.studyStatus == 1) {
  2146. uni.showToast({
  2147. title: "试卷已合格!",
  2148. duration: 2000,
  2149. icon: "none",
  2150. });
  2151. return;
  2152. }
  2153. uni.showModal({
  2154. title: "温馨提示",
  2155. content: "当前节视频已学完,是否进入考试?",
  2156. success: (res) => {
  2157. if (res.confirm) {
  2158. this.toQuestionBank(data);
  2159. }
  2160. },
  2161. });
  2162. return;
  2163. }
  2164. uni.showModal({
  2165. title: "温馨提示",
  2166. content: "当前节视频已学完,继续学习下一节?",
  2167. success: async (res) => {
  2168. if (res.confirm) {
  2169. this.moduleId = data.moduleId;
  2170. this.chapterId = data.chapterId;
  2171. this.sectionId = data.sectionId;
  2172. if (data.sectionType == 1) {
  2173. //录播
  2174. this.$store.commit("setPlaySectionId", {
  2175. playSectionId: data.sectionId,
  2176. });
  2177. this.$store.commit("setPlayVID", {
  2178. playVID: data.recordingUrl,
  2179. });
  2180. this.hasStart = false;
  2181. this.photoConfig = false;
  2182. this.photoIndex = 0;
  2183. this.sectionItem = data;
  2184. await this.getPhotoLastRecord(); // 获取拍照历史
  2185. this.playVideo(data);
  2186. } else if (data.sectionType == 2) {
  2187. //直播
  2188. this.studyRecordGetLastLive();
  2189. } else if (data.sectionType == 3) {
  2190. //回放
  2191. this.$store.commit("setPlaySectionId", {
  2192. playSectionId: data.sectionId,
  2193. });
  2194. this.$store.commit("setPlayVID", {
  2195. playVID: data.recordingUrl,
  2196. });
  2197. this.sectionItem = data;
  2198. this.playVideo(data);
  2199. }
  2200. let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
  2201. this.$store.commit("updatePlayNextId", playNextId);
  2202. this.updateChapterOpen(true);
  2203. }
  2204. },
  2205. });
  2206. }
  2207. },
  2208. //拍照
  2209. openPhoto() {
  2210. if (polyvPlayerContext) {
  2211. // #ifdef MP-WEIXIN
  2212. polyvPlayerContext.exitFullScreen();
  2213. // #endif
  2214. // #ifdef H5
  2215. if (this.isFullScreen()) {
  2216. this.exitFullscreen();
  2217. }
  2218. // #endif
  2219. }
  2220. // #ifdef MP-WEIXIN
  2221. this.enableAutoRotation = false;
  2222. this.photoPopup = true;
  2223. this.isTaking = true;
  2224. uni.setKeepScreenOn({
  2225. keepScreenOn: true,
  2226. });
  2227. uni.authorize({
  2228. scope: "scope.camera",
  2229. success() {},
  2230. });
  2231. // #endif
  2232. // #ifdef H5
  2233. if (
  2234. (window.navigator.mediaDevices &&
  2235. window.navigator.mediaDevices.getUserMedia) ||
  2236. window.navigator.getUserMedia ||
  2237. window.navigator.webkitGetUserMedia ||
  2238. window.navigator.mozGetUserMedia
  2239. ) {
  2240. console.log("getUserMedia----");
  2241. // 调用用户媒体设备, 访问摄像头
  2242. this.getUserMedia(
  2243. {
  2244. video: {
  2245. width: 400,
  2246. height: 300,
  2247. facingMode: "user",
  2248. },
  2249. },
  2250. this.photographSuccess,
  2251. this.photographError
  2252. );
  2253. } else {
  2254. console.log("1111没有摄像");
  2255. this.photographError();
  2256. }
  2257. // #endif
  2258. },
  2259. /**
  2260. * 人脸匹配
  2261. */
  2262. faceRecognition() {
  2263. return new Promise((resolve) => {
  2264. // #ifdef MP-WEIXIN
  2265. let fileSystem = uni.getFileSystemManager();
  2266. fileSystem.readFile({
  2267. filePath: `${this.avatarUrl}`,
  2268. encoding: "base64",
  2269. position: 0,
  2270. success: (res) => {
  2271. let base64 = "data:image/jpg;base64," + res.data;
  2272. // console.log('base64Data人脸识别参数:', {
  2273. // imageA: base64,
  2274. // orderGoodsId: this.orderGoodsId,
  2275. // gradeId: this.gradeId,
  2276. // })
  2277. this.CompareFace(base64, resolve);
  2278. },
  2279. fail(err) {
  2280. // this.$u.toast('人脸识别错误!')
  2281. console.error(err, "err-----人脸识别错误");
  2282. },
  2283. });
  2284. // #endif
  2285. // #ifdef H5
  2286. this.CompareFace(this.faceUrl, resolve);
  2287. // #endif
  2288. });
  2289. },
  2290. CompareFace(url, resolve) {
  2291. let timer = setTimeout(() => {
  2292. uni.showToast({
  2293. icon: "none",
  2294. title: "拍照超时,请重新拍照",
  2295. duration: 2000,
  2296. success: () => {
  2297. setTimeout(() => {
  2298. uni.navigateBack();
  2299. }, 1000);
  2300. },
  2301. });
  2302. }, 10 * 1000);
  2303. this.$api
  2304. .faceCertificationCompareFace({
  2305. imageA: url,
  2306. orderGoodsId: this.orderGoodsId,
  2307. gradeId: this.gradeId,
  2308. })
  2309. .then((res) => {
  2310. clearTimeout(timer);
  2311. console.log(res, "人脸识别成功res");
  2312. resolve(res.data.data);
  2313. })
  2314. .catch((err) => {
  2315. clearTimeout(timer);
  2316. // 当前网络延迟,
  2317. console.log("人脸识别错误:", err);
  2318. uni.showModal({
  2319. content: "当前网络延迟",
  2320. showCancel: false,
  2321. success: (resultst) => {
  2322. if (resultst.confirm) {
  2323. uni.navigateBack();
  2324. }
  2325. },
  2326. });
  2327. });
  2328. },
  2329. // 确定拍照
  2330. async submit() {
  2331. if (this.uploadLock) {
  2332. return;
  2333. }
  2334. this.uploadLock = true;
  2335. let compareFaceData = await this.faceRecognition();
  2336. this.compareFaceData = compareFaceData;
  2337. if (compareFaceData >= 80) {
  2338. await this.imageInfos();
  2339. this.postCoursePhotoRecord()
  2340. .then(async (res) => {
  2341. this.photoHistoryList.push(this.photoIndex);
  2342. // console.log('拍照确定提交', this.photoHistoryList);
  2343. this.postStudyRecord(); //提交记录
  2344. if (this.erJianErZao && this.isReach) {
  2345. console.log("1校验");
  2346. await this.postStudyRecord(1);
  2347. this.photoPopup = false;
  2348. this.uploadLock = false;
  2349. this.enableAutoRotation = true;
  2350. this.nextSection();
  2351. return;
  2352. }
  2353. //恢复播放
  2354. // #ifdef MP-WEIXIN
  2355. uni.setKeepScreenOn({
  2356. keepScreenOn: false,
  2357. });
  2358. // #endif
  2359. this.photoPopup = false;
  2360. this.uploadLock = false;
  2361. this.enableAutoRotation = true;
  2362. this.refPlv.resumeVideo();
  2363. })
  2364. .catch((err) => {
  2365. console.log("拍照记录接口的err", err);
  2366. uni.showToast({
  2367. title: "上传接口报错,请重新拍照上传" + err,
  2368. icon: "none",
  2369. });
  2370. this.uploadLock = false;
  2371. this.openPhoto();
  2372. });
  2373. } else {
  2374. uni.showToast({
  2375. title: "人脸匹配不通过,请重新拍照上传",
  2376. icon: "none",
  2377. duration: 2000,
  2378. });
  2379. setTimeout(() => {
  2380. this.uploadLock = false;
  2381. this.openPhoto();
  2382. }, 2000);
  2383. }
  2384. },
  2385. reTake() {
  2386. this.isTaking = true;
  2387. // #ifdef H5
  2388. this.faceUrl = "";
  2389. this.getUserMedia(
  2390. {
  2391. video: {
  2392. width: 400,
  2393. height: 300,
  2394. facingMode: "user",
  2395. },
  2396. },
  2397. this.photographSuccess,
  2398. this.photographError
  2399. );
  2400. // #endif
  2401. },
  2402. toTakePhoto() {
  2403. this.popupPhotoShow = false;
  2404. this.openPhoto();
  2405. },
  2406. takePhTips() {
  2407. this.popupPhotoShow = true;
  2408. this.isTaking = false;
  2409. this.photoPopup = false;
  2410. this.enableAutoRotation = false;
  2411. },
  2412. //确认拍照
  2413. takePhoto() {
  2414. // #ifdef MP-WEIXIN
  2415. const ctx = uni.createCameraContext();
  2416. ctx.takePhoto({
  2417. quality: "high",
  2418. success: (res) => {
  2419. this.avatarUrl = res.tempImagePath;
  2420. console.log("开始拍照this.avatarUrl:", this.avatarUrl);
  2421. this.isTaking = false;
  2422. },
  2423. fail: (err) => {},
  2424. });
  2425. // #endif
  2426. // #ifdef H5
  2427. const canvas = document.createElement("canvas");
  2428. canvas.width = 400;
  2429. canvas.height = 400;
  2430. const context = canvas.getContext("2d");
  2431. const box = document.querySelector(".photo_v");
  2432. const video = box.querySelector("video");
  2433. context.drawImage(video, 0, 0, 400, 400);
  2434. this.faceUrl = canvas.toDataURL("image/png");
  2435. this.isTaking = false;
  2436. // #endif
  2437. },
  2438. playError(e) {
  2439. console.log(e);
  2440. },
  2441. //拍照报错
  2442. error(e) {
  2443. console.log(e.detail);
  2444. },
  2445. //关闭相机
  2446. closePhoto() {
  2447. this.photoPopup = false;
  2448. this.enableAutoRotation = true;
  2449. },
  2450. async userConfirmInfoDetail() {
  2451. let info = await this.$api.userConfirmInfoDetail({
  2452. orderGoodsId: this.orderGoodsId,
  2453. });
  2454. if (!info.data.data || info.data.data.pushInfo !== 1) {
  2455. uni.showModal({
  2456. showCancel: false,
  2457. title: "提示",
  2458. content: "开通信息推送不成功,无法进入学习!",
  2459. success: (resultst) => {
  2460. uni.navigateBack();
  2461. },
  2462. });
  2463. return Promise.reject();
  2464. }
  2465. },
  2466. checkFinishRequiredCourse() {
  2467. return this.$api
  2468. .checkFinishRequiredCourse({
  2469. businessId: this.goodsData.businessId,
  2470. goodsId: this.goodsId,
  2471. })
  2472. .then((res) => {
  2473. if (res.data.data > 0) {
  2474. uni.showModal({
  2475. showCancel: false,
  2476. confirmText: "确定",
  2477. content: "该业务层次下有未学完的商品,无法学习新商品!",
  2478. success: function (resultst) {
  2479. uni.navigateBack();
  2480. },
  2481. });
  2482. return Promise.reject();
  2483. }
  2484. return Promise.resolve();
  2485. });
  2486. },
  2487. async getGoodsDetail() {
  2488. let { data } = await this.$api.goodsDetail(this.goodsId);
  2489. this.goodsData = data.data;
  2490. this.erJianErZao = this.goodsData.erJianErZao;
  2491. this.erJianErZao && (await this.userConfirmInfoDetail());
  2492. this.option.periodWaitTime && (await this.checkFinishRequiredCourse());
  2493. this.goodsData.buyNote && this.baseHandoutTipList();
  2494. this.gradeId = this.goodsData.gradeId;
  2495. if (this.goodsData.goodsPlayConfig) {
  2496. this.goodsPlayConfig = JSON.parse(this.goodsData.goodsPlayConfig);
  2497. if (this.goodsPlayConfig.autoPlay > 0) {
  2498. this.autoplay = true;
  2499. }
  2500. if (this.goodsPlayConfig.drag > 0 && !this.erJianErZao) {
  2501. // #ifdef MP-WEIXIN
  2502. this.isAllowSeek = "yes";
  2503. // #endif
  2504. // #ifdef H5
  2505. this.isAllowSeek = "off";
  2506. // #endif
  2507. }
  2508. if (this.goodsPlayConfig.speed > 0) {
  2509. this.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  2510. }
  2511. }
  2512. if (this.goodsData.goodsPhotographConfig) {
  2513. this.goodsPhotographConfig = JSON.parse(
  2514. this.goodsData.goodsPhotographConfig
  2515. );
  2516. if (this.goodsPhotographConfig.photoNum > 0) {
  2517. this.photoNum = this.goodsPhotographConfig.photoNum;
  2518. }
  2519. }
  2520. },
  2521. getReMenuList() {
  2522. let self = this;
  2523. this.$api
  2524. .reMenuList({
  2525. orderGoodsId: this.orderGoodsId,
  2526. courseId: this.courseId,
  2527. rebuild: 1,
  2528. gradeId: this.gradeId,
  2529. })
  2530. .then((res) => {
  2531. if (res.data.code == 200) {
  2532. for (let i = 0; i < res.data.rows.length; i++) {
  2533. let item = res.data.rows[i];
  2534. item.down = true;
  2535. item.id = item.menuId;
  2536. item.name = item.menuName;
  2537. }
  2538. self.reMenuList = res.data.rows;
  2539. this.current = 0;
  2540. if (self.reMenuList.length > 0) {
  2541. this.showNotes = false;
  2542. if (Object.keys(this.sectionItem).length) {
  2543. let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
  2544. this.$store.commit("updatePlayNextId", playNextIdisRebuild);
  2545. }
  2546. } else {
  2547. if (Object.keys(this.sectionItem).length) {
  2548. let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
  2549. this.$store.commit("updatePlayNextId", playNextId);
  2550. }
  2551. }
  2552. }
  2553. });
  2554. },
  2555. courseDetail() {
  2556. this.$api.courseDetail(this.courseId).then((res) => {
  2557. if (res.data.code == 200) {
  2558. this.detail = res.data.data;
  2559. }
  2560. });
  2561. },
  2562. open(item) {
  2563. item.showChildren = !item.showChildren;
  2564. },
  2565. change(index) {
  2566. this.current = index;
  2567. },
  2568. clears() {
  2569. return new Promise((resolve, reject) => {
  2570. this.vid = "";
  2571. polyvPlayerContext && polyvPlayerContext.destroy();
  2572. polyvPlayerContext = null;
  2573. resolve();
  2574. });
  2575. },
  2576. /**
  2577. * 退出全屏
  2578. */
  2579. exitFullscreen() {
  2580. try {
  2581. var de = document;
  2582. if (de.exitFullscreen) {
  2583. de.exitFullscreen();
  2584. } else if (de.mozCancelFullScreen) {
  2585. de.mozCancelFullScreen();
  2586. } else if (de.webkitCancelFullScreen) {
  2587. de.webkitCancelFullScreen();
  2588. }
  2589. } catch (err) {}
  2590. },
  2591. fullele() {
  2592. return (
  2593. document.fullscreenElement ||
  2594. document.webkitFullscreenElement ||
  2595. document.msFullscreenElement ||
  2596. document.mozFullScreenElement ||
  2597. null
  2598. );
  2599. },
  2600. //判断是否全屏
  2601. isFullScreen() {
  2602. return !!(document.webkitIsFullScreen || this.fullele());
  2603. },
  2604. getUserMedia(constraints, success, error) {
  2605. console.log("getUserMedia===", constraints, "success:", success);
  2606. if (window.navigator.mediaDevices.getUserMedia) {
  2607. // 最新的标准API
  2608. window.navigator.mediaDevices
  2609. .getUserMedia(constraints)
  2610. .then(success)
  2611. .catch(error);
  2612. } else if (window.navigator.webkitGetUserMedia) {
  2613. // webkit核心浏览器
  2614. window.navigator.webkitGetUserMedia(constraints, success, error);
  2615. } else if (window.navigator.mozGetUserMedia) {
  2616. // firfox浏览器
  2617. window.navigator.mozGetUserMedia(constraints, success, error);
  2618. } else if (window.navigator.getUserMedia) {
  2619. // 旧版API
  2620. window.navigator.getUserMedia(constraints, success, error);
  2621. }
  2622. },
  2623. photographSuccess(stream) {
  2624. console.log("有摄像头---", stream);
  2625. this.photoPopup = true;
  2626. this.isTaking = true;
  2627. this.enableAutoRotation = false;
  2628. this.$nextTick(() => {
  2629. const box = document.querySelector(".photo_v");
  2630. const video = box.querySelector("video");
  2631. video.srcObject = stream;
  2632. video.play();
  2633. });
  2634. },
  2635. photographError(err) {
  2636. console.log("没有摄像头:", err);
  2637. uni.showModal({
  2638. title: "提示",
  2639. content:
  2640. "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
  2641. cancelText: "取消",
  2642. confirmText: "确定",
  2643. success: (res) => {
  2644. if (res.confirm) {
  2645. uni.navigateBack();
  2646. } else if (res.cancel) {
  2647. }
  2648. },
  2649. });
  2650. },
  2651. },
  2652. };
  2653. </script>
  2654. <style lang="scss" scope>
  2655. @import "./css/detail.scss";
  2656. .top {
  2657. &__header {
  2658. position: relative;
  2659. width: 100%;
  2660. height: 150rpx;
  2661. padding: 24rpx 150rpx 24rpx 24rpx;
  2662. .img {
  2663. position: absolute;
  2664. left: 0;
  2665. top: 0;
  2666. width: 100%;
  2667. }
  2668. .note {
  2669. position: relative;
  2670. z-index: 10;
  2671. font-size: 24rpx;
  2672. font-family: PingFang SC;
  2673. font-weight: bold;
  2674. color: #efdbff;
  2675. }
  2676. .title {
  2677. position: relative;
  2678. z-index: 10;
  2679. font-size: 26rpx;
  2680. font-family: PingFang SC;
  2681. font-weight: bold;
  2682. color: #ffffff;
  2683. }
  2684. }
  2685. }
  2686. #top {
  2687. position: relative;
  2688. z-index: 99;
  2689. }
  2690. .polyv_detail {
  2691. display: flex;
  2692. flex-direction: column;
  2693. height: 100vh;
  2694. position: relative;
  2695. top: 0;
  2696. left: 0;
  2697. .pops {
  2698. position: absolute;
  2699. top: 0;
  2700. left: 0;
  2701. background: #ccc;
  2702. opacity: 0.5;
  2703. width: 100%;
  2704. height: 300rpx;
  2705. z-index: 9999;
  2706. }
  2707. .box {
  2708. flex: 1;
  2709. overflow: hidden;
  2710. margin: 16rpx 16rpx 100rpx 16rpx;
  2711. .box_in {
  2712. height: 100%;
  2713. }
  2714. }
  2715. .first_ml {
  2716. margin: 16rpx 16rpx 16rpx 16rpx;
  2717. }
  2718. }
  2719. .btnSet {
  2720. width: 440rpx;
  2721. height: 80rpx;
  2722. background: #007aff;
  2723. border-radius: 40rpx;
  2724. color: #ffffff;
  2725. font-size: 28rpx;
  2726. line-height: 80rpx;
  2727. }
  2728. .lecture-content {
  2729. background: #fff;
  2730. margin-top: 10rpx;
  2731. padding: 10rpx;
  2732. border-radius: 16rpx;
  2733. }
  2734. .photoBox {
  2735. width: 100%;
  2736. // background-color: #ffffff;
  2737. // border-radius: 24px 24px 0px 0px;
  2738. .photoTop {
  2739. width: 100%;
  2740. height: 74rpx;
  2741. border-radius: 20px 20px 0px 0px;
  2742. background-color: #ffffff;
  2743. display: flex;
  2744. align-items: center;
  2745. justify-content: center;
  2746. padding: 0rpx 38rpx;
  2747. .sqzz {
  2748. width: 28rpx;
  2749. height: 28rpx;
  2750. display: flex;
  2751. align-items: center;
  2752. justify-content: center;
  2753. }
  2754. .centersq {
  2755. color: #333;
  2756. font-size: 30rpx;
  2757. font-weight: 500;
  2758. }
  2759. }
  2760. .photoCenter {
  2761. width: 750rpx;
  2762. height: 75vh;
  2763. position: relative;
  2764. .center_camera {
  2765. width: 100%;
  2766. height: 75vh;
  2767. position: fixed;
  2768. .head_take {
  2769. width: 100%;
  2770. height: 75vh;
  2771. display: flex;
  2772. flex-direction: column;
  2773. }
  2774. .headTake_up {
  2775. width: 100%;
  2776. height: 100rpx;
  2777. }
  2778. .headTake_minddle {
  2779. display: flex;
  2780. .min_img {
  2781. width: 500rpx;
  2782. height: 550rpx;
  2783. }
  2784. .min_left,
  2785. .min_right {
  2786. flex: 1;
  2787. height: 550rpx;
  2788. }
  2789. }
  2790. .headTake_down {
  2791. width: 100%;
  2792. flex: 1;
  2793. }
  2794. .color {
  2795. background-color: #333;
  2796. opacity: 0.5;
  2797. }
  2798. .photo_v {
  2799. width: 100%;
  2800. height: 100%;
  2801. }
  2802. .mask {
  2803. width: 500rpx;
  2804. height: 550rpx;
  2805. position: absolute;
  2806. top: 100rpx;
  2807. left: 0;
  2808. right: 0;
  2809. bottom: 0;
  2810. margin: 0 auto;
  2811. box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
  2812. }
  2813. }
  2814. .custom {
  2815. width: 750rpx;
  2816. height: 75vh;
  2817. position: absolute;
  2818. z-index: 1000;
  2819. top: 0;
  2820. left: 0;
  2821. image {
  2822. width: 100%;
  2823. height: 100%;
  2824. }
  2825. }
  2826. }
  2827. .btns {
  2828. display: flex;
  2829. .takePhoto_btn {
  2830. width: 100%;
  2831. display: flex;
  2832. align-items: center;
  2833. justify-content: space-between;
  2834. background: #a9a7a9;
  2835. padding: 40rpx 26rpx;
  2836. .middle_btn {
  2837. width: 120rpx;
  2838. height: 120rpx;
  2839. border-radius: 40rpx;
  2840. border: 4rpx solid #ffffff;
  2841. display: flex;
  2842. align-items: center;
  2843. justify-content: center;
  2844. }
  2845. .square {
  2846. width: 96rpx;
  2847. height: 96rpx;
  2848. background: #ffffff;
  2849. border-radius: 28rpx;
  2850. }
  2851. .rights {
  2852. font-size: 32rpx;
  2853. font-weight: 500;
  2854. color: #ffffff;
  2855. }
  2856. }
  2857. .btnResult {
  2858. height: 100rpx;
  2859. flex: 1;
  2860. background-color: #07c160;
  2861. text-align: center;
  2862. line-height: 100rpx;
  2863. color: #fff;
  2864. font-size: 32rpx;
  2865. font-weight: bold;
  2866. }
  2867. }
  2868. }
  2869. .tBox {
  2870. display: flex;
  2871. align-items: center;
  2872. padding-top: 10rpx;
  2873. }
  2874. .title {
  2875. font-size: 24rpx;
  2876. color: #999999;
  2877. }
  2878. .t_content1 {
  2879. color: #007aff;
  2880. margin-left: 10rpx;
  2881. }
  2882. .tag1 {
  2883. border: 2rpx solid #007aff;
  2884. border-radius: 8rpx;
  2885. font-size: 20rpx;
  2886. color: #007aff;
  2887. padding: 5rpx;
  2888. }
  2889. .b_title {
  2890. color: #333333;
  2891. font-size: 30rpx;
  2892. font-weight: bold;
  2893. }
  2894. page {
  2895. background: #eaeef1;
  2896. }
  2897. .menuBox {
  2898. width: 100%;
  2899. background: #ffffff;
  2900. border-radius: 16rpx;
  2901. padding: 0rpx 20rpx;
  2902. margin-bottom: 20rpx;
  2903. }
  2904. .btnspric {
  2905. border-top: 1rpx solid #eee;
  2906. display: flex;
  2907. align-items: center;
  2908. justify-content: space-between;
  2909. height: 108rpx;
  2910. padding-left: 43rpx;
  2911. padding-right: 32rpx;
  2912. }
  2913. .btnspric > .lefprL {
  2914. font-size: 36rpx;
  2915. color: #0c141f;
  2916. font-weight: bold;
  2917. }
  2918. .btnspric > .lefprR {
  2919. padding: 0rpx 24rpx;
  2920. height: 60rpx;
  2921. line-height: 60rpx;
  2922. text-align: center;
  2923. color: #fff;
  2924. background: #32467b;
  2925. border-radius: 24rpx;
  2926. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2927. }
  2928. .yhj,
  2929. .hdyhj {
  2930. padding: 24rpx 29rpx 24rpx 34rpx;
  2931. }
  2932. .yhj {
  2933. border-bottom: 16rpx solid #f9f9f9;
  2934. }
  2935. .yhjtit {
  2936. font-size: 30rpx;
  2937. color: #0c141f;
  2938. font-weight: 500;
  2939. margin-bottom: 14rpx;
  2940. }
  2941. .yhjList {
  2942. display: flex;
  2943. align-items: center;
  2944. justify-content: space-between;
  2945. margin-bottom: 14rpx;
  2946. }
  2947. .yhjList > .yhjLefts {
  2948. display: flex;
  2949. align-items: center;
  2950. }
  2951. .yhjLefts > .yhl {
  2952. color: #32467b;
  2953. font-size: 30rpx;
  2954. margin-right: 31rpx;
  2955. }
  2956. .yhjLefts > .yhbq {
  2957. font-size: 24rpx;
  2958. color: #ff9500;
  2959. border-radius: 18rpx;
  2960. background-color: rgba(255, 149, 0, 0.2);
  2961. border: 2rpx solid #ff9500;
  2962. height: 38rpx;
  2963. line-height: 38rpx;
  2964. padding: 0rpx 16rpx;
  2965. }
  2966. .ts {
  2967. font-size: 24rpx;
  2968. color: #999;
  2969. margin: 14rpx 0rpx;
  2970. padding-right: 29rpx;
  2971. padding-left: 34rpx;
  2972. }
  2973. .yh {
  2974. padding-top: 20rpx;
  2975. }
  2976. .yh > .yhtitle {
  2977. display: flex;
  2978. align-items: center;
  2979. justify-content: space-between;
  2980. padding-right: 29rpx;
  2981. padding-left: 34rpx;
  2982. }
  2983. .priceBxs {
  2984. display: flex;
  2985. align-items: center;
  2986. }
  2987. .priceBxs > .pricleft {
  2988. border-radius: 24rpx;
  2989. border: 1rpx solid #e91313;
  2990. background-color: rgba(233, 19, 19, 0.1);
  2991. padding: 0rpx 18rpx;
  2992. height: 49rpx;
  2993. line-height: 49rpx;
  2994. text-align: center;
  2995. font-size: 30rpx;
  2996. font-weight: 500;
  2997. color: #e91313;
  2998. margin-right: 13rpx;
  2999. }
  3000. .topBox {
  3001. padding: 32rpx 32rpx 24rpx;
  3002. border-bottom: 1rpx solid #eeeeee;
  3003. }
  3004. .topBox > .boldFonstType {
  3005. font-weight: 500;
  3006. font-size: 30rpx;
  3007. margin: 16rpx 0rpx 23rpx;
  3008. }
  3009. .topBox > .firstTopL {
  3010. display: flex;
  3011. align-items: center;
  3012. }
  3013. .topBox > .firstTopL > .imageBs {
  3014. width: 331rpx;
  3015. height: 160rpx;
  3016. border-radius: 6rpx;
  3017. overflow: hidden;
  3018. margin-right: 8rpx;
  3019. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  3020. }
  3021. .topBox > .firstTopL > .imageBs > image {
  3022. width: 100%;
  3023. height: 100%;
  3024. }
  3025. .topBox > .firstTopL > .textBs {
  3026. font-size: 30rpx;
  3027. font-weight: bold;
  3028. color: #0c141f;
  3029. }
  3030. .content {
  3031. padding: 24rpx;
  3032. text-align: left;
  3033. }
  3034. .catalogBox {
  3035. display: flex;
  3036. align-items: center;
  3037. flex-wrap: nowrap;
  3038. overflow-x: auto;
  3039. padding-left: 38rpx;
  3040. max-height: 305rpx;
  3041. overflow-y: auto;
  3042. transition: all 0.4s;
  3043. }
  3044. .catalogBox > .catalogA {
  3045. min-width: 200rpx;
  3046. height: 48rpx;
  3047. line-height: 48rpx;
  3048. // text-align: center;
  3049. border: 2rpx solid transparent;
  3050. white-space: nowrap;
  3051. text-overflow: ellipsis;
  3052. overflow: hidden;
  3053. word-break: break-all;
  3054. border-radius: 10rpx;
  3055. background: rgba(22, 119, 255, 0.05);
  3056. padding-left: 19rpx;
  3057. box-sizing: border-box;
  3058. padding-right: 15rpx;
  3059. margin-right: 16rpx;
  3060. margin-bottom: 20rpx;
  3061. margin-top: 15rpx;
  3062. font-size: 24rpx;
  3063. color: #666;
  3064. }
  3065. .catalogBox > .activesq {
  3066. border-color: #1677ff;
  3067. }
  3068. .changeCatalogBox {
  3069. display: block;
  3070. }
  3071. .catalogBox::-webkit-scrollbar {
  3072. display: none; /* Chrome Safari */
  3073. }
  3074. .price_t2 {
  3075. font-size: 18rpx;
  3076. font-family: PingFang SC;
  3077. font-weight: 500;
  3078. text-decoration: line-through;
  3079. color: #999999;
  3080. }
  3081. .price_t1 {
  3082. font-size: 33rpx;
  3083. font-family: PingFang SC;
  3084. font-weight: bold;
  3085. color: #e91313;
  3086. }
  3087. .sc_t {
  3088. font-size: 22rpx;
  3089. color: #000000;
  3090. }
  3091. .sc {
  3092. width: 29rpx;
  3093. height: 29rpx;
  3094. }
  3095. .buy {
  3096. width: 138rpx;
  3097. height: 48rpx;
  3098. line-height: 48rpx;
  3099. background: #32467b;
  3100. border-radius: 10rpx;
  3101. color: #ffffff;
  3102. font-size: 28rpx;
  3103. text-align: center;
  3104. vertical-align: middle;
  3105. position: absolute;
  3106. right: 30rpx;
  3107. }
  3108. .video_body {
  3109. padding-bottom: 96rpx;
  3110. }
  3111. .footer_tab {
  3112. position: fixed;
  3113. bottom: 0;
  3114. height: 96rpx;
  3115. width: 100%;
  3116. background-color: #ffffff;
  3117. }
  3118. .tj_box {
  3119. width: 50%;
  3120. display: inline-block;
  3121. text-align: center;
  3122. margin: 10rpx 0;
  3123. }
  3124. .teacher_t {
  3125. font-size: 24rpx;
  3126. font-family: PingFang SC;
  3127. font-weight: 400;
  3128. color: #666666;
  3129. line-height: 36rpx;
  3130. margin-left: 15rpx;
  3131. }
  3132. .teacher_img {
  3133. width: 87rpx;
  3134. height: 129rpx;
  3135. }
  3136. .t2 {
  3137. font-size: 24rpx;
  3138. font-family: PingFang SC;
  3139. color: #666666;
  3140. line-height: 36rpx;
  3141. margin: 15rpx;
  3142. }
  3143. .r_t2 {
  3144. width: 201rpx;
  3145. height: 49rpx;
  3146. background: rgba(22, 119, 255, 0.05);
  3147. border: 1rpx solid #32467b;
  3148. border-radius: 16rpx;
  3149. color: #666666;
  3150. font-size: 23rpx;
  3151. text-align: center;
  3152. display: flex;
  3153. align-items: center;
  3154. padding: 5rpx;
  3155. }
  3156. .scroll_box {
  3157. width: 100%;
  3158. height: 60rpx;
  3159. background: #ffffff;
  3160. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  3161. white-space: nowrap;
  3162. overflow: hidden;
  3163. margin: 15rpx 0;
  3164. }
  3165. .r_sliper {
  3166. padding: 0 20rpx;
  3167. }
  3168. .top_line {
  3169. width: 6rpx;
  3170. height: 22rpx;
  3171. background: #32467b;
  3172. margin-right: 10rpx;
  3173. }
  3174. .video_t2 {
  3175. font-size: 24rpx;
  3176. font-family: PingFang SC;
  3177. font-weight: 500;
  3178. color: #666666;
  3179. }
  3180. .video_play {
  3181. position: absolute;
  3182. width: 95rpx;
  3183. height: 95rpx;
  3184. top: 0;
  3185. left: 0;
  3186. right: 0;
  3187. bottom: 0;
  3188. margin: auto;
  3189. }
  3190. .video_box {
  3191. position: relative;
  3192. }
  3193. .rotoct {
  3194. transform: rotate(90deg);
  3195. }
  3196. .slot-content {
  3197. padding: 0 20rpx;
  3198. }
  3199. .notice_modal {
  3200. .content {
  3201. width: 100%;
  3202. height: 100%;
  3203. padding: 56rpx 56rpx 56rpx 64rpx;
  3204. .title {
  3205. color: #222;
  3206. line-height: 40rpx;
  3207. font-size: 36rpx;
  3208. text-align: center;
  3209. font-weight: bold;
  3210. margin-bottom: 24rpx;
  3211. }
  3212. .text {
  3213. height: 340rpx;
  3214. line-height: 40rpx;
  3215. text-indent: 2em;
  3216. font-size: 32rpx;
  3217. color: #222;
  3218. }
  3219. .had_read {
  3220. width: 100%;
  3221. height: 88rpx;
  3222. line-height: 88rpx;
  3223. text-align: center;
  3224. background: #3577e8;
  3225. border-radius: 240rpx;
  3226. font-size: 32rpx;
  3227. font-weight: 500;
  3228. color: #fff;
  3229. margin-top: 20rpx;
  3230. &.gray {
  3231. background: #bbbec5;
  3232. }
  3233. }
  3234. }
  3235. }
  3236. .full_mulu {
  3237. position: absolute;
  3238. top: 100rpx;
  3239. right: 20rpx;
  3240. width: 700rpx;
  3241. height: 515rpx;
  3242. color: #333;
  3243. display: flex;
  3244. align-items: center;
  3245. justify-content: space-between;
  3246. z-index: 99999;
  3247. .mulus {
  3248. width: 623rpx;
  3249. // height: 515rpx;
  3250. height: 400rpx;
  3251. overflow-y: scroll;
  3252. // overflow: scroll;
  3253. }
  3254. .mulu_box_in {
  3255. background-color: #b7b7b7;
  3256. border-radius: 16rpx;
  3257. // transition: all 0.5s;
  3258. &::after {
  3259. content: "";
  3260. width: 0;
  3261. height: 0;
  3262. position: absolute;
  3263. top: 235rpx;
  3264. right: 27px;
  3265. border-top: 16rpx solid transparent;
  3266. border-right: 16rpx solid transparent;
  3267. border-left: 16rpx solid #b7b7b7;
  3268. border-bottom: 16rpx solid transparent;
  3269. }
  3270. }
  3271. .mulu_box_out {
  3272. // visibility: hidden;
  3273. display: none;
  3274. }
  3275. .menuBox_mulu {
  3276. // width: 100%;
  3277. background: #ffffff;
  3278. border-radius: 16rpx;
  3279. padding: 0rpx 20rpx;
  3280. margin-bottom: 20rpx;
  3281. }
  3282. .ml_img {
  3283. position: absolute;
  3284. right: 0;
  3285. top: 100rpx;
  3286. }
  3287. .items {
  3288. width: 620rpx;
  3289. height: 100rpx;
  3290. border: 1rpx solid red;
  3291. }
  3292. }
  3293. </style>