learningBase.vue 43 KB

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