detail.vue 95 KB

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