video.vue 41 KB

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