detail.vue 87 KB

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