video.vue 44 KB

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