learningBase.vue 43 KB

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