video.vue 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776
  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: false,
  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. this.closeAnswerPopup(1)
  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(type) {
  790. this.$refs.answerPopup.close()
  791. if (this.errTitle == '恭喜你,回答正确') {
  792. const param = {
  793. ...this.urlOption,
  794. rewardType: Number(this.currentReward),
  795. source: 2,
  796. appId: getApp().globalData.appId
  797. }
  798. if(type == 1) {
  799. param = {
  800. ...this.urlOption,
  801. source: 2,
  802. appId: getApp().globalData.appId
  803. }
  804. }
  805. sendReward(param).then(res => {
  806. uni.showToast({
  807. title: res.msg,
  808. icon: 'none'
  809. })
  810. // if(res.code == 200) {
  811. // //重构 发红包,后台通过OPENID发零钱到 账
  812. // //this.initWXConfig(res.package)
  813. // }else {
  814. // uni.showToast({
  815. // title: res.msg,
  816. // icon: 'none'
  817. // })
  818. // }
  819. })
  820. }
  821. },
  822. // 线路
  823. openPop() {
  824. this.$refs.popup.open('bottom')
  825. },
  826. close() {
  827. this.$refs.popup.close()
  828. },
  829. handleLine(index) {
  830. var that=this;
  831. if (this.lineIndex == index && this.videoUrl == this.lineList[index]) {
  832. this.close()
  833. return
  834. } else {
  835. // let div = document.querySelector(".vjs-progress-control");
  836. // if(div) {
  837. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  838. // div.style.pointerEvents = "auto";
  839. // } else {
  840. // div.style.pointerEvents = "none"; //禁止所有事件
  841. // }
  842. // }
  843. this.lineIndex = index
  844. this.videoUrl = this.lineList[index]
  845. this.tipsOpen = false
  846. this.playDurationSeek = this.playTime || 0
  847. this.player = uni.createVideoContext('video-content-box');
  848. setTimeout(function(){
  849. that.player.seek(that.playDurationSeek)
  850. that.player.play();
  851. },500);
  852. // this.player.src(this.lineList[index])
  853. // this.player.one('loadedmetadata', () => {
  854. // this.player.currentTime(this.playDurationSeek);
  855. // this.player.play();
  856. // });
  857. this.close()
  858. }
  859. },
  860. // 温馨提示
  861. openTipsPop() {
  862. this.$refs.tipsPopup.open()
  863. this.tipsOpen = true
  864. this.pause()
  865. },
  866. closeTipsPop() {
  867. this.$refs.tipsPopup.close()
  868. },
  869. // 客服
  870. getIsAddKf() {
  871. this.qrcode = ''
  872. this.qrcodeMsg = ''
  873. this.isAddKf = 0
  874. // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
  875. getIsAddKf(this.urlOption).then(res => {
  876. if (res.code == 200) {
  877. this.isAddKf = 1
  878. this.getH5CourseVideoDetails()
  879. } else if (res.code == 400) {
  880. this.isAddKf = 0
  881. this.qrcode = res.qrcode
  882. this.qrcodeMsg = res.msg
  883. this.$refs.kfPopup.open()
  884. } else if (res.code == 504) {
  885. // 登录
  886. this.goLogin()
  887. } else if (res.code == 566) {
  888. // 官方群发通用链接
  889. const url = res.courseLink.realLink.split('?course=')[1]
  890. this.urlOption = JSON.parse(url)
  891. this.isAddKf = 1
  892. this.getH5CourseVideoDetails()
  893. } else {
  894. this.isAddKf = 0
  895. uni.showToast({
  896. title: res.msg,
  897. icon: 'none'
  898. });
  899. }
  900. },
  901. err => {}
  902. );
  903. },
  904. closeKFPop() {
  905. this.$refs.kfPopup.close()
  906. },
  907. getFinishCourseVideo() {
  908. if (!this.playTime) return
  909. // {videoId: this.videoId,duration:this.playTime}
  910. const param = {
  911. duration: this.playTime,
  912. ...this.urlOption
  913. }
  914. getFinishCourseVideo(param)
  915. },
  916. // 每十分钟获得积分
  917. getIntegralByH5Video() {
  918. const param = {
  919. duration: this.playTime,
  920. ...this.urlOption
  921. }
  922. getIntegralByH5Video(param).then(res => {
  923. if (res.code == 200) {
  924. uni.showToast({
  925. title: "积分+10",
  926. icon: "none"
  927. })
  928. }
  929. })
  930. },
  931. progressChange(e) {
  932. this.bufferRate = Math.ceil(e.detail.buffered)
  933. },
  934. // 缓冲
  935. getInternetTraffic() {
  936. const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
  937. if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
  938. this.bufferRate = playVideoTime
  939. }
  940. if(this.bufferRate == 0 || Number(this.bufferRate.toFixed(2)) == 0) return
  941. const param = {
  942. uuId: dayjs().format('YYYYMMDD') + this.uuId,
  943. duration: this.playTime,
  944. bufferRate: Number(this.bufferRate.toFixed(2)),
  945. ...this.urlOption
  946. }
  947. getInternetTraffic(param)
  948. },
  949. getErrMsg(err) {
  950. let msgerr = {
  951. videoUrl: this.videoUrl,
  952. lineIndex: this.lineIndex,
  953. errTime: new Date(),
  954. ip: this.ip,
  955. errMsg: err
  956. }
  957. getErrMsg({
  958. msg: JSON.stringify(msgerr)
  959. })
  960. },
  961. goLogin() {
  962. let provider = 'weixin'
  963. uni.login({
  964. provider: provider,
  965. success: async loginRes => {
  966. console.log(loginRes)
  967. uni.getUserInfo({
  968. provider: provider,
  969. success: (infoRes)=> {
  970. uni.showToast({
  971. title: '处理中...',
  972. icon: 'loading'
  973. });
  974. console.log("code==",loginRes.code)
  975. loginByMp({
  976. code: loginRes.code,
  977. encryptedData:infoRes.encryptedData,
  978. iv:infoRes.iv,
  979. appId: getApp().globalData.appId
  980. }).then(res=>{
  981. uni.hideLoading();
  982. if (res.code == 200) {
  983. uni.setStorageSync(TOKEN_KEY, res.token);
  984. this.isLogin = true
  985. this.getIsAddKf()
  986. } else {
  987. uni.showToast({
  988. title: res.msg,
  989. icon: 'none'
  990. });
  991. }
  992. }).catch(err=>{
  993. uni.hideLoading();
  994. uni.showToast({
  995. icon:'none',
  996. title: "登录失败,请重新登录",
  997. });
  998. });
  999. }
  1000. });
  1001. }
  1002. })
  1003. },
  1004. getLink() {
  1005. let that = this;
  1006. this.msg = ''
  1007. getRealLink({sortLink:this.sortLink}).then(res=>{
  1008. if(res.code == 200) {
  1009. this.isExpire = false
  1010. // 如果响应中包含真实链接,则跳转到真实链接
  1011. // window.location.href = res.realLink +"&sortLink="+this.sortLink+"&code="+this.code+"&time="+new Date().getTime()
  1012. if (this.isLogin && this.isAddKf == 1) {
  1013. this.getH5CourseVideoDetails()
  1014. }
  1015. if (this.videoId && this.isAddKf != 1) {
  1016. this.$isLoginCourse().then(
  1017. isLogin => {
  1018. this.isLogin = isLogin
  1019. if(isLogin){
  1020. this.getIsAddKf()
  1021. } else {
  1022. this.goLogin()
  1023. }
  1024. },
  1025. rej => {}
  1026. );
  1027. }
  1028. } else {
  1029. this.isExpire = true
  1030. this.msg = '课程已过期或链接无效'
  1031. uni.showToast({
  1032. title: '课程已过期或链接无效',
  1033. icon: 'none'
  1034. });
  1035. }
  1036. }).catch(err=>{
  1037. this.isExpire = true
  1038. this.msg = '发生错误,请稍后再试'
  1039. uni.showToast({
  1040. title: '发生错误,请稍后再试',
  1041. icon: 'none'
  1042. });
  1043. })
  1044. },
  1045. /**
  1046. * 节流原理:在一定时间内,只能触发一次
  1047. *
  1048. * @param {Function} func 要执行的回调函数
  1049. * @param {Number} wait 延时的时间
  1050. * @param {Boolean} immediate 是否立即执行
  1051. * @return null
  1052. */
  1053. throttle(func, wait = 500, immediate = true) {
  1054. if (immediate) {
  1055. if (!this.flag) {
  1056. this.flag = true
  1057. // 如果是立即执行,则在wait毫秒内开始时执行
  1058. typeof func === 'function' && func()
  1059. this.timer = setTimeout(() => {
  1060. this.flag = false
  1061. }, wait)
  1062. }
  1063. } else if (!this.flag) {
  1064. this.flag = true
  1065. // 如果是非立即执行,则在wait毫秒内的结束处执行
  1066. this.timer = setTimeout(() => {
  1067. this.flag = false
  1068. typeof func === 'function' && func()
  1069. }, wait)
  1070. }
  1071. }
  1072. }
  1073. }
  1074. </script>
  1075. <style scoped>
  1076. .full-width-popup {
  1077. width: 100%;
  1078. }
  1079. </style>
  1080. <style lang="scss" scoped>
  1081. @mixin u-flex($flexD, $alignI, $justifyC) {
  1082. display: flex;
  1083. flex-direction: $flexD;
  1084. align-items: $alignI;
  1085. justify-content: $justifyC;
  1086. }
  1087. .footer-tips {
  1088. margin-top: 14rpx;
  1089. text-align: center;
  1090. font-family: PingFang SC,PingFang SC;
  1091. font-weight: 500;
  1092. font-size: 12px;
  1093. color: #bbb;
  1094. }
  1095. .textOne {
  1096. overflow: hidden;
  1097. white-space: nowrap;
  1098. text-overflow: ellipsis;
  1099. }
  1100. .textTwo {
  1101. overflow: hidden;
  1102. text-overflow: ellipsis;
  1103. display: -webkit-box;
  1104. -webkit-line-clamp: 2;
  1105. -webkit-box-orient: vertical;
  1106. }
  1107. .header-nav {
  1108. height: 88rpx;
  1109. @include u-flex(row, center, flex-start);
  1110. overflow: hidden;
  1111. background-color: #fff;
  1112. box-sizing: border-box;
  1113. .header-title {
  1114. text-align: center;
  1115. overflow: hidden;
  1116. white-space: nowrap;
  1117. text-overflow: ellipsis;
  1118. padding: 0 10rpx 0 100rpx;
  1119. font-family: PingFang SC,PingFang SC;
  1120. font-weight: 500;
  1121. font-size: 15px;
  1122. color: #000;
  1123. box-sizing: border-box;
  1124. }
  1125. }
  1126. .reward-list {
  1127. width: 100%;
  1128. margin-top: 20rpx;
  1129. margin-bottom: -40rpx;
  1130. &-group {
  1131. font-family: PingFang SC, PingFang SC;
  1132. font-weight: 400;
  1133. font-size: 14px;
  1134. color: #222222;
  1135. @include u-flex(row, center, center);
  1136. }
  1137. &-option {
  1138. @include u-flex(row, center, flex-start);
  1139. &:first-child {
  1140. margin-right: 40rpx;
  1141. }
  1142. }
  1143. }
  1144. .err {
  1145. color: #f56c6c !important;
  1146. }
  1147. .kfqrcode-box {
  1148. background-color: #fff;
  1149. border-radius: 16rpx;
  1150. max-width: 560rpx;
  1151. padding: 60rpx 40rpx;
  1152. margin-top: -100rpx;
  1153. box-sizing: border-box;
  1154. @include u-flex(column, center, flex-start);
  1155. font-family: PingFang SC, PingFang SC;
  1156. font-weight: 400;
  1157. font-size: 34rpx;
  1158. color: #222;
  1159. position: relative;
  1160. text-align: center;
  1161. .kfqrcode {
  1162. height: 460rpx;
  1163. width: 460rpx;
  1164. }
  1165. }
  1166. .kfqrcode-close {
  1167. width: 64rpx;
  1168. height: 64rpx;
  1169. position: absolute;
  1170. bottom: -100rpx;
  1171. left: 50%;
  1172. transform: translateX(-50%);
  1173. }
  1174. .tipsPopup-mask {
  1175. position: relative;
  1176. width: 560rpx;
  1177. background-color: transparent;
  1178. .red_envelope_top {
  1179. width: 480rpx;
  1180. height: 360rpx;
  1181. margin: 0 auto;
  1182. display: inherit;
  1183. }
  1184. }
  1185. .tipsPopup-btn-box {
  1186. width: 456rpx;
  1187. height: 104rpx;
  1188. padding: 4rpx;
  1189. box-sizing: border-box;
  1190. background: linear-gradient(180deg, rgba(252, 209, 94, 1), rgba(254, 253, 251, 1));
  1191. border-radius: 52rpx;
  1192. }
  1193. .tipsPopup-btn {
  1194. width: 100%;
  1195. height: 100%;
  1196. background: linear-gradient(180deg, #FF9F22 0%, #FA1E05 100%);
  1197. border-radius: 52rpx 52rpx 52rpx 52rpx;
  1198. font-family: PingFang SC, PingFang SC;
  1199. font-weight: 500;
  1200. font-size: 36rpx;
  1201. color: #FFFFFF;
  1202. line-height: 96rpx;
  1203. text-align: center;
  1204. }
  1205. .tipsPopup {
  1206. width: 560rpx;
  1207. padding: 12rpx;
  1208. margin-top: -72rpx;
  1209. box-sizing: border-box;
  1210. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1211. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1212. position: relative;
  1213. &-close {
  1214. width: 64rpx;
  1215. height: 64rpx;
  1216. position: absolute;
  1217. right: 0;
  1218. top: -188rpx;
  1219. }
  1220. &-line {
  1221. padding: 3rpx;
  1222. box-sizing: border-box;
  1223. background: linear-gradient(180deg, rgba(247, 245, 220, 1), rgba(250, 220, 157, 1));
  1224. border-radius: 24rpx;
  1225. }
  1226. &-box {
  1227. padding: 0 40rpx 40rpx 40rpx;
  1228. box-sizing: border-box;
  1229. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1230. border-radius: 24rpx;
  1231. @include u-flex(column, center, flex-start);
  1232. }
  1233. &-head {
  1234. @include u-flex(row, center, center);
  1235. &-title {
  1236. width: 364rpx;
  1237. height: auto;
  1238. margin-top: -22rpx;
  1239. }
  1240. }
  1241. &-content {
  1242. margin: 48rpx 0;
  1243. font-family: PingFang SC, PingFang SC;
  1244. font-weight: 500;
  1245. font-size: 32rpx;
  1246. color: #222222;
  1247. text-align: center;
  1248. &-title {
  1249. margin-bottom: 26rpx;
  1250. font-weight: 600;
  1251. font-size: 40rpx;
  1252. color: #FF5C03;
  1253. }
  1254. }
  1255. }
  1256. .video-controls-box {
  1257. width: 100%;
  1258. height: 420rpx;
  1259. overflow: hidden;
  1260. position: absolute;
  1261. bottom: 0;
  1262. left: 0;
  1263. z-index: 2;
  1264. background: rgba(0, 0, 0, 0.2);
  1265. .video-play {
  1266. height: 72rpx;
  1267. width: 72rpx;
  1268. position: absolute;
  1269. top: 50%;
  1270. left: 50%;
  1271. transform: translate(-50%, -50%);
  1272. }
  1273. }
  1274. .video-controls {
  1275. width: 100%;
  1276. height: 80rpx;
  1277. padding: 0 28rpx;
  1278. box-sizing: border-box;
  1279. position: absolute;
  1280. bottom: 0;
  1281. left: 0;
  1282. display: flex;
  1283. align-items: center;
  1284. justify-content: space-between;
  1285. background: linear-gradient(to top, #222 0%, transparent 80%);
  1286. .video-icon {
  1287. height: 44rpx;
  1288. width: 44rpx;
  1289. }
  1290. }
  1291. .errQuesbox {
  1292. width: 100%;
  1293. max-height: 260rpx;
  1294. overflow-y: auto;
  1295. margin-top: 24rpx;
  1296. font-family: PingFang SC, PingFang SC;
  1297. font-weight: 500;
  1298. font-size: 30rpx;
  1299. color: #222222;
  1300. &-item {
  1301. width: 100%;
  1302. height: 128rpx;
  1303. line-height: 128rpx;
  1304. margin-bottom: 24rpx;
  1305. padding: 0 30rpx;
  1306. box-sizing: border-box;
  1307. overflow: hidden;
  1308. background: #fff;
  1309. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1310. position: relative;
  1311. &::after {
  1312. content: "题目";
  1313. min-width: 64rpx;
  1314. height: 36rpx;
  1315. padding: 0 12rpx;
  1316. line-height: 36rpx;
  1317. background: #FF5C03;
  1318. box-sizing: border-box;
  1319. border-radius: 0rpx 0rpx 16rpx 0rpx;
  1320. text-align: center;
  1321. font-family: PingFang SC, PingFang SC;
  1322. font-weight: 500;
  1323. font-size: 20rpx;
  1324. color: #fff;
  1325. position: absolute;
  1326. left: 0;
  1327. top: 0;
  1328. }
  1329. }
  1330. }
  1331. .bg {
  1332. background: #fff !important;
  1333. }
  1334. .answerPopup {
  1335. &-box {
  1336. width: 560rpx;
  1337. background: linear-gradient(180deg, #FFFAF6 0%, #FEECD8 100%);
  1338. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1339. background-color: #fff;
  1340. font-weight: 400;
  1341. padding: 32rpx;
  1342. box-sizing: border-box;
  1343. position: relative;
  1344. @include u-flex(column, center, flex-start);
  1345. font-family: PingFang SC, PingFang SC;
  1346. font-weight: 400;
  1347. .tipimg {
  1348. width: 206rpx;
  1349. height: 206rpx;
  1350. margin-bottom: 16rpx;
  1351. }
  1352. }
  1353. &-title {
  1354. font-weight: 600;
  1355. font-size: 36rpx;
  1356. color: #222222;
  1357. }
  1358. &-desc {
  1359. margin-top: 10rpx;
  1360. font-size: 28rpx;
  1361. color: #757575;
  1362. }
  1363. &-btn {
  1364. width: 464rpx;
  1365. height: 84rpx;
  1366. margin-top: 54rpx;
  1367. margin-bottom: 16rpx;
  1368. background: #FF5C03;
  1369. border-radius: 42rpx;
  1370. font-weight: 500;
  1371. font-size: 32rpx;
  1372. color: #FFFFFF;
  1373. text-align: center;
  1374. line-height: 84rpx;
  1375. }
  1376. }
  1377. .popupbox {
  1378. width: 100%;
  1379. background-color: #fff;
  1380. border-radius: 16rpx 16rpx 0 0;
  1381. padding: 24rpx 32rpx;
  1382. position: relative;
  1383. &-head {
  1384. height: 60rpx;
  1385. margin-bottom: 30rpx;
  1386. text-align: center;
  1387. overflow-y: auto;
  1388. color: #414858;
  1389. font-size: 32rpx;
  1390. font-weight: bold;
  1391. position: relative;
  1392. .close-icon {
  1393. position: absolute;
  1394. right: 0;
  1395. top: 0;
  1396. height: 40rpx;
  1397. width: 40rpx;
  1398. }
  1399. }
  1400. &-content {
  1401. height: 20vh;
  1402. overflow-y: auto;
  1403. display: flex;
  1404. align-items: flex-start;
  1405. flex-wrap: wrap;
  1406. gap: 32rpx;
  1407. .line-item {
  1408. display: inline-block;
  1409. min-width: 200rpx;
  1410. min-height: 60rpx;
  1411. padding: 0 20rpx;
  1412. box-sizing: border-box;
  1413. border-radius: 50rpx;
  1414. overflow: hidden;
  1415. background-color: #f7f7f7;
  1416. text-align: center;
  1417. color: #414858;
  1418. font-size: 28rpx;
  1419. line-height: 60rpx;
  1420. }
  1421. .line-active {
  1422. color: #f56c6c !important;
  1423. background-color: #fef0f0 !important;
  1424. }
  1425. }
  1426. }
  1427. .content {
  1428. padding-bottom: calc(var(--window-bottom) + 164rpx);
  1429. .video-box {
  1430. width: 100%;
  1431. height: 420rpx;
  1432. overflow: hidden;
  1433. position: relative;
  1434. #myVideo {
  1435. width: 100%;
  1436. height: 100%;
  1437. }
  1438. }
  1439. .video-poster {
  1440. width: 100%;
  1441. height: 420rpx;
  1442. }
  1443. .miantitlebox {
  1444. padding: 30rpx 0;
  1445. border-bottom: 2rpx solid #F5F7FA;
  1446. font-family: PingFang SC, PingFang SC;
  1447. font-weight: 500;
  1448. font-size: 36rpx;
  1449. color: #222222;
  1450. }
  1451. .subtitlebox {
  1452. padding: 30rpx 0;
  1453. border-bottom: 2rpx solid #F5F7FA;
  1454. font-family: PingFang SC, PingFang SC;
  1455. font-weight: 500;
  1456. font-size: 36rpx;
  1457. color: #222222;
  1458. }
  1459. .title-content {
  1460. padding: 0 32rpx;
  1461. background-color: #fff;
  1462. font-size: 28rpx;
  1463. line-height: 1.6;
  1464. .title {
  1465. font-size: 36rpx;
  1466. font-weight: 500;
  1467. color: #414858;
  1468. }
  1469. .time-or-subtitle {
  1470. margin-top: 12rpx;
  1471. color: #666666;
  1472. }
  1473. }
  1474. .descbox {
  1475. padding: 14rpx 32rpx;
  1476. margin-bottom: 20rpx;
  1477. background-color: #fff;
  1478. font-family: PingFang SC, PingFang SC;
  1479. font-weight: 400;
  1480. font-size: 28rpx;
  1481. color: #222222;
  1482. line-height: 42rpx;
  1483. word-break: break-word;
  1484. &-title {
  1485. margin-bottom: 24rpx;
  1486. font-weight: 500;
  1487. font-size: 32rpx;
  1488. }
  1489. &-info {
  1490. margin-bottom: 24rpx;
  1491. @include u-flex(row, center, space-between);
  1492. font-size: 26rpx;
  1493. color: #757575;
  1494. &-l {
  1495. flex: 1;
  1496. @include u-flex(row, center, flex-start);
  1497. }
  1498. &-time {
  1499. margin-left: 18rpx;
  1500. padding-left: 18rpx;
  1501. position: relative;
  1502. &::after {
  1503. content: "";
  1504. width: 4rpx;
  1505. height: 4rpx;
  1506. background: #999999;
  1507. border-radius: 50%;
  1508. position: absolute;
  1509. left: 0;
  1510. top: 50%;
  1511. transform: translateY(-50%);
  1512. }
  1513. }
  1514. &-r {
  1515. background: transparent;
  1516. }
  1517. }
  1518. &-desc {
  1519. overflow: hidden;
  1520. position: relative;
  1521. }
  1522. }
  1523. .expand {
  1524. flex-shrink: 0;
  1525. @include u-flex(row, center, flex-end);
  1526. color: #FF5C03;
  1527. font-weight: 400;
  1528. font-size: 24rpx;
  1529. image {
  1530. width: 32rpx;
  1531. height: 32rpx;
  1532. }
  1533. }
  1534. .expand-ab {
  1535. position: absolute;
  1536. top: 0;
  1537. right: 0;
  1538. box-shadow: -50rpx 0 20rpx 8rpx #FFFFFF;
  1539. background-color: #fff;
  1540. }
  1541. .ques-content {
  1542. background-color: #fff;
  1543. padding: 24rpx 32rpx;
  1544. box-sizing: border-box;
  1545. font-family: PingFang SC, PingFang SC;
  1546. font-weight: 400;
  1547. font-size: 28rpx;
  1548. color: #222222;
  1549. }
  1550. .ques-content-tit {
  1551. font-family: PingFang SC, PingFang SC;
  1552. font-weight: 600;
  1553. font-size: 36rpx;
  1554. color: #222222;
  1555. }
  1556. .ques-title {
  1557. margin: 48rpx 0 34rpx 0;
  1558. font-weight: 500;
  1559. font-size: 32rpx;
  1560. white-space: normal;
  1561. }
  1562. .ques-type {
  1563. flex-shrink: 0;
  1564. min-width: 72rpx;
  1565. min-height: 40rpx;
  1566. padding: 0 12rpx;
  1567. margin: 0 12rpx;
  1568. box-sizing: border-box;
  1569. background: #FF5C03;
  1570. border-radius: 8rpx 8rpx 8rpx 8rpx;
  1571. line-height: 40rpx;
  1572. text-align: center;
  1573. font-family: PingFang SC, PingFang SC;
  1574. font-weight: 400;
  1575. font-size: 24rpx;
  1576. color: #FFFFFF;
  1577. display: inline-block;
  1578. }
  1579. .ques-option {
  1580. min-height: 88rpx;
  1581. padding: 24rpx 32rpx;
  1582. box-sizing: border-box;
  1583. margin-bottom: 24rpx;
  1584. background: #F5F7FA;
  1585. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1586. display: flex;
  1587. align-items: center;
  1588. &-active {
  1589. color: #FF5C03 !important;
  1590. background: #FCF0E7 !important;
  1591. }
  1592. }
  1593. .video-line {
  1594. min-width: 140rpx;
  1595. max-width: 200rpx;
  1596. height: 60rpx;
  1597. padding: 0 20rpx;
  1598. box-sizing: border-box;
  1599. border-radius: 50rpx 0 0 50rpx;
  1600. overflow: hidden;
  1601. background-color: #fff;
  1602. text-align: center;
  1603. color: #888;
  1604. font-size: 28rpx;
  1605. line-height: 60rpx;
  1606. display: inline-flex;
  1607. align-items: center;
  1608. justify-content: center;
  1609. position: fixed;
  1610. right: 0;
  1611. z-index: 9;
  1612. bottom: calc(var(--window-bottom) + 280rpx);
  1613. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .12);
  1614. image {
  1615. flex-shrink: 0;
  1616. height: 30rpx;
  1617. width: 30rpx;
  1618. margin-right: 6rpx;
  1619. }
  1620. }
  1621. .footer {
  1622. border-top: 1rpx solid #ededef;
  1623. background: #fff;
  1624. width: 100%;
  1625. position: fixed;
  1626. bottom: 0;
  1627. padding: 32rpx;
  1628. padding-bottom: calc(var(--window-bottom) + 12rpx);
  1629. box-sizing: border-box;
  1630. z-index: 9;
  1631. &-btn {
  1632. width: 100%;
  1633. height: 98rpx;
  1634. background: #FF5C03;
  1635. border-radius: 49rpx 49rpx 49rpx 49rpx;
  1636. line-height: 98rpx;
  1637. text-align: center;
  1638. font-family: PingFang SC, PingFang SC;
  1639. font-weight: 600;
  1640. font-size: 32rpx;
  1641. color: #FFFFFF;
  1642. @include u-flex(row, center, center);
  1643. &-img {
  1644. flex-shrink: 0;
  1645. width: 144rpx;
  1646. height: 144rpx;
  1647. margin-right: 8rpx;
  1648. margin-top: -24rpx;
  1649. }
  1650. }
  1651. &-btn-border {
  1652. position: relative;
  1653. &::after {
  1654. content: "";
  1655. background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  1656. position: absolute;
  1657. top: -2rpx;
  1658. left: 0;
  1659. height: 103rpx;
  1660. width: 100%;
  1661. z-index: -1;
  1662. border-radius: 49rpx 49rpx 49rpx 49rpx;
  1663. box-shadow: 0rpx 8rpx 11rpx 0rpx rgba(255, 92, 3, 0.3);
  1664. overflow: hidden;
  1665. }
  1666. }
  1667. }
  1668. }
  1669. .agreement {
  1670. display: inline-flex;
  1671. margin-top: 16rpx;
  1672. font-size: 24rpx;
  1673. color: #525252;
  1674. align-items: center;
  1675. justify-content: center;
  1676. }
  1677. .nocourse {
  1678. display: flex;
  1679. flex-direction: column;
  1680. align-items: center;
  1681. padding-bottom: 88rpx;
  1682. justify-content: center;
  1683. font-family: PingFang SC, PingFang SC;
  1684. font-weight: 400;
  1685. font-size: 32rpx;
  1686. color: #757575;
  1687. line-height: 48rpx;
  1688. text-align: center;
  1689. image {
  1690. width: 328rpx;
  1691. height: auto;
  1692. margin-bottom: 30rpx;
  1693. }
  1694. }
  1695. </style>