video.vue 42 KB

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