videoNew.vue 51 KB

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