video.vue 53 KB

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