video.vue 53 KB

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