videoNew.vue 51 KB

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