learning.vue 42 KB

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