video.vue 53 KB

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