videoDetail.vue 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420
  1. <template>
  2. <view class="content">
  3. <view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
  4. <view class="arrow-left-warning" @click="feedback">
  5. <image src="/static/images/warning.png"></image>
  6. <text>投诉</text>
  7. </view>
  8. <view class="header-title" :style="{width:menuButtonLeft + 'px',height:menuButtonH+'px',lineHeight:menuButtonH+'px'}">{{courseInfo.title}}</view>
  9. </view>
  10. <view class="video-box">
  11. <image v-if="!isLogin || isAddKf!=1" class="video-poster" :src="courseInfo.imgUrl" mode="aspectFill">
  12. </image>
  13. <video
  14. @timeupdate="onTimeUpdate"
  15. @progress="progressChange"
  16. @error="videoErrorCallback"
  17. @play="getPlay"
  18. @pause="getPause"
  19. @ended="getEnded"
  20. @fullscreenchange="fullscreenchange"
  21. @controlstoggle="controlstoggle"
  22. @waiting="getWaiting"
  23. :title="courseInfo.title"
  24. style="width: 100%;height: 420rpx;"
  25. :poster="poster"
  26. id="video-content-box"
  27. controls
  28. :show-fullscreen-btn="true"
  29. :auto-pause-if-open-native="true"
  30. :auto-pause-if-navigate="true"
  31. :enable-progress-gesture="false"
  32. :show-progress="true"
  33. :picture-in-picture-mode="[]"
  34. :show-background-playback-button="false"
  35. :src="videoUrl"
  36. >
  37. <!-- :danmu-list="danmuList"
  38. enable-danmu
  39. danmu-btn -->
  40. <!-- 弹幕展示 -->
  41. <template v-if="showDanmu==1&&openCommentStatus==2">
  42. <text v-for="(item, index) in activeDanmus" :key="item.commentId" class="danmu-item danmuMove"
  43. :style="item.danmustyle" @animationend="animationend(item,index)">
  44. {{ item.content }}
  45. </text>
  46. </template>
  47. <cover-view class="video-danmu-btnbox" :style="{display: openCommentStatus==2&&isfull&&crtShow&&isLogin&&isAddKf==1 ? 'block':'none'}">
  48. <cover-image class="video-danmu-image"
  49. :src="baseUrl+'/images/danmu_set.png'"
  50. @click="openDanmu(1)"></cover-image>
  51. </cover-view>
  52. <treasureChest ref="treasureChest" :isfull="isfull" :onHide="onHide" :boxList="fsUserCourseRewardRoundStatusVO" @claimFun="claimFun"></treasureChest>
  53. </video>
  54. </view>
  55. <!-- 弹幕方法 -->
  56. <commentBox
  57. v-if="openCommentStatus==2"
  58. ref="danmuBox"
  59. :height="height"
  60. :urlOption="urlOption"
  61. :time="playTime"
  62. :showDanmu="showDanmu"
  63. :viewCommentNum="viewCommentNum"
  64. :openCommentStatus="openCommentStatus"
  65. :isSocketOpen="isSocketOpen"
  66. @socketSend="socketSend"
  67. @initSocket="initSocket"
  68. @setInputText="setInputText"
  69. @getScrollTop="getScrollTop"
  70. @getMore="getMore"
  71. @getActiveDanmus="getActiveDanmus"></commentBox>
  72. <view id="title-contentnav">
  73. <template v-show="isLogin&&notice">
  74. <u-notice-bar :text="notice" color="red" speed='60' fontSize="18"></u-notice-bar>
  75. </template>
  76. </view>
  77. <scroll-view
  78. class="scroll-view"
  79. :style="{height: height}"
  80. :scroll-top="scrollTop"
  81. :scroll-y="true"
  82. :refresher-enabled="currentTab == 2"
  83. :refresher-triggered="triggered"
  84. @refresherrefresh="handleRefresher">
  85. <view style="font-size: 30rpx;color: #999;padding: 10rpx 24rpx;">本页内容受知识产权保护,请勿截屏录屏及转发,感谢理解。</view>
  86. <view class="title-content" v-if="openCommentStatus!=1">
  87. <!-- 答题时展示小节课程名,其他展示课程名 -->
  88. <!-- 小节课程名 -->
  89. <view class="subtitlebox" v-if="isLogin&&isAddKf==1">
  90. {{courseInfo.title|| ''}}
  91. </view>
  92. <!-- 课程名字 -->
  93. <view class="miantitlebox" v-else>
  94. {{courseInfo.courseName|| ''}}
  95. </view>
  96. </view>
  97. <view class="tabbox-bar" v-if="openCommentStatus==1">
  98. <view class="tabbox">
  99. <view :class="currentTab == nav.id ? 'tabbox-active':''" v-for="nav in navList" :key="nav.id" @click="handleTab(nav.id)">{{nav.name}}</view>
  100. </view>
  101. </view>
  102. <template v-if="openCommentStatus==1">
  103. <view v-show="currentTab==0">
  104. <descInfoNav ref="descInfoNav" :isLogin="isLogin" :isAddKf="isAddKf" :courseInfo="courseInfo"></descInfoNav>
  105. </view>
  106. <view v-show="currentTab==2">
  107. <commentBox
  108. ref="commentBox"
  109. :height="height"
  110. :urlOption="urlOption"
  111. :time="playTime"
  112. :flagTime="flagTime"
  113. :showDanmu="showDanmu"
  114. :viewCommentNum="viewCommentNum"
  115. :openCommentStatus="openCommentStatus"
  116. :isSocketOpen="isSocketOpen"
  117. @socketSend="socketSend"
  118. @initSocket="initSocket"
  119. @setInputText="setInputText"
  120. @getScrollTop="getScrollTop"
  121. @getMore="getMore"></commentBox>
  122. </view>
  123. </template>
  124. <view v-show="currentTab==1">
  125. <template v-if="openCommentStatus!=1">
  126. <!-- 介绍 -->
  127. <descInfo ref="descInfo" :isLogin="isLogin" :isAddKf="isAddKf" :courseInfo="courseInfo"></descInfo>
  128. </template>
  129. <!-- 问题 -->
  130. <template v-if="isLogin&&isAddKf==1">
  131. <ques ref="ques" :urlOption="urlOption" :courseNote="courseNote" :showNote="showNote" :treatmentPackage="treatmentPackage" :showTreatment="showTreatment" :quesList="quesList" :openCommentStatus="openCommentStatus" @handleAnswer="handleAnswer" @showBtnType="showBtnType"></ques>
  132. </template>
  133. </view>
  134. </scroll-view>
  135. <!-- 线路 -->
  136. <view class="video-line" v-if="isLogin&&isAddKf==1" @click="openPop">
  137. <image src="https://cos.his.cdwjyyh.com/fs/20250915/04889779f7f44e22a7a378d26823b2e8.png"></image>
  138. <text>线路{{numberToChinese(lineIndex + 1)}}</text>
  139. </view>
  140. <!-- 线路弹窗 -->
  141. <uni-popup ref="popup" type="bottom" class="full-width-popup">
  142. <view class="popupbox">
  143. <view class="popupbox-head">
  144. <text>线路选择</text>
  145. <image class="close-icon" src="https://cos.his.cdwjyyh.com/fs/20250915/b950ff20d115453f9d7f908590c9c0e7.png" mode="aspectFill" @click="close">
  146. </image>
  147. </view>
  148. <view class="popupbox-content">
  149. <view :class="lineIndex == index ? 'line-item line-active': 'line-item'"
  150. v-for="(it,index) in lineList" :key="index" @click="handleLine(index)">
  151. 线路{{numberToChinese(index + 1)}}</view>
  152. </view>
  153. </view>
  154. </uni-popup>
  155. <!-- 发送弹幕 -->
  156. <view class="video-line danmu-line" v-if="isLogin&&isAddKf==1&&openCommentStatus==2" @click="openDanmu(0)" >
  157. <image class="set_image" src="https://cos.his.cdwjyyh.com/fs/20250418/5e508642737a44169061382566043ac9.png" mode="aspectFill"></image>
  158. <text>发弹幕</text>
  159. </view>
  160. <!-- 发送弹幕弹窗 -->
  161. <uni-popup ref="danmuPopup" type="bottom" style="z-index: 999;" @change="changeShowPopup">
  162. <view class="danmuPopup" :style="{marginLeft:isfull ? statusBarHeight+'px': 0,marginBottom: danmuboxHeight+'px'}">
  163. <view class="danmuPopup-head border-line">
  164. <image class="danmu-icon" :src="showDanmu==0?baseUrl+'/images/danmu-off.png':baseUrl+'/images/danmu-on.png'" mode="heightFix" @click="switchDanmu()"></image>
  165. <view class="u-border">
  166. <u-input
  167. class="danmuPopup-input"
  168. placeholder="发个弹幕吧~"
  169. border="border"
  170. :focus="focus"
  171. :adjustPosition="false"
  172. :autoBlur="true"
  173. maxlength="50"
  174. v-model.trim="inputText">
  175. </u-input>
  176. <text style="font-size: 24rpx;color: #bbb;margin-left: 10rpx;">{{inputText?inputText.trim().length:0}}/50</text>
  177. </view>
  178. <button class="danmuPopup-send" @click="handleChatInput">发送</button>
  179. </view>
  180. </view>
  181. </uni-popup>
  182. <!-- 答题弹窗 -->
  183. <uni-popup ref="answerPopup" type="center">
  184. <view :class="errTitle == '恭喜你,回答正确' ? 'answerPopup-box bg':'answerPopup-box'">
  185. <!-- 正确 -->
  186. <image class="tipimg" v-if="errTitle == '恭喜你,回答正确'" src="https://cos.his.cdwjyyh.com/fs/20250915/f7b1075c21b442069ec9721a1a4790ec.png"
  187. mode="aspectFill"></image>
  188. <!-- 错误 -->
  189. <image class="tipimg" v-else src="https://cos.his.cdwjyyh.com/fs/20250915/a4b145c94b684c778c03ad9b52d717f3.png" mode="aspectFill">
  190. </image>
  191. <view class="answerPopup-title">{{errTitle}}</view>
  192. <view class="answerPopup-desc" v-html="errDesc"></view>
  193. <view style="color: #FF5C03;">{{currentRewardText}}</view>
  194. <!-- 选择奖励 -->
  195. <view class="reward-list" v-if="errTitle == '恭喜你,回答正确'">
  196. <view :class="item.value == currentReward?'reward-item reward-active':'reward-item'"
  197. v-for="(item, index) in rewardType" :key="item.value" @click="rewardChange(item)">
  198. {{item.name}}
  199. </view>
  200. <!-- <radio-group class="reward-list-group" @change="rewardChange">
  201. <label class="reward-list-option" v-for="(item, index) in rewardType" :key="item.value">
  202. <radio :value="item.value+ ''" :checked="item.value == currentReward"
  203. activeBorderColor="#FF5C03" activeBackgroundColor="#FF5C03"
  204. style="transform:scale(0.7)" color="#FF5C03" />
  205. <view :style="{color: item.value == currentReward ? '#FF5C03':''}">{{item.name}}</view>
  206. </label>
  207. </radio-group> -->
  208. </view>
  209. <!-- 错误题目 -->
  210. <view class="errQuesbox" v-if="errQues&&errQues.length>0">
  211. <view class="errQuesbox-item textOne" v-for="(it,index) in errQues" :key="index">{{it.title}}</view>
  212. </view>
  213. <view class="answerPopup-btn" v-if="errTitle == '恭喜你,回答正确'" @click="closeAnswerPopup">确认</view>
  214. <view class="tipsPopup-btn-box" v-else
  215. :style="{marginTop: errQues&&errQues.length>0 ? '40rpx':'54rpx'}">
  216. <view class="tipsPopup-btn" @click="closeAnswerPopup">{{remain > 0 ? '重新答题': '确认'}}</view>
  217. </view>
  218. </view>
  219. </uni-popup>
  220. <!-- 展示兑换奖品弹窗 -->
  221. <appPopup ref="appPopup"></appPopup>
  222. <!-- 客服二维码弹窗 -->
  223. <uni-popup ref="kfPopup" type="center" :mask-click="false">
  224. <view class="kfqrcode-box">
  225. <image class="kfqrcode" v-if="qrcode" :src="qrcode" show-menu-by-longpress="true"></image>
  226. <view v-show="qrcodeMsg" style="margin-top: 30rpx;" v-html="qrcodeMsg"></view>
  227. <image class="kfqrcode-close" src="https://cos.his.cdwjyyh.com/fs/20250915/97978486cc6c47c6949c5bcc9bc0c4a3.png" mode="aspectFill"
  228. @click="closeKFPop"></image>
  229. </view>
  230. </uni-popup>
  231. <!-- 可以答题提示 -->
  232. <view class="answerTip" v-if="currentTab!=1&&openCommentStatus==1&&showAnswerTip" @click="handleTab(1)">
  233. 可以答题啦
  234. </view>
  235. <!-- footer -->
  236. <view class="footer" v-show="currentTab!=2&&videoId">
  237. <view class="footer-btn" v-if="!isLogin || isAddKf !=1" @click="submit">
  238. <text>立即学习</text>
  239. </view>
  240. <view v-if="isLogin&&isAddKf==1&&currentTab==1&&quesList&&quesList.length>0&&showBtn==0" class="footer-btn footer-btn-border" @click="submit">
  241. <!-- <image class="footer-btn-img" :src="baseUrl+'/images/red_envelope_btnimg.png'" mode="aspectFill"></image> -->
  242. <text>提交答案领取奖励</text>
  243. </view>
  244. <!-- <view @click="checked=!checked" class="agreement" v-if="!isLogin">
  245. <radio value="r1" :checked="checked" color="#ff5c03" activeBorderColor="#ff5c03"
  246. style="transform:scale(0.6);" />
  247. <view>阅读并同意<text style="color: #ff5c03;" @click.stop="goWeb(0)">《用户协议》</text>和<text
  248. style="color: #ff5c03;" @click.stop="goWeb(1)">《隐私协议》</text></view>
  249. </view> -->
  250. <!-- <view class="footer-tips">重庆云联融智提供技术支持</view> -->
  251. </view>
  252. <view v-show="currentTab==2">
  253. <view class="chatinput" :style="{bottom:danmuboxHeight>0?danmuboxHeight+'px':'calc(var(--window-bottom) + 24rpx)'}">
  254. <input class="uni-input" v-model.trim="inputText" :adjustPosition="false" :autoBlur="false" maxlength="140" placeholder="发消息···" confirm-type="send" @confirm="handleChatInput" />
  255. <button class="send" @click="handleChatInput">发送</button>
  256. </view>
  257. </view>
  258. <turntableOne ref="turntableOne" @sendRewardFun="sendRewardFun" @openAppPop="openAppPop"></turntableOne>
  259. <turntableTwo ref="turntableTwo" @sendRewardFun="sendRewardFun" @openAppPop="openAppPop"></turntableTwo>
  260. <yk-screenRecord></yk-screenRecord>
  261. </view>
  262. </template>
  263. <script>
  264. import ykScreenRecord from './components/yk-screenRecord/yk-screenRecord';
  265. import { mapGetters } from 'vuex';
  266. import turntableOne from "./components/turntableOne.vue"
  267. import turntableTwo from "./components/turntableTwo.vue"
  268. import appPopup from "./components/appPopup.vue"
  269. import ques from "./components/ques.vue"
  270. import descInfo from "./components/descInfo.vue"
  271. import descInfoNav from "./components/descInfoNav.vue"
  272. import commentBox from "./components/commentBox.vue"
  273. import treasureChest from "./components/treasureChest.vue"
  274. import dayjs from 'dayjs';
  275. import {
  276. getErrMsg,
  277. getH5CourseByVideoId,
  278. getH5CourseVideoDetails,
  279. courseAnswer,
  280. getFinishCourseVideo,
  281. getIsAddKf,
  282. internetTraffic,
  283. getIntegralByH5Video,
  284. sendReward,
  285. loginByMp,
  286. getRealLink,
  287. getConfigByKey,
  288. claim,
  289. getVideoRewardTypes,
  290. getUserPhoneDeviceType
  291. } from "@/api/course.js"
  292. export default {
  293. components: {
  294. descInfoNav,
  295. descInfo,
  296. commentBox,
  297. ques,
  298. treasureChest,
  299. appPopup,
  300. turntableOne,
  301. turntableTwo,
  302. ykScreenRecord
  303. },
  304. data() {
  305. return {
  306. socket: null,
  307. isSocketOpen: false,
  308. pingpangTimes: null,
  309. baseUrl:uni.getStorageSync('requestImagesPath'),
  310. // 1 红包 2 芳华币
  311. rewardType:[],
  312. currentReward: -1,
  313. player: null,
  314. loading: true,
  315. progress: 0,
  316. code: null,
  317. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  318. scrollTop: 0,
  319. height: '0px',
  320. isLogin: false,
  321. videoUrl: "",
  322. videoId: "",
  323. //现在的时长
  324. playTime: 0,
  325. //总时长
  326. duration: 0,
  327. playDuration: 0,
  328. // 用于续播
  329. playDurationSeek: 0,
  330. // 温馨提醒时间节点,
  331. tipsTime: 0,
  332. tipsOpen: false,
  333. config: {},
  334. courseInfo: {},
  335. quesList: [],
  336. lineList: [],
  337. // 错题
  338. errQues: [],
  339. // 答题机会
  340. remain: 0,
  341. errTitle: "",
  342. errDesc: "",
  343. showPlay: true,
  344. showControls: false,
  345. playStatus: "",
  346. isfull: false,
  347. isAddKf: 0,
  348. lineIndex: 0,
  349. textHeight: 0, //文本高度
  350. qwUserId: "",
  351. qrcode: "",
  352. corpId: "",
  353. qrcodeMsg: "",
  354. urlOption: {},
  355. bufferRate: 0, // 缓冲时间
  356. uuId: "",
  357. isEnded: false,
  358. // 是否允许拖动进度条
  359. linkType: 0,
  360. ip: null,
  361. checked: true,
  362. isFinish: 0, // 是否完课
  363. interval: null,
  364. intervalIntegral: null, // 芳华币定时
  365. options: {
  366. sources: [{
  367. src: ""
  368. }],
  369. poster: "",
  370. live: false /* 是否直播 */ ,
  371. controls: true,
  372. autoplay: false,
  373. licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323137866_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl,
  374. LicenseKey: 'bcc5bd9a14b798b48c52ff005a21d926',
  375. controlBar: {
  376. volumePanel: false,
  377. playbackRateMenuButton: false,
  378. QualitySwitcherMenuButton: false,
  379. // progressControl: false
  380. },
  381. plugins: {
  382. // ProgressMarker: false,
  383. ContextMenu: {
  384. statistic: false
  385. }
  386. },
  387. },
  388. poster: "",
  389. // 错误请求次数
  390. errorCount: 0,
  391. answerPopup: false,
  392. sortLink:"",
  393. // 课程是否过期
  394. isExpire: false,
  395. menuButtonLeft: 281,
  396. menuButtonH: 45,
  397. timer: null,
  398. flag: false,
  399. focus: false,
  400. openDanmuType: 0,
  401. danmuboxHeight: 0,
  402. user: {},
  403. crtShow: true,
  404. // 是否获取到对应观看者的真实链接
  405. isCheckRealUrl: false,
  406. courseLogo: '',
  407. isfull: false,
  408. navList:[{
  409. id: 0,
  410. name: '介绍'
  411. },{
  412. id: 1,
  413. name: '答题'
  414. },{
  415. id: 2,
  416. name: '评论'
  417. }],
  418. currentTab: 1,
  419. triggered: false,
  420. // 没有更多
  421. isMore: false,
  422. inputText:"",
  423. // 获取最多历史评论条数
  424. viewCommentNum: 200,
  425. // 1-开启评论;2-开启弹幕;3-关闭
  426. openCommentStatus: 3,
  427. showAnswerTip: false,
  428. showDanmu: 1,
  429. activeDanmus:[],
  430. flagTime: 0,
  431. notice: '',
  432. fsUserCourseRewardRoundStatusVO: [],
  433. onHide: false,
  434. courseNote:'',
  435. showBtn: 0,
  436. showNote: 0,
  437. showTreatment: 1, // 1不展示,0展示
  438. treatmentPackage: []
  439. }
  440. },
  441. computed:{
  442. ...mapGetters(['coureLogin']),
  443. currentRewardText(){
  444. const index = this.rewardType.findIndex(it=>it.value==this.currentReward)
  445. return index > -1 ? this.rewardType[index].text || '':''
  446. }
  447. },
  448. watch: {
  449. coureLogin: {
  450. immediate: true, // 页面一进入就检查一次
  451. handler(val) {
  452. if (val == 2) {
  453. console.log("AppToken失效,请重新登录")
  454. this.isLogin = false
  455. this.isAddKf = 0
  456. this.goLogin()
  457. }
  458. }
  459. }
  460. },
  461. onLoad(option) {
  462. this.code = option.code
  463. this.urlOption = option.course ? JSON.parse(decodeURIComponent(option.course)) : {}
  464. this.videoId = this.urlOption.videoId || ''
  465. this.qwUserId = this.urlOption.qwUserId || ''
  466. this.corpId = this.urlOption.corpId || ''
  467. this.linkType = this.urlOption.linkType || 0
  468. // if (this.code) {
  469. // this.loginByMp()
  470. // }
  471. var that=this;
  472. if (this.videoId) {
  473. this.getH5CourseByVideo()
  474. this.getConfigByKey()
  475. }
  476. this.sortLink = this.urlOption.link || ''
  477. this.getMenuButton()
  478. // #ifndef H5
  479. uni.onKeyboardHeightChange(this.keyboardHeightChange);
  480. // #endif
  481. },
  482. onShow() {
  483. this.onHide = false
  484. this.tipsOpen = false
  485. // this.isLogin = this.utils.isLoginCourse()
  486. this.uuId = this.utils.generateRandomString(16)
  487. if(uni.getStorageSync('auto_userInfo') && JSON.stringify(uni.getStorageSync('auto_userInfo'))!='{}') {
  488. this.user = JSON.parse(uni.getStorageSync('auto_userInfo'))
  489. } else {
  490. this.user = {}
  491. }
  492. if(this.sortLink){
  493. this.getLink()
  494. } else {
  495. uni.showToast({
  496. title: 'sortLink is not found',
  497. icon: 'none'
  498. });
  499. if(this.isLogin) {
  500. this.getUserPhoneDeviceType()
  501. }
  502. }
  503. },
  504. mounted() {
  505. this.getIP()
  506. this.getHeight()
  507. },
  508. onHide() {
  509. this.onHide = true
  510. // this.player = uni.createVideoContext('video-content-box');
  511. if (this.player) {
  512. this.player.pause()
  513. }
  514. // if (this.interval != null) {
  515. // clearInterval(this.interval)
  516. // this.interval = null
  517. // }
  518. this.closeSocket()
  519. },
  520. onUnload() {
  521. if (this.interval != null) {
  522. clearInterval(this.interval)
  523. this.interval = null
  524. }
  525. this.clearIntegral()
  526. // #ifndef H5
  527. uni.offKeyboardHeightChange(this.keyboardHeightChange);
  528. // #endif
  529. this.closeSocket()
  530. },
  531. beforeDestroy() {
  532. this.player = uni.createVideoContext('video-content-box');
  533. if (this.player) {
  534. this.player.stop()
  535. this.player = null
  536. }
  537. if (this.interval != null) {
  538. clearInterval(this.interval)
  539. this.interval = null
  540. }
  541. this.clearIntegral()
  542. // #ifndef H5
  543. uni.offKeyboardHeightChange(this.keyboardHeightChange);
  544. // #endif
  545. this.closeSocket()
  546. },
  547. methods: {
  548. getVideoRewardTypes() {
  549. getVideoRewardTypes({...this.urlOption}).then(res=>{
  550. if(res.code == 200) {
  551. this.rewardType = res.data
  552. this.currentReward = this.rewardType&&this.rewardType.length>0 ? this.rewardType[0].value : -1
  553. }
  554. })
  555. },
  556. getConfigByKey(){
  557. let param = {key:"course.config"};
  558. getConfigByKey(param).then(
  559. res => {
  560. if(res.code==200){
  561. let data=res.data ? JSON.parse(res.data) : {};
  562. this.notice = data.notify || ''
  563. }
  564. },
  565. rej => {}
  566. );
  567. },
  568. numberToChinese(number) {
  569. if (number) {
  570. const chineseNumber = ['一', '二', '三', '四', '五', '六', '七', '八', '九'];
  571. return chineseNumber[number - 1];
  572. } else {
  573. return ''
  574. }
  575. },
  576. keyboardHeightChange(res) {
  577. // #ifndef H5
  578. console.log("this.danmuboxHeight",this.danmuboxHeight)
  579. this.danmuboxHeight = res.height
  580. // #endif
  581. },
  582. getMenuButton(){
  583. const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  584. this.menuButtonLeft = menuButtonInfo.left
  585. this.menuButtonH = menuButtonInfo.height
  586. },
  587. //播放时间更新事件方法
  588. onTimeUpdate(e){
  589. let currentTime = Math.round(e.detail.currentTime)
  590. if (this.playDurationSeek > 0) {
  591. this.playTime = this.playDurationSeek
  592. this.throttle(() => this.changeTime(this), 1000, false)
  593. } else {
  594. if (this.linkType != 1 && (currentTime - this.playTime > 3 || currentTime - this.playTime < -3)&&this.isFinish!=1) {
  595. uni.showToast({
  596. title: '不能快进哦',
  597. icon: 'none',
  598. });
  599. currentTime = this.playTime
  600. this.player.seek(this.playTime);
  601. }
  602. this.playTime = currentTime
  603. }
  604. if (Math.floor(e.detail.currentTime) != this.flagTime) {
  605. this.flagTime = Math.floor(e.detail.currentTime)
  606. const isNearEnd = this.playTime >= this.duration - 60;
  607. this.showAnswerTip = this.isEnded || isNearEnd;
  608. const progress = this.duration ? (this.playTime || 0) / this.duration : 0;
  609. const answerRate = Number(this.config.answerRate ?? 1); // 默认 100%
  610. const hitRate = progress >= answerRate;
  611. this.showNote = (this.isEnded || this.isFinish === 1 || hitRate) ? 1 : 0;
  612. if(this.fsUserCourseRewardRoundStatusVO&&this.fsUserCourseRewardRoundStatusVO.length>0) {
  613. this.$refs.treasureChest&&this.$refs.treasureChest.showTreasure(this.flagTime)
  614. }
  615. if(this.openCommentStatus == 2) {
  616. this.$refs.danmuBox&&this.$refs.danmuBox.checkDanmu(this.flagTime)
  617. }
  618. }
  619. },
  620. changeTime(that,e) {
  621. that.playDurationSeek = 0
  622. },
  623. videoErrorCallback(e) {
  624. this.errorCount++
  625. if (this.errorCount > 3) return
  626. if (this.interval != null) {
  627. clearInterval(this.interval)
  628. }
  629. this.clearIntegral()
  630. console.log(e)
  631. this.getErrMsg(e.target.errMsg)
  632. this.getH5CourseVideoDetails('error')
  633. },
  634. // 当开始/继续播放时触发play事件
  635. getPlay() {
  636. this.errorCount = 0
  637. // this.judgeDuration()
  638. },
  639. getPause() {
  640. this.clearIntegral()
  641. },
  642. getEnded() {
  643. this.clearIntegral()
  644. this.isEnded = true
  645. this.showAnswerTip = true
  646. this.isFinish = 1
  647. this.showNote = 1
  648. this.getFinishCourseVideo()
  649. },
  650. getWaiting() {
  651. this.getErrMsg('','waiting')
  652. },
  653. fullscreenchange(event) {
  654. this.isfull = event.detail.fullScreen
  655. if(this.isfull) {
  656. this.$refs.danmuBox&&this.$refs.danmuBox.initTracks()
  657. }
  658. },
  659. controlstoggle(event) {
  660. this.crtShow = event.detail.show
  661. },
  662. getIP() {
  663. uni.request({
  664. url: 'https://ipinfo.io/json', //仅为示例,并非真实接口地址。
  665. method: 'GET',
  666. success: (res) => {
  667. this.ip = res.data.ip
  668. }
  669. });
  670. },
  671. getHeight() {
  672. setTimeout(()=>{
  673. const query = uni.createSelectorQuery().in(this);
  674. query
  675. .select("#title-contentnav")
  676. .boundingClientRect((data) => {
  677. if(data) {
  678. const footerH = this.showBtn==0? 80: 0
  679. this.height =
  680. `calc(100vh - ${data.height}px - 420rpx - ${this.statusBarHeight}px - ${footerH}px - 88rpx)`
  681. }
  682. })
  683. .exec();
  684. },200)
  685. },
  686. numberToLetter(num) {
  687. // 将数字转换为字母的 ASCII 码
  688. let letterCode = num + 65;
  689. // 将 ASCII 码转换为大写字母
  690. let letter = String.fromCharCode(letterCode);
  691. return letter;
  692. },
  693. updateTime() {
  694. var that = this;
  695. if (this.interval != null) {
  696. clearInterval(this.interval)
  697. }
  698. this.interval = setInterval(function() {
  699. that.getFinishCourseVideo()
  700. that.getInternetTraffic()
  701. }, 60000);
  702. },
  703. judgeDuration() {
  704. var that = this;
  705. if (this.intervalIntegral != null) {
  706. clearInterval(this.intervalIntegral)
  707. this.intervalIntegral = null
  708. }
  709. // 观看10分钟获得芳华币
  710. this.intervalIntegral = setInterval(function() {
  711. that.getIntegralByH5Video()
  712. }, 600000);
  713. },
  714. clearIntegral() {
  715. if (this.intervalIntegral != null) {
  716. clearInterval(this.intervalIntegral)
  717. this.intervalIntegral = null
  718. }
  719. },
  720. getH5CourseByVideo() {
  721. this.loading = true
  722. getH5CourseByVideoId({
  723. videoId: this.videoId
  724. }).then(res => {
  725. this.loading = false
  726. if (res.code == 200) {
  727. this.courseInfo = res.data
  728. uni.setNavigationBarTitle({
  729. title: this.courseInfo && this.courseInfo.title ? this.courseInfo.title : ''
  730. });
  731. }
  732. this.getHeight()
  733. this.$nextTick(()=>{
  734. this.$refs.descInfo&&this.$refs.descInfo.getDescHeight()
  735. this.$refs.descInfoNav&&this.$refs.descInfoNav.getDescHeight()
  736. })
  737. },
  738. rej => {
  739. this.loading = false
  740. }
  741. ).catch(() => {
  742. this.loading = false
  743. })
  744. },
  745. getH5CourseVideoDetails(type) {
  746. getH5CourseVideoDetails(this.urlOption).then(res => {
  747. if (res.code == 200) {
  748. this.config = res.config || {}
  749. this.courseNote = res.course&&res.course.note
  750. this.isFinish = res.isFinish || 0
  751. this.showNote = this.isFinish==1 ? 1:0
  752. this.duration = res.course && res.course.duration ? res.course.duration : 0
  753. this.playDuration = res.playDuration || 0
  754. this.tipsTime = res.tipsTime || 0
  755. const showTreatmentFlag = res.course&&res.course.showTreatment!=null ? res.course.showTreatment : 1
  756. this.treatmentPackage = res.course&&res.course.treatmentPackage ? res.course.treatmentPackage : []
  757. this.showTreatment = showTreatmentFlag==0&&this.treatmentPackage.length>0 ? 0 : 1
  758. let lineList = []
  759. if (res.course && res.course.lineOne) {
  760. lineList.push(res.course.lineOne)
  761. }
  762. if (res.course && res.course.lineTwo) {
  763. lineList.push(res.course.lineTwo)
  764. }
  765. if (res.course && res.course.lineThree) {
  766. lineList.push(res.course.lineThree)
  767. }
  768. this.lineList = lineList
  769. this.quesList = res.questions && res.questions.length > 0 ? res.questions : []
  770. this.quesList = this.quesList.map(item => ({
  771. ...item,
  772. questionOption: JSON.parse(item.question),
  773. answer: ''
  774. }))
  775. this.courseLogo = res.config&&res.config.courseLogo
  776. this.viewCommentNum = res.config&&res.config.viewCommentNum || 200
  777. this.openCommentStatus = res.config&&res.config.openCommentStatus || 3;
  778. // this.openCommentStatus = source
  779. // console.log('socket===',socket,this.openCommentStatus)
  780. if(this.openCommentStatus == 3) {
  781. this.closeSocket()
  782. }else {
  783. this.initSocket()
  784. }
  785. this.currentTab = 1
  786. if(this.openCommentStatus!=2 || this.showDanmu!=1) {
  787. this.activeDanmus = []
  788. }
  789. this.fsUserCourseRewardRoundStatusVO = this.getBox(res)
  790. if (!this.player || type == 'error') {
  791. this.lineIndex = this.config.defaultLine
  792. this.videoUrl = lineList[this.lineIndex]
  793. this.poster= res.course && res.course.imgUrl ? res.course.imgUrl : ''
  794. // this.options.sources = [{
  795. // src: this.videoUrl
  796. // }]
  797. // this.options.poster = res.course && res.course.imgUrl ? res.course.imgUrl : ''
  798. // this.initVideo()
  799. this.playTime = this.playDuration >= this.duration ? 0 : this.playDuration
  800. this.playDurationSeek = this.playTime
  801. setTimeout(()=>{
  802. this.player = uni.createVideoContext('video-content-box');
  803. this.player.seek(this.playTime)
  804. this.player.play();
  805. },500);
  806. } else {
  807. // let div = document.querySelector(".vjs-progress-control");
  808. // if(div) {
  809. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  810. // div.style.pointerEvents = "auto";
  811. // } else {
  812. // div.style.pointerEvents = "none"; //禁止所有事件
  813. // }
  814. // }
  815. this.playTime = this.playTime > this.playDuration ? this.playTime : this.playDuration >= this.duration ? 0 : this.playDuration
  816. this.playDurationSeek = this.playTime
  817. this.player.seek(this.playTime)
  818. this.player.play();
  819. }
  820. this.updateTime();
  821. } else {
  822. uni.showToast({
  823. title: res.msg,
  824. icon: 'none'
  825. })
  826. }
  827. this.getHeight()
  828. this.$nextTick(()=>{
  829. this.$refs.descInfo&&this.$refs.descInfo.getDescHeight()
  830. this.$refs.descInfoNav&&this.$refs.descInfoNav.getDescHeight()
  831. })
  832. },
  833. rej => {}
  834. )
  835. },
  836. handleAnswer(val) {
  837. let {item, option,index} = val
  838. let time = this.playTime
  839. if(this.isEnded||this.isFinish==1) {
  840. time = this.duration
  841. } else {
  842. if(time < this.playDuration&&this.isFinish!=1) {
  843. // 没完课且小于续播的时间
  844. time = this.playDuration
  845. }
  846. }
  847. if(Number(this.duration || 0) == 0 || time < this.duration - 60) {
  848. uni.showToast({
  849. title: "请先观看完整课程再答题哦~",
  850. icon: "none"
  851. })
  852. return
  853. }
  854. if (this.quesList[index].type == 1) {
  855. // 单选option
  856. this.quesList[index].answer = option.name
  857. } else if (this.quesList[index].type == 2) {
  858. // 多选
  859. let answer = this.quesList[index].answer ? this.quesList[index].answer.split(',') : []
  860. if (answer.indexOf(option.name) === -1) {
  861. answer.push(option.name)
  862. this.quesList[index].answer = answer.join(',')
  863. } else {
  864. answer.splice(answer.indexOf(option.name), 1)
  865. this.quesList[index].answer = answer.join(',')
  866. }
  867. }
  868. },
  869. submit() {
  870. if(this.isExpire){
  871. uni.showToast({
  872. title: '课程已过期或链接无效',
  873. icon: 'none'
  874. });
  875. return
  876. }
  877. // 登录
  878. this.utils.isLoginCourse().then(
  879. res => {
  880. if(res){
  881. if (this.isAddKf == 1&&this.isCheckRealUrl) {
  882. // 答题
  883. // 您已提交过答案,请领取红包
  884. this.courseAnswer()
  885. } else {
  886. // 添加客服
  887. if (this.videoId && this.qwUserId) {
  888. this.getIsAddKf()
  889. } else {
  890. uni.showToast({
  891. title: '请添加客服',
  892. icon: 'none'
  893. })
  894. }
  895. }
  896. } else{
  897. this.goLogin()
  898. }
  899. },
  900. rej => {}
  901. );
  902. },
  903. // 答题
  904. courseAnswer() {
  905. let time = this.playTime
  906. if (this.isEnded || this.isFinish==1) {
  907. time = this.duration
  908. } else {
  909. if (time < this.playDuration && this.isFinish != 1) {
  910. // 没完课且小于续播的时间
  911. time = this.playDuration
  912. }
  913. }
  914. if (Number(this.duration || 0) == 0 || time < this.duration - 60) {
  915. uni.showToast({
  916. title: "请先观看完整课程再答题哦~",
  917. icon: "none"
  918. })
  919. return
  920. }
  921. if (this.quesList.some(item => !item.answer)) {
  922. uni.showToast({
  923. title: "请确认是否答完所有题目",
  924. icon: "none"
  925. })
  926. return
  927. }
  928. const questions = this.quesList.map(obj => {
  929. const {
  930. questionOption,
  931. ...rest
  932. } = obj;
  933. return rest;
  934. });
  935. if(!this.isCheckRealUrl) return;
  936. const param = {
  937. ...this.urlOption,
  938. questions: questions,
  939. videoId: this.videoId,
  940. duration: this.playTime,
  941. }
  942. this.errTitle = ""
  943. this.errDesc = ""
  944. this.errQues = []
  945. courseAnswer(param).then(res => {
  946. if (res.code == 200) {
  947. if (res.incorrectQuestions) {
  948. // 答题失败
  949. if (res.incorrectQuestions.length > 0) {
  950. this.errQues = res.incorrectQuestions
  951. }
  952. this.remain = res.remain || 0
  953. if (res.remain > 0) {
  954. this.errTitle = "很遗憾答错了"
  955. this.errDesc = `<span style="color:#FF5C03">还有${res.remain}次机会,继续加油</span>`
  956. this.$refs.answerPopup.open("center")
  957. }
  958. } else {
  959. // 答题成功
  960. this.errTitle = "恭喜你,回答正确"
  961. this.errDesc = `请选择奖励`
  962. this.currentReward = this.rewardType&&this.rewardType.length>0 ? this.rewardType[0].value : -1
  963. this.$refs.answerPopup.open("center")
  964. }
  965. } else {
  966. if (res.msg == "该课题到达答错次数限制") {
  967. this.errTitle = "答题次数超过限制"
  968. this.errDesc = "以后的课程要认真学习哦"
  969. this.$refs.answerPopup.open("center")
  970. } else {
  971. uni.showToast({
  972. title: res.msg,
  973. icon: "none"
  974. })
  975. }
  976. }
  977. },
  978. rej => {}
  979. )
  980. },
  981. // 选择
  982. rewardChange(e) {
  983. this.currentReward = e.value
  984. },
  985. closeAnswerPopup() {
  986. this.$refs.answerPopup.close()
  987. if(!this.isCheckRealUrl) return;
  988. if (this.errTitle == '恭喜你,回答正确') {
  989. if(this.currentReward==4) {
  990. this.$refs.turntableTwo.open(this.urlOption)
  991. } else if(this.currentReward==3) {
  992. this.$refs.turntableOne.open(this.urlOption)
  993. } else {
  994. this.sendRewardFun(this.currentReward)
  995. }
  996. }
  997. },
  998. sendRewardFun(currentReward) {
  999. this.currentReward = currentReward
  1000. const param = {
  1001. ...this.urlOption,
  1002. rewardType: Number(this.currentReward),
  1003. source: 2,
  1004. appId: getApp().globalData.appId
  1005. }
  1006. sendReward(param).then(res => {
  1007. if(res.code == 200) {
  1008. if(currentReward == 4) {
  1009. this.$refs.turntableTwo.endSuccess(res.data)
  1010. }else if(currentReward == 3) {
  1011. this.$refs.turntableOne.endSuccess(res.data)
  1012. }else {
  1013. uni.showToast({
  1014. title: res.msg,
  1015. icon: 'none'
  1016. })
  1017. this.openAppPop()
  1018. }
  1019. } else {
  1020. this.currentReward == 4 ? this.$refs.turntableTwo.close('close') : this.currentReward == 3? this.$refs.turntableOne.close('close'):''
  1021. uni.showToast({
  1022. title: res.msg,
  1023. icon: 'none'
  1024. })
  1025. }
  1026. })
  1027. },
  1028. openAppPop() {
  1029. this.$refs.appPopup.openPop()
  1030. },
  1031. // 线路
  1032. openPop() {
  1033. this.$refs.popup.open('bottom')
  1034. },
  1035. close() {
  1036. this.$refs.popup.close()
  1037. },
  1038. handleLine(index) {
  1039. var that=this;
  1040. if (this.lineIndex == index && this.videoUrl == this.lineList[index]) {
  1041. this.close()
  1042. return
  1043. } else {
  1044. // let div = document.querySelector(".vjs-progress-control");
  1045. // if(div) {
  1046. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  1047. // div.style.pointerEvents = "auto";
  1048. // } else {
  1049. // div.style.pointerEvents = "none"; //禁止所有事件
  1050. // }
  1051. // }
  1052. this.lineIndex = index
  1053. this.videoUrl = this.lineList[index]
  1054. this.tipsOpen = false
  1055. this.playDurationSeek = this.playTime || 0
  1056. this.player = uni.createVideoContext('video-content-box');
  1057. setTimeout(function(){
  1058. that.player.seek(that.playDurationSeek)
  1059. that.player.play();
  1060. },500);
  1061. // this.player.src(this.lineList[index])
  1062. // this.player.one('loadedmetadata', () => {
  1063. // this.player.currentTime(this.playDurationSeek);
  1064. // this.player.play();
  1065. // });
  1066. this.close()
  1067. }
  1068. },
  1069. // 客服
  1070. getIsAddKf() {
  1071. this.qrcode = ''
  1072. this.qrcodeMsg = ''
  1073. this.isAddKf = 0
  1074. // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
  1075. getIsAddKf(this.urlOption).then(res => {
  1076. if (res.code == 200) {
  1077. this.isAddKf = 1
  1078. this.isCheckRealUrl = true
  1079. this.getH5CourseVideoDetails()
  1080. } else if (res.code == 400) {
  1081. this.isAddKf = 0
  1082. this.isCheckRealUrl = false
  1083. this.qrcode = res.qrcode
  1084. this.qrcodeMsg = res.msg
  1085. this.$refs.kfPopup.open()
  1086. } else if (res.code == 566) {
  1087. // 官方群发通用链接
  1088. const url = res.courseLink.realLink.split('?course=')[1]
  1089. this.urlOption = JSON.parse(url)
  1090. this.isAddKf = 1
  1091. this.isCheckRealUrl = true
  1092. this.getH5CourseVideoDetails()
  1093. } else if (res.code == 567) {
  1094. // 群聊通用链接
  1095. this.urlOption = {
  1096. ...this.urlOption,
  1097. qwExternalId: res.qwExternalId
  1098. }
  1099. this.isAddKf = 1
  1100. this.isCheckRealUrl = true
  1101. this.getH5CourseVideoDetails()
  1102. }else {
  1103. this.isCheckRealUrl = false
  1104. this.isAddKf = 0
  1105. uni.showToast({
  1106. title: res.msg,
  1107. icon: 'none'
  1108. });
  1109. if(res.code==401) return;
  1110. uni.redirectTo({
  1111. url: '/pages_course/courseExpiration?code='+res.code+'&msg='+res.msg
  1112. })
  1113. }
  1114. },
  1115. err => {}
  1116. ).catch((err) => {
  1117. uni.showToast({
  1118. title: err,
  1119. icon: 'none'
  1120. });
  1121. })
  1122. },
  1123. closeKFPop() {
  1124. this.$refs.kfPopup.close()
  1125. },
  1126. getFinishCourseVideo() {
  1127. if (!this.isLogin||!this.playTime || !this.isCheckRealUrl) return
  1128. // {videoId: this.videoId,duration:this.playTime}
  1129. const param = {
  1130. duration: this.playTime,
  1131. ...this.urlOption
  1132. }
  1133. getFinishCourseVideo(param)
  1134. },
  1135. // 每十分钟获得芳华币
  1136. getIntegralByH5Video() {
  1137. if(!this.isLogin||!this.isCheckRealUrl) return
  1138. const param = {
  1139. duration: this.playTime,
  1140. ...this.urlOption
  1141. }
  1142. getIntegralByH5Video(param).then(res => {
  1143. if (res.code == 200) {
  1144. uni.showToast({
  1145. title: "芳华币+10",
  1146. icon: "none"
  1147. })
  1148. }
  1149. })
  1150. },
  1151. progressChange(e) {
  1152. this.bufferRate = Math.ceil(e.detail.buffered)
  1153. },
  1154. // 缓冲
  1155. getInternetTraffic() {
  1156. if(!this.isLogin||!this.isCheckRealUrl) return
  1157. const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
  1158. if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
  1159. this.bufferRate = playVideoTime
  1160. }
  1161. if(this.bufferRate == 0 || Number(this.bufferRate.toFixed(2)) == 0) return
  1162. const param = {
  1163. ...this.urlOption,
  1164. uuId: dayjs().format('YYYYMMDD') + this.uuId,
  1165. duration: this.playTime,
  1166. bufferRate: Number(this.bufferRate.toFixed(2)),
  1167. }
  1168. if(!param.bufferRate) return
  1169. internetTraffic(param)
  1170. },
  1171. getErrMsg(err,type) {
  1172. let msgerr = {
  1173. errType: type || 'error',
  1174. videoUrl: this.videoUrl,
  1175. lineIndex: this.lineIndex,
  1176. errTime: new Date(),
  1177. ip: this.ip,
  1178. errMsg: err || ''
  1179. }
  1180. getErrMsg({
  1181. msg: JSON.stringify(msgerr)
  1182. })
  1183. },
  1184. goLogin() {
  1185. this.utils.getProvider().then(provider=>{
  1186. console.log('当前的环境商',provider)
  1187. if (!provider) {
  1188. reject()
  1189. }
  1190. uni.login({
  1191. provider: provider,
  1192. success: async loginRes => {
  1193. console.log(loginRes)
  1194. uni.getUserInfo({
  1195. provider: provider,
  1196. success: (infoRes)=> {
  1197. uni.showToast({
  1198. title: '处理中...',
  1199. icon: 'loading'
  1200. });
  1201. loginByMp({code: loginRes.code,encryptedData:infoRes.encryptedData,iv:infoRes.iv,appId:getApp().globalData.appId}).then(res=>{
  1202. uni.hideLoading();
  1203. if (res.code == 200) {
  1204. this.$store.commit('setCoureLogin', 1);
  1205. uni.setStorageSync('AppTokenmini_RTCourse', res.token);
  1206. uni.setStorageSync('auto_userInfo', JSON.stringify(res.user));
  1207. this.user = res.user
  1208. this.isLogin = true
  1209. this.getIsAddKf()
  1210. this.getVideoRewardTypes()
  1211. this.getUserPhoneDeviceType()
  1212. } else {
  1213. uni.showToast({
  1214. title: res.msg,
  1215. icon: 'none'
  1216. });
  1217. }
  1218. }).catch(err=>{
  1219. uni.hideLoading();
  1220. uni.showToast({
  1221. icon:'none',
  1222. title: "登录失败,请重新登录",
  1223. });
  1224. });
  1225. }
  1226. });
  1227. }
  1228. })
  1229. }).catch(err => {})
  1230. },
  1231. getLink() {
  1232. let that = this;
  1233. getRealLink({sortLink:this.sortLink}).then(res=>{
  1234. if(res.code == 200) {
  1235. this.isExpire = false
  1236. if(this.isLogin) {
  1237. this.getUserPhoneDeviceType()
  1238. }
  1239. // 如果响应中包含真实链接,则跳转到真实链接
  1240. // window.location.href = res.realLink +"&sortLink="+this.sortLink+"&code="+this.code+"&time="+new Date().getTime()
  1241. if (this.isLogin && this.isAddKf == 1&&this.isCheckRealUrl) {
  1242. this.getH5CourseVideoDetails()
  1243. }
  1244. if (this.videoId &&(this.isAddKf != 1 || !this.isCheckRealUrl)) {
  1245. this.utils.isLoginCourse().then(
  1246. isLogin => {
  1247. this.isLogin = isLogin
  1248. if(isLogin){
  1249. this.getIsAddKf()
  1250. this.getVideoRewardTypes()
  1251. } else {
  1252. this.goLogin()
  1253. }
  1254. },
  1255. rej => {}
  1256. );
  1257. }
  1258. } else {
  1259. this.isExpire = true
  1260. uni.showToast({
  1261. title: '课程已过期或链接无效',
  1262. icon: 'none'
  1263. });
  1264. }
  1265. }).catch(err=>{
  1266. this.isExpire = true
  1267. uni.showToast({
  1268. title: '发生错误,请稍后再试',
  1269. icon: 'none'
  1270. });
  1271. })
  1272. },
  1273. /**
  1274. * 节流原理:在一定时间内,只能触发一次
  1275. *
  1276. * @param {Function} func 要执行的回调函数
  1277. * @param {Number} wait 延时的时间
  1278. * @param {Boolean} immediate 是否立即执行
  1279. * @return null
  1280. */
  1281. throttle(func, wait = 500, immediate = true) {
  1282. if (immediate) {
  1283. if (!this.flag) {
  1284. this.flag = true
  1285. // 如果是立即执行,则在wait毫秒内开始时执行
  1286. typeof func === 'function' && func()
  1287. this.timer = setTimeout(() => {
  1288. this.flag = false
  1289. }, wait)
  1290. }
  1291. } else if (!this.flag) {
  1292. this.flag = true
  1293. // 如果是非立即执行,则在wait毫秒内的结束处执行
  1294. this.timer = setTimeout(() => {
  1295. this.flag = false
  1296. typeof func === 'function' && func()
  1297. }, wait)
  1298. }
  1299. },
  1300. // 弹幕
  1301. openDanmu(type) {
  1302. this.openDanmuType = type
  1303. this.inputText = ''
  1304. if(type == 1) {
  1305. this.player.exitFullScreen()
  1306. }
  1307. this.$refs.danmuPopup.open()
  1308. },
  1309. changeShowPopup(val) {
  1310. this.focus = val.show
  1311. },
  1312. switchDanmu() {
  1313. this.showDanmu = this.showDanmu == 1 ? 0:1
  1314. if(this.showDanmu == 0&&this.$refs.danmuBox) {
  1315. this.$refs.danmuPopup.close()
  1316. this.activeDanmus = []
  1317. this.$refs.danmuBox.activeDanmus = []
  1318. this.$refs.danmuBox.initTracks()
  1319. }
  1320. },
  1321. getScrollTop(res) {
  1322. if(this.currentTab == 2) {
  1323. this.scrollTop = res
  1324. } else {
  1325. this.scrollTop = 0
  1326. }
  1327. },
  1328. handleTab(index) {
  1329. this.currentTab = index
  1330. if(this.currentTab==2) {
  1331. if(this.$refs.commentBox) {
  1332. this.$refs.commentBox.msgs = []
  1333. this.$refs.commentBox.pageNum = 1
  1334. this.$refs.commentBox.getComments()
  1335. }
  1336. } else {
  1337. setTimeout(()=>{
  1338. this.scrollTop = 0
  1339. },100)
  1340. }
  1341. },
  1342. handleRefresher() {
  1343. this.triggered = true;
  1344. if (!this.isMore&&this.currentTab==2&&this.openCommentStatus==1) {
  1345. this.$nextTick(()=>{
  1346. this.$refs.commentBox&&this.$refs.commentBox.getComments()
  1347. })
  1348. }
  1349. setTimeout(() => {
  1350. this.triggered = false;
  1351. }, 500);
  1352. },
  1353. getMore(val) {
  1354. this.triggered = false;
  1355. this.isMore = val == 1
  1356. },
  1357. handleChatInput() {
  1358. this.inputText = this.inputText.trim()
  1359. if (this.inputText == "" || this.inputText.trim() == "") {
  1360. uni.showToast({
  1361. title: '请输入评论',
  1362. icon: "none"
  1363. })
  1364. return;
  1365. }
  1366. if(this.openCommentStatus==1) {
  1367. this.$refs.commentBox&&this.$refs.commentBox.handleInput(this.inputText)
  1368. } else if(this.openCommentStatus==2) {
  1369. this.$refs.danmuBox&&this.$refs.danmuBox.handleInput(this.inputText)
  1370. }
  1371. },
  1372. setInputText() {
  1373. this.inputText = ""
  1374. if(this.openCommentStatus==2) {
  1375. this.$refs.danmuPopup.close()
  1376. }
  1377. },
  1378. getActiveDanmus(val) {
  1379. this.activeDanmus = val.map(item=>({
  1380. ...item,
  1381. danmustyle: {
  1382. top: item.top + 'px',
  1383. ...item.style,
  1384. 'animation-duration': '8s'
  1385. }
  1386. }))
  1387. },
  1388. animationend(moveItem, i) {
  1389. // 移除动画结束的弹幕(性能优化)
  1390. if(this.openCommentStatus==2) {
  1391. this.$refs.danmuBox&&this.$refs.danmuBox.animationend(moveItem, i)
  1392. }
  1393. },
  1394. feedback() {
  1395. const userId = this.user.userId || ''
  1396. const courseId = this.urlOption.courseId || ''
  1397. const videoId = this.urlOption.videoId || ''
  1398. uni.navigateTo({
  1399. url: './feedback?userId='+userId+'&courseId='+courseId+'&videoId='+videoId
  1400. })
  1401. },
  1402. getBox(data) {
  1403. if(data.fsUserCourseRewardRoundStatusVO&&data.fsUserCourseRewardRoundStatusVO.length>0) {
  1404. const list = data.fsUserCourseRewardRoundStatusVO.map(item=>({
  1405. ...item,
  1406. time: Math.round(this.duration * Number(item.question || 0) * 0.01)
  1407. }))
  1408. return list
  1409. } else {
  1410. return []
  1411. }
  1412. },
  1413. claimFun(val) {
  1414. claim({
  1415. ...this.urlOption,
  1416. second: val.time,
  1417. rewardId: val.rewardId,
  1418. status: val.status
  1419. }).then(res=>{
  1420. if(res.code == 200) {
  1421. this.$refs.treasureChest.claimSuccess(val.status)
  1422. } else {
  1423. this.$refs.treasureChest.close()
  1424. }
  1425. if(res.msg!="success") {
  1426. uni.showToast({
  1427. title: res.msg,
  1428. icon: 'none',
  1429. duration: 3000
  1430. })
  1431. }
  1432. })
  1433. },
  1434. showBtnType(value) {
  1435. this.showBtn = value
  1436. this.getHeight()
  1437. },
  1438. getUserPhoneDeviceType(){
  1439. uni.getSystemInfo({
  1440. success: (result) => {
  1441. const param = {
  1442. os: result.osName || '',
  1443. deviceId: result.deviceId || '',
  1444. appId: getApp().globalData.appId
  1445. }
  1446. getUserPhoneDeviceType({param:JSON.stringify(param)})
  1447. },
  1448. fail: (error) => {
  1449. console.log('获取型号失败',JSON.stringify(error))
  1450. }
  1451. })
  1452. },
  1453. initSocket(type) {
  1454. const userId = this.user.userId; // 假设你已经获取了用户ID
  1455. const that = this;
  1456. // 如果已经存在连接,先关闭
  1457. if (this.socket) {
  1458. this.socket.onClose(() => {
  1459. console.log('旧的 WebSocket 连接已完全关闭');
  1460. that.socket = null;
  1461. if(that.pingpangTimes) {
  1462. clearInterval(that.pingpangTimes)
  1463. that.pingpangTimes= null
  1464. }
  1465. that.createNewSocket(type,userId);
  1466. });
  1467. this.socket.close();
  1468. return;
  1469. }
  1470. // 创建一个新的 WebSocket 连接
  1471. this.createNewSocket(type,userId);
  1472. },
  1473. createNewSocket(type,userId) {
  1474. if(this.openCommentStatus == 3) return
  1475. //创建一个socket连接
  1476. const that = this;
  1477. // if (this.socket) {
  1478. // this.socket.close()
  1479. // }
  1480. this.socket = uni.connectSocket({
  1481. url: getApp().globalData.wsUrl + "/app/webSocket/" + userId,
  1482. multiple: true,
  1483. success: res => {
  1484. that.isSocketOpen = true
  1485. console.log('WebSocket连接已打开1!');
  1486. // 保持心跳
  1487. if(that.pingpangTimes) {
  1488. clearInterval(that.pingpangTimes)
  1489. that.pingpangTimes= null
  1490. }
  1491. that.pingpangTimes=setInterval(()=>{
  1492. let data={
  1493. userId: userId || '',
  1494. userType: 2, // 1-管理员,2-用户
  1495. courseId: that.urlOption.courseId,
  1496. videoId: that.urlOption.videoId,
  1497. type:1, // 评论类型 1:评论,2:回复,目前没有回复,默认传1就行了
  1498. // msg: that.inputText,
  1499. cmd:'heartbeat'
  1500. };
  1501. that.socket.send({
  1502. data: JSON.stringify(data),
  1503. success: () => {
  1504. // console.log('WebSocket发送心条数据!');
  1505. },
  1506. fail: () => {
  1507. that.isSocketOpen=false
  1508. }
  1509. });
  1510. },15000)
  1511. },
  1512. error: res => {
  1513. console.log(res)
  1514. },
  1515. })
  1516. this.socket.onMessage((res) => {
  1517. // console.log("收到消息parse",JSON.parse(res.data))
  1518. const redata = JSON.parse(res.data);
  1519. if(redata.cmd=="heartbeat"){
  1520. //心跳
  1521. // console.log("heartbeat")
  1522. }else if(redata.cmd=="sendMsg"){
  1523. if(that.openCommentStatus==1) {
  1524. that.$refs.commentBox.isSend=true;
  1525. that.$refs.commentBox.addMsg(redata);
  1526. } else if(that.openCommentStatus==2) {
  1527. that.$refs.danmuBox.isSend=true;
  1528. that.$refs.danmuBox.addMsg(redata);
  1529. }
  1530. // that.isSend=true;
  1531. // that.addMsg(redata);
  1532. }
  1533. })
  1534. //监听socket打开
  1535. this.socket.onOpen(() => {
  1536. that.isSocketOpen = true
  1537. console.log('WebSocket连接已打开2!');
  1538. // that.isSend = true;
  1539. if(that.openCommentStatus==1) {
  1540. that.$refs.commentBox.isSend=true;
  1541. } else if(that.openCommentStatus==2) {
  1542. that.$refs.danmuBox.isSend=true;
  1543. }
  1544. if(type=='reStart') {
  1545. // 重连的时候重新发消息
  1546. if(that.openCommentStatus==1) {
  1547. that.$refs.commentBox.saveMsg()
  1548. } else if(that.openCommentStatus==2) {
  1549. that.$refs.danmuBox.saveMsg()
  1550. }
  1551. // this.saveMsg()
  1552. }
  1553. })
  1554. //监听socket关闭
  1555. this.socket.onClose(() => {
  1556. that.isSocketOpen = false
  1557. that.socket = null
  1558. console.log('WebSocket连接已关闭!');
  1559. if(that.pingpangTimes) {
  1560. clearInterval(that.pingpangTimes)
  1561. that.pingpangTimes= null
  1562. }
  1563. })
  1564. //监听socket错误
  1565. this.socket.onError((err) => {
  1566. console.log("socket err:",err)
  1567. that.isSocketOpen = false
  1568. that.socket = null
  1569. if(that.pingpangTimes) {
  1570. clearInterval(that.pingpangTimes)
  1571. that.pingpangTimes= null
  1572. }
  1573. })
  1574. },
  1575. socketSend(data) {
  1576. let that = this
  1577. this.socket.send({
  1578. data: JSON.stringify(data),
  1579. success: () => {
  1580. console.log("发送成功")
  1581. // this.isSend = false;
  1582. if(that.openCommentStatus==1) {
  1583. that.$refs.commentBox.isSend = false;
  1584. } else if(that.openCommentStatus==2) {
  1585. that.$refs.danmuBox.isSend = false;
  1586. }
  1587. },
  1588. fail: () => {
  1589. console.log("发送失败")
  1590. }
  1591. });
  1592. },
  1593. closeSocket() {
  1594. if (this.socket) {
  1595. this.socket.close();
  1596. }
  1597. if (this.pingpangTimes) {
  1598. clearInterval(this.pingpangTimes);
  1599. this.pingpangTimes = null;
  1600. }
  1601. }
  1602. }
  1603. }
  1604. </script>
  1605. <style scoped>
  1606. .full-width-popup {
  1607. width: 100%;
  1608. }
  1609. </style>
  1610. <style lang="scss" scoped>
  1611. @mixin u-flex($flexD, $alignI, $justifyC) {
  1612. display: flex;
  1613. flex-direction: $flexD;
  1614. align-items: $alignI;
  1615. justify-content: $justifyC;
  1616. }
  1617. .reward-list {
  1618. display: flex;
  1619. align-items: center;
  1620. flex-wrap: wrap;
  1621. margin-top: 40rpx;
  1622. margin-bottom: -24rpx;
  1623. }
  1624. .reward-item{
  1625. padding: 16rpx 10rpx;
  1626. box-sizing: border-box;
  1627. border-radius: 10rpx;
  1628. width: calc(50% - 14rpx);
  1629. overflow: hidden;
  1630. text-align: center;
  1631. border-radius: 8rpx;
  1632. border: 1rpx solid #ededef;
  1633. // margin: 10rpx 5px;
  1634. margin-bottom: 24rpx;
  1635. color: #222;
  1636. background-color: #fff;
  1637. &:nth-child(odd) {
  1638. margin-right: 20rpx;
  1639. }
  1640. }
  1641. .reward-active {
  1642. border: 1rpx solid #ff5c03 !important;
  1643. color: #ff5c03 !important;
  1644. background: #FCF0E7 !important;
  1645. }
  1646. .footer-tips {
  1647. margin-top: 14rpx;
  1648. text-align: center;
  1649. font-family: PingFang SC,PingFang SC;
  1650. font-weight: 500;
  1651. font-size: 12px;
  1652. color: #bbb;
  1653. }
  1654. .textOne {
  1655. overflow: hidden;
  1656. white-space: nowrap;
  1657. text-overflow: ellipsis;
  1658. }
  1659. .textTwo {
  1660. overflow: hidden;
  1661. text-overflow: ellipsis;
  1662. display: -webkit-box;
  1663. -webkit-line-clamp: 2;
  1664. -webkit-box-orient: vertical;
  1665. }
  1666. .header-nav {
  1667. height: 88rpx;
  1668. @include u-flex(row, center, flex-start);
  1669. overflow: hidden;
  1670. background-color: #fff;
  1671. box-sizing: border-box;
  1672. .header-title {
  1673. text-align: center;
  1674. overflow: hidden;
  1675. white-space: nowrap;
  1676. text-overflow: ellipsis;
  1677. padding: 0 10rpx 0 100rpx;
  1678. font-family: PingFang SC,PingFang SC;
  1679. font-weight: 500;
  1680. font-size: 15px;
  1681. color: #000;
  1682. box-sizing: border-box;
  1683. }
  1684. }
  1685. .reward-list {
  1686. width: 100%;
  1687. // margin-top: 20rpx;
  1688. // margin-bottom: -40rpx;
  1689. &-group {
  1690. font-family: PingFang SC, PingFang SC;
  1691. font-weight: 400;
  1692. font-size: 14px;
  1693. color: #222222;
  1694. @include u-flex(row, center, center);
  1695. }
  1696. &-option {
  1697. @include u-flex(row, center, flex-start);
  1698. &:first-child {
  1699. margin-right: 40rpx;
  1700. }
  1701. }
  1702. }
  1703. .err {
  1704. color: #f56c6c !important;
  1705. }
  1706. .kfqrcode-box {
  1707. background-color: #fff;
  1708. border-radius: 16rpx;
  1709. max-width: 560rpx;
  1710. padding: 60rpx 40rpx;
  1711. margin-top: -100rpx;
  1712. box-sizing: border-box;
  1713. @include u-flex(column, center, flex-start);
  1714. font-family: PingFang SC, PingFang SC;
  1715. font-weight: 400;
  1716. font-size: 34rpx;
  1717. color: #222;
  1718. position: relative;
  1719. text-align: center;
  1720. .kfqrcode {
  1721. height: 460rpx;
  1722. width: 460rpx;
  1723. }
  1724. }
  1725. .kfqrcode-close {
  1726. width: 64rpx;
  1727. height: 64rpx;
  1728. position: absolute;
  1729. bottom: -100rpx;
  1730. left: 50%;
  1731. transform: translateX(-50%);
  1732. }
  1733. .tipsPopup-mask {
  1734. position: relative;
  1735. width: 560rpx;
  1736. background-color: transparent;
  1737. .red_envelope_top {
  1738. width: 480rpx;
  1739. height: 360rpx;
  1740. margin: 0 auto;
  1741. display: inherit;
  1742. }
  1743. }
  1744. .tipsPopup-btn-box {
  1745. width: 456rpx;
  1746. height: 104rpx;
  1747. padding: 4rpx;
  1748. box-sizing: border-box;
  1749. background: linear-gradient(180deg, rgba(252, 209, 94, 1), rgba(254, 253, 251, 1));
  1750. border-radius: 52rpx;
  1751. }
  1752. .tipsPopup-btn {
  1753. width: 100%;
  1754. height: 100%;
  1755. background: linear-gradient(180deg, #FF9F22 0%, #FA1E05 100%);
  1756. border-radius: 52rpx 52rpx 52rpx 52rpx;
  1757. font-family: PingFang SC, PingFang SC;
  1758. font-weight: 500;
  1759. font-size: 36rpx;
  1760. color: #FFFFFF;
  1761. line-height: 96rpx;
  1762. text-align: center;
  1763. }
  1764. .tipsPopup {
  1765. width: 560rpx;
  1766. padding: 12rpx;
  1767. margin-top: -72rpx;
  1768. box-sizing: border-box;
  1769. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1770. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1771. position: relative;
  1772. &-close {
  1773. width: 64rpx;
  1774. height: 64rpx;
  1775. position: absolute;
  1776. right: 0;
  1777. top: -188rpx;
  1778. }
  1779. &-line {
  1780. padding: 3rpx;
  1781. box-sizing: border-box;
  1782. background: linear-gradient(180deg, rgba(247, 245, 220, 1), rgba(250, 220, 157, 1));
  1783. border-radius: 24rpx;
  1784. }
  1785. &-box {
  1786. padding: 0 40rpx 40rpx 40rpx;
  1787. box-sizing: border-box;
  1788. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1789. border-radius: 24rpx;
  1790. @include u-flex(column, center, flex-start);
  1791. }
  1792. &-head {
  1793. @include u-flex(row, center, center);
  1794. &-title {
  1795. width: 364rpx;
  1796. height: auto;
  1797. margin-top: -22rpx;
  1798. }
  1799. }
  1800. &-content {
  1801. margin: 48rpx 0;
  1802. font-family: PingFang SC, PingFang SC;
  1803. font-weight: 500;
  1804. font-size: 32rpx;
  1805. color: #222222;
  1806. text-align: center;
  1807. &-title {
  1808. margin-bottom: 26rpx;
  1809. font-weight: 600;
  1810. font-size: 40rpx;
  1811. color: #FF5C03;
  1812. }
  1813. }
  1814. }
  1815. .video-controls-box {
  1816. width: 100%;
  1817. height: 420rpx;
  1818. overflow: hidden;
  1819. position: absolute;
  1820. bottom: 0;
  1821. left: 0;
  1822. z-index: 2;
  1823. background: rgba(0, 0, 0, 0.2);
  1824. .video-play {
  1825. height: 72rpx;
  1826. width: 72rpx;
  1827. position: absolute;
  1828. top: 50%;
  1829. left: 50%;
  1830. transform: translate(-50%, -50%);
  1831. }
  1832. }
  1833. .video-controls {
  1834. width: 100%;
  1835. height: 80rpx;
  1836. padding: 0 28rpx;
  1837. box-sizing: border-box;
  1838. position: absolute;
  1839. bottom: 0;
  1840. left: 0;
  1841. display: flex;
  1842. align-items: center;
  1843. justify-content: space-between;
  1844. background: linear-gradient(to top, #222 0%, transparent 80%);
  1845. .video-icon {
  1846. height: 44rpx;
  1847. width: 44rpx;
  1848. }
  1849. }
  1850. .errQuesbox {
  1851. width: 100%;
  1852. max-height: 260rpx;
  1853. overflow-y: auto;
  1854. margin-top: 24rpx;
  1855. font-family: PingFang SC, PingFang SC;
  1856. font-weight: 500;
  1857. font-size: 30rpx;
  1858. color: #222222;
  1859. &-item {
  1860. width: 100%;
  1861. height: 128rpx;
  1862. line-height: 128rpx;
  1863. margin-bottom: 24rpx;
  1864. padding: 0 30rpx;
  1865. box-sizing: border-box;
  1866. overflow: hidden;
  1867. background: #fff;
  1868. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1869. position: relative;
  1870. &::after {
  1871. content: "题目";
  1872. min-width: 64rpx;
  1873. height: 36rpx;
  1874. padding: 0 12rpx;
  1875. line-height: 36rpx;
  1876. background: #FF5C03;
  1877. box-sizing: border-box;
  1878. border-radius: 0rpx 0rpx 16rpx 0rpx;
  1879. text-align: center;
  1880. font-family: PingFang SC, PingFang SC;
  1881. font-weight: 500;
  1882. font-size: 20rpx;
  1883. color: #fff;
  1884. position: absolute;
  1885. left: 0;
  1886. top: 0;
  1887. }
  1888. }
  1889. }
  1890. .bg {
  1891. background: #fff !important;
  1892. }
  1893. .answerPopup {
  1894. &-box {
  1895. width: 560rpx;
  1896. background: linear-gradient(180deg, #FFFAF6 0%, #FEECD8 100%);
  1897. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1898. background-color: #fff;
  1899. font-weight: 400;
  1900. padding: 32rpx;
  1901. box-sizing: border-box;
  1902. position: relative;
  1903. @include u-flex(column, center, flex-start);
  1904. font-family: PingFang SC, PingFang SC;
  1905. font-weight: 400;
  1906. .tipimg {
  1907. width: 206rpx;
  1908. height: 206rpx;
  1909. margin-bottom: 16rpx;
  1910. }
  1911. }
  1912. &-title {
  1913. font-weight: 600;
  1914. font-size: 36rpx;
  1915. color: #222222;
  1916. }
  1917. &-desc {
  1918. margin-top: 10rpx;
  1919. font-size: 28rpx;
  1920. color: #757575;
  1921. }
  1922. &-btn {
  1923. width: 464rpx;
  1924. height: 84rpx;
  1925. margin-top: 54rpx;
  1926. margin-bottom: 16rpx;
  1927. background: #FF5C03;
  1928. border-radius: 42rpx;
  1929. font-weight: 500;
  1930. font-size: 32rpx;
  1931. color: #FFFFFF;
  1932. text-align: center;
  1933. line-height: 84rpx;
  1934. }
  1935. }
  1936. .popupbox {
  1937. width: 100%;
  1938. background-color: #fff;
  1939. border-radius: 16rpx 16rpx 0 0;
  1940. padding: 24rpx 32rpx;
  1941. position: relative;
  1942. &-head {
  1943. height: 60rpx;
  1944. margin-bottom: 30rpx;
  1945. text-align: center;
  1946. overflow-y: auto;
  1947. color: #414858;
  1948. font-size: 32rpx;
  1949. font-weight: bold;
  1950. position: relative;
  1951. .close-icon {
  1952. position: absolute;
  1953. right: 0;
  1954. top: 0;
  1955. height: 40rpx;
  1956. width: 40rpx;
  1957. }
  1958. }
  1959. &-content {
  1960. height: 20vh;
  1961. overflow-y: auto;
  1962. display: flex;
  1963. align-items: flex-start;
  1964. flex-wrap: wrap;
  1965. gap: 32rpx;
  1966. .line-item {
  1967. display: inline-block;
  1968. min-width: 200rpx;
  1969. min-height: 60rpx;
  1970. padding: 0 20rpx;
  1971. box-sizing: border-box;
  1972. border-radius: 50rpx;
  1973. overflow: hidden;
  1974. background-color: #f7f7f7;
  1975. text-align: center;
  1976. color: #414858;
  1977. font-size: 28rpx;
  1978. line-height: 60rpx;
  1979. }
  1980. .line-active {
  1981. color: #f56c6c !important;
  1982. background-color: #fef0f0 !important;
  1983. }
  1984. }
  1985. }
  1986. .content {
  1987. padding-bottom: calc(var(--window-bottom));
  1988. .video-box {
  1989. width: 100%;
  1990. height: 420rpx;
  1991. overflow: hidden;
  1992. position: relative;
  1993. #myVideo {
  1994. width: 100%;
  1995. height: 100%;
  1996. }
  1997. }
  1998. .video-poster {
  1999. width: 100%;
  2000. height: 420rpx;
  2001. }
  2002. .miantitlebox {
  2003. padding: 30rpx 0;
  2004. border-bottom: 2rpx solid #F5F7FA;
  2005. font-family: PingFang SC, PingFang SC;
  2006. font-weight: 500;
  2007. font-size: 36rpx;
  2008. color: #222222;
  2009. }
  2010. .subtitlebox {
  2011. padding: 30rpx 0;
  2012. border-bottom: 2rpx solid #F5F7FA;
  2013. font-family: PingFang SC, PingFang SC;
  2014. font-weight: 500;
  2015. font-size: 36rpx;
  2016. color: #222222;
  2017. }
  2018. .title-content {
  2019. padding: 0 32rpx;
  2020. background-color: #fff;
  2021. font-size: 28rpx;
  2022. line-height: 1.6;
  2023. box-sizing: border-box;
  2024. @include u-flex(row, center, space-between);
  2025. .title {
  2026. font-size: 36rpx;
  2027. font-weight: 500;
  2028. color: #414858;
  2029. }
  2030. .time-or-subtitle {
  2031. margin-top: 12rpx;
  2032. color: #666666;
  2033. }
  2034. }
  2035. .warning {
  2036. flex-shrink: 0;
  2037. color: #888;
  2038. font-size: 24rpx;
  2039. @include u-flex(column, center, center);
  2040. image {
  2041. flex-shrink: 0;
  2042. height: 36rpx;
  2043. width: 36rpx;
  2044. }
  2045. }
  2046. .video-line {
  2047. min-width: 140rpx;
  2048. max-width: 200rpx;
  2049. height: 60rpx;
  2050. padding: 0 20rpx;
  2051. box-sizing: border-box;
  2052. border-radius: 50rpx 0 0 50rpx;
  2053. overflow: hidden;
  2054. background-color: #fff;
  2055. text-align: center;
  2056. color: #888;
  2057. font-size: 28rpx;
  2058. line-height: 60rpx;
  2059. display: inline-flex;
  2060. align-items: center;
  2061. justify-content: center;
  2062. position: fixed;
  2063. right: 0;
  2064. z-index: 9;
  2065. bottom: calc(var(--window-bottom) + 280rpx);
  2066. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .12);
  2067. image {
  2068. flex-shrink: 0;
  2069. height: 34rpx;
  2070. width: 34rpx;
  2071. margin-right: 6rpx;
  2072. }
  2073. }
  2074. .danmu-line {
  2075. bottom: calc(var(--window-bottom) + 370rpx);
  2076. word-break: keep-all;
  2077. .set_image {
  2078. height: 40rpx;
  2079. width: 40rpx;
  2080. }
  2081. }
  2082. .footer {
  2083. border-top: 1rpx solid #ededef;
  2084. background: #fff;
  2085. width: 100%;
  2086. position: fixed;
  2087. bottom: 0;
  2088. // padding: 32rpx;
  2089. padding-bottom: calc(var(--window-bottom));
  2090. box-sizing: border-box;
  2091. z-index: 9;
  2092. &-btn {
  2093. width: calc(100% - 64rpx);
  2094. height: 98rpx;
  2095. background: #FF5C03;
  2096. border-radius: 49rpx 49rpx 49rpx 49rpx;
  2097. line-height: 98rpx;
  2098. text-align: center;
  2099. font-family: PingFang SC, PingFang SC;
  2100. font-weight: 600;
  2101. font-size: 32rpx;
  2102. color: #FFFFFF;
  2103. @include u-flex(row, center, center);
  2104. margin: 24rpx 32rpx;
  2105. box-sizing: border-box;
  2106. &-img {
  2107. flex-shrink: 0;
  2108. width: 144rpx;
  2109. height: 144rpx;
  2110. margin-right: 8rpx;
  2111. margin-top: -24rpx;
  2112. }
  2113. }
  2114. &-btn-border {
  2115. position: relative;
  2116. &::after {
  2117. content: "";
  2118. background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  2119. position: absolute;
  2120. top: -2rpx;
  2121. left: 0;
  2122. height: 103rpx;
  2123. width: 100%;
  2124. z-index: -1;
  2125. border-radius: 49rpx 49rpx 49rpx 49rpx;
  2126. box-shadow: 0rpx 8rpx 11rpx 0rpx rgba(255, 92, 3, 0.3);
  2127. overflow: hidden;
  2128. }
  2129. }
  2130. }
  2131. }
  2132. .agreement {
  2133. display: inline-flex;
  2134. margin-top: 16rpx;
  2135. font-size: 24rpx;
  2136. color: #525252;
  2137. align-items: center;
  2138. justify-content: center;
  2139. }
  2140. .video-danmu-btnbox {
  2141. width: 50px;
  2142. height: 50px;
  2143. border-radius: 50%;
  2144. overflow: hidden;
  2145. position: absolute;
  2146. right: 10px;
  2147. bottom: calc(50% - 50px);
  2148. transform: translateY(-50%);
  2149. padding: 8px;
  2150. box-sizing: border-box;
  2151. }
  2152. .video-danmu-image {
  2153. width: 100%;
  2154. height: 100%;
  2155. }
  2156. .danmuPopup {
  2157. background-color: #fff;
  2158. padding-bottom: calc(var(--window-bottom) + 10px);
  2159. .u-border {
  2160. flex: 1;
  2161. @include u-flex(row,center,flex-start);
  2162. padding: 0 6rpx;
  2163. border-radius: 6px;
  2164. }
  2165. &-head {
  2166. width: 100%;
  2167. padding: 10px;
  2168. box-sizing: border-box;
  2169. overflow: hidden;
  2170. @include u-flex(row,center,flex-start);
  2171. .danmu-icon {
  2172. height: 24px;
  2173. width: 24px;
  2174. margin-right: 10px;
  2175. }
  2176. }
  2177. &-input {
  2178. flex: 1;
  2179. height: 35px;
  2180. }
  2181. &-send {
  2182. flex-shrink: 0;
  2183. height: 35px;
  2184. display: flex;
  2185. align-items: center;
  2186. justify-content: center;
  2187. padding: 5px 15px;
  2188. box-sizing: border-box;
  2189. background: #FF5C03 !important;
  2190. border-radius: 6px;
  2191. font-family: PingFang SC, PingFang SC;
  2192. font-weight: 500;
  2193. font-size: 15px;
  2194. color: #fff !important;
  2195. margin-left: 12px;
  2196. &::after {
  2197. border: none;
  2198. }
  2199. }
  2200. &-con {
  2201. background-color: #F5F7FA;
  2202. padding: 24px 12px 48px 12px;
  2203. font-family: PingFang SC, PingFang SC;
  2204. font-weight: 400;
  2205. font-size: 14px;
  2206. color: #757575;
  2207. }
  2208. }
  2209. .danmu-icon{
  2210. height: 24px;
  2211. width: 24px;
  2212. margin-right: 12px;
  2213. }
  2214. .logo {
  2215. display: inline-block;
  2216. width: 30px;
  2217. height: auto;
  2218. margin: 20px 0 0 10px;
  2219. pointer-events: none;
  2220. object-fit: cover;
  2221. }
  2222. .logo-full {
  2223. display: inline-block;
  2224. width: 40px;
  2225. height: auto;
  2226. margin: 50px 0 0 30px;
  2227. pointer-events: none;
  2228. object-fit: cover;
  2229. }
  2230. .tabbox-bar {
  2231. @include u-flex(row, center, flex-start);
  2232. background-color: #fff;
  2233. .warning {
  2234. flex-shrink: 0;
  2235. padding-right: 20rpx;
  2236. }
  2237. }
  2238. .tabbox {
  2239. flex: 1;
  2240. @include u-flex(row, center, center);
  2241. border-bottom: 2rpx solid #F5F7FA;
  2242. height: 44px;
  2243. background-color: #fff;
  2244. view {
  2245. flex: 1;
  2246. padding: 20rpx 0;
  2247. margin-right: 40rpx;
  2248. text-align: center;
  2249. }
  2250. &-active {
  2251. position: relative;
  2252. &::after {
  2253. position: absolute;
  2254. bottom: 0;
  2255. left: 50%;
  2256. transform: translateX(-50%);
  2257. content: "";
  2258. width: 3rem;
  2259. border-bottom: 4px solid #FF5C03;
  2260. }
  2261. }
  2262. }
  2263. .chatinput {
  2264. position: fixed;
  2265. left: 32rpx;
  2266. right: 32rpx;
  2267. z-index: 999;
  2268. height: 96rpx;
  2269. background-color: green;
  2270. background: #FFFFFF;
  2271. box-shadow: 0rpx 8rpx 21rpx 0rpx rgba(0, 0, 0, 0.1);
  2272. border-radius: 24rpx 24rpx 24rpx 24rpx;
  2273. @include u-flex(row, center, center);
  2274. padding: 0 24rpx;
  2275. box-sizing: border-box;
  2276. .uni-input {
  2277. flex: 1;
  2278. margin-right: 32rpx;
  2279. font-size: 30rpx;
  2280. }
  2281. .send {
  2282. font-family: PingFang SC, PingFang SC;
  2283. font-weight: 400;
  2284. font-size: 28rpx;
  2285. color: #FFFFFF !important;
  2286. flex-shrink: 0;
  2287. padding: 0 20rpx;
  2288. height: 72rpx;
  2289. background: #FF5C03 !important;
  2290. border-radius: 8rpx 8rpx 8rpx 8rpx;
  2291. &::after {
  2292. border: none;
  2293. }
  2294. }
  2295. }
  2296. .answerTip {
  2297. position: fixed;
  2298. right: 0;
  2299. z-index: 9;
  2300. bottom: calc(var(--window-bottom) + 380rpx);
  2301. box-shadow: 0rpx 8rpx 21rpx 0rpx rgba(0, 0, 0, 0.1);
  2302. border-radius: 24rpx 24rpx 24rpx 24rpx;
  2303. background-color: #ff5c03;
  2304. color: #fff;
  2305. border-radius: 50%;
  2306. height: 100rpx;
  2307. width: 100rpx;
  2308. font-size: 25rpx;
  2309. text-align: center;
  2310. padding: 10rpx;
  2311. @include u-flex(row, center, center);
  2312. }
  2313. .danmu-item {
  2314. position: absolute;
  2315. top: 0;
  2316. white-space: nowrap;
  2317. font-size: 16px;
  2318. height: 20px;
  2319. display: inline-flex;
  2320. box-sizing: border-box;
  2321. align-items: center;
  2322. }
  2323. .danmuMove {
  2324. // animation: mymove 8s linear forwards;
  2325. // animation-duration: 8s;
  2326. animation-timing-function: linear;
  2327. animation-delay: 0s;
  2328. animation-iteration-count: 1;
  2329. animation-direction: normal;
  2330. animation-fill-mode: forwards;
  2331. animation-play-state: running;
  2332. animation-name: mymove;
  2333. will-change: transform;
  2334. }
  2335. @keyframes mymove {
  2336. from {
  2337. transform: translateX(100vw);
  2338. }
  2339. to {
  2340. transform: translateX(-100%);
  2341. }
  2342. }
  2343. .arrow-left-warning {
  2344. position: absolute;
  2345. left: 24rpx;
  2346. height: 88rpx;
  2347. overflow: hidden;
  2348. color: #888;
  2349. font-size: 24rpx;
  2350. @include u-flex(column, center, center);
  2351. image {
  2352. flex-shrink: 0;
  2353. height: 36rpx;
  2354. width: 36rpx;
  2355. }
  2356. }
  2357. </style>