videoNew.vue 51 KB

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