learning.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751
  1. <template>
  2. <view>
  3. <view class="expirebox" v-if="isExpire">
  4. <image src="/static/images/expire.png" mode="aspectFill"></image>
  5. {{msg}}
  6. </view>
  7. <view class="content" v-show="!isExpire">
  8. <view class="video-box">
  9. <image v-if="!isLogin || isAddKf!=1" class="video-poster" :src="courseInfo.imgUrl" mode="aspectFill">
  10. </image>
  11. <video
  12. @timeupdate="onTimeUpdate"
  13. @progress="progressChange"
  14. @error="videoErrorCallback"
  15. @play="getPlay"
  16. @pause="getPause"
  17. @ended="getEnded"
  18. @waiting="getWaiting"
  19. @fullscreenchange="fullscreenchange"
  20. :title="courseInfo.title"
  21. style="width: 100%;height: 420rpx;"
  22. :poster="poster"
  23. id="video-content-box"
  24. controls
  25. :auto-pause-if-open-native="true"
  26. :auto-pause-if-navigate="true"
  27. :enable-progress-gesture="false"
  28. :show-progress="true"
  29. :picture-in-picture-mode="[]"
  30. :show-background-playback-button="false"
  31. :src="videoUrl">
  32. <!-- logo -->
  33. <cover-image v-if="courseLogo" :class="isfull?'logo-full':'logo'" :src="courseLogo" mode="widthFix"></cover-image>
  34. <cover-view class="video-controls-box" v-if="isLogin&&isAddKf==1&&isPause">
  35. <cover-image class="video-play" src="@/static/images/video_icon.png" @click="clickVideo()"></cover-image>
  36. </cover-view>
  37. </video>
  38. </view>
  39. <view class="title-content" id="title-content">
  40. <!-- 答题时展示小节课程名,其他展示课程名 -->
  41. <!-- 小节课程名 -->
  42. <view class="subtitlebox" v-if="isLogin&&isAddKf==1">
  43. {{courseInfo.title}}
  44. </view>
  45. <!-- 课程名字 -->
  46. <view class="miantitlebox" v-else>
  47. {{courseInfo.courseName}}
  48. </view>
  49. </view>
  50. <scroll-view class="scroll-view" :style="{height: height}" :scroll-top="scrollTop" scroll-y="true">
  51. <!-- 介绍 -->
  52. <!-- <view class="descbox">
  53. <template v-if="!isLogin||isAddKf!=1">
  54. <view class="descbox-title">{{courseInfo.title}}</view>
  55. <view class="descbox-info">
  56. <view class="descbox-info-r expand" v-if="textHeight > 21">
  57. <text @click="handleExpand">{{isExpand ? '收起简介' : '展开简介'}}</text>
  58. <image src="/static/images/course_arrow_up_icon.png" v-show="isExpand"></image>
  59. <image src="/static/images/course_arrow_down_icon.png" v-show="!isExpand"></image>
  60. </view>
  61. </view>
  62. </template>
  63. <view class="descbox-desc" id="descbox-desc" :style="{height: isExpand ? 'auto': '42rpx'}">
  64. <text>{{courseInfo.description}}</text>
  65. <view :class="isExpand ? 'expand': 'expand expand-ab'" v-if="isLogin&&isAddKf==1&&textHeight > 21">
  66. <text @click="handleExpand">{{isExpand ? '收起简介' : '展开简介'}}</text>
  67. <image src="/static/images/course_arrow_up_icon.png" v-show="isExpand"></image>
  68. <image src="/static/images/course_arrow_down_icon.png" v-show="!isExpand"></image>
  69. </view>
  70. </view>
  71. </view> -->
  72. <!-- 问题 -->
  73. <view class="ques-content" v-if="isLogin&&isAddKf==1&&quesList&&quesList.length>0">
  74. <view class="ques-content-tit">问答题</view>
  75. <view v-for="(item,index) in quesList" :key="index">
  76. <view class="ques-title">
  77. <text>{{index + 1}}.</text>
  78. <view class="ques-type" v-show="item.type == 1 || item.type == 2">
  79. {{item.type == 1 ? '单选' : item.type == 2 ? '多选' : ''}}
  80. </view>
  81. <text>{{item.title}}</text>
  82. </view>
  83. <view
  84. :class="isAnswer(item,option.name) ?'ques-option ques-option-active':'ques-option'"
  85. v-for="(option,idx) in item.questionOption"
  86. :key="idx"
  87. @click="handleAnswer(item,option)">
  88. <view>
  89. {{numberToLetter(idx)}}.
  90. </view>
  91. <view>{{option.name}}</view>
  92. </view>
  93. </view>
  94. </view>
  95. </scroll-view>
  96. <!-- 线路 -->
  97. <view class="video-line" @click="openPop" v-if="isLogin&&isAddKf==1">
  98. <image src="/static/images/changePlayer-icon.png"></image>
  99. <text>线路{{lineIndex + 1 | numberToChinese}}</text>
  100. </view>
  101. <!-- 线路弹窗 -->
  102. <uni-popup ref="popup" type="bottom" class="full-width-popup">
  103. <view class="popupbox">
  104. <view class="popupbox-head">
  105. <text>线路选择</text>
  106. <image class="close-icon" src="/static/images/tc_close_icon.png" mode="aspectFill" @click="close">
  107. </image>
  108. </view>
  109. <view class="popupbox-content">
  110. <view :class="lineIndex == index ? 'line-item line-active': 'line-item'"
  111. v-for="(it,index) in lineList" :key="index" @click="handleLine(index)">
  112. 线路{{index + 1 | numberToChinese}}</view>
  113. </view>
  114. </view>
  115. </uni-popup>
  116. <!-- 温馨提示弹窗 -->
  117. <uni-popup ref="tipsPopup" type="center" :is-mask-click="false">
  118. <view class="tipsPopup-mask">
  119. <image class="red_envelope_top" src="/static/images/red_envelope_img.png" mode="aspectFill"></image>
  120. <view class="tipsPopup">
  121. <image class="tipsPopup-close" src="/static/images/course_close_white_icon.png" mode="aspectFill"
  122. @click="closeTipsPop"></image>
  123. <view class="tipsPopup-line">
  124. <view class="tipsPopup-box">
  125. <view class="tipsPopup-head">
  126. <image class="tipsPopup-head-title" src="/static/images/tips_title_img.png"
  127. mode="widthFix"></image>
  128. </view>
  129. <view class="tipsPopup-content">
  130. <view class="tipsPopup-content-title">亲爱的用户,</view>
  131. <view>您已经观看课程一半的时间了,请注意休息并保持专注。</view>
  132. </view>
  133. <view class="tipsPopup-btn-box">
  134. <view class="tipsPopup-btn" @click="closeTipsPop">继续观看领奖励</view>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </uni-popup>
  141. <!-- 答题弹窗 -->
  142. <uni-popup ref="answerPopup" type="center" :show="answerPopup">
  143. <view :class="errTitle == '恭喜你,回答正确' ? 'answerPopup-box bg':'answerPopup-box'">
  144. <!-- 正确 -->
  145. <image class="tipimg" v-if="errTitle == '恭喜你,回答正确'" src="/static/images/course_answer_img.png"
  146. mode="aspectFill"></image>
  147. <!-- 错误 -->
  148. <image class="tipimg" v-else src="/static/images/course_answer_incorrectly_img.png" mode="aspectFill">
  149. </image>
  150. <view class="answerPopup-title">{{errTitle}}</view>
  151. <view class="answerPopup-desc" v-html="errDesc"></view>
  152. <!-- 选择奖励 -->
  153. <view class="reward-list" v-if="errTitle == '恭喜你,回答正确'">
  154. <radio-group class="reward-list-group" @change="rewardChange">
  155. <label class="reward-list-option" v-for="(item, index) in rewardType" :key="item.value">
  156. <radio :value="item.value+ ''" :checked="item.value == currentReward"
  157. activeBorderColor="#FF5C03" activeBackgroundColor="#FF5C03"
  158. style="transform:scale(0.7)" />
  159. <view :style="{color: item.value == currentReward ? '#FF5C03':''}">{{item.name}}</view>
  160. </label>
  161. </radio-group>
  162. </view>
  163. <!-- 错误题目 -->
  164. <view class="errQuesbox" v-if="errQues&&errQues.length>0">
  165. <view class="errQuesbox-item textOne" v-for="(it,index) in errQues" :key="index">{{it.title}}</view>
  166. </view>
  167. <view class="answerPopup-btn" v-if="errTitle == '恭喜你,回答正确'" @click="closeAnswerPopup">领取</view>
  168. <view class="tipsPopup-btn-box" v-else
  169. :style="{marginTop: errQues&&errQues.length>0 ? '40rpx':'54rpx'}">
  170. <view class="tipsPopup-btn" @click="closeAnswerPopup">{{remain > 0 ? '重新答题': '确认'}}</view>
  171. </view>
  172. </view>
  173. </uni-popup>
  174. <!-- 客服二维码弹窗 -->
  175. <uni-popup ref="kfPopup" type="center" :mask-click="false">
  176. <view class="kfqrcode-box">
  177. <image class="kfqrcode" :src="qrcode" show-menu-by-longpress="true"></image>
  178. <view v-show="qrcodeMsg" style="margin-top: 30rpx;" v-html="qrcodeMsg"></view>
  179. <image class="kfqrcode-close" src="/static/images/course_close_white_icon.png" mode="aspectFill"
  180. @click="closeKFPop"></image>
  181. </view>
  182. </uni-popup>
  183. <!-- footer -->
  184. <view class="footer" v-if="videoId||sortLink">
  185. <view class="footer-btn" v-if="!isLogin || isAddKf !=1" @click="submit">
  186. <text>立即学习</text>
  187. </view>
  188. <view v-if="isLogin&&isAddKf==1&&quesList&&quesList.length>0" class="footer-btn footer-btn-border" @click="submit">
  189. <!-- <image class="footer-btn-img" v-show="isLogin&&isAddKf==1" src="@/static/images/red_envelope_btnimg.png"
  190. mode="aspectFill"></image> -->
  191. <text>提交答案领取奖励</text>
  192. </view>
  193. <view @click="checked=!checked" class="agreement" v-if="!isLogin">
  194. <radio value="r1" :checked="checked" color="#ff5c03" activeBorderColor="#ff5c03"
  195. style="transform:scale(0.6);" />
  196. <view>阅读并同意<text style="color: #ff5c03;" @click.stop="goWeb(0)">《用户协议》</text>和<text
  197. style="color: #ff5c03;" @click.stop="goWeb(1)">《隐私协议》</text></view>
  198. </view>
  199. <view class="footer-tips" v-if="isLogin">重庆云联融智提供技术支持</view>
  200. </view>
  201. </view>
  202. </view>
  203. </template>
  204. <script>
  205. import { generateRandomString,initJssdk } from "@/utils/common.js"
  206. import dayjs from 'dayjs';
  207. import {
  208. getErrMsg,
  209. getH5CourseByVideoId,
  210. getH5CourseVideoDetails,
  211. courseAnswer,
  212. getFinishCourseVideo,
  213. getIsAddKf,
  214. getInternetTraffic,
  215. getIntegralByH5Video,
  216. sendReward,
  217. loginByMp,
  218. getRealLink
  219. } from "@/api/course.js"
  220. const isWechat = () => {
  221. return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger";
  222. }
  223. export default {
  224. data() {
  225. return {
  226. // 1 红包 2 积分
  227. rewardType: [{
  228. name: '红包奖励',
  229. value: 1
  230. }, {
  231. name: '积分奖励',
  232. value: 2
  233. }],
  234. currentReward: 1,
  235. player: null,
  236. loading: true,
  237. progress: 0,
  238. code: null,
  239. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  240. scrollTop: 0,
  241. height: '0px',
  242. isLogin: false,
  243. videoUrl: "",
  244. videoId: "",
  245. //现在的时长
  246. playTime: 0,
  247. //总时长
  248. duration: 0,
  249. playDuration: 0,
  250. // 用于续播
  251. playDurationSeek: 0,
  252. // 温馨提醒时间节点,
  253. tipsTime: 0,
  254. tipsOpen: false,
  255. config: {},
  256. courseInfo: {},
  257. quesList: [],
  258. lineList: [],
  259. // 错题
  260. errQues: [],
  261. // 答题机会
  262. remain: 0,
  263. errTitle: "",
  264. errDesc: "",
  265. showPlay: true,
  266. showControls: false,
  267. playStatus: "",
  268. isAddKf: 0,
  269. lineIndex: 0,
  270. // 是否展开
  271. isExpand: true,
  272. textHeight: 0, //文本高度
  273. qwUserId: "",
  274. qrcode: "",
  275. corpId: "",
  276. qrcodeMsg: "",
  277. urlOption: {},
  278. bufferRate: 0, // 缓冲时间
  279. uuId: "",
  280. isEnded: false,
  281. // 是否允许拖动进度条
  282. linkType: 0,
  283. ip: null,
  284. checked: true,
  285. isFinish: 0, // 是否完课
  286. interval: null,
  287. intervalIntegral: null, // 积分定时
  288. // 错误请求次数
  289. errorCount: 0,
  290. answerPopup: false,
  291. sortLink:"",
  292. // 课程是否过期
  293. isExpire: false,
  294. timer: null,
  295. flag: false,
  296. poster:"",
  297. msg:"",
  298. authDomainName: "",
  299. // 是否暂停
  300. isPause: true,
  301. courseLogo: '',
  302. isfull: false,
  303. }
  304. },
  305. filters: {
  306. numberToChinese(number) {
  307. if (number) {
  308. const chineseNumber = ['一', '二', '三', '四', '五', '六', '七', '八', '九'];
  309. return chineseNumber[number - 1];
  310. } else {
  311. return ''
  312. }
  313. },
  314. },
  315. computed: {
  316. isAnswer() {
  317. return (item, name) => {
  318. if (item.type == 1) {
  319. return item.answer == name
  320. } else if (item.type == 2) {
  321. const array = item.answer.split(',')
  322. return array.some(i => i == name)
  323. } else {
  324. return false
  325. }
  326. }
  327. }
  328. },
  329. onLoad(option) {
  330. this.sortLink = option.s || ''
  331. this.code = option.code
  332. this.urlOption = option.course ? JSON.parse(option.course) : {}
  333. this.videoId = this.urlOption.videoId || ''
  334. console.log("this.videoId====",this.videoId)
  335. this.qwUserId = this.urlOption.qwUserId || ''
  336. this.corpId = this.urlOption.corpId || ''
  337. this.linkType = this.urlOption.linkType || 0
  338. if (this.videoId) {
  339. this.getH5CourseByVideo()
  340. }
  341. },
  342. onShow() {
  343. this.isLogin = this.$isLogin()
  344. this.tipsOpen = false
  345. this.isExpand = true
  346. this.uuId = generateRandomString(16)
  347. if(this.videoId) {
  348. if (this.$isLogin()) {
  349. if(this.isAddKf == 1) {
  350. this.getH5CourseVideoDetails()
  351. } else {
  352. this.getIsAddKf()
  353. }
  354. } else {
  355. this.loginByMp()
  356. }
  357. } else {
  358. if(this.sortLink){
  359. this.getLink()
  360. return
  361. }
  362. uni.showToast({
  363. title: 'sortLink is not found',
  364. icon: 'none'
  365. });
  366. }
  367. },
  368. mounted() {
  369. this.getIP()
  370. this.getHeight()
  371. },
  372. onHide() {
  373. if (this.player) {
  374. this.player.pause()
  375. }
  376. this.getFinishCourseVideo()
  377. this.getInternetTraffic()
  378. if (this.interval != null) {
  379. clearInterval(this.interval)
  380. this.interval = null
  381. }
  382. },
  383. onUnload() {
  384. this.getFinishCourseVideo()
  385. this.getInternetTraffic()
  386. if (this.interval != null) {
  387. clearInterval(this.interval)
  388. this.interval = null
  389. }
  390. this.clearIntegral()
  391. },
  392. beforeDestroy() {
  393. this.player = uni.createVideoContext('video-content-box');
  394. if (this.player) {
  395. this.player.stop()
  396. this.player = null
  397. }
  398. if (this.interval != null) {
  399. clearInterval(this.interval)
  400. this.interval = null
  401. }
  402. this.clearIntegral()
  403. },
  404. methods: {
  405. fullscreenchange(e) {
  406. this.isfull = e.detail.fullScreen
  407. },
  408. clickVideo() {
  409. if (this.player) {
  410. this.player.play()
  411. }
  412. },
  413. //播放时间更新事件方法
  414. onTimeUpdate(e){
  415. let currentTime = Math.round(e.detail.currentTime)
  416. if (this.playDurationSeek > 0) {
  417. this.playTime = this.playDurationSeek
  418. this.throttle(() => this.changeTime(this), 1000, false)
  419. } else {
  420. if (this.linkType != 1 && (currentTime - this.playTime > 3 || currentTime - this.playTime < -3)&&this.isFinish!=1) {
  421. uni.showToast({
  422. title: '不能快进哦',
  423. icon: 'none',
  424. });
  425. currentTime = this.playTime
  426. this.player.seek(this.playTime);
  427. }
  428. this.playTime = currentTime
  429. }
  430. },
  431. changeTime(that,e) {
  432. that.playDurationSeek = 0
  433. },
  434. videoErrorCallback(e) {
  435. if(this.$isLogin()&&this.isAddKf==1) {
  436. this.clearIntegral()
  437. this.errorCount++
  438. if (this.errorCount > 3) return
  439. console.log(e)
  440. this.getErrMsg(e.target.errMsg)
  441. this.getH5CourseVideoDetails('error')
  442. }
  443. },
  444. // 当开始/继续播放时触发play事件
  445. getPlay() {
  446. this.isPause = false
  447. this.errorCount = 0
  448. // this.judgeDuration()
  449. },
  450. getPause() {
  451. this.isPause = true
  452. this.clearIntegral()
  453. },
  454. getEnded() {
  455. this.clearIntegral()
  456. this.isEnded = true
  457. this.getFinishCourseVideo()
  458. },
  459. getWaiting() {
  460. this.getErrMsg('','waiting')
  461. },
  462. getIP() {
  463. uni.request({
  464. url: 'https://ipinfo.io/json', //仅为示例,并非真实接口地址。
  465. method: 'GET',
  466. success: (res) => {
  467. this.ip = res.data.ip
  468. }
  469. });
  470. },
  471. goWeb(tyep) {
  472. const path = uni.getStorageSync('requestPath',path);
  473. const url = tyep == 0 ? path + "/web/userAgreement" : path + "/web/privacyPolicy"
  474. window.open(url)
  475. },
  476. getHeight() {
  477. this.$nextTick(() => {
  478. const query = uni.createSelectorQuery().in(this);
  479. query
  480. .select("#title-content")
  481. .boundingClientRect((data) => {
  482. this.height =
  483. `calc(100vh - ${data.height}px - 420rpx - ${this.statusBarHeight}px - 164rpx)`
  484. })
  485. .exec();
  486. })
  487. },
  488. getDescHeight() {
  489. this.$nextTick(() => {
  490. const query = uni.createSelectorQuery().in(this);
  491. query
  492. .select("#descbox-desc")
  493. .boundingClientRect((data) => {
  494. this.textHeight = data.height
  495. })
  496. .exec();
  497. })
  498. },
  499. numberToLetter(num) {
  500. // 将数字转换为字母的 ASCII 码
  501. let letterCode = num + 65;
  502. // 将 ASCII 码转换为大写字母
  503. let letter = String.fromCharCode(letterCode);
  504. return letter;
  505. },
  506. updateTime() {
  507. var that = this;
  508. if (this.interval != null) {
  509. clearInterval(this.interval)
  510. }
  511. this.interval = setInterval(function() {
  512. that.getFinishCourseVideo()
  513. that.getInternetTraffic()
  514. }, 60000);
  515. },
  516. judgeDuration() {
  517. var that = this;
  518. if (this.intervalIntegral != null) {
  519. clearInterval(this.intervalIntegral)
  520. this.intervalIntegral = null
  521. }
  522. // 观看10分钟获得积分
  523. this.intervalIntegral = setInterval(function() {
  524. that.getIntegralByH5Video()
  525. }, 600000);
  526. },
  527. clearIntegral() {
  528. if (this.intervalIntegral != null) {
  529. clearInterval(this.intervalIntegral)
  530. this.intervalIntegral = null
  531. }
  532. },
  533. // 展开简介
  534. handleExpand() {
  535. this.isExpand = !this.isExpand
  536. },
  537. getH5CourseByVideo(videoId) {
  538. this.loading = true
  539. getH5CourseByVideoId({
  540. videoId: this.videoId || videoId
  541. }).then(res => {
  542. this.loading = false
  543. if (res.code == 200) {
  544. this.courseInfo = res.data
  545. uni.setNavigationBarTitle({
  546. title: this.courseInfo && this.courseInfo.title ? this.courseInfo.title : ''
  547. });
  548. }
  549. this.getHeight()
  550. // this.getDescHeight()
  551. },
  552. rej => {
  553. this.loading = false
  554. }
  555. ).catch(() => {
  556. this.loading = false
  557. })
  558. },
  559. getH5CourseVideoDetails(type) {
  560. const param = {
  561. ...this.urlOption
  562. }
  563. getH5CourseVideoDetails(param).then(res => {
  564. if (res.code == 200) {
  565. this.config = res.config || {}
  566. this.courseLogo = res.config&&res.config.courseLogo
  567. this.isFinish = res.isFinish || 0
  568. this.duration = res.course && res.course.duration ? res.course.duration : 0
  569. this.playDuration = res.playDuration || 0
  570. this.playDurationSeek = res.playDuration || 0
  571. this.tipsTime = res.tipsTime || 0
  572. let lineList = []
  573. if (res.course && res.course.lineOne) {
  574. lineList.push(res.course.lineOne)
  575. }
  576. if (res.course && res.course.lineTwo) {
  577. lineList.push(res.course.lineTwo)
  578. }
  579. if (res.course && res.course.lineThree) {
  580. lineList.push(res.course.lineThree)
  581. }
  582. this.lineList = lineList
  583. if (!this.player || type == 'error') {
  584. this.lineIndex = this.config.defaultLine
  585. this.videoUrl = lineList[this.lineIndex]
  586. this.poster= res.course && res.course.imgUrl ? res.course.imgUrl : ''
  587. this.playTime = this.playDuration >= this.duration ? 0 : this.playDuration
  588. setTimeout(()=>{
  589. this.player = uni.createVideoContext('video-content-box');
  590. this.player.seek(this.playTime)
  591. this.player.play();
  592. },500);
  593. } else {
  594. this.playTime = this.playTime > this.playDuration ? this.playTime : this.playDuration >= this.duration ? 0 : this.playDuration
  595. this.player.seek(this.playTime)
  596. this.player.play();
  597. }
  598. this.updateTime();
  599. this.quesList = res.questions && res.questions.length > 0 ? res.questions : [],
  600. this.quesList = this.quesList.map(item => ({
  601. ...item,
  602. questionOption: JSON.parse(item.question),
  603. answer: ''
  604. }))
  605. }
  606. this.getHeight()
  607. // this.getDescHeight()
  608. },
  609. rej => {}
  610. )
  611. },
  612. handleAnswer(item, option, idx) {
  613. let time = this.playTime
  614. if(this.isEnded) {
  615. time = this.duration
  616. } else {
  617. if(time < this.playDuration&&this.isFinish!=1) {
  618. // 没完课且小于续播的时间
  619. time = this.playDuration
  620. }
  621. }
  622. if(Number(this.duration || 0) == 0 || time < this.duration - 60) {
  623. uni.showToast({
  624. title: "请先观看完整课程再答题哦~",
  625. icon: "none"
  626. })
  627. return
  628. }
  629. if (item.type == 1) {
  630. // 单选option
  631. item.answer = option.name
  632. } else if (item.type == 2) {
  633. // 多选
  634. let answer = item.answer ? item.answer.split(',') : []
  635. if (answer.indexOf(option.name) === -1) {
  636. answer.push(option.name)
  637. item.answer = answer.join(',')
  638. } else {
  639. answer.splice(answer.indexOf(option.name), 1)
  640. item.answer = answer.join(',')
  641. }
  642. }
  643. },
  644. submit() {
  645. // 登录
  646. if (this.$isLogin()) {
  647. if (this.isAddKf == 1) {
  648. // 答题
  649. // 您已提交过答案,请领取红包
  650. this.courseAnswer()
  651. } else {
  652. // 添加客服
  653. if (this.videoId && this.qwUserId) {
  654. this.getIsAddKf()
  655. } else {
  656. uni.showToast({
  657. title: '请添加客服',
  658. icon: 'none'
  659. })
  660. }
  661. }
  662. } else {
  663. // 登录
  664. if (!this.checked) {
  665. uni.showToast({
  666. title: "请先勾选阅读并同意《用户协议》和《隐私协议》",
  667. icon: "none"
  668. })
  669. return
  670. }
  671. // #ifdef H5
  672. if (isWechat) { //是否在微信浏览器中打开
  673. this.loginByMp()
  674. } else {
  675. uni.showToast({
  676. title: '请在微信浏览器中打开',
  677. icon: 'error'
  678. })
  679. }
  680. // #endif
  681. }
  682. },
  683. // 答题
  684. courseAnswer() {
  685. let time = this.playTime
  686. if (this.isEnded) {
  687. time = this.duration
  688. } else {
  689. if (time < this.playDuration && this.isFinish != 1) {
  690. // 没完课且小于续播的时间
  691. time = this.playDuration
  692. }
  693. }
  694. if (Number(this.duration || 0) == 0 || time < this.duration - 60) {
  695. uni.showToast({
  696. title: "请先观看完整课程再答题哦~",
  697. icon: "none"
  698. })
  699. return
  700. }
  701. if (this.quesList.some(item => !item.answer)) {
  702. uni.showToast({
  703. title: "请确认是否答完所有题目",
  704. icon: "none"
  705. })
  706. return
  707. }
  708. const questions = this.quesList.map(obj => {
  709. const {
  710. questionOption,
  711. ...rest
  712. } = obj;
  713. return rest;
  714. });
  715. const param = {
  716. ...this.urlOption,
  717. questions: questions,
  718. videoId: this.videoId,
  719. duration: this.playTime
  720. }
  721. this.errTitle = ""
  722. this.errDesc = ""
  723. this.errQues = []
  724. courseAnswer(param).then(res => {
  725. if (res.code == 200) {
  726. if (res.incorrectQuestions) {
  727. // 答题失败
  728. if (res.incorrectQuestions.length > 0) {
  729. this.errQues = res.incorrectQuestions
  730. }
  731. this.remain = res.remain || 0
  732. if (res.remain > 0) {
  733. this.errTitle = "很遗憾答错了"
  734. this.errDesc = `<span style="color:#FF5C03">还有${res.remain}次机会,继续加油</span>`
  735. this.$refs.answerPopup.open("center")
  736. }
  737. } else {
  738. // 答题成功
  739. this.errTitle = "恭喜你,回答正确"
  740. this.errDesc = `您有一份奖励待领取哦~`
  741. this.$refs.answerPopup.open("center")
  742. // this.closeAnswerPopup()
  743. }
  744. } else {
  745. if (res.msg == "该课题到达答错次数限制") {
  746. this.errTitle = "答题次数超过限制"
  747. this.errDesc = "以后的课程要认真学习哦"
  748. this.$refs.answerPopup.open("center")
  749. } else {
  750. uni.showToast({
  751. title: res.msg,
  752. icon: "none"
  753. })
  754. }
  755. }
  756. },
  757. rej => {}
  758. )
  759. },
  760. // 选择
  761. rewardChange(e) {
  762. this.currentReward = e.detail.value
  763. },
  764. closeAnswerPopup() {
  765. this.$refs.answerPopup.close()
  766. if (this.errTitle == '恭喜你,回答正确') {
  767. const param = {
  768. ...this.urlOption,
  769. rewardType: Number(this.currentReward),
  770. }
  771. sendReward(param).then(res => {
  772. if(res.code == 200) {
  773. if(res.isNew&&res.isNew==1) {
  774. const packageInfo = res.data.packageInfo || ''
  775. if(packageInfo) {
  776. uni.setStorageSync('receive_package',packageInfo);
  777. if(res.mchId) uni.setStorageSync('mchId',res.mchId);
  778. uni.navigateTo({
  779. url: '/pages/course/reward'
  780. })
  781. }
  782. } else {
  783. uni.showToast({
  784. title: res.msg,
  785. icon: 'none'
  786. })
  787. }
  788. }else {
  789. uni.showToast({
  790. title: res.msg,
  791. icon: 'none'
  792. })
  793. }
  794. })
  795. }
  796. },
  797. // 线路
  798. openPop() {
  799. this.$refs.popup.open('bottom')
  800. },
  801. close() {
  802. this.$refs.popup.close()
  803. },
  804. handleLine(index) {
  805. var that=this;
  806. if (this.lineIndex == index && this.videoUrl == this.lineList[index]) {
  807. this.close()
  808. return
  809. } else {
  810. // let div = document.querySelector(".vjs-progress-control");
  811. // if(div) {
  812. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  813. // div.style.pointerEvents = "auto";
  814. // } else {
  815. // div.style.pointerEvents = "none"; //禁止所有事件
  816. // }
  817. // }
  818. this.lineIndex = index
  819. this.videoUrl = this.lineList[index]
  820. this.tipsOpen = false
  821. this.playDurationSeek = this.playTime || 0
  822. this.player = uni.createVideoContext('video-content-box');
  823. setTimeout(function(){
  824. that.player.seek(that.playDurationSeek)
  825. that.player.play();
  826. },500);
  827. // this.player.src(this.lineList[index])
  828. // this.player.one('loadedmetadata', () => {
  829. // this.player.currentTime(this.playDurationSeek);
  830. // this.player.play();
  831. // });
  832. this.close()
  833. }
  834. },
  835. // 温馨提示
  836. openTipsPop() {
  837. this.$refs.tipsPopup.open()
  838. this.tipsOpen = true
  839. this.pause()
  840. },
  841. closeTipsPop() {
  842. this.$refs.tipsPopup.close()
  843. },
  844. // 客服
  845. getIsAddKf() {
  846. this.qrcode = ''
  847. this.qrcodeMsg = ''
  848. this.isAddKf = 0
  849. // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
  850. const param = {
  851. ...this.urlOption
  852. }
  853. getIsAddKf(param).then(res => {
  854. if (res.code == 200) {
  855. if (this.urlOption.isRoom == 1 && res.qwExternalId) {
  856. this.urlOption = {
  857. ...this.urlOption,
  858. qwExternalId: res.qwExternalId
  859. }
  860. }
  861. this.isAddKf = 1
  862. this.getH5CourseVideoDetails()
  863. } else if (res.code == 400) {
  864. this.isAddKf = 0
  865. this.qrcode = res.qrcode
  866. this.qrcodeMsg = res.msg
  867. this.$refs.kfPopup.open()
  868. } else if (res.code == 504) {
  869. // 登录
  870. // #ifdef H5
  871. if (isWechat) { //是否在微信浏览器中打开
  872. this.loginByMp()
  873. } else {
  874. uni.navigateTo({
  875. url: "/pages/auth/login"
  876. });
  877. }
  878. // #endif
  879. } else {
  880. this.isAddKf = 0
  881. uni.showToast({
  882. title: res.msg,
  883. icon: 'none'
  884. });
  885. }
  886. },
  887. err => {}
  888. );
  889. },
  890. closeKFPop() {
  891. this.$refs.kfPopup.close()
  892. },
  893. loginByMp() {
  894. if (this.code == null||!this.code) {
  895. if(this.sortLink) {
  896. window.location.href = uni.getStorageSync('authDomainName') + '?sortLink='+this.sortLink
  897. } else {
  898. if(this.urlOption.link) {
  899. window.location.href = uni.getStorageSync('authDomainName') + '?sortLink='+this.urlOption.link
  900. } else {
  901. this.isExpire = true
  902. this.msg = '课程链接地址有误'
  903. uni.showToast({
  904. title: '课程链接地址有误',
  905. icon: 'none'
  906. });
  907. }
  908. }
  909. return;
  910. }
  911. uni.showLoading({
  912. title: "处理中..."
  913. });
  914. let that = this;
  915. var data = {
  916. code: this.code
  917. }
  918. loginByMp(data).then(res => {
  919. uni.hideLoading();
  920. if (res.code == 200) {
  921. uni.setStorageSync(this.$TOKEN_KEY, res.token);
  922. this.isLogin = this.$isLogin()
  923. if(this.isAddKf == 1) {
  924. this.getH5CourseVideoDetails()
  925. } else {
  926. this.getIsAddKf()
  927. }
  928. } else {
  929. uni.showToast({
  930. title: res.msg,
  931. icon: 'none'
  932. });
  933. }
  934. },
  935. err => {}
  936. ).catch(err=>{
  937. uni.hideLoading();
  938. });
  939. },
  940. getFinishCourseVideo() {
  941. if (!this.playTime || !this.isLogin || this.isAddKf!=1) return
  942. // {videoId: this.videoId,duration:this.playTime}
  943. const param = {
  944. duration: this.playTime,
  945. ...this.urlOption
  946. }
  947. getFinishCourseVideo(param)
  948. },
  949. // 每十分钟获得积分
  950. getIntegralByH5Video() {
  951. if(!this.isLogin || this.isAddKf!=1) return;
  952. const param = {
  953. duration: this.playTime,
  954. ...this.urlOption,
  955. }
  956. getIntegralByH5Video(param).then(res => {
  957. if (res.code == 200) {
  958. uni.showToast({
  959. title: "积分+10",
  960. icon: "none"
  961. })
  962. }
  963. })
  964. },
  965. progressChange(e) {
  966. this.bufferRate = Math.ceil(e.detail.buffered)
  967. },
  968. // 缓冲
  969. getInternetTraffic() {
  970. if(!this.isLogin || this.isAddKf!=1) return
  971. const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
  972. if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
  973. this.bufferRate = playVideoTime
  974. }
  975. if(this.bufferRate == 0 || Number(this.bufferRate.toFixed(2)) == 0) return
  976. const param = {
  977. ...this.urlOption,
  978. uuId: dayjs().format('YYYYMMDD') + this.uuId,
  979. duration: this.playTime,
  980. bufferRate: Number(this.bufferRate.toFixed(2)),
  981. }
  982. if(!param.bufferRate) return
  983. getInternetTraffic(param)
  984. },
  985. getErrMsg(err,type) {
  986. let msgerr = {
  987. errType: type || 'error',
  988. videoUrl: this.videoUrl,
  989. lineIndex: this.lineIndex,
  990. errTime: new Date(),
  991. ip: this.ip,
  992. errMsg: err || ''
  993. }
  994. getErrMsg({
  995. msg: JSON.stringify(msgerr)
  996. })
  997. },
  998. getLink() {
  999. let that = this;
  1000. getRealLink({sortLink:this.sortLink}).then(res=>{
  1001. if(res.code == 200) {
  1002. this.isExpire = false
  1003. this.authDomainName = res.config.authDomainName || ''
  1004. if(this.authDomainName) {
  1005. uni.setStorageSync('authDomainName',this.authDomainName)
  1006. }
  1007. if(this.isLogin) {
  1008. window.location.replace(res.realLink)
  1009. } else{
  1010. const option = res.realLink.split('?course=')[1]
  1011. const urlOption = option ? JSON.parse(option) : {}
  1012. const videoId = urlOption.videoId || ''
  1013. this.getH5CourseByVideo(videoId)
  1014. }
  1015. } else {
  1016. this.isExpire = true
  1017. this.msg = '课程已过期或链接无效'
  1018. uni.showToast({
  1019. title: '课程已过期或链接无效',
  1020. icon: 'none'
  1021. });
  1022. }
  1023. }).catch(err=>{
  1024. this.isExpire = true
  1025. this.msg = '发生错误,请稍后再试'
  1026. uni.showToast({
  1027. title: '发生错误,请稍后再试',
  1028. icon: 'none'
  1029. });
  1030. })
  1031. },
  1032. /**
  1033. * 节流原理:在一定时间内,只能触发一次
  1034. *
  1035. * @param {Function} func 要执行的回调函数
  1036. * @param {Number} wait 延时的时间
  1037. * @param {Boolean} immediate 是否立即执行
  1038. * @return null
  1039. */
  1040. throttle(func, wait = 500, immediate = true) {
  1041. if (immediate) {
  1042. if (!this.flag) {
  1043. this.flag = true
  1044. // 如果是立即执行,则在wait毫秒内开始时执行
  1045. typeof func === 'function' && func()
  1046. this.timer = setTimeout(() => {
  1047. this.flag = false
  1048. }, wait)
  1049. }
  1050. } else if (!this.flag) {
  1051. this.flag = true
  1052. // 如果是非立即执行,则在wait毫秒内的结束处执行
  1053. this.timer = setTimeout(() => {
  1054. this.flag = false
  1055. typeof func === 'function' && func()
  1056. }, wait)
  1057. }
  1058. }
  1059. }
  1060. }
  1061. </script>
  1062. <style scoped>
  1063. .full-width-popup {
  1064. width: 100%;
  1065. }
  1066. </style>
  1067. <style lang="scss" scoped>
  1068. @mixin u-flex($flexD, $alignI, $justifyC) {
  1069. display: flex;
  1070. flex-direction: $flexD;
  1071. align-items: $alignI;
  1072. justify-content: $justifyC;
  1073. }
  1074. .footer-tips {
  1075. margin-top: 14rpx;
  1076. text-align: center;
  1077. font-family: PingFang SC,PingFang SC;
  1078. font-weight: 500;
  1079. font-size: 12px;
  1080. color: #bbb;
  1081. }
  1082. .textOne {
  1083. overflow: hidden;
  1084. white-space: nowrap;
  1085. text-overflow: ellipsis;
  1086. }
  1087. .textTwo {
  1088. overflow: hidden;
  1089. text-overflow: ellipsis;
  1090. display: -webkit-box;
  1091. -webkit-line-clamp: 2;
  1092. -webkit-box-orient: vertical;
  1093. }
  1094. .expirebox {
  1095. height: 100vh;
  1096. @include u-flex(column, center, center);
  1097. font-family: PingFang SC, PingFang SC;
  1098. font-weight: 400;
  1099. font-size: 32rpx;
  1100. color: #757575;
  1101. image {
  1102. width: 428rpx;
  1103. height: 360rpx;
  1104. margin-bottom: 30rpx;
  1105. }
  1106. }
  1107. .reward-list {
  1108. width: 100%;
  1109. margin-top: 20rpx;
  1110. margin-bottom: -40rpx;
  1111. &-group {
  1112. font-family: PingFang SC, PingFang SC;
  1113. font-weight: 400;
  1114. font-size: 14px;
  1115. color: #222222;
  1116. @include u-flex(row, center, center);
  1117. }
  1118. &-option {
  1119. @include u-flex(row, center, flex-start);
  1120. &:first-child {
  1121. margin-right: 40rpx;
  1122. }
  1123. }
  1124. }
  1125. .err {
  1126. color: #f56c6c !important;
  1127. }
  1128. .kfqrcode-box {
  1129. background-color: #fff;
  1130. border-radius: 16rpx;
  1131. max-width: 560rpx;
  1132. padding: 60rpx 40rpx;
  1133. margin-top: -100rpx;
  1134. box-sizing: border-box;
  1135. @include u-flex(column, center, flex-start);
  1136. font-family: PingFang SC, PingFang SC;
  1137. font-weight: 400;
  1138. font-size: 34rpx;
  1139. color: #222;
  1140. position: relative;
  1141. text-align: center;
  1142. .kfqrcode {
  1143. height: 460rpx;
  1144. width: 460rpx;
  1145. }
  1146. }
  1147. .kfqrcode-close {
  1148. width: 64rpx;
  1149. height: 64rpx;
  1150. position: absolute;
  1151. bottom: -100rpx;
  1152. left: 50%;
  1153. transform: translateX(-50%);
  1154. }
  1155. .tipsPopup-mask {
  1156. position: relative;
  1157. width: 560rpx;
  1158. background-color: transparent;
  1159. .red_envelope_top {
  1160. width: 480rpx;
  1161. height: 360rpx;
  1162. margin: 0 auto;
  1163. display: inherit;
  1164. }
  1165. }
  1166. .tipsPopup-btn-box {
  1167. width: 456rpx;
  1168. height: 104rpx;
  1169. padding: 4rpx;
  1170. box-sizing: border-box;
  1171. background: linear-gradient(180deg, rgba(252, 209, 94, 1), rgba(254, 253, 251, 1));
  1172. border-radius: 52rpx;
  1173. }
  1174. .tipsPopup-btn {
  1175. width: 100%;
  1176. height: 100%;
  1177. background: linear-gradient(180deg, #FF9F22 0%, #FA1E05 100%);
  1178. border-radius: 52rpx 52rpx 52rpx 52rpx;
  1179. font-family: PingFang SC, PingFang SC;
  1180. font-weight: 500;
  1181. font-size: 36rpx;
  1182. color: #FFFFFF;
  1183. line-height: 96rpx;
  1184. text-align: center;
  1185. }
  1186. .tipsPopup {
  1187. width: 560rpx;
  1188. padding: 12rpx;
  1189. margin-top: -72rpx;
  1190. box-sizing: border-box;
  1191. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1192. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1193. position: relative;
  1194. &-close {
  1195. width: 64rpx;
  1196. height: 64rpx;
  1197. position: absolute;
  1198. right: 0;
  1199. top: -188rpx;
  1200. }
  1201. &-line {
  1202. padding: 3rpx;
  1203. box-sizing: border-box;
  1204. background: linear-gradient(180deg, rgba(247, 245, 220, 1), rgba(250, 220, 157, 1));
  1205. border-radius: 24rpx;
  1206. }
  1207. &-box {
  1208. padding: 0 40rpx 40rpx 40rpx;
  1209. box-sizing: border-box;
  1210. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1211. border-radius: 24rpx;
  1212. @include u-flex(column, center, flex-start);
  1213. }
  1214. &-head {
  1215. @include u-flex(row, center, center);
  1216. &-title {
  1217. width: 364rpx;
  1218. height: auto;
  1219. margin-top: -22rpx;
  1220. }
  1221. }
  1222. &-content {
  1223. margin: 48rpx 0;
  1224. font-family: PingFang SC, PingFang SC;
  1225. font-weight: 500;
  1226. font-size: 32rpx;
  1227. color: #222222;
  1228. text-align: center;
  1229. &-title {
  1230. margin-bottom: 26rpx;
  1231. font-weight: 600;
  1232. font-size: 40rpx;
  1233. color: #FF5C03;
  1234. }
  1235. }
  1236. }
  1237. .video-controls-box {
  1238. width: 100%;
  1239. height: 420rpx;
  1240. overflow: hidden;
  1241. position: absolute;
  1242. bottom: 0;
  1243. left: 0;
  1244. z-index: 2;
  1245. background: rgba(0, 0, 0, 0.2);
  1246. .video-play {
  1247. height: 72rpx;
  1248. width: 72rpx;
  1249. position: absolute;
  1250. top: 50%;
  1251. left: 50%;
  1252. transform: translate(-50%, -50%);
  1253. }
  1254. }
  1255. .video-controls {
  1256. width: 100%;
  1257. height: 80rpx;
  1258. padding: 0 28rpx;
  1259. box-sizing: border-box;
  1260. position: absolute;
  1261. bottom: 0;
  1262. left: 0;
  1263. display: flex;
  1264. align-items: center;
  1265. justify-content: space-between;
  1266. background: linear-gradient(to top, #222 0%, transparent 80%);
  1267. .video-icon {
  1268. height: 44rpx;
  1269. width: 44rpx;
  1270. }
  1271. }
  1272. .errQuesbox {
  1273. width: 100%;
  1274. max-height: 260rpx;
  1275. overflow-y: auto;
  1276. margin-top: 24rpx;
  1277. font-family: PingFang SC, PingFang SC;
  1278. font-weight: 500;
  1279. font-size: 30rpx;
  1280. color: #222222;
  1281. &-item {
  1282. width: 100%;
  1283. height: 128rpx;
  1284. line-height: 128rpx;
  1285. margin-bottom: 24rpx;
  1286. padding: 0 30rpx;
  1287. box-sizing: border-box;
  1288. overflow: hidden;
  1289. background: #fff;
  1290. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1291. position: relative;
  1292. &::after {
  1293. content: "题目";
  1294. min-width: 64rpx;
  1295. height: 36rpx;
  1296. padding: 0 12rpx;
  1297. line-height: 36rpx;
  1298. background: #FF5C03;
  1299. box-sizing: border-box;
  1300. border-radius: 0rpx 0rpx 16rpx 0rpx;
  1301. text-align: center;
  1302. font-family: PingFang SC, PingFang SC;
  1303. font-weight: 500;
  1304. font-size: 20rpx;
  1305. color: #fff;
  1306. position: absolute;
  1307. left: 0;
  1308. top: 0;
  1309. }
  1310. }
  1311. }
  1312. .bg {
  1313. background: #fff !important;
  1314. }
  1315. .answerPopup {
  1316. &-box {
  1317. width: 560rpx;
  1318. background: linear-gradient(180deg, #FFFAF6 0%, #FEECD8 100%);
  1319. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1320. background-color: #fff;
  1321. font-weight: 400;
  1322. padding: 32rpx;
  1323. box-sizing: border-box;
  1324. position: relative;
  1325. @include u-flex(column, center, flex-start);
  1326. font-family: PingFang SC, PingFang SC;
  1327. font-weight: 400;
  1328. .tipimg {
  1329. width: 206rpx;
  1330. height: 206rpx;
  1331. margin-bottom: 16rpx;
  1332. }
  1333. }
  1334. &-title {
  1335. font-weight: 600;
  1336. font-size: 36rpx;
  1337. color: #222222;
  1338. }
  1339. &-desc {
  1340. margin-top: 10rpx;
  1341. font-size: 28rpx;
  1342. color: #757575;
  1343. }
  1344. &-btn {
  1345. width: 464rpx;
  1346. height: 84rpx;
  1347. margin-top: 54rpx;
  1348. margin-bottom: 16rpx;
  1349. background: #FF5C03;
  1350. border-radius: 42rpx;
  1351. font-weight: 500;
  1352. font-size: 32rpx;
  1353. color: #FFFFFF;
  1354. text-align: center;
  1355. line-height: 84rpx;
  1356. }
  1357. }
  1358. .popupbox {
  1359. width: 100%;
  1360. background-color: #fff;
  1361. border-radius: 16rpx 16rpx 0 0;
  1362. padding: 24rpx 32rpx;
  1363. position: relative;
  1364. &-head {
  1365. height: 60rpx;
  1366. margin-bottom: 30rpx;
  1367. text-align: center;
  1368. overflow-y: auto;
  1369. color: #414858;
  1370. font-size: 32rpx;
  1371. font-weight: bold;
  1372. position: relative;
  1373. .close-icon {
  1374. position: absolute;
  1375. right: 0;
  1376. top: 0;
  1377. height: 40rpx;
  1378. width: 40rpx;
  1379. }
  1380. }
  1381. &-content {
  1382. height: 20vh;
  1383. overflow-y: auto;
  1384. display: flex;
  1385. align-items: flex-start;
  1386. flex-wrap: wrap;
  1387. gap: 32rpx;
  1388. .line-item {
  1389. display: inline-block;
  1390. min-width: 200rpx;
  1391. min-height: 60rpx;
  1392. padding: 0 20rpx;
  1393. box-sizing: border-box;
  1394. border-radius: 50rpx;
  1395. overflow: hidden;
  1396. background-color: #f7f7f7;
  1397. text-align: center;
  1398. color: #414858;
  1399. font-size: 28rpx;
  1400. line-height: 60rpx;
  1401. }
  1402. .line-active {
  1403. color: #f56c6c !important;
  1404. background-color: #fef0f0 !important;
  1405. }
  1406. }
  1407. }
  1408. .content {
  1409. // padding-bottom: calc(var(--window-bottom));
  1410. padding-bottom: calc(var(--window-bottom) + 164rpx);
  1411. .video-box {
  1412. width: 100%;
  1413. height: 420rpx;
  1414. overflow: hidden;
  1415. position: relative;
  1416. #myVideo {
  1417. width: 100%;
  1418. height: 100%;
  1419. }
  1420. }
  1421. .video-poster {
  1422. width: 100%;
  1423. height: 420rpx;
  1424. }
  1425. .miantitlebox {
  1426. padding: 30rpx 0;
  1427. border-bottom: 2rpx solid #F5F7FA;
  1428. font-family: PingFang SC, PingFang SC;
  1429. font-weight: 500;
  1430. font-size: 36rpx;
  1431. color: #222222;
  1432. }
  1433. .subtitlebox {
  1434. padding: 30rpx 0;
  1435. border-bottom: 2rpx solid #F5F7FA;
  1436. font-family: PingFang SC, PingFang SC;
  1437. font-weight: 500;
  1438. font-size: 36rpx;
  1439. color: #222222;
  1440. }
  1441. .title-content {
  1442. padding: 0 32rpx;
  1443. background-color: #fff;
  1444. font-size: 28rpx;
  1445. line-height: 1.6;
  1446. .title {
  1447. font-size: 36rpx;
  1448. font-weight: 500;
  1449. color: #414858;
  1450. }
  1451. .time-or-subtitle {
  1452. margin-top: 12rpx;
  1453. color: #666666;
  1454. }
  1455. }
  1456. .descbox {
  1457. padding: 36rpx 32rpx;
  1458. margin-bottom: 20rpx;
  1459. background-color: #fff;
  1460. font-family: PingFang SC, PingFang SC;
  1461. font-weight: 400;
  1462. font-size: 28rpx;
  1463. color: #222222;
  1464. line-height: 42rpx;
  1465. word-break: break-word;
  1466. &-title {
  1467. margin-bottom: 24rpx;
  1468. font-weight: 500;
  1469. font-size: 32rpx;
  1470. }
  1471. &-info {
  1472. margin-bottom: 24rpx;
  1473. @include u-flex(row, center, space-between);
  1474. font-size: 26rpx;
  1475. color: #757575;
  1476. &-l {
  1477. flex: 1;
  1478. @include u-flex(row, center, flex-start);
  1479. }
  1480. &-time {
  1481. margin-left: 18rpx;
  1482. padding-left: 18rpx;
  1483. position: relative;
  1484. &::after {
  1485. content: "";
  1486. width: 4rpx;
  1487. height: 4rpx;
  1488. background: #999999;
  1489. border-radius: 50%;
  1490. position: absolute;
  1491. left: 0;
  1492. top: 50%;
  1493. transform: translateY(-50%);
  1494. }
  1495. }
  1496. &-r {
  1497. background: transparent;
  1498. }
  1499. }
  1500. &-desc {
  1501. overflow: hidden;
  1502. position: relative;
  1503. }
  1504. }
  1505. .expand {
  1506. flex-shrink: 0;
  1507. @include u-flex(row, center, flex-end);
  1508. color: #FF5C03;
  1509. font-weight: 400;
  1510. font-size: 24rpx;
  1511. image {
  1512. width: 32rpx;
  1513. height: 32rpx;
  1514. }
  1515. }
  1516. .expand-ab {
  1517. position: absolute;
  1518. top: 0;
  1519. right: 0;
  1520. box-shadow: -50rpx 0 20rpx 8rpx #FFFFFF;
  1521. background-color: #fff;
  1522. }
  1523. .ques-content {
  1524. background-color: #fff;
  1525. padding: 40rpx 32rpx;
  1526. box-sizing: border-box;
  1527. font-family: PingFang SC, PingFang SC;
  1528. font-weight: 400;
  1529. font-size: 28rpx;
  1530. color: #222222;
  1531. }
  1532. .ques-content-tit {
  1533. font-family: PingFang SC, PingFang SC;
  1534. font-weight: 600;
  1535. font-size: 36rpx;
  1536. color: #222222;
  1537. }
  1538. .ques-title {
  1539. margin: 48rpx 0 34rpx 0;
  1540. font-weight: 500;
  1541. font-size: 32rpx;
  1542. white-space: normal;
  1543. }
  1544. .ques-type {
  1545. flex-shrink: 0;
  1546. min-width: 72rpx;
  1547. min-height: 40rpx;
  1548. padding: 0 12rpx;
  1549. margin: 0 12rpx;
  1550. box-sizing: border-box;
  1551. background: #FF5C03;
  1552. border-radius: 8rpx 8rpx 8rpx 8rpx;
  1553. line-height: 40rpx;
  1554. text-align: center;
  1555. font-family: PingFang SC, PingFang SC;
  1556. font-weight: 400;
  1557. font-size: 24rpx;
  1558. color: #FFFFFF;
  1559. display: inline-block;
  1560. }
  1561. .ques-option {
  1562. min-height: 88rpx;
  1563. padding: 24rpx 32rpx;
  1564. box-sizing: border-box;
  1565. margin-bottom: 24rpx;
  1566. background: #F5F7FA;
  1567. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1568. display: flex;
  1569. align-items: center;
  1570. &-active {
  1571. color: #FF5C03 !important;
  1572. background: #FCF0E7 !important;
  1573. }
  1574. }
  1575. .video-line {
  1576. min-width: 140rpx;
  1577. max-width: 200rpx;
  1578. height: 60rpx;
  1579. padding: 0 20rpx;
  1580. box-sizing: border-box;
  1581. border-radius: 50rpx 0 0 50rpx;
  1582. overflow: hidden;
  1583. background-color: #fff;
  1584. text-align: center;
  1585. color: #888;
  1586. font-size: 28rpx;
  1587. line-height: 60rpx;
  1588. display: inline-flex;
  1589. align-items: center;
  1590. justify-content: center;
  1591. position: fixed;
  1592. right: 0;
  1593. z-index: 9;
  1594. bottom: calc(var(--window-bottom) + 280rpx);
  1595. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .12);
  1596. image {
  1597. flex-shrink: 0;
  1598. height: 30rpx;
  1599. width: 30rpx;
  1600. margin-right: 6rpx;
  1601. }
  1602. }
  1603. .footer {
  1604. border-top: 1rpx solid #ededef;
  1605. background: #fff;
  1606. width: 100%;
  1607. position: fixed;
  1608. bottom: 0;
  1609. padding: 18rpx 32rpx;
  1610. padding-bottom: calc(var(--window-bottom) + 18rpx);
  1611. box-sizing: border-box;
  1612. z-index: 9;
  1613. &-btn {
  1614. width: 100%;
  1615. height: 98rpx;
  1616. background: #FF5C03;
  1617. border-radius: 49rpx 49rpx 49rpx 49rpx;
  1618. line-height: 98rpx;
  1619. text-align: center;
  1620. font-family: PingFang SC, PingFang SC;
  1621. font-weight: 600;
  1622. font-size: 32rpx;
  1623. color: #FFFFFF;
  1624. @include u-flex(row, center, center);
  1625. &-img {
  1626. flex-shrink: 0;
  1627. width: 144rpx;
  1628. height: 144rpx;
  1629. margin-right: 8rpx;
  1630. margin-top: -24rpx;
  1631. }
  1632. }
  1633. &-btn-border {
  1634. position: relative;
  1635. &::after {
  1636. content: "";
  1637. background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  1638. position: absolute;
  1639. top: -2rpx;
  1640. left: 0;
  1641. height: 103rpx;
  1642. width: 100%;
  1643. z-index: -1;
  1644. border-radius: 49rpx 49rpx 49rpx 49rpx;
  1645. box-shadow: 0rpx 8rpx 11rpx 0rpx rgba(255, 92, 3, 0.3);
  1646. overflow: hidden;
  1647. }
  1648. }
  1649. }
  1650. }
  1651. .agreement {
  1652. display: inline-flex;
  1653. margin-top: 16rpx;
  1654. font-size: 24rpx;
  1655. color: #525252;
  1656. align-items: center;
  1657. justify-content: center;
  1658. }
  1659. .logo {
  1660. display: inline-block;
  1661. width: 30px;
  1662. height: auto;
  1663. margin: 20px 0 0 10px;
  1664. pointer-events: none;
  1665. object-fit: cover;
  1666. }
  1667. .logo-full {
  1668. display: inline-block;
  1669. width: 40px;
  1670. height: auto;
  1671. margin: 50px 0 0 30px;
  1672. pointer-events: none;
  1673. object-fit: cover;
  1674. }
  1675. </style>