video.vue 43 KB

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