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 class="title-content" v-if="openCommentStatus!=1">
  77. <!-- 答题时展示小节课程名,其他展示课程名 -->
  78. <!-- 小节课程名 -->
  79. <view class="subtitlebox" v-if="isLogin&&isAddKf==1">
  80. {{courseInfo.title|| ''}}
  81. </view>
  82. <!-- 课程名字 -->
  83. <view class="miantitlebox" v-else>
  84. {{courseInfo.courseName|| ''}}
  85. </view>
  86. <!-- 投诉 -->
  87. <!-- <view class="warning" @click="feedback" v-if="isLogin&&videoId">
  88. <image src="/static/images/warning.png"></image>
  89. <text>投诉</text>
  90. </view> -->
  91. </view>
  92. <view class="tabbox-bar" v-if="openCommentStatus==1">
  93. <view class="tabbox">
  94. <view :class="currentTab == nav.id ? 'tabbox-active':''" v-for="nav in navList" :key="nav.id" @click="handleTab(nav.id)">{{nav.name}}</view>
  95. </view>
  96. <!-- 投诉 -->
  97. <!-- <view class="warning" @click="feedback">
  98. <image src="/static/images/warning.png"></image>
  99. <text>投诉</text>
  100. </view> -->
  101. </view>
  102. </view>
  103. <scroll-view
  104. class="scroll-view"
  105. :style="{height: height}"
  106. :scroll-top="scrollTop"
  107. :scroll-y="true"
  108. :refresher-enabled="currentTab == 2"
  109. :refresher-triggered="triggered"
  110. @refresherrefresh="handleRefresher">
  111. <template v-if="openCommentStatus==1">
  112. <view v-show="currentTab==0">
  113. <descInfoNav ref="descInfoNav" :isLogin="isLogin" :isAddKf="isAddKf" :courseInfo="courseInfo"></descInfoNav>
  114. </view>
  115. <view v-show="currentTab==2">
  116. <commentBox
  117. ref="commentBox"
  118. :height="height"
  119. :urlOption="urlOption"
  120. :time="playTime"
  121. :flagTime="flagTime"
  122. :showDanmu="showDanmu"
  123. :viewCommentNum="viewCommentNum"
  124. :openCommentStatus="openCommentStatus"
  125. :isSocketOpen="isSocketOpen"
  126. @socketSend="socketSend"
  127. @initSocket="initSocket"
  128. @setInputText="setInputText"
  129. @getScrollTop="getScrollTop"
  130. @getMore="getMore"></commentBox>
  131. </view>
  132. </template>
  133. <view v-show="currentTab==1">
  134. <template v-if="openCommentStatus!=1">
  135. <!-- 介绍 -->
  136. <descInfo ref="descInfo" :isLogin="isLogin" :isAddKf="isAddKf" :courseInfo="courseInfo"></descInfo>
  137. </template>
  138. <!-- 问题 -->
  139. <template v-if="isLogin&&isAddKf==1">
  140. <ques ref="ques" :urlOption="urlOption" :courseNote="courseNote" :showNote="showNote" :treatmentPackage="treatmentPackage" :showTreatment="showTreatment" :quesList="quesList" :openCommentStatus="openCommentStatus" @handleAnswer="handleAnswer" @showBtnType="showBtnType"></ques>
  141. </template>
  142. </view>
  143. </scroll-view>
  144. <!-- 线路 -->
  145. <view class="video-line" v-if="isLogin&&isAddKf==1" @click="openPop">
  146. <image src="https://cos.his.cdwjyyh.com/fs/20250915/04889779f7f44e22a7a378d26823b2e8.png"></image>
  147. <text>线路{{numberToChinese(lineIndex + 1)}}</text>
  148. </view>
  149. <!-- 线路弹窗 -->
  150. <uni-popup ref="popup" type="bottom" class="full-width-popup">
  151. <view class="popupbox">
  152. <view class="popupbox-head">
  153. <text>线路选择</text>
  154. <image class="close-icon" src="https://cos.his.cdwjyyh.com/fs/20250915/b950ff20d115453f9d7f908590c9c0e7.png" mode="aspectFill" @click="close">
  155. </image>
  156. </view>
  157. <view class="popupbox-content">
  158. <view :class="lineIndex == index ? 'line-item line-active': 'line-item'"
  159. v-for="(it,index) in lineList" :key="index" @click="handleLine(index)">
  160. 线路{{numberToChinese(index + 1)}}</view>
  161. </view>
  162. </view>
  163. </uni-popup>
  164. <!-- 发送弹幕 -->
  165. <view class="video-line danmu-line" v-if="isLogin&&isAddKf==1&&openCommentStatus==2" @click="openDanmu(0)" >
  166. <image class="set_image" src="https://cos.his.cdwjyyh.com/fs/20250418/5e508642737a44169061382566043ac9.png" mode="aspectFill"></image>
  167. <text>发弹幕</text>
  168. </view>
  169. <!-- 发送弹幕弹窗 -->
  170. <uni-popup ref="danmuPopup" type="bottom" style="z-index: 999;" @change="changeShowPopup">
  171. <view class="danmuPopup" :style="{marginLeft:isfull ? statusBarHeight+'px': 0,marginBottom: danmuboxHeight+'px'}">
  172. <view class="danmuPopup-head border-line">
  173. <image class="danmu-icon" :src="showDanmu==0?baseUrl+'/images/danmu-off.png':baseUrl+'/images/danmu-on.png'" mode="heightFix" @click="switchDanmu()"></image>
  174. <view class="u-border">
  175. <u-input
  176. class="danmuPopup-input"
  177. placeholder="发个弹幕吧~"
  178. border="border"
  179. :focus="focus"
  180. :adjustPosition="false"
  181. :autoBlur="true"
  182. maxlength="50"
  183. v-model.trim="inputText">
  184. </u-input>
  185. <text style="font-size: 24rpx;color: #bbb;margin-left: 10rpx;">{{inputText?inputText.trim().length:0}}/50</text>
  186. </view>
  187. <button class="danmuPopup-send" @click="handleChatInput">发送</button>
  188. </view>
  189. </view>
  190. </uni-popup>
  191. <!-- 答题弹窗 -->
  192. <uni-popup ref="answerPopup" type="center">
  193. <view :class="errTitle == '恭喜你,回答正确' ? 'answerPopup-box bg':'answerPopup-box'">
  194. <!-- 正确 -->
  195. <image class="tipimg" v-if="errTitle == '恭喜你,回答正确'" src="https://cos.his.cdwjyyh.com/fs/20250915/f7b1075c21b442069ec9721a1a4790ec.png"
  196. mode="aspectFill"></image>
  197. <!-- 错误 -->
  198. <image class="tipimg" v-else src="https://cos.his.cdwjyyh.com/fs/20250915/a4b145c94b684c778c03ad9b52d717f3.png" mode="aspectFill">
  199. </image>
  200. <view class="answerPopup-title">{{errTitle}}</view>
  201. <view class="answerPopup-desc" v-html="errDesc"></view>
  202. <view style="color: #FF5C03;">{{currentRewardText}}</view>
  203. <!-- 选择奖励 -->
  204. <view class="reward-list" v-if="errTitle == '恭喜你,回答正确'">
  205. <view :class="item.value == currentReward?'reward-item reward-active':'reward-item'"
  206. v-for="(item, index) in rewardType" :key="item.value" @click="rewardChange(item)">
  207. {{item.name}}
  208. </view>
  209. <!-- <radio-group class="reward-list-group" @change="rewardChange">
  210. <label class="reward-list-option" v-for="(item, index) in rewardType" :key="item.value">
  211. <radio :value="item.value+ ''" :checked="item.value == currentReward"
  212. activeBorderColor="#FF5C03" activeBackgroundColor="#FF5C03"
  213. style="transform:scale(0.7)" color="#FF5C03" />
  214. <view :style="{color: item.value == currentReward ? '#FF5C03':''}">{{item.name}}</view>
  215. </label>
  216. </radio-group> -->
  217. </view>
  218. <!-- 错误题目 -->
  219. <view class="errQuesbox" v-if="errQues&&errQues.length>0">
  220. <view class="errQuesbox-item textOne" v-for="(it,index) in errQues" :key="index">{{it.title}}</view>
  221. </view>
  222. <view class="answerPopup-btn" v-if="errTitle == '恭喜你,回答正确'" @click="closeAnswerPopup">确认</view>
  223. <view class="tipsPopup-btn-box" v-else
  224. :style="{marginTop: errQues&&errQues.length>0 ? '40rpx':'54rpx'}">
  225. <view class="tipsPopup-btn" @click="closeAnswerPopup">{{remain > 0 ? '重新答题': '确认'}}</view>
  226. </view>
  227. </view>
  228. </uni-popup>
  229. <!-- 展示兑换奖品弹窗 -->
  230. <appPopup ref="appPopup"></appPopup>
  231. <!-- 客服二维码弹窗 -->
  232. <uni-popup ref="kfPopup" type="center" :mask-click="false">
  233. <view class="kfqrcode-box">
  234. <image class="kfqrcode" v-if="qrcode" :src="qrcode" show-menu-by-longpress="true"></image>
  235. <view v-show="qrcodeMsg" style="margin-top: 30rpx;" v-html="qrcodeMsg"></view>
  236. <image class="kfqrcode-close" src="https://cos.his.cdwjyyh.com/fs/20250915/97978486cc6c47c6949c5bcc9bc0c4a3.png" mode="aspectFill"
  237. @click="closeKFPop"></image>
  238. </view>
  239. </uni-popup>
  240. <!-- 可以答题提示 -->
  241. <view class="answerTip" v-if="currentTab!=1&&openCommentStatus==1&&showAnswerTip" @click="handleTab(1)">
  242. 可以答题啦
  243. </view>
  244. <!-- footer -->
  245. <view class="footer" v-show="currentTab!=2&&videoId">
  246. <view class="footer-btn" v-if="!isLogin || isAddKf !=1" @click="submit">
  247. <text>立即学习</text>
  248. </view>
  249. <view v-if="isLogin&&isAddKf==1&&currentTab==1&&quesList&&quesList.length>0&&showBtn==0" class="footer-btn footer-btn-border" @click="submit">
  250. <!-- <image class="footer-btn-img" :src="baseUrl+'/images/red_envelope_btnimg.png'" mode="aspectFill"></image> -->
  251. <text>提交答案领取奖励</text>
  252. </view>
  253. <!-- <view @click="checked=!checked" class="agreement" v-if="!isLogin">
  254. <radio value="r1" :checked="checked" color="#ff5c03" activeBorderColor="#ff5c03"
  255. style="transform:scale(0.6);" />
  256. <view>阅读并同意<text style="color: #ff5c03;" @click.stop="goWeb(0)">《用户协议》</text>和<text
  257. style="color: #ff5c03;" @click.stop="goWeb(1)">《隐私协议》</text></view>
  258. </view> -->
  259. <!-- <view class="footer-tips">重庆云联融智提供技术支持</view> -->
  260. </view>
  261. <view v-show="currentTab==2">
  262. <view class="chatinput" :style="{bottom:danmuboxHeight>0?danmuboxHeight+'px':'calc(var(--window-bottom) + 24rpx)'}">
  263. <input class="uni-input" v-model.trim="inputText" :adjustPosition="false" :autoBlur="false" maxlength="140" placeholder="发消息···" confirm-type="send" @confirm="handleChatInput" />
  264. <button class="send" @click="handleChatInput">发送</button>
  265. </view>
  266. </view>
  267. <turntableOne ref="turntableOne" @sendRewardFun="sendRewardFun" @openAppPop="openAppPop"></turntableOne>
  268. <turntableTwo ref="turntableTwo" @sendRewardFun="sendRewardFun" @openAppPop="openAppPop"></turntableTwo>
  269. <yk-screenRecord></yk-screenRecord>
  270. </view>
  271. </template>
  272. <script>
  273. import ykScreenRecord from './components/yk-screenRecord/yk-screenRecord';
  274. import { mapGetters } from 'vuex';
  275. import turntableOne from "./components/turntableOne.vue"
  276. import turntableTwo from "./components/turntableTwo.vue"
  277. import appPopup from "./components/appPopup.vue"
  278. import ques from "./components/ques.vue"
  279. import descInfo from "./components/descInfo.vue"
  280. import descInfoNav from "./components/descInfoNav.vue"
  281. import commentBox from "./components/commentBox.vue"
  282. import treasureChest from "./components/treasureChest.vue"
  283. import dayjs from 'dayjs';
  284. import {
  285. getErrMsg,
  286. getH5CourseByVideoId,
  287. getH5CourseVideoDetails,
  288. courseAnswer,
  289. getFinishCourseVideo,
  290. getIsAddKf,
  291. internetTraffic,
  292. getIntegralByH5Video,
  293. sendReward,
  294. loginByMp,
  295. getRealLink,
  296. getConfigByKey,
  297. claim,
  298. getVideoRewardTypes,
  299. getUserPhoneDeviceType
  300. } from "@/api/course.js"
  301. export default {
  302. components: {
  303. descInfoNav,
  304. descInfo,
  305. commentBox,
  306. ques,
  307. treasureChest,
  308. appPopup,
  309. turntableOne,
  310. turntableTwo,
  311. ykScreenRecord
  312. },
  313. data() {
  314. return {
  315. socket: null,
  316. isSocketOpen: false,
  317. pingpangTimes: null,
  318. baseUrl:uni.getStorageSync('requestImagesPath'),
  319. // 1 红包 2 芳华币
  320. rewardType:[],
  321. currentReward: -1,
  322. player: null,
  323. loading: true,
  324. progress: 0,
  325. code: null,
  326. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  327. scrollTop: 0,
  328. height: '0px',
  329. isLogin: false,
  330. videoUrl: "",
  331. videoId: "",
  332. //现在的时长
  333. playTime: 0,
  334. //总时长
  335. duration: 0,
  336. playDuration: 0,
  337. // 用于续播
  338. playDurationSeek: 0,
  339. // 温馨提醒时间节点,
  340. tipsTime: 0,
  341. tipsOpen: false,
  342. config: {},
  343. courseInfo: {},
  344. quesList: [],
  345. lineList: [],
  346. // 错题
  347. errQues: [],
  348. // 答题机会
  349. remain: 0,
  350. errTitle: "",
  351. errDesc: "",
  352. showPlay: true,
  353. showControls: false,
  354. playStatus: "",
  355. isfull: false,
  356. isAddKf: 0,
  357. lineIndex: 0,
  358. textHeight: 0, //文本高度
  359. qwUserId: "",
  360. qrcode: "",
  361. corpId: "",
  362. qrcodeMsg: "",
  363. urlOption: {},
  364. bufferRate: 0, // 缓冲时间
  365. uuId: "",
  366. isEnded: false,
  367. // 是否允许拖动进度条
  368. linkType: 0,
  369. ip: null,
  370. checked: true,
  371. isFinish: 0, // 是否完课
  372. interval: null,
  373. intervalIntegral: null, // 芳华币定时
  374. options: {
  375. sources: [{
  376. src: ""
  377. }],
  378. poster: "",
  379. live: false /* 是否直播 */ ,
  380. controls: true,
  381. autoplay: false,
  382. licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323137866_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl,
  383. LicenseKey: 'bcc5bd9a14b798b48c52ff005a21d926',
  384. controlBar: {
  385. volumePanel: false,
  386. playbackRateMenuButton: false,
  387. QualitySwitcherMenuButton: false,
  388. // progressControl: false
  389. },
  390. plugins: {
  391. // ProgressMarker: false,
  392. ContextMenu: {
  393. statistic: false
  394. }
  395. },
  396. },
  397. poster: "",
  398. // 错误请求次数
  399. errorCount: 0,
  400. answerPopup: false,
  401. sortLink:"",
  402. // 课程是否过期
  403. isExpire: false,
  404. menuButtonLeft: 281,
  405. menuButtonH: 45,
  406. timer: null,
  407. flag: false,
  408. focus: false,
  409. openDanmuType: 0,
  410. danmuboxHeight: 0,
  411. user: {},
  412. crtShow: true,
  413. // 是否获取到对应观看者的真实链接
  414. isCheckRealUrl: false,
  415. courseLogo: '',
  416. isfull: false,
  417. navList:[{
  418. id: 0,
  419. name: '介绍'
  420. },{
  421. id: 1,
  422. name: '答题'
  423. },{
  424. id: 2,
  425. name: '评论'
  426. }],
  427. currentTab: 1,
  428. triggered: false,
  429. // 没有更多
  430. isMore: false,
  431. inputText:"",
  432. // 获取最多历史评论条数
  433. viewCommentNum: 200,
  434. // 1-开启评论;2-开启弹幕;3-关闭
  435. openCommentStatus: 3,
  436. showAnswerTip: false,
  437. showDanmu: 1,
  438. activeDanmus:[],
  439. flagTime: 0,
  440. notice: '',
  441. fsUserCourseRewardRoundStatusVO: [],
  442. onHide: false,
  443. courseNote:'',
  444. showBtn: 0,
  445. showNote: 0,
  446. showTreatment: 1, // 1不展示,0展示
  447. treatmentPackage: []
  448. }
  449. },
  450. computed:{
  451. ...mapGetters(['coureLogin']),
  452. currentRewardText(){
  453. const index = this.rewardType.findIndex(it=>it.value==this.currentReward)
  454. return index > -1 ? this.rewardType[index].text || '':''
  455. }
  456. },
  457. watch: {
  458. coureLogin: {
  459. immediate: true, // 页面一进入就检查一次
  460. handler(val) {
  461. if (val == 2) {
  462. console.log("AppToken失效,请重新登录")
  463. this.isLogin = false
  464. this.isAddKf = 0
  465. this.goLogin()
  466. }
  467. }
  468. }
  469. },
  470. onLoad(option) {
  471. this.code = option.code
  472. this.urlOption = option.course ? JSON.parse(decodeURIComponent(option.course)) : {}
  473. this.videoId = this.urlOption.videoId || ''
  474. this.qwUserId = this.urlOption.qwUserId || ''
  475. this.corpId = this.urlOption.corpId || ''
  476. this.linkType = this.urlOption.linkType || 0
  477. // if (this.code) {
  478. // this.loginByMp()
  479. // }
  480. var that=this;
  481. if (this.videoId) {
  482. this.getH5CourseByVideo()
  483. this.getConfigByKey()
  484. }
  485. this.sortLink = this.urlOption.link || ''
  486. this.getMenuButton()
  487. // #ifndef H5
  488. uni.onKeyboardHeightChange(this.keyboardHeightChange);
  489. // #endif
  490. },
  491. onShow() {
  492. this.onHide = false
  493. this.tipsOpen = false
  494. // this.isLogin = this.utils.isLoginCourse()
  495. this.uuId = this.utils.generateRandomString(16)
  496. if(uni.getStorageSync('auto_userInfo') && JSON.stringify(uni.getStorageSync('auto_userInfo'))!='{}') {
  497. this.user = JSON.parse(uni.getStorageSync('auto_userInfo'))
  498. } else {
  499. this.user = {}
  500. }
  501. if(this.sortLink){
  502. this.getLink()
  503. } else {
  504. uni.showToast({
  505. title: 'sortLink is not found',
  506. icon: 'none'
  507. });
  508. if(this.isLogin) {
  509. this.getUserPhoneDeviceType()
  510. }
  511. }
  512. },
  513. mounted() {
  514. this.getIP()
  515. this.getHeight()
  516. },
  517. onHide() {
  518. this.onHide = true
  519. // this.player = uni.createVideoContext('video-content-box');
  520. if (this.player) {
  521. this.player.pause()
  522. }
  523. // if (this.interval != null) {
  524. // clearInterval(this.interval)
  525. // this.interval = null
  526. // }
  527. this.closeSocket()
  528. },
  529. onUnload() {
  530. if (this.interval != null) {
  531. clearInterval(this.interval)
  532. this.interval = null
  533. }
  534. this.clearIntegral()
  535. // #ifndef H5
  536. uni.offKeyboardHeightChange(this.keyboardHeightChange);
  537. // #endif
  538. this.closeSocket()
  539. },
  540. beforeDestroy() {
  541. this.player = uni.createVideoContext('video-content-box');
  542. if (this.player) {
  543. this.player.stop()
  544. this.player = null
  545. }
  546. if (this.interval != null) {
  547. clearInterval(this.interval)
  548. this.interval = null
  549. }
  550. this.clearIntegral()
  551. // #ifndef H5
  552. uni.offKeyboardHeightChange(this.keyboardHeightChange);
  553. // #endif
  554. this.closeSocket()
  555. },
  556. methods: {
  557. getVideoRewardTypes() {
  558. getVideoRewardTypes({...this.urlOption}).then(res=>{
  559. if(res.code == 200) {
  560. this.rewardType = res.data
  561. this.currentReward = this.rewardType&&this.rewardType.length>0 ? this.rewardType[0].value : -1
  562. }
  563. })
  564. },
  565. getConfigByKey(){
  566. let param = {key:"course.config"};
  567. getConfigByKey(param).then(
  568. res => {
  569. if(res.code==200){
  570. let data=res.data ? JSON.parse(res.data) : {};
  571. this.notice = data.notify || ''
  572. }
  573. },
  574. rej => {}
  575. );
  576. },
  577. numberToChinese(number) {
  578. if (number) {
  579. const chineseNumber = ['一', '二', '三', '四', '五', '六', '七', '八', '九'];
  580. return chineseNumber[number - 1];
  581. } else {
  582. return ''
  583. }
  584. },
  585. keyboardHeightChange(res) {
  586. // #ifndef H5
  587. console.log("this.danmuboxHeight",this.danmuboxHeight)
  588. this.danmuboxHeight = res.height
  589. // #endif
  590. },
  591. getMenuButton(){
  592. const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  593. this.menuButtonLeft = menuButtonInfo.left
  594. this.menuButtonH = menuButtonInfo.height
  595. },
  596. //播放时间更新事件方法
  597. onTimeUpdate(e){
  598. let currentTime = Math.round(e.detail.currentTime)
  599. if (this.playDurationSeek > 0) {
  600. this.playTime = this.playDurationSeek
  601. this.throttle(() => this.changeTime(this), 1000, false)
  602. } else {
  603. if (this.linkType != 1 && (currentTime - this.playTime > 3 || currentTime - this.playTime < -3)&&this.isFinish!=1) {
  604. uni.showToast({
  605. title: '不能快进哦',
  606. icon: 'none',
  607. });
  608. currentTime = this.playTime
  609. this.player.seek(this.playTime);
  610. }
  611. this.playTime = currentTime
  612. }
  613. if (Math.floor(e.detail.currentTime) != this.flagTime) {
  614. this.flagTime = Math.floor(e.detail.currentTime)
  615. const isNearEnd = this.playTime >= this.duration - 60;
  616. this.showAnswerTip = this.isEnded || isNearEnd;
  617. const progress = this.duration ? (this.playTime || 0) / this.duration : 0;
  618. const answerRate = Number(this.config.answerRate ?? 1); // 默认 100%
  619. const hitRate = progress >= answerRate;
  620. this.showNote = (this.isEnded || this.isFinish === 1 || hitRate) ? 1 : 0;
  621. if(this.fsUserCourseRewardRoundStatusVO&&this.fsUserCourseRewardRoundStatusVO.length>0) {
  622. this.$refs.treasureChest&&this.$refs.treasureChest.showTreasure(this.flagTime)
  623. }
  624. if(this.openCommentStatus == 2) {
  625. this.$refs.danmuBox&&this.$refs.danmuBox.checkDanmu(this.flagTime)
  626. }
  627. }
  628. },
  629. changeTime(that,e) {
  630. that.playDurationSeek = 0
  631. },
  632. videoErrorCallback(e) {
  633. this.errorCount++
  634. if (this.errorCount > 3) return
  635. if (this.interval != null) {
  636. clearInterval(this.interval)
  637. }
  638. this.clearIntegral()
  639. console.log(e)
  640. this.getErrMsg(e.target.errMsg)
  641. this.getH5CourseVideoDetails('error')
  642. },
  643. // 当开始/继续播放时触发play事件
  644. getPlay() {
  645. this.errorCount = 0
  646. // this.judgeDuration()
  647. },
  648. getPause() {
  649. this.clearIntegral()
  650. },
  651. getEnded() {
  652. this.clearIntegral()
  653. this.isEnded = true
  654. this.showAnswerTip = true
  655. this.isFinish = 1
  656. this.showNote = 1
  657. this.getFinishCourseVideo()
  658. },
  659. getWaiting() {
  660. this.getErrMsg('','waiting')
  661. },
  662. fullscreenchange(event) {
  663. this.isfull = event.detail.fullScreen
  664. if(this.isfull) {
  665. this.$refs.danmuBox&&this.$refs.danmuBox.initTracks()
  666. }
  667. },
  668. controlstoggle(event) {
  669. this.crtShow = event.detail.show
  670. },
  671. getIP() {
  672. uni.request({
  673. url: 'https://ipinfo.io/json', //仅为示例,并非真实接口地址。
  674. method: 'GET',
  675. success: (res) => {
  676. this.ip = res.data.ip
  677. }
  678. });
  679. },
  680. getHeight() {
  681. setTimeout(()=>{
  682. const query = uni.createSelectorQuery().in(this);
  683. query
  684. .select("#title-contentnav")
  685. .boundingClientRect((data) => {
  686. if(data) {
  687. const footerH = this.showBtn==0? 80: 0
  688. this.height =
  689. `calc(100vh - ${data.height}px - 420rpx - ${this.statusBarHeight}px - ${footerH}px - 88rpx)`
  690. }
  691. })
  692. .exec();
  693. },200)
  694. },
  695. numberToLetter(num) {
  696. // 将数字转换为字母的 ASCII 码
  697. let letterCode = num + 65;
  698. // 将 ASCII 码转换为大写字母
  699. let letter = String.fromCharCode(letterCode);
  700. return letter;
  701. },
  702. updateTime() {
  703. var that = this;
  704. if (this.interval != null) {
  705. clearInterval(this.interval)
  706. }
  707. this.interval = setInterval(function() {
  708. that.getFinishCourseVideo()
  709. that.getInternetTraffic()
  710. }, 60000);
  711. },
  712. judgeDuration() {
  713. var that = this;
  714. if (this.intervalIntegral != null) {
  715. clearInterval(this.intervalIntegral)
  716. this.intervalIntegral = null
  717. }
  718. // 观看10分钟获得芳华币
  719. this.intervalIntegral = setInterval(function() {
  720. that.getIntegralByH5Video()
  721. }, 600000);
  722. },
  723. clearIntegral() {
  724. if (this.intervalIntegral != null) {
  725. clearInterval(this.intervalIntegral)
  726. this.intervalIntegral = null
  727. }
  728. },
  729. getH5CourseByVideo() {
  730. this.loading = true
  731. getH5CourseByVideoId({
  732. videoId: this.videoId
  733. }).then(res => {
  734. this.loading = false
  735. if (res.code == 200) {
  736. this.courseInfo = res.data
  737. uni.setNavigationBarTitle({
  738. title: this.courseInfo && this.courseInfo.title ? this.courseInfo.title : ''
  739. });
  740. }
  741. this.getHeight()
  742. this.$nextTick(()=>{
  743. this.$refs.descInfo&&this.$refs.descInfo.getDescHeight()
  744. this.$refs.descInfoNav&&this.$refs.descInfoNav.getDescHeight()
  745. })
  746. },
  747. rej => {
  748. this.loading = false
  749. }
  750. ).catch(() => {
  751. this.loading = false
  752. })
  753. },
  754. getH5CourseVideoDetails(type) {
  755. getH5CourseVideoDetails(this.urlOption).then(res => {
  756. if (res.code == 200) {
  757. this.config = res.config || {}
  758. this.courseNote = res.course&&res.course.note
  759. this.isFinish = res.isFinish || 0
  760. this.showNote = this.isFinish==1 ? 1:0
  761. this.duration = res.course && res.course.duration ? res.course.duration : 0
  762. this.playDuration = res.playDuration || 0
  763. this.tipsTime = res.tipsTime || 0
  764. const showTreatmentFlag = res.course&&res.course.showTreatment!=null ? res.course.showTreatment : 1
  765. this.treatmentPackage = res.course&&res.course.treatmentPackage ? res.course.treatmentPackage : [],
  766. this.showTreatment = showTreatmentFlag==0&&this.treatmentPackage.length>0 ? 0 : 1
  767. let lineList = []
  768. if (res.course && res.course.lineOne) {
  769. lineList.push(res.course.lineOne)
  770. }
  771. if (res.course && res.course.lineTwo) {
  772. lineList.push(res.course.lineTwo)
  773. }
  774. if (res.course && res.course.lineThree) {
  775. lineList.push(res.course.lineThree)
  776. }
  777. this.lineList = lineList
  778. this.courseLogo = res.config&&res.config.courseLogo
  779. this.viewCommentNum = res.config&&res.config.viewCommentNum || 200
  780. this.openCommentStatus = res.config&&res.config.openCommentStatus || 3;
  781. // this.openCommentStatus = source
  782. // console.log('socket===',socket,this.openCommentStatus)
  783. if(this.openCommentStatus == 3) {
  784. this.closeSocket()
  785. }else {
  786. this.initSocket()
  787. }
  788. this.currentTab = 1
  789. if(this.openCommentStatus!=2 || this.showDanmu!=1) {
  790. this.activeDanmus = []
  791. }
  792. this.fsUserCourseRewardRoundStatusVO = this.getBox(res)
  793. if (!this.player || type == 'error') {
  794. this.lineIndex = this.config.defaultLine
  795. this.videoUrl = lineList[this.lineIndex]
  796. this.poster= res.course && res.course.imgUrl ? res.course.imgUrl : ''
  797. // this.options.sources = [{
  798. // src: this.videoUrl
  799. // }]
  800. // this.options.poster = res.course && res.course.imgUrl ? res.course.imgUrl : ''
  801. // this.initVideo()
  802. this.playTime = this.playDuration >= this.duration ? 0 : this.playDuration
  803. this.playDurationSeek = this.playTime
  804. setTimeout(()=>{
  805. this.player = uni.createVideoContext('video-content-box');
  806. this.player.seek(this.playTime)
  807. this.player.play();
  808. },500);
  809. } else {
  810. // let div = document.querySelector(".vjs-progress-control");
  811. // if(div) {
  812. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  813. // div.style.pointerEvents = "auto";
  814. // } else {
  815. // div.style.pointerEvents = "none"; //禁止所有事件
  816. // }
  817. // }
  818. this.playTime = this.playTime > this.playDuration ? this.playTime : this.playDuration >= this.duration ? 0 : this.playDuration
  819. this.playDurationSeek = this.playTime
  820. this.player.seek(this.playTime)
  821. this.player.play();
  822. }
  823. this.updateTime();
  824. this.quesList = res.questions && res.questions.length > 0 ? res.questions : [],
  825. this.quesList = this.quesList.map(item => ({
  826. ...item,
  827. questionOption: JSON.parse(item.question),
  828. answer: ''
  829. }))
  830. }
  831. this.getHeight()
  832. this.$nextTick(()=>{
  833. this.$refs.descInfo&&this.$refs.descInfo.getDescHeight()
  834. this.$refs.descInfoNav&&this.$refs.descInfoNav.getDescHeight()
  835. })
  836. },
  837. rej => {}
  838. )
  839. },
  840. handleAnswer(val) {
  841. let {item, option,index} = val
  842. let time = this.playTime
  843. if(this.isEnded||this.isFinish==1) {
  844. time = this.duration
  845. } else {
  846. if(time < this.playDuration&&this.isFinish!=1) {
  847. // 没完课且小于续播的时间
  848. time = this.playDuration
  849. }
  850. }
  851. if(Number(this.duration || 0) == 0 || time < this.duration - 60) {
  852. uni.showToast({
  853. title: "请先观看完整课程再答题哦~",
  854. icon: "none"
  855. })
  856. return
  857. }
  858. if (this.quesList[index].type == 1) {
  859. // 单选option
  860. this.quesList[index].answer = option.name
  861. } else if (this.quesList[index].type == 2) {
  862. // 多选
  863. let answer = this.quesList[index].answer ? this.quesList[index].answer.split(',') : []
  864. if (answer.indexOf(option.name) === -1) {
  865. answer.push(option.name)
  866. this.quesList[index].answer = answer.join(',')
  867. } else {
  868. answer.splice(answer.indexOf(option.name), 1)
  869. this.quesList[index].answer = answer.join(',')
  870. }
  871. }
  872. },
  873. submit() {
  874. if(this.isExpire){
  875. uni.showToast({
  876. title: '课程已过期或链接无效',
  877. icon: 'none'
  878. });
  879. return
  880. }
  881. // 登录
  882. this.utils.isLoginCourse().then(
  883. res => {
  884. if(res){
  885. if (this.isAddKf == 1&&this.isCheckRealUrl) {
  886. // 答题
  887. // 您已提交过答案,请领取红包
  888. this.courseAnswer()
  889. } else {
  890. // 添加客服
  891. if (this.videoId && this.qwUserId) {
  892. this.getIsAddKf()
  893. } else {
  894. uni.showToast({
  895. title: '请添加客服',
  896. icon: 'none'
  897. })
  898. }
  899. }
  900. } else{
  901. this.goLogin()
  902. }
  903. },
  904. rej => {}
  905. );
  906. },
  907. // 答题
  908. courseAnswer() {
  909. let time = this.playTime
  910. if (this.isEnded || this.isFinish==1) {
  911. time = this.duration
  912. } else {
  913. if (time < this.playDuration && this.isFinish != 1) {
  914. // 没完课且小于续播的时间
  915. time = this.playDuration
  916. }
  917. }
  918. if (Number(this.duration || 0) == 0 || time < this.duration - 60) {
  919. uni.showToast({
  920. title: "请先观看完整课程再答题哦~",
  921. icon: "none"
  922. })
  923. return
  924. }
  925. if (this.quesList.some(item => !item.answer)) {
  926. uni.showToast({
  927. title: "请确认是否答完所有题目",
  928. icon: "none"
  929. })
  930. return
  931. }
  932. const questions = this.quesList.map(obj => {
  933. const {
  934. questionOption,
  935. ...rest
  936. } = obj;
  937. return rest;
  938. });
  939. if(!this.isCheckRealUrl) return;
  940. const param = {
  941. ...this.urlOption,
  942. questions: questions,
  943. videoId: this.videoId,
  944. duration: this.playTime,
  945. }
  946. this.errTitle = ""
  947. this.errDesc = ""
  948. this.errQues = []
  949. courseAnswer(param).then(res => {
  950. if (res.code == 200) {
  951. if (res.incorrectQuestions) {
  952. // 答题失败
  953. if (res.incorrectQuestions.length > 0) {
  954. this.errQues = res.incorrectQuestions
  955. }
  956. this.remain = res.remain || 0
  957. if (res.remain > 0) {
  958. this.errTitle = "很遗憾答错了"
  959. this.errDesc = `<span style="color:#FF5C03">还有${res.remain}次机会,继续加油</span>`
  960. this.$refs.answerPopup.open("center")
  961. }
  962. } else {
  963. // 答题成功
  964. this.errTitle = "恭喜你,回答正确"
  965. this.errDesc = `请选择奖励`
  966. this.currentReward = this.rewardType&&this.rewardType.length>0 ? this.rewardType[0].value : -1
  967. this.$refs.answerPopup.open("center")
  968. }
  969. } else {
  970. if (res.msg == "该课题到达答错次数限制") {
  971. this.errTitle = "答题次数超过限制"
  972. this.errDesc = "以后的课程要认真学习哦"
  973. this.$refs.answerPopup.open("center")
  974. } else {
  975. uni.showToast({
  976. title: res.msg,
  977. icon: "none"
  978. })
  979. }
  980. }
  981. },
  982. rej => {}
  983. )
  984. },
  985. // 选择
  986. rewardChange(e) {
  987. this.currentReward = e.value
  988. },
  989. closeAnswerPopup() {
  990. this.$refs.answerPopup.close()
  991. if(!this.isCheckRealUrl) return;
  992. if (this.errTitle == '恭喜你,回答正确') {
  993. if(this.currentReward==4) {
  994. this.$refs.turntableTwo.open(this.urlOption)
  995. } else if(this.currentReward==3) {
  996. this.$refs.turntableOne.open(this.urlOption)
  997. } else {
  998. this.sendRewardFun(this.currentReward)
  999. }
  1000. }
  1001. },
  1002. sendRewardFun(currentReward) {
  1003. this.currentReward = currentReward
  1004. const param = {
  1005. ...this.urlOption,
  1006. rewardType: Number(this.currentReward),
  1007. source: 2,
  1008. appId: getApp().globalData.appId
  1009. }
  1010. sendReward(param).then(res => {
  1011. if(res.code == 200) {
  1012. if(currentReward == 4) {
  1013. this.$refs.turntableTwo.endSuccess(res.data)
  1014. }else if(currentReward == 3) {
  1015. this.$refs.turntableOne.endSuccess(res.data)
  1016. }else {
  1017. uni.showToast({
  1018. title: res.msg,
  1019. icon: 'none'
  1020. })
  1021. // this.openAppPop()
  1022. }
  1023. } else {
  1024. this.currentReward == 4 ? this.$refs.turntableTwo.close('close') : this.currentReward == 3? this.$refs.turntableOne.close('close'):''
  1025. uni.showToast({
  1026. title: res.msg,
  1027. icon: 'none'
  1028. })
  1029. }
  1030. })
  1031. },
  1032. openAppPop() {
  1033. this.$refs.appPopup.openPop()
  1034. },
  1035. // 线路
  1036. openPop() {
  1037. this.$refs.popup.open('bottom')
  1038. },
  1039. close() {
  1040. this.$refs.popup.close()
  1041. },
  1042. handleLine(index) {
  1043. var that=this;
  1044. if (this.lineIndex == index && this.videoUrl == this.lineList[index]) {
  1045. this.close()
  1046. return
  1047. } else {
  1048. // let div = document.querySelector(".vjs-progress-control");
  1049. // if(div) {
  1050. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  1051. // div.style.pointerEvents = "auto";
  1052. // } else {
  1053. // div.style.pointerEvents = "none"; //禁止所有事件
  1054. // }
  1055. // }
  1056. this.lineIndex = index
  1057. this.videoUrl = this.lineList[index]
  1058. this.tipsOpen = false
  1059. this.playDurationSeek = this.playTime || 0
  1060. this.player = uni.createVideoContext('video-content-box');
  1061. setTimeout(function(){
  1062. that.player.seek(that.playDurationSeek)
  1063. that.player.play();
  1064. },500);
  1065. // this.player.src(this.lineList[index])
  1066. // this.player.one('loadedmetadata', () => {
  1067. // this.player.currentTime(this.playDurationSeek);
  1068. // this.player.play();
  1069. // });
  1070. this.close()
  1071. }
  1072. },
  1073. // 客服
  1074. getIsAddKf() {
  1075. this.qrcode = ''
  1076. this.qrcodeMsg = ''
  1077. this.isAddKf = 0
  1078. // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
  1079. getIsAddKf(this.urlOption).then(res => {
  1080. if (res.code == 200) {
  1081. this.isAddKf = 1
  1082. this.isCheckRealUrl = true
  1083. this.getH5CourseVideoDetails()
  1084. } else if (res.code == 400) {
  1085. this.isAddKf = 0
  1086. this.isCheckRealUrl = false
  1087. this.qrcode = res.qrcode
  1088. this.qrcodeMsg = res.msg
  1089. this.$refs.kfPopup.open()
  1090. } else if (res.code == 566) {
  1091. // 官方群发通用链接
  1092. const url = res.courseLink.realLink.split('?course=')[1]
  1093. this.urlOption = JSON.parse(url)
  1094. this.isAddKf = 1
  1095. this.isCheckRealUrl = true
  1096. this.getH5CourseVideoDetails()
  1097. } else if (res.code == 567) {
  1098. // 群聊通用链接
  1099. this.urlOption = {
  1100. ...this.urlOption,
  1101. qwExternalId: res.qwExternalId
  1102. }
  1103. this.isAddKf = 1
  1104. this.isCheckRealUrl = true
  1105. this.getH5CourseVideoDetails()
  1106. }else {
  1107. this.isCheckRealUrl = false
  1108. this.isAddKf = 0
  1109. uni.showToast({
  1110. title: res.msg,
  1111. icon: 'none'
  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>