detail.vue 87 KB

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