video.vue 52 KB

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