videoNew.vue 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037
  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 if (res.code == 567) {
  988. // 群聊通用链接
  989. this.urlOption = {
  990. ...this.urlOption,
  991. qwExternalId: res.qwExternalId
  992. }
  993. this.isAddKf = 1
  994. this.getH5CourseVideoDetails()
  995. } else {
  996. this.isAddKf = 0
  997. uni.showToast({
  998. title: res.msg,
  999. icon: 'none'
  1000. });
  1001. }
  1002. },
  1003. err => {}
  1004. );
  1005. },
  1006. closeKFPop() {
  1007. this.$refs.kfPopup.close()
  1008. },
  1009. getFinishCourseVideo() {
  1010. if (!this.isLogin||!this.playTime || this.isAddKf!=1) return
  1011. // {videoId: this.videoId,duration:this.playTime}
  1012. const param = {
  1013. duration: this.playTime,
  1014. ...this.urlOption
  1015. }
  1016. getFinishCourseVideo(param)
  1017. },
  1018. // 每十分钟获得积分
  1019. getIntegralByH5Video() {
  1020. if(!this.isLogin||this.isAddKf!=1) return
  1021. const param = {
  1022. duration: this.playTime,
  1023. ...this.urlOption
  1024. }
  1025. getIntegralByH5Video(param).then(res => {
  1026. if (res.code == 200) {
  1027. uni.showToast({
  1028. title: "积分+10",
  1029. icon: "none"
  1030. })
  1031. }
  1032. })
  1033. },
  1034. progressChange(e) {
  1035. this.bufferRate = Math.ceil(e.detail.buffered)
  1036. },
  1037. // 缓冲
  1038. getInternetTraffic() {
  1039. if(!this.isLogin||this.isAddKf!=1) return
  1040. const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
  1041. if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
  1042. this.bufferRate = playVideoTime
  1043. }
  1044. if(this.bufferRate == 0 || Number(this.bufferRate.toFixed(2)) == 0) return
  1045. const param = {
  1046. ...this.urlOption,
  1047. uuId: dayjs().format('YYYYMMDD') + this.uuId,
  1048. duration: this.playTime,
  1049. bufferRate: Number(this.bufferRate.toFixed(2)),
  1050. }
  1051. if(!param.bufferRate) return
  1052. getInternetTraffic(param)
  1053. },
  1054. getErrMsg(err,type) {
  1055. let msgerr = {
  1056. errType: type || 'error',
  1057. videoUrl: this.videoUrl,
  1058. lineIndex: this.lineIndex,
  1059. errTime: new Date(),
  1060. ip: this.ip,
  1061. errMsg: err || ''
  1062. }
  1063. getErrMsg({
  1064. msg: JSON.stringify(msgerr)
  1065. })
  1066. },
  1067. goLogin() {
  1068. let provider = 'weixin'
  1069. uni.login({
  1070. provider: provider,
  1071. success: async loginRes => {
  1072. console.log(loginRes)
  1073. uni.getUserInfo({
  1074. provider: provider,
  1075. success: (infoRes)=> {
  1076. uni.showToast({
  1077. title: '处理中...',
  1078. icon: 'loading'
  1079. });
  1080. loginByMp({code: loginRes.code,encryptedData:infoRes.encryptedData,iv:infoRes.iv}).then(res=>{
  1081. uni.hideLoading();
  1082. if (res.code == 200) {
  1083. uni.setStorageSync(TOKEN_KEY, res.token);
  1084. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  1085. this.user = res.user
  1086. this.isLogin = true
  1087. this.getIsAddKf()
  1088. } else {
  1089. uni.showToast({
  1090. title: res.msg,
  1091. icon: 'none'
  1092. });
  1093. }
  1094. }).catch(err=>{
  1095. uni.hideLoading();
  1096. uni.showToast({
  1097. icon:'none',
  1098. title: "登录失败,请重新登录",
  1099. });
  1100. });
  1101. }
  1102. });
  1103. }
  1104. })
  1105. },
  1106. getLink() {
  1107. let that = this;
  1108. getRealLink({sortLink:this.sortLink}).then(res=>{
  1109. if(res.code == 200) {
  1110. this.isExpire = false
  1111. // 如果响应中包含真实链接,则跳转到真实链接
  1112. // window.location.href = res.realLink +"&sortLink="+this.sortLink+"&code="+this.code+"&time="+new Date().getTime()
  1113. if (this.isLogin && this.isAddKf == 1) {
  1114. this.getH5CourseVideoDetails()
  1115. }
  1116. if (this.videoId &&this.isAddKf != 1) {
  1117. this.$isLoginCourse().then(
  1118. isLogin => {
  1119. this.isLogin = isLogin
  1120. if(isLogin){
  1121. this.getIsAddKf()
  1122. } else {
  1123. this.goLogin()
  1124. }
  1125. },
  1126. rej => {}
  1127. );
  1128. }
  1129. } else {
  1130. this.isExpire = true
  1131. uni.showToast({
  1132. title: '课程已过期或链接无效',
  1133. icon: 'none'
  1134. });
  1135. }
  1136. }).catch(err=>{
  1137. this.isExpire = true
  1138. uni.showToast({
  1139. title: '发生错误,请稍后再试',
  1140. icon: 'none'
  1141. });
  1142. })
  1143. },
  1144. /**
  1145. * 节流原理:在一定时间内,只能触发一次
  1146. *
  1147. * @param {Function} func 要执行的回调函数
  1148. * @param {Number} wait 延时的时间
  1149. * @param {Boolean} immediate 是否立即执行
  1150. * @return null
  1151. */
  1152. throttle(func, wait = 500, immediate = true) {
  1153. if (immediate) {
  1154. if (!this.flag) {
  1155. this.flag = true
  1156. // 如果是立即执行,则在wait毫秒内开始时执行
  1157. typeof func === 'function' && func()
  1158. this.timer = setTimeout(() => {
  1159. this.flag = false
  1160. }, wait)
  1161. }
  1162. } else if (!this.flag) {
  1163. this.flag = true
  1164. // 如果是非立即执行,则在wait毫秒内的结束处执行
  1165. this.timer = setTimeout(() => {
  1166. this.flag = false
  1167. typeof func === 'function' && func()
  1168. }, wait)
  1169. }
  1170. },
  1171. // 弹幕
  1172. openDanmu(type) {
  1173. this.openDanmuType = type
  1174. this.inputText = ''
  1175. if(type == 1) {
  1176. this.player.exitFullScreen()
  1177. }
  1178. this.$refs.danmuPopup.open()
  1179. },
  1180. changeShowPopup(val) {
  1181. this.focus = val.show
  1182. },
  1183. switchDanmu() {
  1184. this.showDanmu = this.showDanmu == 1 ? 0:1
  1185. if(this.showDanmu == 0&&this.$refs.danmuBox) {
  1186. this.$refs.danmuPopup.close()
  1187. this.activeDanmus = []
  1188. this.$refs.danmuBox.activeDanmus = []
  1189. this.$refs.danmuBox.initTracks()
  1190. }
  1191. },
  1192. getScrollTop(res) {
  1193. console.log(res)
  1194. if(this.currentTab == 2) {
  1195. this.scrollTop = res
  1196. } else {
  1197. this.scrollTop = 0
  1198. }
  1199. },
  1200. handleTab(index) {
  1201. this.currentTab = index
  1202. if(this.currentTab==2) {
  1203. if(this.$refs.commentBox) {
  1204. this.$refs.commentBox.msgs = []
  1205. this.$refs.commentBox.pageNum = 1
  1206. this.$refs.commentBox.getComments()
  1207. }
  1208. } else {
  1209. setTimeout(()=>{
  1210. this.scrollTop = 0
  1211. },100)
  1212. }
  1213. },
  1214. handleRefresher() {
  1215. this.triggered = true;
  1216. if (!this.isMore&&this.currentTab==2&&this.openCommentStatus==1) {
  1217. this.$nextTick(()=>{
  1218. this.$refs.commentBox&&this.$refs.commentBox.getComments()
  1219. })
  1220. }
  1221. setTimeout(() => {
  1222. this.triggered = false;
  1223. }, 500);
  1224. },
  1225. getMore(val) {
  1226. this.triggered = false;
  1227. this.isMore = val == 1
  1228. },
  1229. handleChatInput() {
  1230. this.inputText = this.inputText.trim()
  1231. if (this.inputText == "" || this.inputText.trim() == "") {
  1232. uni.showToast({
  1233. title: '请输入评论',
  1234. icon: "none"
  1235. })
  1236. return;
  1237. }
  1238. if(this.openCommentStatus==1) {
  1239. this.$refs.commentBox&&this.$refs.commentBox.handleInput(this.inputText)
  1240. } else if(this.openCommentStatus==2) {
  1241. this.$refs.danmuBox&&this.$refs.danmuBox.handleInput(this.inputText)
  1242. }
  1243. },
  1244. setInputText() {
  1245. this.inputText = ""
  1246. if(this.openCommentStatus==2) {
  1247. this.$refs.danmuPopup.close()
  1248. }
  1249. },
  1250. getActiveDanmus(val) {
  1251. this.activeDanmus = val
  1252. },
  1253. animationend(moveItem, i) {
  1254. // 移除动画结束的弹幕(性能优化)
  1255. if(this.openCommentStatus==2) {
  1256. this.$refs.danmuBox&&this.$refs.danmuBox.animationend(moveItem, i)
  1257. }
  1258. },
  1259. feedback() {
  1260. const userId = this.user.userId || ''
  1261. const courseId = this.urlOption.courseId || ''
  1262. const videoId = this.urlOption.videoId || ''
  1263. uni.navigateTo({
  1264. url: './feedback?userId='+userId+'&courseId='+courseId+'&videoId='+videoId
  1265. })
  1266. }
  1267. }
  1268. }
  1269. </script>
  1270. <style scoped>
  1271. .full-width-popup {
  1272. width: 100%;
  1273. }
  1274. </style>
  1275. <style lang="scss" scoped>
  1276. @mixin u-flex($flexD, $alignI, $justifyC) {
  1277. display: flex;
  1278. flex-direction: $flexD;
  1279. align-items: $alignI;
  1280. justify-content: $justifyC;
  1281. }
  1282. .footer-tips {
  1283. margin-top: 14rpx;
  1284. text-align: center;
  1285. font-family: PingFang SC,PingFang SC;
  1286. font-weight: 500;
  1287. font-size: 12px;
  1288. color: #bbb;
  1289. }
  1290. .textOne {
  1291. overflow: hidden;
  1292. white-space: nowrap;
  1293. text-overflow: ellipsis;
  1294. }
  1295. .textTwo {
  1296. overflow: hidden;
  1297. text-overflow: ellipsis;
  1298. display: -webkit-box;
  1299. -webkit-line-clamp: 2;
  1300. -webkit-box-orient: vertical;
  1301. }
  1302. .header-nav {
  1303. height: 88rpx;
  1304. @include u-flex(row, center, flex-start);
  1305. overflow: hidden;
  1306. background-color: #fff;
  1307. box-sizing: border-box;
  1308. .header-title {
  1309. text-align: center;
  1310. overflow: hidden;
  1311. white-space: nowrap;
  1312. text-overflow: ellipsis;
  1313. padding: 0 10rpx 0 100rpx;
  1314. font-family: PingFang SC,PingFang SC;
  1315. font-weight: 500;
  1316. font-size: 15px;
  1317. color: #000;
  1318. box-sizing: border-box;
  1319. }
  1320. }
  1321. .reward-list {
  1322. width: 100%;
  1323. margin-top: 20rpx;
  1324. margin-bottom: -40rpx;
  1325. &-group {
  1326. font-family: PingFang SC, PingFang SC;
  1327. font-weight: 400;
  1328. font-size: 14px;
  1329. color: #222222;
  1330. @include u-flex(row, center, center);
  1331. }
  1332. &-option {
  1333. @include u-flex(row, center, flex-start);
  1334. &:first-child {
  1335. margin-right: 40rpx;
  1336. }
  1337. }
  1338. }
  1339. .err {
  1340. color: #f56c6c !important;
  1341. }
  1342. .kfqrcode-box {
  1343. background-color: #fff;
  1344. border-radius: 16rpx;
  1345. max-width: 560rpx;
  1346. padding: 60rpx 40rpx;
  1347. margin-top: -100rpx;
  1348. box-sizing: border-box;
  1349. @include u-flex(column, center, flex-start);
  1350. font-family: PingFang SC, PingFang SC;
  1351. font-weight: 400;
  1352. font-size: 34rpx;
  1353. color: #222;
  1354. position: relative;
  1355. text-align: center;
  1356. .kfqrcode {
  1357. height: 460rpx;
  1358. width: 460rpx;
  1359. }
  1360. }
  1361. .kfqrcode-close {
  1362. width: 64rpx;
  1363. height: 64rpx;
  1364. position: absolute;
  1365. bottom: -100rpx;
  1366. left: 50%;
  1367. transform: translateX(-50%);
  1368. }
  1369. .tipsPopup-mask {
  1370. position: relative;
  1371. width: 560rpx;
  1372. background-color: transparent;
  1373. .red_envelope_top {
  1374. width: 480rpx;
  1375. height: 360rpx;
  1376. margin: 0 auto;
  1377. display: inherit;
  1378. }
  1379. }
  1380. .tipsPopup-btn-box {
  1381. width: 456rpx;
  1382. height: 104rpx;
  1383. padding: 4rpx;
  1384. box-sizing: border-box;
  1385. background: linear-gradient(180deg, rgba(252, 209, 94, 1), rgba(254, 253, 251, 1));
  1386. border-radius: 52rpx;
  1387. }
  1388. .tipsPopup-btn {
  1389. width: 100%;
  1390. height: 100%;
  1391. background: linear-gradient(180deg, #FF9F22 0%, #FA1E05 100%);
  1392. border-radius: 52rpx 52rpx 52rpx 52rpx;
  1393. font-family: PingFang SC, PingFang SC;
  1394. font-weight: 500;
  1395. font-size: 36rpx;
  1396. color: #FFFFFF;
  1397. line-height: 96rpx;
  1398. text-align: center;
  1399. }
  1400. .tipsPopup {
  1401. width: 560rpx;
  1402. padding: 12rpx;
  1403. margin-top: -72rpx;
  1404. box-sizing: border-box;
  1405. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1406. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1407. position: relative;
  1408. &-close {
  1409. width: 64rpx;
  1410. height: 64rpx;
  1411. position: absolute;
  1412. right: 0;
  1413. top: -188rpx;
  1414. }
  1415. &-line {
  1416. padding: 3rpx;
  1417. box-sizing: border-box;
  1418. background: linear-gradient(180deg, rgba(247, 245, 220, 1), rgba(250, 220, 157, 1));
  1419. border-radius: 24rpx;
  1420. }
  1421. &-box {
  1422. padding: 0 40rpx 40rpx 40rpx;
  1423. box-sizing: border-box;
  1424. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1425. border-radius: 24rpx;
  1426. @include u-flex(column, center, flex-start);
  1427. }
  1428. &-head {
  1429. @include u-flex(row, center, center);
  1430. &-title {
  1431. width: 364rpx;
  1432. height: auto;
  1433. margin-top: -22rpx;
  1434. }
  1435. }
  1436. &-content {
  1437. margin: 48rpx 0;
  1438. font-family: PingFang SC, PingFang SC;
  1439. font-weight: 500;
  1440. font-size: 32rpx;
  1441. color: #222222;
  1442. text-align: center;
  1443. &-title {
  1444. margin-bottom: 26rpx;
  1445. font-weight: 600;
  1446. font-size: 40rpx;
  1447. color: #FF5C03;
  1448. }
  1449. }
  1450. }
  1451. .video-controls-box {
  1452. width: 100%;
  1453. height: 420rpx;
  1454. overflow: hidden;
  1455. position: absolute;
  1456. bottom: 0;
  1457. left: 0;
  1458. z-index: 2;
  1459. background: rgba(0, 0, 0, 0.2);
  1460. .video-play {
  1461. height: 72rpx;
  1462. width: 72rpx;
  1463. position: absolute;
  1464. top: 50%;
  1465. left: 50%;
  1466. transform: translate(-50%, -50%);
  1467. }
  1468. }
  1469. .video-controls {
  1470. width: 100%;
  1471. height: 80rpx;
  1472. padding: 0 28rpx;
  1473. box-sizing: border-box;
  1474. position: absolute;
  1475. bottom: 0;
  1476. left: 0;
  1477. display: flex;
  1478. align-items: center;
  1479. justify-content: space-between;
  1480. background: linear-gradient(to top, #222 0%, transparent 80%);
  1481. .video-icon {
  1482. height: 44rpx;
  1483. width: 44rpx;
  1484. }
  1485. }
  1486. .errQuesbox {
  1487. width: 100%;
  1488. max-height: 260rpx;
  1489. overflow-y: auto;
  1490. margin-top: 24rpx;
  1491. font-family: PingFang SC, PingFang SC;
  1492. font-weight: 500;
  1493. font-size: 30rpx;
  1494. color: #222222;
  1495. &-item {
  1496. width: 100%;
  1497. height: 128rpx;
  1498. line-height: 128rpx;
  1499. margin-bottom: 24rpx;
  1500. padding: 0 30rpx;
  1501. box-sizing: border-box;
  1502. overflow: hidden;
  1503. background: #fff;
  1504. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1505. position: relative;
  1506. &::after {
  1507. content: "题目";
  1508. min-width: 64rpx;
  1509. height: 36rpx;
  1510. padding: 0 12rpx;
  1511. line-height: 36rpx;
  1512. background: #FF5C03;
  1513. box-sizing: border-box;
  1514. border-radius: 0rpx 0rpx 16rpx 0rpx;
  1515. text-align: center;
  1516. font-family: PingFang SC, PingFang SC;
  1517. font-weight: 500;
  1518. font-size: 20rpx;
  1519. color: #fff;
  1520. position: absolute;
  1521. left: 0;
  1522. top: 0;
  1523. }
  1524. }
  1525. }
  1526. .bg {
  1527. background: #fff !important;
  1528. }
  1529. .answerPopup {
  1530. &-box {
  1531. width: 560rpx;
  1532. background: linear-gradient(180deg, #FFFAF6 0%, #FEECD8 100%);
  1533. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1534. background-color: #fff;
  1535. font-weight: 400;
  1536. padding: 32rpx;
  1537. box-sizing: border-box;
  1538. position: relative;
  1539. @include u-flex(column, center, flex-start);
  1540. font-family: PingFang SC, PingFang SC;
  1541. font-weight: 400;
  1542. .tipimg {
  1543. width: 206rpx;
  1544. height: 206rpx;
  1545. margin-bottom: 16rpx;
  1546. }
  1547. }
  1548. &-title {
  1549. font-weight: 600;
  1550. font-size: 36rpx;
  1551. color: #222222;
  1552. }
  1553. &-desc {
  1554. margin-top: 10rpx;
  1555. font-size: 28rpx;
  1556. color: #757575;
  1557. }
  1558. &-btn {
  1559. width: 464rpx;
  1560. height: 84rpx;
  1561. margin-top: 54rpx;
  1562. margin-bottom: 16rpx;
  1563. background: #FF5C03;
  1564. border-radius: 42rpx;
  1565. font-weight: 500;
  1566. font-size: 32rpx;
  1567. color: #FFFFFF;
  1568. text-align: center;
  1569. line-height: 84rpx;
  1570. }
  1571. }
  1572. .popupbox {
  1573. width: 100%;
  1574. background-color: #fff;
  1575. border-radius: 16rpx 16rpx 0 0;
  1576. padding: 24rpx 32rpx;
  1577. position: relative;
  1578. &-head {
  1579. height: 60rpx;
  1580. margin-bottom: 30rpx;
  1581. text-align: center;
  1582. overflow-y: auto;
  1583. color: #414858;
  1584. font-size: 32rpx;
  1585. font-weight: bold;
  1586. position: relative;
  1587. .close-icon {
  1588. position: absolute;
  1589. right: 0;
  1590. top: 0;
  1591. height: 40rpx;
  1592. width: 40rpx;
  1593. }
  1594. }
  1595. &-content {
  1596. height: 20vh;
  1597. overflow-y: auto;
  1598. display: flex;
  1599. align-items: flex-start;
  1600. flex-wrap: wrap;
  1601. gap: 32rpx;
  1602. .line-item {
  1603. display: inline-block;
  1604. min-width: 200rpx;
  1605. min-height: 60rpx;
  1606. padding: 0 20rpx;
  1607. box-sizing: border-box;
  1608. border-radius: 50rpx;
  1609. overflow: hidden;
  1610. background-color: #f7f7f7;
  1611. text-align: center;
  1612. color: #414858;
  1613. font-size: 28rpx;
  1614. line-height: 60rpx;
  1615. }
  1616. .line-active {
  1617. color: #f56c6c !important;
  1618. background-color: #fef0f0 !important;
  1619. }
  1620. }
  1621. }
  1622. .content {
  1623. padding-bottom: calc(var(--window-bottom));
  1624. .video-box {
  1625. width: 100%;
  1626. height: 420rpx;
  1627. overflow: hidden;
  1628. position: relative;
  1629. #myVideo {
  1630. width: 100%;
  1631. height: 100%;
  1632. }
  1633. }
  1634. .video-poster {
  1635. width: 100%;
  1636. height: 420rpx;
  1637. }
  1638. .miantitlebox {
  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. .subtitlebox {
  1647. padding: 30rpx 0;
  1648. border-bottom: 2rpx solid #F5F7FA;
  1649. font-family: PingFang SC, PingFang SC;
  1650. font-weight: 500;
  1651. font-size: 36rpx;
  1652. color: #222222;
  1653. }
  1654. .title-content {
  1655. padding: 0 32rpx;
  1656. background-color: #fff;
  1657. font-size: 28rpx;
  1658. line-height: 1.6;
  1659. box-sizing: border-box;
  1660. @include u-flex(row, center, space-between);
  1661. .title {
  1662. font-size: 36rpx;
  1663. font-weight: 500;
  1664. color: #414858;
  1665. }
  1666. .time-or-subtitle {
  1667. margin-top: 12rpx;
  1668. color: #666666;
  1669. }
  1670. }
  1671. .warning {
  1672. flex-shrink: 0;
  1673. color: #888;
  1674. font-size: 24rpx;
  1675. @include u-flex(column, center, center);
  1676. image {
  1677. flex-shrink: 0;
  1678. height: 36rpx;
  1679. width: 36rpx;
  1680. }
  1681. }
  1682. .video-line {
  1683. min-width: 140rpx;
  1684. max-width: 200rpx;
  1685. height: 60rpx;
  1686. padding: 0 20rpx;
  1687. box-sizing: border-box;
  1688. border-radius: 50rpx 0 0 50rpx;
  1689. overflow: hidden;
  1690. background-color: #fff;
  1691. text-align: center;
  1692. color: #888;
  1693. font-size: 28rpx;
  1694. line-height: 60rpx;
  1695. display: inline-flex;
  1696. align-items: center;
  1697. justify-content: center;
  1698. position: fixed;
  1699. right: 0;
  1700. z-index: 9;
  1701. bottom: calc(var(--window-bottom) + 280rpx);
  1702. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .12);
  1703. image {
  1704. flex-shrink: 0;
  1705. height: 34rpx;
  1706. width: 34rpx;
  1707. margin-right: 6rpx;
  1708. }
  1709. }
  1710. .danmu-line {
  1711. bottom: calc(var(--window-bottom) + 370rpx);
  1712. word-break: keep-all;
  1713. .set_image {
  1714. height: 40rpx;
  1715. width: 40rpx;
  1716. }
  1717. }
  1718. .footer {
  1719. border-top: 1rpx solid #ededef;
  1720. background: #fff;
  1721. width: 100%;
  1722. position: fixed;
  1723. bottom: 0;
  1724. padding: 32rpx;
  1725. padding-bottom: calc(var(--window-bottom) + 14rpx);
  1726. box-sizing: border-box;
  1727. z-index: 9;
  1728. &-btn {
  1729. width: 100%;
  1730. height: 98rpx;
  1731. background: #FF5C03;
  1732. border-radius: 49rpx 49rpx 49rpx 49rpx;
  1733. line-height: 98rpx;
  1734. text-align: center;
  1735. font-family: PingFang SC, PingFang SC;
  1736. font-weight: 600;
  1737. font-size: 32rpx;
  1738. color: #FFFFFF;
  1739. @include u-flex(row, center, center);
  1740. &-img {
  1741. flex-shrink: 0;
  1742. width: 144rpx;
  1743. height: 144rpx;
  1744. margin-right: 8rpx;
  1745. margin-top: -24rpx;
  1746. }
  1747. }
  1748. &-btn-border {
  1749. position: relative;
  1750. &::after {
  1751. content: "";
  1752. background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  1753. position: absolute;
  1754. top: -2rpx;
  1755. left: 0;
  1756. height: 103rpx;
  1757. width: 100%;
  1758. z-index: -1;
  1759. border-radius: 49rpx 49rpx 49rpx 49rpx;
  1760. box-shadow: 0rpx 8rpx 11rpx 0rpx rgba(255, 92, 3, 0.3);
  1761. overflow: hidden;
  1762. }
  1763. }
  1764. }
  1765. }
  1766. .agreement {
  1767. display: inline-flex;
  1768. margin-top: 16rpx;
  1769. font-size: 24rpx;
  1770. color: #525252;
  1771. align-items: center;
  1772. justify-content: center;
  1773. }
  1774. .video-danmu-btnbox {
  1775. width: 50px;
  1776. height: 50px;
  1777. border-radius: 50%;
  1778. overflow: hidden;
  1779. position: absolute;
  1780. right: 10px;
  1781. bottom: calc(50% - 50px);
  1782. transform: translateY(-50%);
  1783. padding: 8px;
  1784. box-sizing: border-box;
  1785. }
  1786. .video-danmu-image {
  1787. width: 100%;
  1788. height: 100%;
  1789. }
  1790. .danmuPopup {
  1791. background-color: #fff;
  1792. padding-bottom: calc(var(--window-bottom) + 10px);
  1793. .u-border {
  1794. flex: 1;
  1795. @include u-flex(row,center,flex-start);
  1796. padding: 0 10rpx;
  1797. border-radius: 6px;
  1798. border: 1rpx solid #eee;
  1799. }
  1800. &-head {
  1801. width: 100%;
  1802. padding: 10px;
  1803. box-sizing: border-box;
  1804. overflow: hidden;
  1805. @include u-flex(row,center,flex-start);
  1806. .danmu-icon {
  1807. height: 24px;
  1808. width: 24px;
  1809. margin-right: 10px;
  1810. }
  1811. }
  1812. &-input {
  1813. flex: 1;
  1814. height: 35px;
  1815. }
  1816. &-send {
  1817. flex-shrink: 0;
  1818. height: 35px;
  1819. display: flex;
  1820. align-items: center;
  1821. justify-content: center;
  1822. padding: 5px 15px;
  1823. box-sizing: border-box;
  1824. background: #FF5C03 !important;
  1825. border-radius: 6px;
  1826. font-family: PingFang SC, PingFang SC;
  1827. font-weight: 500;
  1828. font-size: 15px;
  1829. color: #fff !important;
  1830. margin-left: 12px;
  1831. &::after {
  1832. border: none;
  1833. }
  1834. }
  1835. &-con {
  1836. background-color: #F5F7FA;
  1837. padding: 24px 12px 48px 12px;
  1838. font-family: PingFang SC, PingFang SC;
  1839. font-weight: 400;
  1840. font-size: 14px;
  1841. color: #757575;
  1842. }
  1843. }
  1844. .danmu-icon{
  1845. height: 24px;
  1846. width: 24px;
  1847. margin-right: 12px;
  1848. }
  1849. .logo {
  1850. display: inline-block;
  1851. width: 30px;
  1852. height: auto;
  1853. margin: 20px 0 0 10px;
  1854. pointer-events: none;
  1855. object-fit: cover;
  1856. }
  1857. .logo-full {
  1858. display: inline-block;
  1859. width: 40px;
  1860. height: auto;
  1861. margin: 50px 0 0 30px;
  1862. pointer-events: none;
  1863. object-fit: cover;
  1864. }
  1865. .tabbox-bar {
  1866. @include u-flex(row, center, flex-start);
  1867. background-color: #fff;
  1868. .warning {
  1869. flex-shrink: 0;
  1870. padding-right: 20rpx;
  1871. }
  1872. }
  1873. .tabbox {
  1874. flex: 1;
  1875. @include u-flex(row, center, center);
  1876. border-bottom: 2rpx solid #F5F7FA;
  1877. height: 44px;
  1878. background-color: #fff;
  1879. view {
  1880. flex: 1;
  1881. padding: 20rpx 0;
  1882. margin-right: 40rpx;
  1883. text-align: center;
  1884. }
  1885. &-active {
  1886. position: relative;
  1887. &::after {
  1888. position: absolute;
  1889. bottom: 0;
  1890. left: 50%;
  1891. transform: translateX(-50%);
  1892. content: "";
  1893. width: 3rem;
  1894. border-bottom: 4px solid #FF5C03;
  1895. }
  1896. }
  1897. }
  1898. .chatinput {
  1899. position: fixed;
  1900. left: 32rpx;
  1901. right: 32rpx;
  1902. z-index: 999;
  1903. height: 96rpx;
  1904. background-color: green;
  1905. background: #FFFFFF;
  1906. box-shadow: 0rpx 8rpx 21rpx 0rpx rgba(0, 0, 0, 0.1);
  1907. border-radius: 24rpx 24rpx 24rpx 24rpx;
  1908. @include u-flex(row, center, center);
  1909. padding: 0 24rpx;
  1910. box-sizing: border-box;
  1911. .uni-input {
  1912. flex: 1;
  1913. margin-right: 32rpx;
  1914. font-size: 30rpx;
  1915. }
  1916. .send {
  1917. font-family: PingFang SC, PingFang SC;
  1918. font-weight: 400;
  1919. font-size: 28rpx;
  1920. color: #FFFFFF !important;
  1921. flex-shrink: 0;
  1922. padding: 0 20rpx;
  1923. height: 72rpx;
  1924. background: #FF5C03 !important;
  1925. border-radius: 8rpx 8rpx 8rpx 8rpx;
  1926. &::after {
  1927. border: none;
  1928. }
  1929. }
  1930. }
  1931. .answerTip {
  1932. position: fixed;
  1933. right: 0;
  1934. z-index: 9;
  1935. bottom: calc(var(--window-bottom) + 380rpx);
  1936. box-shadow: 0rpx 8rpx 21rpx 0rpx rgba(0, 0, 0, 0.1);
  1937. border-radius: 24rpx 24rpx 24rpx 24rpx;
  1938. background-color: #ff5c03;
  1939. color: #fff;
  1940. border-radius: 50%;
  1941. height: 100rpx;
  1942. width: 100rpx;
  1943. font-size: 25rpx;
  1944. text-align: center;
  1945. padding: 10rpx;
  1946. @include u-flex(row, center, center);
  1947. }
  1948. .danmu-item {
  1949. position: absolute;
  1950. top: 0;
  1951. white-space: nowrap;
  1952. font-size: 16px;
  1953. height: 20px;
  1954. display: inline-flex;
  1955. box-sizing: border-box;
  1956. align-items: center;
  1957. }
  1958. .danmuMove {
  1959. // animation: mymove 8s linear forwards;
  1960. // animation-duration: 8s;
  1961. animation-timing-function: linear;
  1962. animation-delay: 0s;
  1963. animation-iteration-count: 1;
  1964. animation-direction: normal;
  1965. animation-fill-mode: forwards;
  1966. animation-play-state: running;
  1967. animation-name: mymove;
  1968. will-change: transform;
  1969. }
  1970. @keyframes mymove {
  1971. from {
  1972. transform: translateX(100vw);
  1973. }
  1974. to {
  1975. transform: translateX(-100%);
  1976. }
  1977. }
  1978. </style>