detail.vue 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108
  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="650rpx"
  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" v-html="goodsData.buyNote && goodsData.buyNote.replace(/\n|\r\n/g, '<br>')">
  560. </view>
  561. </scroll-view>
  562. <view class="had_read" :class="{'gray': CountTo >= 0}" @click="noticeConfirm()">
  563. <text v-if="CountTo >= 0">请阅读学员须知,30s后可关闭</text>
  564. <text v-else>我已阅读学员须知</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. console.log('--option--', option);
  758. this.options = option
  759. this.courseId = option.courseId || ''
  760. this.goodsId = Number(option.goodsId);
  761. // this.gradeId = option.gradeId || 0
  762. this.orderGoodsId = Number(option.orderGoodsId) || '';
  763. // 公众号模板消息的数据埋点
  764. if (option.informId) {
  765. this.informId = option.informId
  766. // this.clickOfficial()
  767. }
  768. },
  769. onShow() {
  770. console.log('this.options:', this.options);
  771. if (this.$method.isGoLogin()) { // 从公众号消息进来的没登录需要跳到登录页,登录后返回
  772. return;
  773. }
  774. this.courseCourseList();
  775. this.informId && this.clickOfficial() // 从公众号消息点击进来上报一次
  776. this.$store.getters.dictObj;
  777. //相机授权
  778. // this.userConfirmInfoDetail().then(res => {
  779. // })
  780. // this.getbaseprofiletplists();
  781. },
  782. onUnload() {
  783. this.originUnload()
  784. },
  785. onHide() {
  786. this.originUnload()
  787. },
  788. mounted() {
  789. },
  790. methods: {
  791. ...mapMutations(["updateChapterOpen","updateLiveLast"]),
  792. // 新增微信公众号模板消息点击数据
  793. clickOfficial() {
  794. this.$http({
  795. url: '/data/click',
  796. method: 'post',
  797. data: { informId: this.informId }
  798. }).then((res) => {
  799. if (res.data.code == 200) {
  800. console.log('埋点')
  801. }
  802. })
  803. },
  804. // 点击课程目录
  805. cMenu(item, index) {
  806. this.subIndex = index
  807. if (item.subjectId != 0) {
  808. this.s_courseList = this.courseList.filter((e) => e.subjectId == item.subjectId)
  809. } else {
  810. this.s_courseList = this.courseList
  811. }
  812. },
  813. courseCourseList() {
  814. this.courseList = []
  815. this.$api.courseCourseList({
  816. pageNum: 1,
  817. pageSize: 100,
  818. goodsId: this.goodsId,
  819. gradeId: this.gradeId,
  820. orderGoodsId: this.orderGoodsId,
  821. }).then((res) => {
  822. if (res.data.code == 200) {
  823. this.courseList.push.apply(this.courseList, res.data.rows)
  824. this.courseTotal = res.data.total || 0
  825. this.s_courseList = this.courseList
  826. let allItem = [{ subjectId: 0, subjectName: '所有'}]
  827. let ids = []
  828. const newArr = []
  829. this.courseList.forEach(item => {
  830. if (ids.indexOf(item.subjectId) == -1) {
  831. ids.push(item.subjectId)
  832. newArr.push(item)
  833. }
  834. })
  835. this.subList = [...allItem, ...newArr]
  836. if(res.data.total > 1) {
  837. this.getUserWatchLast()
  838. } else if(res.data.total == 1) {
  839. this.originOnShow()
  840. this.originOnMount()
  841. }
  842. }
  843. });
  844. },
  845. // 查询用户最后一次看的录播的信息
  846. getUserWatchLast() {
  847. this.$http({
  848. // url: '/study/record/getUserWatchLast',
  849. url: '/study/record/queryLiveLast',
  850. method: 'get',
  851. data: {
  852. goodsId: this.goodsId
  853. }
  854. }).then((res) => {
  855. if (res.data.code == 200) {
  856. if (res.data.data && Object.keys(res.data.data).length) { //有最后一次看的录播的信息
  857. this.courseId = res.data.data.courseId
  858. } else {
  859. this.courseId = this.courseList[0].courseId // 没有观看记录默认一个课程
  860. // this.toggleCourseShow = true
  861. }
  862. } else {
  863. this.courseId = this.courseList[0].courseId // 没有观看记录默认一个课程
  864. }
  865. this.originOnShow()
  866. this.originOnMount()
  867. })
  868. },
  869. // 原来onshow里面的内容
  870. originOnShow() {
  871. this.updateLiveLast(null)
  872. this.courseDetail();
  873. this.getGoodsDetail();
  874. this.getAnswerList();
  875. this.studyRecordMenuAllList();
  876. // this.answerTimer = setInterval(() => {
  877. // this.getAnswerList();
  878. // }, 5000);
  879. let option = this.options
  880. let noteSecond = Number(option.noteSecond);
  881. if (noteSecond > 0) {
  882. //我的消息跳过来,播放节
  883. let item = {
  884. sectionId: Number(option.sectionId),
  885. recordingUrl: option.recordingUrl,
  886. noteSecond: noteSecond,
  887. studyDuration: noteSecond,
  888. };
  889. let playNextId = `moduleId${option.moduleId}chapterId${
  890. option.chapterId
  891. }sectionId${option.sectionId}${option.isRebuild ? "isRebuild" : ""}`;
  892. this.$store.commit("setPlaySectionId", { playSectionId: item.sectionId || item.menuId });
  893. this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
  894. this.$store.commit("updatePlayNextId", playNextId);
  895. this.playNoteVideo(item)
  896. } else {
  897. this.studyRecordQueryLiveLast();
  898. }
  899. },
  900. // 原来的mouted内容
  901. originOnMount() {
  902. uni.$on("changeSection", (oldSectionId) => {
  903. this.hasStart = false;
  904. this.photoConfig = false;
  905. this.photoIndex = 0;
  906. var polyvPlayerContext = this.selectComponent("#playerVideo");
  907. if (polyvPlayerContext) {
  908. //解决同个节视频切换问题
  909. polyvPlayerContext.seek(0);
  910. polyvPlayerContext.pause();
  911. }
  912. //清除直播
  913. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  914. this.postStudyRecord(0, oldSectionId);
  915. });
  916. uni.$on("getSection", (item) => {
  917. //清除直播
  918. this.hasStart = false;
  919. this.isPlayRebuild = item.rebuild;
  920. this.photoConfig = false;
  921. this.photoIndex = 0;
  922. this.sectionItem = item;
  923. this.moduleId = item.moduleId || null
  924. this.chapterId = item.chapterId || null
  925. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  926. this.$store.commit("setPlaySectionId", { playSectionId: item.sectionId || item.menuId });
  927. console.log('清除直播节点胡:', this.moduleId,this.chapterId, this.playSectionId )
  928. //获取拍照历史
  929. this.getPhotoLastRecord();
  930. this.polyvLiveHistoryChatMsgList();
  931. this.playVideo(item);
  932. });
  933. uni.$on("levelId", (item) => {
  934. let arr = item.split("-");
  935. //点击节获取的各层级ID
  936. this.moduleId = arr[0];
  937. this.chapterId = arr[1];
  938. });
  939. uni.$on("getChannel", (item) => {
  940. //清除录播
  941. this.hasStart = false;
  942. this.$store.commit("setPlayVID", { playVID: null });
  943. this.moduleId = item.moduleId
  944. this.chapterId = item.chapterId
  945. this.$store.commit("setPlaySectionId", { playSectionId: item.sectionId || item.menuId });
  946. this.getPhotoLastRecord();
  947. this.playChannel(item);
  948. this.channelItem = item;
  949. });
  950. uni.$on("isRebuild", (item) => {
  951. this.isRebuild = item;
  952. });
  953. this.updateChapterOpen(true);
  954. },
  955. // 原来onUnload里面的内容
  956. originUnload() {
  957. if (this.playSectionId > 0 && this.hasStart) {
  958. //退出提交记录
  959. this.postStudyRecord();
  960. }
  961. //清除正在播放的节ID
  962. // this.$store.commit('setPlayObj',null)
  963. this.$store.commit("setPlaySectionId", { playSectionId: 0 });
  964. this.$store.commit("setPlayChannelId", { playChannelId: 0 });
  965. this.$store.commit("setPlayVID", { playVID: null });
  966. this.closePlv();
  967. //移除所有的事件监听器
  968. uni.$off();
  969. this.clearTimer && clearTimeout(this.clearTimer)
  970. this.toastTimer && clearTimeout(this.toastTimer)
  971. this.timer && clearInterval(this.timer);
  972. if (this.lockTimer) {
  973. clearInterval(this.lockTimer);
  974. this.$api
  975. .lockDelLock({
  976. uuid: this.$method.getUuid(),
  977. action: "jxjy",
  978. })
  979. .then((res) => {
  980. uni.hideLoading()
  981. });
  982. }
  983. },
  984. changeCourses() {
  985. this.toggleCourseShow = true
  986. },
  987. closePop() {
  988. this.toggleCourseShow = false
  989. },
  990. // 进入学习
  991. async jump(item, index) {
  992. this.vid = ''
  993. this.hasStart = true
  994. await this.originUnload()
  995. this.courseId = item.courseId
  996. this.reStart = false
  997. this.toggleCourseShow = false
  998. this.originOnShow()
  999. this.originOnMount()
  1000. },
  1001. clickLeft() {
  1002. // uni.navigateBack()
  1003. uni.switchTab({
  1004. url:'/pages/learn/index'
  1005. })
  1006. },
  1007. /**
  1008. * 获取上次观看的直播
  1009. */
  1010. studyRecordGetLastLive() {
  1011. this.$api.studyRecordGetLastLive({
  1012. orderGoodsId:this.orderGoodsId,
  1013. courseId:this.courseId
  1014. }).then(res => {
  1015. this.updateLiveLast(res.data.data)
  1016. })
  1017. },
  1018. /**
  1019. * 获取最后一次看的节
  1020. */
  1021. studyRecordQueryLiveLast() {
  1022. // /study/record/queryLiveLast
  1023. this.$api.studyRecordQueryLiveLast({
  1024. orderGoodsId:this.orderGoodsId,
  1025. courseId:this.courseId
  1026. }).then(async res => {
  1027. if(res.data.data) {
  1028. this.moduleId = res.data.data.moduleId
  1029. this.chapterId = res.data.data.chapterId
  1030. if(res.data.data.sectionType == 1) { //录播
  1031. this.$store.commit("setPlaySectionId", { playSectionId: res.data.data.sectionId });
  1032. this.$store.commit("setPlayVID", { playVID: res.data.data.recordingUrl });
  1033. this.sectionItem = res.data.data;
  1034. await this.getPhotoLastRecord() // 获取拍照历史
  1035. this.playVideo(res.data.data)
  1036. } else if(res.data.data.sectionType == 2) { //直播
  1037. this.studyRecordGetLastLive();
  1038. } else if(res.data.data.sectionType == 3) { //回放
  1039. this.$store.commit("setPlaySectionId", { playSectionId: res.data.data.sectionId });
  1040. this.$store.commit("setPlayVID", { playVID: res.data.data.recordingUrl });
  1041. this.sectionItem = res.data.data;
  1042. this.polyvLiveHistoryChatMsgList();
  1043. if(!res.data.data.recordingUrl) {
  1044. return;
  1045. }
  1046. await this.getPhotoLastRecord() // 获取拍照历史
  1047. this.playVideo(res.data.data)
  1048. }
  1049. }
  1050. })
  1051. },
  1052. async goLive(item) {
  1053. let data = await this.studyRecordGetChannelBasicInfo(item.liveUrl);
  1054. let nowTime = +this.$method.timest();
  1055. if (item.liveStartTime > nowTime) {
  1056. if (data.watchStatus == "end" || data.watchStatus == "playback") {
  1057. uni.showToast({
  1058. title: '直播未开始',
  1059. icon: 'none'
  1060. });
  1061. return;
  1062. }
  1063. } else if (
  1064. item.liveStartTime < nowTime &&
  1065. item.liveEndTime > nowTime
  1066. ) {
  1067. if (data.watchStatus == "end" || data.watchStatus == "playback") {
  1068. uni.showToast({
  1069. title: '暂无直播',
  1070. icon: 'none'
  1071. });
  1072. return;
  1073. }
  1074. } else if (item.liveEndTime < nowTime) {
  1075. if (data.watchStatus == "end" || data.watchStatus == "playback") {
  1076. uni.showToast({
  1077. title: '直播已结束',
  1078. icon: 'none'
  1079. });
  1080. return;
  1081. }
  1082. }
  1083. let moduleId = item.moduleId || 0;
  1084. let chapterId = item.chapterId || 0;
  1085. let sectionId = item.sectionId || item.menuId;
  1086. let uuid = new Date().valueOf() + ""
  1087. // buyCourse 是否购买课程:1是 0否
  1088. let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='+
  1089. item.liveUrl+'&gradeId='+this.gradeId+'&courseId='+this.courseId+'&goodsId='+this.goodsId+'&orderGoodsId='+this.orderGoodsId+'&sectionId='+sectionId+
  1090. '&chapterId='+chapterId+'&moduleId='+moduleId+'&buyCourse=1'+'&ident='+uuid)
  1091. uni.navigateTo({
  1092. url:`../../pages/webview/index?url=`+encode
  1093. })
  1094. },
  1095. studyRecordMenuAllList() {
  1096. this.$api.studyRecordMenuAllList({
  1097. courseId:this.courseId,
  1098. gradeId:this.gradeId,
  1099. goodsId:this.goodsId
  1100. }).then(res => {
  1101. let nowTime = Number(new Date().getTime()/1000).toFixed(0)
  1102. // this.livingItem = res.data.data[0]
  1103. if (res.data.data) {
  1104. this.livingItem = res.data.data.find(item => item.liveStartTime<=nowTime&&item.liveEndTime>nowTime);
  1105. let isShowNotice = res.data.data.every(e => e.studyStatus == -1)
  1106. if (this.CountTo == 30 && isShowNotice) { // studyStatus 全部等于-1的时候就是没有看过
  1107. this.noticeShow = true
  1108. var timer = setInterval(() => {
  1109. this.CountTo--
  1110. if( this.CountTo < 0 ) {
  1111. clearInterval(timer)
  1112. }
  1113. }, 1000)
  1114. } else {
  1115. this.CountTo = -1
  1116. }
  1117. } else {
  1118. this.CountTo = -1
  1119. }
  1120. })
  1121. },
  1122. noticeConfirm() {
  1123. console.log('CountTo:', this.CountTo);
  1124. if (this.CountTo < 0) {
  1125. this.noticeShow = false
  1126. }
  1127. },
  1128. studyRecordGetChannelBasicInfo(channelId) {
  1129. return new Promise((resolve) => {
  1130. this.$api
  1131. .studyRecordGetChannelBasicInfo({
  1132. channelId,
  1133. })
  1134. .then((res) => {
  1135. resolve(res.data.data);
  1136. });
  1137. });
  1138. },
  1139. polyvLiveHistoryChatMsgList() {
  1140. this.$api.polyvLiveHistoryChatMsgList({
  1141. sectionId:this.playSectionId,
  1142. channelId:this.sectionItem.liveUrl
  1143. }).then(res => {
  1144. this.historyChatMsgList = res.data.data
  1145. })
  1146. },
  1147. /**
  1148. * 获取业务层次详情
  1149. */
  1150. // courseBusiness() {
  1151. // this.$api.courseBusiness(this.goodsData.businessId).then((res) => {
  1152. // this.businessData = res.data.data;
  1153. // });
  1154. // },
  1155. /**
  1156. * 计算tabs宽度
  1157. */
  1158. itemWidth() {
  1159. return 100 / this.list.length + "%";
  1160. },
  1161. /**
  1162. * 获取讲义权限
  1163. */
  1164. // courseHandouts() {
  1165. // this.$api.courseHandouts(this.goodsData.handoutsId).then((res) => {
  1166. // this.courseHandoutsData = res.data.data;
  1167. // });
  1168. // },
  1169. findMenuNextSection(index) {
  1170. for (let i = index + 1; i < this.reMenuList.length; i++) {
  1171. let item = this.reMenuList[i];
  1172. if (item.type == 3) {
  1173. return item;
  1174. }
  1175. }
  1176. return {};
  1177. },
  1178. loadedmetadata(e) {
  1179. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1180. this.hasStart = true;
  1181. uni.$off('playPause')
  1182. uni.$on('playPause',() => {
  1183. polyvPlayerContext.pause()
  1184. })
  1185. if(!this.recordObj.videoCurrentTime) { //新视频直接提交一条观看记录
  1186. this.postStudyRecord(0)
  1187. }
  1188. },
  1189. getPhotoLastRecord() {
  1190. let self = this;
  1191. let data = {
  1192. sectionId: parseInt(self.playSectionId),
  1193. goodsId: parseInt(self.goodsId),
  1194. courseId: parseInt(self.courseId),
  1195. gradeId: parseInt(self.gradeId),
  1196. chapterId: parseInt(self.chapterId),
  1197. moduleId: parseInt(self.moduleId),
  1198. orderGoodsId: this.orderGoodsId,
  1199. };
  1200. this.$api.getPhotoLastRecord(data).then((res) => {
  1201. if (res.data.code == 200) {
  1202. //清空历史数据
  1203. self.photoHistoryList = [];
  1204. this.photoIndex = 0;
  1205. self.photoList = [];
  1206. for (let i = 0; i < res.data.data.length; i++) {
  1207. //-2存储随机拍照数组
  1208. if (res.data.data[i].photoIndex == -2) {
  1209. self.photoList = res.data.data[i].timeInterval.split(",");
  1210. } else {
  1211. self.photoHistoryList.push(res.data.data[i].photoIndex);
  1212. }
  1213. }
  1214. }
  1215. });
  1216. },
  1217. //postTime 只提交随机时间
  1218. postCoursePhotoRecord(postTime = false) {
  1219. return new Promise((resolve, reject) => {
  1220. let currentTime = 0;
  1221. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1222. if (polyvPlayerContext) {
  1223. currentTime = polyvPlayerContext.getCurrentTime();
  1224. }
  1225. let self = this;
  1226. let photoIndex = self.photoIndex;
  1227. let data = {
  1228. photo: self.ossAvatarUrl,
  1229. sectionId: parseInt(self.playSectionId),
  1230. goodsId: parseInt(self.goodsId),
  1231. courseId: parseInt(self.courseId),
  1232. photoTime: parseInt(currentTime > 0 ? currentTime : 0),
  1233. gradeId: parseInt(self.gradeId),
  1234. photoIndex: postTime ? -2 : parseInt(photoIndex), //从0算起,-2只提交随机时间
  1235. photoNum: parseInt(self.photoNum),
  1236. chapterId: parseInt(self.chapterId),
  1237. moduleId: parseInt(self.moduleId),
  1238. timeInterval: postTime ? self.photoList.join(",") : "",
  1239. orderGoodsId: this.orderGoodsId,
  1240. };
  1241. // console.log("提交接口", data);
  1242. this.$api
  1243. .coursePhotoRecord(data)
  1244. .then((res) => {
  1245. // console.log(res,'postCoursePhotoRecord')
  1246. if (res.data.code == 200) {
  1247. resolve();
  1248. } else {
  1249. reject();
  1250. }
  1251. })
  1252. .catch((err) => {
  1253. reject();
  1254. });
  1255. });
  1256. },
  1257. randomNum(minNum, maxNum) {
  1258. switch (arguments.length) {
  1259. case 1:
  1260. return parseInt(Math.random() * minNum + 1, 10);
  1261. break;
  1262. case 2:
  1263. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  1264. break;
  1265. default:
  1266. return 0;
  1267. break;
  1268. }
  1269. },
  1270. //配置随机拍照时间
  1271. configPhoto() {
  1272. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1273. let totalVideoTime = polyvPlayerContext.getDuration();
  1274. let duration = polyvPlayerContext.getCurrentTime();
  1275. let photoNum = this.photoNum;
  1276. if (!this.photoConfig) {
  1277. this.photoConfig = true;
  1278. // let spaceTime = Math.floor(totalVideoTime/photoNum) //拍照时间区间
  1279. // if(spaceTime<5){//区间小于5秒
  1280. // photoNum = Math.floor(totalVideoTime/5)
  1281. // spaceTime = 5
  1282. // }
  1283. // if(photoNum<1){
  1284. // photoNum = 1 //只要设置,至少拍一次
  1285. // spaceTime = totalVideoTime
  1286. // }
  1287. // let initSpace = 0
  1288. //没有历史拍照间隔数据
  1289. if (this.photoList.length == 0) {
  1290. if (totalVideoTime >= 900) {
  1291. //大于15分钟
  1292. if (photoNum == 1) {
  1293. //开头拍1张
  1294. this.photoList.push(0);
  1295. } else if (photoNum == 3) {
  1296. //拍3张
  1297. this.photoList.push(0); //开头拍一张
  1298. let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
  1299. let centerMinTime = centerTime - 300; //前后5分钟
  1300. let centerMaxTime = centerTime + 300;
  1301. let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
  1302. this.photoList.push(centerTakeTime); //中间拍一张
  1303. let endMaxTime = totalVideoTime - 60;
  1304. let endMinTime = totalVideoTime - 300;
  1305. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  1306. this.photoList.push(endTakeTime); //最后拍一张
  1307. }
  1308. } else {
  1309. //小于15分钟,只拍前后各一张
  1310. if (photoNum == 1) {
  1311. //开头拍1张
  1312. this.photoList.push(0);
  1313. } else if (photoNum == 3) {
  1314. //拍2张
  1315. if (totalVideoTime <= 300) {
  1316. //小于5分钟
  1317. this.photoList.push(0); //开头拍一张
  1318. let endTakeTime = this.randomNum(10, totalVideoTime); //中间随机取一张
  1319. this.photoList.push(endTakeTime);
  1320. } else {
  1321. this.photoList.push(0); //开头拍一张
  1322. let endMaxTime = totalVideoTime - 60;
  1323. let endMinTime = totalVideoTime - 300;
  1324. let endTakeTime = this.randomNum(endMinTime, endMaxTime);
  1325. this.photoList.push(endTakeTime); //最后1-5分钟拍一张
  1326. }
  1327. }
  1328. }
  1329. // for(let i=0;i<photoNum;i++){
  1330. // let s = this.randomNum(initSpace,initSpace+spaceTime)
  1331. // if(s>totalVideoTime){
  1332. // s = totalVideoTime-1
  1333. // }
  1334. // if(s<=5){
  1335. // s =5 //避免出现5秒内拍照时间
  1336. // }
  1337. // this.photoList.push(s)
  1338. // initSpace+=spaceTime
  1339. // }
  1340. // console.log(this.photoList, "随机拍照时间数组11", photoNum);
  1341. this.postCoursePhotoRecord(true); //提交随机拍照时间数组
  1342. }
  1343. // console.log(this.photoList, "随机拍照时间数组");
  1344. //兼容已有观看历史
  1345. for (let i = 0; i < this.photoList.length - 1; i++) {
  1346. if (
  1347. this.photoList[i] < duration &&
  1348. this.photoList[i + 1] > duration
  1349. ) {
  1350. this.photoIndex = i + 1;
  1351. break;
  1352. }
  1353. if (duration > this.photoList[this.photoList.length - 1]) {
  1354. this.photoIndex = this.photoList.length - 1; //取最后一个下标
  1355. break;
  1356. }
  1357. }
  1358. }
  1359. },
  1360. getLiveUid(channelId) {
  1361. let self = this;
  1362. return new Promise((resolve) => {
  1363. let data = {
  1364. channelId: channelId,
  1365. orderGoodsId: this.orderGoodsId,
  1366. };
  1367. self.$api.polyvSign(data).then((res) => {
  1368. resolve(res.data.data);
  1369. });
  1370. });
  1371. },
  1372. timeEventLiving() {
  1373. if (plv != null) {
  1374. if (this.livePlay) {
  1375. this.liveDuration = this.liveDuration + 1; //每隔1秒
  1376. if (this.liveDuration == 2) {
  1377. //直播第2秒拍照
  1378. // console.log(this.channelItem)
  1379. // console.log(this.photoHistoryList,'this.photoHistoryList')
  1380. if (
  1381. this.goodsPhotographConfig && this.goodsPhotographConfig.livephotograph == 1 &&
  1382. this.channelItem.learning != 1 && this.photoHistoryList.length == 0
  1383. ) {
  1384. //开启直播拍照
  1385. this.openPhoto();
  1386. } else {
  1387. this.postStudyRecord(0);
  1388. }
  1389. }
  1390. }
  1391. }
  1392. },
  1393. playerLiveStatusChange(e) {
  1394. const status = e.detail.status;
  1395. // console.log("直播状态", status);
  1396. if (status === "live") {
  1397. // console.log("开始直播");
  1398. //开始播放
  1399. if (this.timer) {
  1400. clearInterval(this.timer);
  1401. }
  1402. this.livePlay = true;
  1403. this.timer = setInterval(this.timeEventLiving, 1000); //定时器
  1404. }
  1405. if (status === "end") {
  1406. this.hasStart = false;
  1407. if (this.livePlay) {
  1408. //只有播放过的结束才提交,避免未开播触发结束
  1409. this.postStudyRecord(1);
  1410. }
  1411. // console.log("结束直播");
  1412. this.livePlay = false;
  1413. // 未开始
  1414. }
  1415. },
  1416. closePlv() {
  1417. if (plv) {
  1418. plv.destroy();
  1419. }
  1420. },
  1421. playChannel(item) {
  1422. if (this.timer) {
  1423. clearInterval(this.timer);
  1424. }
  1425. this.startStatus = true;
  1426. this.initLive();
  1427. },
  1428. setLiveOption(status) {
  1429. const { userId, channelId, recordFileSimpleModel, playbackEnabled } =
  1430. this.detail;
  1431. const playRecordFile =
  1432. playbackEnabled && recordFileSimpleModel && status === "end";
  1433. // if(this.channelItem.sectionType == 3) { //回放
  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. // } else { //直播
  1443. this.videoOption = {
  1444. mode: "live",
  1445. uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
  1446. cid: this.playChannelId,
  1447. openId: this.userInfo.userAccount,
  1448. isAutoChange: false,
  1449. forceVideo: false,
  1450. };
  1451. // }
  1452. },
  1453. async initLive() {
  1454. this.liveObj = await this.getLiveUid(this.playChannelId);
  1455. this.initLiveOk = true;
  1456. let optionsData = {};
  1457. optionsData.mode = "live";
  1458. optionsData.forceVideo = false;
  1459. optionsData.channelId = this.playChannelId; // 频道ID '2553128'
  1460. optionsData.openId = this.userInfo.userAccount; // 用户openId this.userInfo.userAccount 'oQ5eX5BCtSjkE1ct8CzvxGWgh0hQ'
  1461. optionsData.userId = this.liveObj.uid; // 2.0.0及以上版本的demo需要使用 userId 设置学员唯一id 'egsxlptzdq'
  1462. let self = this;
  1463. this.closePlv();
  1464. plv.init(optionsData).then(({ detail, chat }) => {
  1465. self.liveDetail = detail;
  1466. // 设置mode为live的videoOption
  1467. this.setLiveOption();
  1468. if (detail.isPPT) {
  1469. chat.on(chat.events.SLICESTART, () => {
  1470. // 开始直播
  1471. });
  1472. } else {
  1473. plv.api.getOrdinaryLiveStatus(detail.stream);
  1474. }
  1475. });
  1476. },
  1477. openSetting(res) {
  1478. // console.log(res, 98);
  1479. },
  1480. getCameraSetting() {
  1481. const self = this;
  1482. wx.getSetting({
  1483. success: (res) => {
  1484. if (res.authSetting["scope.camera"]) {
  1485. // 用户已经授权
  1486. self.showSet = false;
  1487. } else {
  1488. // 用户还没有授权,向用户发起授权请求
  1489. wx.authorize({
  1490. scope: "scope.camera",
  1491. success() {
  1492. // 用户同意授权
  1493. self.showSet = false;
  1494. },
  1495. fail() {
  1496. // 用户不同意授权
  1497. self.showSet = true;
  1498. /* wx.showToast({
  1499. title: '摄像头授权失败',
  1500. icon: 'none',
  1501. duration: 3000
  1502. }) */
  1503. },
  1504. });
  1505. }
  1506. },
  1507. fail: (res) => {},
  1508. });
  1509. },
  1510. studyNotice() {
  1511. this.noticeShow = true;
  1512. },
  1513. //播放笔记视频
  1514. async playNoteVideo(item) {
  1515. if (this.timer) {
  1516. clearInterval(this.timer);
  1517. }
  1518. if (this.vid) {
  1519. //切换视频
  1520. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1521. polyvPlayerContext.changeVid(item.recordingUrl);
  1522. } else {
  1523. this.vid = item.recordingUrl;
  1524. }
  1525. this.recordObj = { videoCurrentTime: item.noteSecond };
  1526. if (this.recordObj.videoCurrentTime) {
  1527. this.needSeek = true; //需要跳转到播放记录
  1528. }
  1529. this.startStatus = true;
  1530. //获取节笔记
  1531. this.getNoteList();
  1532. },
  1533. //正常播放视频
  1534. async playVideo(item) {
  1535. console.log(item, '2222222222');
  1536. if (item.sectionType == 3) { // 回放的不播放
  1537. return
  1538. }
  1539. if (this.timer) {
  1540. clearInterval(this.timer);
  1541. }
  1542. if (this.vid) {
  1543. //切换视频
  1544. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1545. polyvPlayerContext.changeVid(item.recordingUrl);
  1546. } else {
  1547. this.vid = item.recordingUrl;
  1548. }
  1549. this.recordObj = null;
  1550. this.recordObj = await this.getRecordLast();
  1551. // console.log('this.recordObj:', this.recordObj)
  1552. this.needSeek = true; //跳转到播放记录
  1553. this.startStatus = true;
  1554. // 提交学习记录
  1555. this.postStudyRecord(0)
  1556. //获取节笔记
  1557. this.getNoteList();
  1558. },
  1559. getRecordLast() {
  1560. let self = this;
  1561. return new Promise((resolve) => {
  1562. let data = {
  1563. gradeId: Number(self.gradeId),
  1564. goodsId: Number(self.goodsId),
  1565. sectionId: Number(self.playSectionId),
  1566. courseId: Number(self.courseId),
  1567. chapterId: parseInt(self.chapterId),
  1568. moduleId: parseInt(self.moduleId),
  1569. orderGoodsId: this.orderGoodsId,
  1570. };
  1571. // 获取用户节的最后一次学习记录/study/record/last
  1572. self.$api.recordLast(data).then((res) => {
  1573. resolve(res.data.data);
  1574. });
  1575. });
  1576. },
  1577. jumpNote(item) {
  1578. this.noteId = item.noteId;
  1579. //没视频播放
  1580. if (this.playSectionId == 0) {
  1581. this.$u.toast("即将跳到笔记位置");
  1582. this.$store.commit("setPlaySectionId", {
  1583. playSectionId: item.sectionId || item.menuId,
  1584. });
  1585. this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
  1586. this.playNoteVideo(item);
  1587. } else {
  1588. //正在看当前笔记视频
  1589. this.$u.toast("即将跳到笔记位置");
  1590. //跳到笔记时刻
  1591. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1592. polyvPlayerContext.seek(item.noteSecond);
  1593. polyvPlayerContext.play();
  1594. }
  1595. },
  1596. postNote() {
  1597. let self = this;
  1598. if (!(this.playSectionId > 0)) {
  1599. this.$u.toast("目前无播放视频");
  1600. return;
  1601. }
  1602. if (!this.noteValue) {
  1603. this.$u.toast("请输入内容");
  1604. return;
  1605. }
  1606. // if (!this.gradeId) { // 直播课程没有班级,去掉判断,默认为0
  1607. // this.$u.toast("暂无班级数据");
  1608. // return;
  1609. // }
  1610. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1611. let noteDate = this.$method.getZeroTime();
  1612. let noteSecond = polyvPlayerContext.getCurrentTime();
  1613. if (!noteSecond) {
  1614. if (noteSecond == 0) {
  1615. //播放结束
  1616. noteSecond = polyvPlayerContext.getDuration();
  1617. }
  1618. if (!noteSecond) {
  1619. this.$u.toast("视频暂未开始");
  1620. return;
  1621. }
  1622. }
  1623. let data = {
  1624. gradeId: this.gradeId,
  1625. goodsId: this.goodsId,
  1626. sectionId: this.playSectionId,
  1627. courseId: this.courseId,
  1628. noteText: this.noteValue,
  1629. noteDate: noteDate,
  1630. noteSecond: noteSecond,
  1631. orderGoodsId: this.orderGoodsId,
  1632. };
  1633. // /user/note 新增用户笔记
  1634. this.$api.postNote(data).then((res) => {
  1635. if (res.data.code == 200) {
  1636. this.$u.toast("发布成功");
  1637. self.getNoteList();
  1638. this.noteValue = "";
  1639. }
  1640. });
  1641. },
  1642. getNoteList() {
  1643. let self = this;
  1644. self.noteList = [];
  1645. let data = {
  1646. courseId: this.courseId,
  1647. gradeId: this.gradeId,
  1648. goodsId: this.goodsId,
  1649. orderGoodsId: this.orderGoodsId,
  1650. };
  1651. if (this.playSectionId > 0) {
  1652. data.sectionId = this.playSectionId;
  1653. }
  1654. this.$api.noteList(data).then((res) => {
  1655. if (res.data.code == 200) {
  1656. self.noteList = res.data.rows;
  1657. }
  1658. });
  1659. },
  1660. delAnswer(answerId) {
  1661. let self = this;
  1662. let data = { answerId: answerId, status: -1 ,orderGoodsId: this.orderGoodsId,};
  1663. this.$api.delAnswer(data).then((res) => {
  1664. if (res.data.code == 200) {
  1665. self.getAnswerList();
  1666. }
  1667. });
  1668. },
  1669. clearCtx() {
  1670. this.placeholder = "您可以在这里输入答疑内容";
  1671. this.ctxValue = "";
  1672. this.assignUserId = 0;
  1673. },
  1674. focusNote(event) {
  1675. this.bottomHeight = event.detail.height
  1676. },
  1677. blurNote() {
  1678. this.bottomHeight = 0
  1679. },
  1680. blur() {
  1681. this.bottomHeight = 0
  1682. this.clearTimer = setTimeout(() => {
  1683. this.ctxValue = ""
  1684. this.isFocus = false;
  1685. this.assignUserId = 0;
  1686. this.placeholder = '您可以在这里输入答疑内容';
  1687. },2000)
  1688. },
  1689. replyContent(item) {
  1690. this.isFocus = true;
  1691. this.assignUserId = item.userId;
  1692. this.placeholder = "@" + item.realname;
  1693. },
  1694. delContent(item) {
  1695. this.delAnswer(item.answerId);
  1696. },
  1697. postAnswer() {
  1698. let self = this;
  1699. let data = {
  1700. courseId: this.courseId,
  1701. answerText: this.ctxValue,
  1702. goodsId: this.goodsId,
  1703. orderGoodsId: this.orderGoodsId,
  1704. };
  1705. if (this.assignUserId > 0) {
  1706. data.assignUserId = this.assignUserId;
  1707. }
  1708. this.$api.postAnswer(data).then((res) => {
  1709. if (res.data.code == 200) {
  1710. this.$u.toast("发布成功");
  1711. self.getAnswerList();
  1712. this.isFocus = false;
  1713. this.placeholder = "您可以在这里输入答疑内容";
  1714. this.ctxValue = "";
  1715. this.assignUserId = 0;
  1716. }
  1717. });
  1718. },
  1719. postContent() {
  1720. if (!this.ctxValue || this.ctxValue == "") {
  1721. this.$u.toast("请输入内容");
  1722. return;
  1723. }
  1724. this.postAnswer();
  1725. },
  1726. postStudyRecord(status = 0, sectionId = this.playSectionId) {
  1727. let currentTime = 0;
  1728. let PlayDuration = 0;
  1729. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1730. if (polyvPlayerContext) {
  1731. currentTime = polyvPlayerContext.getCurrentTime(); //总的视频播放时刻
  1732. PlayDuration = polyvPlayerContext.getVideoPlayDuration(); //本次看的时长
  1733. }
  1734. if (this.playChannelId > 0) {
  1735. currentTime = 2; //直播无法获取,无论开始结束都传2秒
  1736. }
  1737. let self = this;
  1738. let data = {
  1739. fromPlat: 1, //来源平台 1小程序 2网站
  1740. photo: self.ossAvatarUrl,
  1741. sectionId: sectionId || 0,
  1742. goodsId: parseInt(self.goodsId),
  1743. courseId: parseInt(self.courseId),
  1744. orderGoodsId: this.orderGoodsId,
  1745. studyDuration: parseInt(
  1746. PlayDuration > 0 ? PlayDuration : self.studyDuration
  1747. ),
  1748. gradeId: parseInt(self.gradeId),
  1749. chapterId: this.chapterId || 0,
  1750. moduleId: this.moduleId || 0,
  1751. videoCurrentTime: parseInt(
  1752. currentTime > 0 ? currentTime : self.studyDuration
  1753. ),
  1754. };
  1755. if (this.ossAvatarUrl) {
  1756. data.similarity = this.compareFaceData // 相似度
  1757. }
  1758. if (status > 0) {
  1759. data.status = status;
  1760. }
  1761. // console.log("提交接口", data);
  1762. this.$api.studyRecord(data).then((res) => {
  1763. if (res.data.code == 200) {
  1764. if (status > 0) {
  1765. let moduleId = this.moduleId || 0;
  1766. let chapterId = this.chapterId || 0;
  1767. let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
  1768. let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
  1769. uni.$emit("playNext" + playNextIdisRebuild, {
  1770. fromRebuild: this.isRebuild,
  1771. }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
  1772. uni.$emit("playNext" + playNextId); //通知播放结束
  1773. }
  1774. self.ossAvatarUrl = "";
  1775. } else {
  1776. this.uploadLock = false;
  1777. uni.showToast({
  1778. icon: "none",
  1779. title: res.data.msg,
  1780. });
  1781. }
  1782. });
  1783. },
  1784. uploadFile(options, int) {
  1785. var self = this;
  1786. return new Promise((resolve, reject) => {
  1787. var data = {
  1788. imageStatus: int,
  1789. gradeId: this.gradeId,
  1790. orderGoodsId: this.orderGoodsId,
  1791. };
  1792. self.$api.aliyunpolicy(data).then((res) => {
  1793. if (res.data.code != 200) {
  1794. self.$method.showToast("签名错误" + JSON.stringify(res.data));
  1795. return;
  1796. }
  1797. var ossToken = res.data.data.resultContent;
  1798. if (ossToken.host == null || ossToken.host == undefined) {
  1799. self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
  1800. return;
  1801. }
  1802. uni.uploadFile({
  1803. url: ossToken.host,
  1804. name: "file",
  1805. filePath: options,
  1806. fileType: "image",
  1807. header: {
  1808. AuthorizationToken: "WX " + uni.getStorageSync("token"),
  1809. },
  1810. formData: {
  1811. key: ossToken.dir,
  1812. OSSAccessKeyId: ossToken.accessid,
  1813. policy: ossToken.policy,
  1814. Signature: ossToken.signature,
  1815. callback: ossToken.callback,
  1816. success_action_status: 200,
  1817. },
  1818. success: (result) => {
  1819. // if (result.statusCode === 200) {
  1820. this.$u.toast('上传成功')
  1821. self.ossAvatarUrl = ossToken.dir;
  1822. resolve();
  1823. // } else {
  1824. // uni.showToast({
  1825. // title: "上传失败",
  1826. // icon: "none",
  1827. // });
  1828. // this.openPhoto();
  1829. // return;
  1830. // }
  1831. },
  1832. fail: (error) => {
  1833. uni.showToast({
  1834. title: "上传接口报错,请重新拍照上传" + error,
  1835. icon: "none",
  1836. });
  1837. this.openPhoto();
  1838. return;
  1839. },
  1840. });
  1841. });
  1842. });
  1843. },
  1844. imageInfos() {
  1845. var self = this;
  1846. return new Promise((resolve, reject) => {
  1847. uni.getImageInfo({
  1848. src: self.avatarUrl,
  1849. success: async (res) => {
  1850. let canvasWidth = res.width; //图片原始长宽
  1851. let canvasHeight = res.height;
  1852. if (canvasWidth > 2000 || canvasHeight > 2000) {
  1853. uni.compressImage({
  1854. src: self.avatarUrl,
  1855. quality: 75,
  1856. width: "35%",
  1857. height: "35%",
  1858. success: async (rest) => {
  1859. const waitUpload = await self.uploadFile(
  1860. rest.tempFilePath,
  1861. 0
  1862. );
  1863. resolve(waitUpload);
  1864. },
  1865. });
  1866. } else if (canvasWidth > 1000 || canvasHeight > 1000) {
  1867. uni.compressImage({
  1868. src: self.avatarUrl,
  1869. quality: 75,
  1870. width: "50%",
  1871. height: "50%",
  1872. success: async (rest) => {
  1873. const waitUpload = await self.uploadFile(
  1874. rest.tempFilePath,
  1875. 0
  1876. );
  1877. resolve(waitUpload);
  1878. },
  1879. });
  1880. } else {
  1881. // console.log("无需压缩");
  1882. const waitUpload = await self.uploadFile(self.avatarUrl, 0);
  1883. resolve(waitUpload);
  1884. }
  1885. },
  1886. fail: (err) => {
  1887. this.$u.toast('图片上传失败')
  1888. }
  1889. });
  1890. });
  1891. },
  1892. timeEvent() {
  1893. let self = this;
  1894. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1895. if (polyvPlayerContext != null) {
  1896. this.playTime = polyvPlayerContext.getCurrentTime(); //播放时刻
  1897. // console.log(this.playTime,789,this.photoHistoryList)
  1898. //判断是否需要拍照
  1899. if (this.photoNum > 0) {
  1900. this.configPhoto();
  1901. let photoTime = 0; //获取拍照秒数
  1902. for (let i = 0; i < this.photoList.length; i++) {
  1903. photoTime = Number(this.photoList[i]); //获取拍照秒数
  1904. if (photoTime < this.playTime && photoTime > this.playTime - 8) {
  1905. //3秒区间内才触发拍照,避免拉动滚动条
  1906. if (
  1907. this.photoHistoryList.indexOf(i) < 0 &&
  1908. this.sectionItem.learning != 1
  1909. ) {
  1910. //不存在拍照历史,没有重修过,没有学过,则拍照
  1911. //启动拍照
  1912. //暂停
  1913. polyvPlayerContext.exitFullScreen();
  1914. polyvPlayerContext.pause();
  1915. this.photoIndex = i;
  1916. this.openPhoto();
  1917. }
  1918. }
  1919. }
  1920. }
  1921. }
  1922. },
  1923. closeToast() {
  1924. clearTimeout(this.toastTimer);
  1925. this.videoToastShow = false;
  1926. },
  1927. restart() {
  1928. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1929. polyvPlayerContext.seek(0);
  1930. clearTimeout(this.toastTimer);
  1931. this.videoToastShow = false;
  1932. },
  1933. // 新增用户视频学习日志
  1934. studyLog() {
  1935. this.$http({
  1936. url: '/user/study/log',
  1937. method: 'post',
  1938. data: {
  1939. goodsId: this.goodsId,
  1940. courseId: this.courseId,
  1941. moduleId: this.moduleId || 0,
  1942. chapterId: this.chapterId || 0,
  1943. sectionId: this.playSectionId || 0,
  1944. fromPlat: 1, //来源平台 1小程序 2PC网站
  1945. goodsType: 6, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
  1946. orderGoodsId: this.orderGoodsId,
  1947. }
  1948. }).then((res) => {
  1949. // console.log('直播的用户学习日志:', res)
  1950. })
  1951. },
  1952. onStateChange(newstate, oldstate) {
  1953. if (newstate.detail.newstate == "playing") {
  1954. if (this.needSeek) {
  1955. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1956. if (this.recordObj.videoCurrentTime) {
  1957. polyvPlayerContext.seek(this.recordObj.videoCurrentTime);
  1958. this.seekTime = this.$method.secondToDate(
  1959. this.recordObj.videoCurrentTime
  1960. );
  1961. this.videoToastShow = true;
  1962. this.toastTimer = setTimeout(() => {
  1963. this.videoToastShow = false;
  1964. }, 3000);
  1965. } else {
  1966. polyvPlayerContext.seek(1); //避免相同节继续播放
  1967. }
  1968. polyvPlayerContext.play();
  1969. this.needSeek = false;
  1970. // 新增用户视频学习日志
  1971. this.studyLog()
  1972. }
  1973. //开始播放
  1974. if (this.timer) {
  1975. clearInterval(this.timer);
  1976. }
  1977. this.timer = setInterval(this.timeEvent, 1000); //定时器
  1978. }
  1979. if (newstate.detail.newstate == "pause") {
  1980. clearInterval(this.timer);
  1981. //暂停提交记录
  1982. /* this.ossAvatarUrl = ""
  1983. this.postStudyRecord() */
  1984. }
  1985. if (newstate.detail.newstate == "ended") {
  1986. clearInterval(this.timer);
  1987. uni.showToast({
  1988. icon: "none",
  1989. title: "播放完毕",
  1990. });
  1991. this.hasStart = false;
  1992. this.postStudyRecord(1);
  1993. // uni.$emit('playNext') //播放重修下一节
  1994. }
  1995. },
  1996. //拍照
  1997. openPhoto() {
  1998. var polyvPlayerContext = this.selectComponent("#playerVideo");
  1999. if (polyvPlayerContext) {
  2000. polyvPlayerContext.exitFullScreen();
  2001. }
  2002. this.enableAutoRotation = false;
  2003. this.photoPopup = true;
  2004. this.isTaking = true;
  2005. uni.setKeepScreenOn({
  2006. keepScreenOn: true,
  2007. });
  2008. uni.authorize({
  2009. scope: "scope.camera",
  2010. success() {},
  2011. });
  2012. },
  2013. /**
  2014. * 人脸匹配
  2015. */
  2016. faceRecognition() {
  2017. return new Promise((resolve) => {
  2018. let fileSystem = uni.getFileSystemManager();
  2019. fileSystem.readFile({
  2020. filePath: `${this.avatarUrl}`,
  2021. encoding: "base64",
  2022. position: 0,
  2023. success: (res) => {
  2024. let base64 = "data:image/jpg;base64," + res.data;
  2025. console.log('直播课-base64Data人脸识别参数:', {
  2026. imageA: base64,
  2027. orderGoodsId: this.orderGoodsId,
  2028. gradeId: this.gradeId,
  2029. })
  2030. let timer = setTimeout(() => {
  2031. uni.showToast({
  2032. icon: "none",
  2033. title: '拍照超时,请重新拍照',
  2034. duration: 2000,
  2035. success: () => {
  2036. setTimeout(() => {
  2037. uni.navigateBack()
  2038. }, 1000)
  2039. }
  2040. })
  2041. }, 10 * 1000)
  2042. this.$api
  2043. .faceCertificationCompareFace({
  2044. imageA: base64,
  2045. orderGoodsId: this.orderGoodsId,
  2046. gradeId: this.gradeId,
  2047. })
  2048. .then((res) => {
  2049. clearTimeout(timer)
  2050. resolve(res.data.data);
  2051. }).catch((err) => {
  2052. clearTimeout(timer)
  2053. // 当前网络延迟,
  2054. console.log('人脸识别错误:', err)
  2055. uni.showModal({
  2056. content: "当前网络延迟",
  2057. showCancel: false,
  2058. success: (resultst) => {
  2059. if (resultst.confirm) {
  2060. uni.navigateBack()
  2061. }
  2062. },
  2063. })
  2064. })
  2065. },
  2066. fail(err) {
  2067. console.error(err, "err");
  2068. },
  2069. });
  2070. });
  2071. },
  2072. async submit() {
  2073. if (this.uploadLock) {
  2074. return;
  2075. }
  2076. this.uploadLock = true;
  2077. let compareFaceData = await this.faceRecognition();
  2078. this.compareFaceData = compareFaceData
  2079. if (compareFaceData >= 80) {
  2080. const waitYS = await this.imageInfos();
  2081. this.postCoursePhotoRecord()
  2082. .then((res) => {
  2083. this.photoHistoryList.push(this.photoIndex);
  2084. this.postStudyRecord(); //提交记录
  2085. //恢复播放
  2086. uni.setKeepScreenOn({
  2087. keepScreenOn: false,
  2088. });
  2089. this.photoPopup = false;
  2090. this.uploadLock = false;
  2091. this.enableAutoRotation = true;
  2092. var polyvPlayerContext = this.selectComponent("#playerVideo");
  2093. if (polyvPlayerContext != null) {
  2094. polyvPlayerContext.play();
  2095. }
  2096. })
  2097. .catch((err) => {
  2098. uni.showToast({
  2099. title: "上传接口报错,请重新拍照上传" + err,
  2100. icon: "none",
  2101. });
  2102. this.uploadLock = false;
  2103. this.openPhoto();
  2104. });
  2105. } else {
  2106. uni.showToast({
  2107. title: "人脸匹配不通过,请重新拍照上传",
  2108. icon: "none",
  2109. duration: 2000,
  2110. });
  2111. setTimeout(() => {
  2112. this.uploadLock = false;
  2113. this.openPhoto();
  2114. }, 2000);
  2115. return;
  2116. }
  2117. },
  2118. reTake() {
  2119. this.isTaking = true;
  2120. },
  2121. //确认拍照
  2122. takePhoto() {
  2123. var self = this;
  2124. const ctx = uni.createCameraContext();
  2125. ctx.takePhoto({
  2126. quality: "high",
  2127. success: (res) => {
  2128. self.avatarUrl = res.tempImagePath;
  2129. this.isTaking = false;
  2130. // self.submit();
  2131. // self.photoPopup = false;
  2132. // self.enableAutoRotation = true;
  2133. },
  2134. fail: (err) => {
  2135. console.log(err);
  2136. },
  2137. });
  2138. },
  2139. playError(e) {
  2140. console.log(e);
  2141. },
  2142. //拍照报错
  2143. error(e) {
  2144. console.log(e.detail);
  2145. },
  2146. //关闭相机
  2147. closePhoto() {
  2148. this.photoPopup = false;
  2149. self.enableAutoRotation = true;
  2150. },
  2151. /**
  2152. * 进入全屏
  2153. */
  2154. fullscreenchange(event) {
  2155. if (event.detail.direction == "vertical") {
  2156. this.navShow = true;
  2157. } else if (event.detail.direction == "horizontal") {
  2158. this.navShow = false;
  2159. }
  2160. },
  2161. getGoodsDetail() {
  2162. let self = this;
  2163. // goods/'+ data
  2164. this.$api.goodsDetail(this.goodsId).then((res) => {
  2165. self.goodsData = res.data.data;
  2166. // this.courseBusiness();
  2167. // this.courseHandouts();
  2168. self.getMenuList();
  2169. //获取节笔记
  2170. this.getNoteList();
  2171. if (self.goodsData.goodsPlayConfig) {
  2172. self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
  2173. if (self.goodsPlayConfig.autoPlay > 0) {
  2174. self.autoplay = true;
  2175. }
  2176. if (self.goodsPlayConfig.drag > 0) {
  2177. self.isAllowSeek = "yes";
  2178. }
  2179. if (self.goodsPlayConfig.speed > 0) {
  2180. self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
  2181. }
  2182. }
  2183. if (self.goodsData.goodsPhotographConfig) {
  2184. self.goodsPhotographConfig = JSON.parse(
  2185. self.goodsData.goodsPhotographConfig
  2186. );
  2187. if (self.goodsPhotographConfig.photoNum > 0) {
  2188. self.photoNum = self.goodsPhotographConfig.photoNum;
  2189. }
  2190. }
  2191. });
  2192. },
  2193. startVideo() {
  2194. this.startStatus = true;
  2195. },
  2196. getAnswerList() {
  2197. let self = this;
  2198. this.$api
  2199. .answerList({ courseId: this.courseId, goodsId: this.goodsId,orderGoodsId: this.orderGoodsId, })
  2200. .then((res) => {
  2201. if (res.data.code == 200) {
  2202. self.answerList = res.data.rows;
  2203. }
  2204. });
  2205. },
  2206. getMenuList() {
  2207. // let self = this;
  2208. // /course/menuList
  2209. this.$api
  2210. .reMenuList({ courseId: this.courseId, gradeId: this.gradeId,orderGoodsId: this.orderGoodsId, })
  2211. .then((res) => {
  2212. if (res.data.code == 200) {
  2213. for (let i = 0; i < res.data.rows.length; i++) {
  2214. let item = res.data.rows[i];
  2215. item.down = true;
  2216. item.id = item.menuId;
  2217. item.name = item.menuName;
  2218. item.menuType = item.type;
  2219. }
  2220. this.menuList = res.data.rows;
  2221. this.reStart = true
  2222. for (let i = 0; i < res.data.rows.length; i++) {
  2223. if (res.data.rows[i].type == 1) {
  2224. this.menuIndex = [i];
  2225. break;
  2226. } else if (res.data.rows[i].type == 2) {
  2227. this.menuIndex = [i];
  2228. break;
  2229. }
  2230. }
  2231. }
  2232. });
  2233. },
  2234. courseDetail() {
  2235. let self = this;
  2236. // /course/'+data 获取课程详细信息
  2237. this.$api.courseDetail(this.courseId).then((res) => {
  2238. if (res.data.code == 200) {
  2239. // if (res.data.data.educationName == "继续教育") {
  2240. this.$api
  2241. .lockLockAction({
  2242. action: "jxjy",
  2243. uuid:this.$method.getUuid()
  2244. })
  2245. .then((res) => {});
  2246. this.lockTimer = setInterval(() => {
  2247. this.$api
  2248. .lockLockAction({
  2249. action: "jxjy",
  2250. uuid:this.$method.getUuid()
  2251. })
  2252. .then((res) => {});
  2253. }, 10000);
  2254. // websocket.sendMsg("doCourse");
  2255. // }
  2256. self.detail = res.data.data;
  2257. }
  2258. });
  2259. },
  2260. open(item) {
  2261. item.showChildren = !item.showChildren;
  2262. },
  2263. change(index) {
  2264. this.current = index;
  2265. },
  2266. openDocument() {
  2267. let self = this;
  2268. let url = this.$method.splitImgHost(this.courseHandoutsData.handoutsUrl);
  2269. uni.downloadFile({
  2270. url: url,
  2271. success: function (res) {
  2272. var filePath = res.tempFilePath;
  2273. uni.openDocument({
  2274. filePath: filePath,
  2275. showMenu: self.courseHandoutsData.canDownload == 1 ? true : false,
  2276. success: function (res) {
  2277. // console.log(res, "打开文档成功");
  2278. },
  2279. fail: function (err) {
  2280. uni.showToast({
  2281. icon: "none",
  2282. title: "文档地址错误",
  2283. });
  2284. },
  2285. });
  2286. },
  2287. fail: (err) => {
  2288. uni.showModal({
  2289. title: "提示",
  2290. content: "文档错误," + err.errMsg,
  2291. showCancel: false,
  2292. });
  2293. },
  2294. });
  2295. },
  2296. },
  2297. };
  2298. </script>
  2299. <style lang="scss" scope>
  2300. @import '../polyv/css/detail.scss';
  2301. .top {
  2302. &__header {
  2303. position:relative;
  2304. width:100%;
  2305. height:150rpx;
  2306. padding:24rpx 150rpx 24rpx 24rpx;
  2307. .img {
  2308. position:absolute;
  2309. left:0;
  2310. top:0;
  2311. width:100%;
  2312. }
  2313. .note {
  2314. position:relative;
  2315. z-index: 10;
  2316. font-size: 24rpx;
  2317. font-family: PingFang SC;
  2318. font-weight: bold;
  2319. color: #EFDBFF;
  2320. }
  2321. .title {
  2322. position:relative;
  2323. z-index: 10;
  2324. font-size: 26rpx;
  2325. font-family: PingFang SC;
  2326. font-weight: bold;
  2327. color: #FFFFFF;
  2328. }
  2329. .desc {
  2330. }
  2331. }
  2332. }
  2333. .polyv_detail {
  2334. display: flex;
  2335. flex-direction: column;
  2336. height: 100vh;
  2337. .box {
  2338. flex: 1;
  2339. overflow: hidden;
  2340. margin: 16rpx 16rpx 100rpx 16rpx;
  2341. .box_in {
  2342. height: 100%;
  2343. }
  2344. }
  2345. .first_ml {
  2346. margin: 16rpx 16rpx 16rpx 16rpx;
  2347. }
  2348. }
  2349. .btnSet {
  2350. width: 440rpx;
  2351. height: 80rpx;
  2352. background: #007aff;
  2353. border-radius: 40rpx;
  2354. color: #ffffff;
  2355. font-size: 28rpx;
  2356. line-height: 80rpx;
  2357. }
  2358. .btnReply {
  2359. width: 80rpx;
  2360. height: 40rpx;
  2361. background: #e3f0ff;
  2362. border-radius: 16rpx;
  2363. text-align: center;
  2364. color: #007aff;
  2365. }
  2366. .btnDel {
  2367. width: 80rpx;
  2368. height: 40rpx;
  2369. background: #ffedf0;
  2370. border-radius: 16rpx;
  2371. text-align: center;
  2372. color: #ff2d55;
  2373. }
  2374. .btnReply {
  2375. width: 80rpx;
  2376. height: 40rpx;
  2377. background: #e3f0ff;
  2378. border-radius: 16rpx;
  2379. font-size: 24rpx;
  2380. }
  2381. .lecture-box {
  2382. display: flex;
  2383. align-items: center;
  2384. height: 80rpx;
  2385. background: #ffffff;
  2386. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2387. .title {
  2388. padding: 10rpx;
  2389. flex: 1;
  2390. overflow: hidden;
  2391. text-overflow: ellipsis;
  2392. white-space: nowrap;
  2393. color: #333;
  2394. font-weight: bold;
  2395. font-size: 32rpx;
  2396. }
  2397. .btn {
  2398. display: flex;
  2399. align-items: center;
  2400. justify-content: center;
  2401. width: 80rpx;
  2402. height: 80rpx;
  2403. background: #ffffff;
  2404. box-shadow: -4rpx 0rpx 4rpx 0rpx rgba(0, 0, 0, 0.1);
  2405. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2406. }
  2407. }
  2408. .lecture-content {
  2409. background: #fff;
  2410. margin-top: 10rpx;
  2411. padding: 10rpx;
  2412. border-radius: 16rpx;
  2413. }
  2414. .photoBox {
  2415. width: 100%;
  2416. // background-color: #ffffff;
  2417. // border-radius: 24px 24px 0px 0px;
  2418. .photoTop {
  2419. width: 100%;
  2420. height: 74rpx;
  2421. border-radius: 20px 20px 0px 0px;
  2422. background-color: #ffffff;
  2423. display: flex;
  2424. align-items: center;
  2425. justify-content: center;
  2426. padding: 0rpx 38rpx;
  2427. .sqzz {
  2428. width: 28rpx;
  2429. height: 28rpx;
  2430. display: flex;
  2431. align-items: center;
  2432. justify-content: center;
  2433. }
  2434. .centersq {
  2435. color: #333;
  2436. font-size: 30rpx;
  2437. font-weight: 500;
  2438. }
  2439. }
  2440. .photoCenter {
  2441. width: 750rpx;
  2442. height: 75vh;
  2443. position: relative;
  2444. .center_camera {
  2445. width: 100%;
  2446. height: 75vh;
  2447. // position: fixed;
  2448. .head_take {
  2449. width: 100%;
  2450. height: 75vh;
  2451. display: flex;
  2452. flex-direction: column;
  2453. }
  2454. .headTake_up {
  2455. width: 100%;
  2456. height: 100rpx;
  2457. }
  2458. .headTake_minddle {
  2459. display: flex;
  2460. .min_img {
  2461. width: 500rpx;
  2462. height: 550rpx;
  2463. }
  2464. .min_left, .min_right {
  2465. flex: 1;
  2466. height: 550rpx;
  2467. }
  2468. }
  2469. .headTake_down {
  2470. width: 100%;
  2471. flex: 1;
  2472. }
  2473. .color {
  2474. background-color: #333;
  2475. opacity: 0.5;
  2476. }
  2477. }
  2478. .custom {
  2479. width: 750rpx;
  2480. height: 75vh;
  2481. position: absolute;
  2482. z-index: 1000;
  2483. top: 0;
  2484. left: 0;
  2485. image {
  2486. width: 100%;
  2487. height: 100%;
  2488. }
  2489. }
  2490. }
  2491. .btns {
  2492. display: flex;
  2493. .btnResult {
  2494. height: 100rpx;
  2495. flex: 1;
  2496. background-color: #07c160;
  2497. text-align: center;
  2498. line-height: 100rpx;
  2499. color: #fff;
  2500. font-size: 32rpx;
  2501. font-weight: bold;
  2502. }
  2503. }
  2504. }
  2505. .chat_box {
  2506. display: flex;
  2507. padding: 20rpx;
  2508. justify-content: space-between;
  2509. }
  2510. .chat3 {
  2511. font-size: 30rpx;
  2512. font-family: PingFang SC;
  2513. font-weight: 500;
  2514. color: #666666;
  2515. margin-top: 10rpx;
  2516. }
  2517. .chat2 {
  2518. font-size: 20rpx;
  2519. font-family: PingFang SC;
  2520. font-weight: 500;
  2521. color: #999999;
  2522. margin-top: 10rpx;
  2523. }
  2524. .chat1 {
  2525. font-size: 24rpx;
  2526. font-family: PingFang SC;
  2527. font-weight: 500;
  2528. color: #333333;
  2529. }
  2530. .leftPadding {
  2531. margin-left: 8rpx;
  2532. }
  2533. .t2Content {
  2534. font-size: 24rpx;
  2535. font-family: PingFang SC;
  2536. font-weight: bold;
  2537. color: #999999;
  2538. line-height: 48rpx;
  2539. }
  2540. .tBox2 {
  2541. display: flex;
  2542. padding-top: 10rpx;
  2543. color: #333333;
  2544. font-size: 30rpx;
  2545. font-weight: 400;
  2546. }
  2547. .tBox {
  2548. display: flex;
  2549. align-items: center;
  2550. padding-top: 10rpx;
  2551. }
  2552. .title {
  2553. font-size: 24rpx;
  2554. color: #999999;
  2555. }
  2556. page {
  2557. // padding-top: 10px;
  2558. // padding-top: constant(safe-area-inset-top);
  2559. // padding-top: env(safe-area-inset-top);
  2560. }
  2561. .Answering {
  2562. .answer_item {
  2563. &:nth-child(2) {
  2564. border-radius: 16rpx 16rpx 0rpx 0rpx;
  2565. }
  2566. &:nth-last-child(1) {
  2567. border-radius: 0rpx 0rpx 16rpx 16rpx;
  2568. }
  2569. }
  2570. }
  2571. .inputBottom {
  2572. position: fixed;
  2573. left: 0;
  2574. bottom: 0;
  2575. background: #ffffff;
  2576. height: 98rpx;
  2577. display: flex;
  2578. align-items: center;
  2579. width: 100%;
  2580. z-index: 99;
  2581. .flex_auto {
  2582. flex: 1;
  2583. margin-left: 10%;
  2584. }
  2585. .btn {
  2586. color: #007aff;
  2587. font-size: 30rpx;
  2588. font-weight: bold;
  2589. width: 15%;
  2590. text-align: center;
  2591. }
  2592. .input {
  2593. background: rgba(244, 244, 244, 0.98);
  2594. height: 60rpx;
  2595. border-radius: 24rpx;
  2596. margin-top: 12rpx;
  2597. }
  2598. }
  2599. .noteBox {
  2600. width: 100%;
  2601. background: #ffffff;
  2602. padding: 0rpx 10rpx 20rpx;
  2603. border-radius: 16rpx;
  2604. overflow: hidden;
  2605. .left_ti {
  2606. padding-top: 14rpx;
  2607. }
  2608. }
  2609. .dateBox {
  2610. width: 216rpx;
  2611. height: 48rpx;
  2612. background: #ffffff;
  2613. border-radius: 24rpx;
  2614. font-size: 24rpx;
  2615. color: #666666;
  2616. text-align: center;
  2617. line-height: 48rpx;
  2618. margin: 16rpx 0rpx 8rpx;
  2619. }
  2620. .t_content1 {
  2621. color: #007aff;
  2622. margin-left: 10rpx;
  2623. }
  2624. .tag1 {
  2625. border: 2rpx solid #007aff;
  2626. border-radius: 8rpx;
  2627. font-size: 20rpx;
  2628. color: #007aff;
  2629. padding: 5rpx;
  2630. }
  2631. .b_title {
  2632. color: #333333;
  2633. font-size: 30rpx;
  2634. font-weight: bold;
  2635. }
  2636. page {
  2637. background: #eaeef1;
  2638. }
  2639. .menuBox {
  2640. width: 100%;
  2641. background: #ffffff;
  2642. border-radius: 16rpx;
  2643. padding: 20rpx;
  2644. margin-bottom: 20rpx;
  2645. }
  2646. .btnspric {
  2647. border-top: 1rpx solid #eee;
  2648. display: flex;
  2649. align-items: center;
  2650. justify-content: space-between;
  2651. height: 108rpx;
  2652. padding-left: 43rpx;
  2653. padding-right: 32rpx;
  2654. }
  2655. .btnspric > .lefprL {
  2656. font-size: 36rpx;
  2657. color: #0c141f;
  2658. font-weight: bold;
  2659. }
  2660. .btnspric > .lefprR {
  2661. padding: 0rpx 24rpx;
  2662. height: 60rpx;
  2663. line-height: 60rpx;
  2664. text-align: center;
  2665. color: #fff;
  2666. background: #32467b;
  2667. border-radius: 24rpx;
  2668. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2669. }
  2670. .yhj,
  2671. .hdyhj {
  2672. padding: 24rpx 29rpx 24rpx 34rpx;
  2673. }
  2674. .yhj {
  2675. border-bottom: 16rpx solid #f9f9f9;
  2676. }
  2677. .yhjtit {
  2678. font-size: 30rpx;
  2679. color: #0c141f;
  2680. font-weight: 500;
  2681. margin-bottom: 14rpx;
  2682. }
  2683. .yhjList {
  2684. display: flex;
  2685. align-items: center;
  2686. justify-content: space-between;
  2687. margin-bottom: 14rpx;
  2688. }
  2689. .yhjList > .yhjLefts {
  2690. display: flex;
  2691. align-items: center;
  2692. }
  2693. .yhjLefts > .yhl {
  2694. color: #32467b;
  2695. font-size: 30rpx;
  2696. margin-right: 31rpx;
  2697. }
  2698. .yhjLefts > .yhbq {
  2699. font-size: 24rpx;
  2700. color: #ff9500;
  2701. border-radius: 18rpx;
  2702. background-color: rgba(255, 149, 0, 0.2);
  2703. border: 2rpx solid #ff9500;
  2704. height: 38rpx;
  2705. line-height: 38rpx;
  2706. padding: 0rpx 16rpx;
  2707. }
  2708. .ts {
  2709. font-size: 24rpx;
  2710. color: #999;
  2711. margin: 14rpx 0rpx;
  2712. padding-right: 29rpx;
  2713. padding-left: 34rpx;
  2714. }
  2715. .yh {
  2716. padding-top: 20rpx;
  2717. }
  2718. .yh > .yhtitle {
  2719. display: flex;
  2720. align-items: center;
  2721. justify-content: space-between;
  2722. padding-right: 29rpx;
  2723. padding-left: 34rpx;
  2724. }
  2725. .priceBxs {
  2726. display: flex;
  2727. align-items: center;
  2728. }
  2729. .priceBxs > .pricleft {
  2730. border-radius: 24rpx;
  2731. border: 1rpx solid #e91313;
  2732. background-color: rgba(233, 19, 19, 0.1);
  2733. padding: 0rpx 18rpx;
  2734. height: 49rpx;
  2735. line-height: 49rpx;
  2736. text-align: center;
  2737. font-size: 30rpx;
  2738. font-weight: 500;
  2739. color: #e91313;
  2740. margin-right: 13rpx;
  2741. }
  2742. .topBox {
  2743. padding: 32rpx 32rpx 24rpx;
  2744. border-bottom: 1rpx solid #eeeeee;
  2745. }
  2746. .topBox > .boldFonstType {
  2747. font-weight: 500;
  2748. font-size: 30rpx;
  2749. margin: 16rpx 0rpx 23rpx;
  2750. }
  2751. .topBox > .firstTopL {
  2752. display: flex;
  2753. align-items: center;
  2754. }
  2755. .topBox > .firstTopL > .imageBs {
  2756. width: 331rpx;
  2757. height: 160rpx;
  2758. border-radius: 6rpx;
  2759. overflow: hidden;
  2760. margin-right: 8rpx;
  2761. box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
  2762. }
  2763. .topBox > .firstTopL > .imageBs > image {
  2764. width: 100%;
  2765. height: 100%;
  2766. }
  2767. .topBox > .firstTopL > .textBs {
  2768. font-size: 30rpx;
  2769. font-weight: bold;
  2770. color: #0c141f;
  2771. }
  2772. .content {
  2773. padding: 24rpx;
  2774. text-align: left;
  2775. }
  2776. .catalogBox {
  2777. display: flex;
  2778. align-items: center;
  2779. flex-wrap: nowrap;
  2780. overflow-x: auto;
  2781. padding-left: 38rpx;
  2782. max-height: 305rpx;
  2783. overflow-y: auto;
  2784. transition: all 0.4s;
  2785. }
  2786. .catalogBox > .catalogA {
  2787. min-width: 200rpx;
  2788. height: 48rpx;
  2789. line-height: 48rpx;
  2790. // text-align: center;
  2791. border: 2rpx solid transparent;
  2792. white-space: nowrap;
  2793. text-overflow: ellipsis;
  2794. overflow: hidden;
  2795. word-break: break-all;
  2796. border-radius: 10rpx;
  2797. background: rgba(22, 119, 255, 0.05);
  2798. padding-left: 19rpx;
  2799. box-sizing: border-box;
  2800. padding-right: 15rpx;
  2801. margin-right: 16rpx;
  2802. margin-bottom: 20rpx;
  2803. margin-top: 15rpx;
  2804. font-size: 24rpx;
  2805. color: #666;
  2806. }
  2807. .catalogBox > .activesq {
  2808. border-color: #1677ff;
  2809. }
  2810. .changeCatalogBox {
  2811. display: block;
  2812. }
  2813. .catalogBox::-webkit-scrollbar {
  2814. display: none; /* Chrome Safari */
  2815. }
  2816. .price_t2 {
  2817. font-size: 18rpx;
  2818. font-family: PingFang SC;
  2819. font-weight: 500;
  2820. text-decoration: line-through;
  2821. color: #999999;
  2822. }
  2823. .price_t1 {
  2824. font-size: 33rpx;
  2825. font-family: PingFang SC;
  2826. font-weight: bold;
  2827. color: #e91313;
  2828. }
  2829. .sc_t {
  2830. font-size: 22rpx;
  2831. color: #000000;
  2832. }
  2833. .sc {
  2834. width: 29rpx;
  2835. height: 29rpx;
  2836. }
  2837. .buy {
  2838. width: 138rpx;
  2839. height: 48rpx;
  2840. line-height: 48rpx;
  2841. background: #32467b;
  2842. border-radius: 10rpx;
  2843. color: #ffffff;
  2844. font-size: 28rpx;
  2845. text-align: center;
  2846. vertical-align: middle;
  2847. position: absolute;
  2848. right: 30rpx;
  2849. }
  2850. .video_body {
  2851. padding-bottom: 96rpx;
  2852. }
  2853. .footer_tab {
  2854. position: fixed;
  2855. bottom: 0;
  2856. height: 96rpx;
  2857. width: 100%;
  2858. background-color: #ffffff;
  2859. }
  2860. .tj_box {
  2861. width: 50%;
  2862. display: inline-block;
  2863. text-align: center;
  2864. margin: 10rpx 0;
  2865. }
  2866. .teacher_t {
  2867. font-size: 24rpx;
  2868. font-family: PingFang SC;
  2869. font-weight: 400;
  2870. color: #666666;
  2871. line-height: 36rpx;
  2872. margin-left: 15rpx;
  2873. }
  2874. .teacher_img {
  2875. width: 87rpx;
  2876. height: 129rpx;
  2877. }
  2878. .t2 {
  2879. font-size: 24rpx;
  2880. font-family: PingFang SC;
  2881. color: #666666;
  2882. line-height: 36rpx;
  2883. margin: 15rpx;
  2884. }
  2885. .r_t2 {
  2886. width: 201rpx;
  2887. height: 49rpx;
  2888. background: rgba(22, 119, 255, 0.05);
  2889. border: 1rpx solid #32467b;
  2890. border-radius: 16rpx;
  2891. color: #666666;
  2892. font-size: 23rpx;
  2893. text-align: center;
  2894. display: flex;
  2895. align-items: center;
  2896. padding: 5rpx;
  2897. }
  2898. .scroll_box {
  2899. width: 100%;
  2900. height: 60rpx;
  2901. background: #ffffff;
  2902. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  2903. white-space: nowrap;
  2904. overflow: hidden;
  2905. margin: 15rpx 0;
  2906. }
  2907. .r_sliper {
  2908. padding: 0 20rpx;
  2909. }
  2910. .top_line {
  2911. width: 6rpx;
  2912. height: 22rpx;
  2913. background: #32467b;
  2914. margin-right: 10rpx;
  2915. }
  2916. .video_t2 {
  2917. font-size: 24rpx;
  2918. font-family: PingFang SC;
  2919. font-weight: 500;
  2920. color: #666666;
  2921. }
  2922. .course_name {
  2923. height: 80rpx;
  2924. background-color: #fff;
  2925. }
  2926. .video_t1 {
  2927. height: 80rpx;
  2928. color: #333333;
  2929. line-height: 80rpx;
  2930. font-size: 30rpx;
  2931. font-family: PingFang SC;
  2932. font-weight: bold;
  2933. color: #333333;
  2934. margin-left: 15rpx;
  2935. overflow: hidden;
  2936. text-overflow: ellipsis;
  2937. white-space: nowrap;
  2938. }
  2939. .notice_wrap {
  2940. height: 80rpx;
  2941. display: flex;
  2942. align-items: center;
  2943. justify-content: flex-end;
  2944. .video_t1_t {
  2945. width: 100%;
  2946. height: 40rpx;
  2947. line-height: 40rpx;
  2948. text-align: center;
  2949. background: rgba(245, 154, 35, 1);
  2950. color: #333;
  2951. border-radius: 10rpx;
  2952. font-size: 24rpx;
  2953. }
  2954. }
  2955. .video_play {
  2956. position: absolute;
  2957. width: 95rpx;
  2958. height: 95rpx;
  2959. top: 0;
  2960. left: 0;
  2961. right: 0;
  2962. bottom: 0;
  2963. margin: auto;
  2964. }
  2965. .video_box {
  2966. position: relative;
  2967. .video-toast {
  2968. position: absolute;
  2969. width: 686rpx;
  2970. height: 80rpx;
  2971. background: rgba(0, 0, 0, 0.6);
  2972. border-radius: 24rpx;
  2973. bottom: 100rpx;
  2974. left: 50%;
  2975. transform: translateX(-50%);
  2976. color: #fff;
  2977. display: flex;
  2978. font-size: 26rpx;
  2979. align-items: center;
  2980. overflow: visible;
  2981. &__text {
  2982. flex: 1;
  2983. margin-left: 40rpx;
  2984. }
  2985. &__btn {
  2986. width: 180rpx;
  2987. text-align: center;
  2988. border-left: 1rpx solid #fff;
  2989. }
  2990. }
  2991. .video-toast__close {
  2992. position: absolute;
  2993. right: 32rpx;
  2994. bottom: 184rpx;
  2995. width: 40rpx;
  2996. height: 40rpx;
  2997. line-height: 40rpx;
  2998. text-align: center;
  2999. background: rgba(0, 0, 0, 0.6);
  3000. border-radius: 50%;
  3001. color: rgba(255, 255, 255, 0.3);
  3002. }
  3003. }
  3004. .rotoct {
  3005. transform: rotate(90deg);
  3006. }
  3007. .notice_modal {
  3008. .content {
  3009. width: 100%;
  3010. height: 100%;
  3011. padding: 56rpx 56rpx 56rpx 64rpx;
  3012. .title {
  3013. color: #222;
  3014. line-height: 40rpx;
  3015. font-size: 36rpx;
  3016. text-align: center;
  3017. font-weight: bold;
  3018. margin-bottom: 24rpx;
  3019. }
  3020. .text {
  3021. height: 340rpx;
  3022. line-height: 40rpx;
  3023. text-indent: 2em;
  3024. font-size: 32rpx;
  3025. color: #222;
  3026. }
  3027. .had_read {
  3028. width: 100%;
  3029. height: 88rpx;
  3030. line-height: 88rpx;
  3031. text-align: center;
  3032. background: #3577E8;
  3033. border-radius: 240rpx;
  3034. font-size: 32rpx;
  3035. font-weight: 500;
  3036. color: #fff;
  3037. margin-top: 20rpx;
  3038. &.gray {
  3039. background: #BBBEC5;
  3040. }
  3041. }
  3042. }
  3043. }
  3044. </style>