video.vue 42 KB

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