video.vue 54 KB

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