video.vue 42 KB

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