video.vue 52 KB

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