video.vue 44 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. :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="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/course_arrow_up_icon.png" v-show="isExpand"></image>
  53. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/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="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/course_arrow_up_icon.png" v-show="isExpand"></image>
  62. <image src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/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="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/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="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/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//image/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="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/red_envelope_img.png" mode="aspectFill"></image>
  119. <view class="tipsPopup">
  120. <image class="tipsPopup-close" src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/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="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/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="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/course_answer_img.png"
  145. mode="aspectFill"></image>
  146. <!-- 错误 -->
  147. <image class="tipimg" v-else src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/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="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/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="isLogin&&isAddKf==1 ? 'footer-btn footer-btn-border':'footer-btn'" @click="submit">
  185. <image class="footer-btn-img" v-show="isLogin&&isAddKf==1" src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com:443/app/image/red_envelope_btnimg.png"
  186. mode="aspectFill"></image>
  187. <text>{{isLogin&&isAddKf==1 ? '提交答案领取奖励' : '立即学习'}}</text>
  188. </view>
  189. <!-- <view @click="checked=!checked" class="agreement" v-if="!isLogin">
  190. <radio value="r1" :checked="checked" color="#ff5c03" activeBorderColor="#ff5c03"
  191. style="transform:scale(0.6);" />
  192. <view>阅读并同意<text style="color: #ff5c03;" @click.stop="goWeb(0)">《用户协议》</text>和<text
  193. style="color: #ff5c03;" @click.stop="goWeb(1)">《隐私协议》</text></view>
  194. </view> -->
  195. </view>
  196. </view>
  197. </template>
  198. <script>
  199. import { generateRandomString } from "@/utils/common.js"
  200. import dayjs from 'dayjs';
  201. import {
  202. getErrMsg,
  203. getH5CourseByVideoId,
  204. getH5CourseVideoDetails,
  205. courseAnswer,
  206. getFinishCourseVideo,
  207. getIsAddKf,
  208. getInternetTraffic,
  209. getIntegralByH5Video,
  210. sendReward,
  211. loginByMp,
  212. getRealLink
  213. } from "@/api/course.js"
  214. export default {
  215. data() {
  216. return {
  217. baseUrl:uni.getStorageSync('requestPath'),
  218. // 1 红包 2 积分
  219. rewardType: [{
  220. name: '红包奖励',
  221. value: 1
  222. }, {
  223. name: '积分奖励',
  224. value: 2
  225. }],
  226. currentReward: 1,
  227. player: null,
  228. loading: true,
  229. progress: 0,
  230. code: null,
  231. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  232. scrollTop: 0,
  233. height: '0px',
  234. isLogin: true,
  235. videoUrl: "",
  236. videoId: "",
  237. //现在的时长
  238. playTime: 0,
  239. //总时长
  240. duration: 0,
  241. playDuration: 0,
  242. // 用于续播
  243. playDurationSeek: 0,
  244. // 温馨提醒时间节点,
  245. tipsTime: 0,
  246. tipsOpen: false,
  247. config: {},
  248. courseInfo: {},
  249. quesList: [],
  250. lineList: [],
  251. // 错题
  252. errQues: [],
  253. // 答题机会
  254. remain: 0,
  255. errTitle: "",
  256. errDesc: "",
  257. showPlay: true,
  258. showControls: false,
  259. playStatus: "",
  260. isFullscreen: false,
  261. isAddKf: 0,
  262. lineIndex: 0,
  263. // 是否展开
  264. isExpand: true,
  265. textHeight: 0, //文本高度
  266. qwUserId: "",
  267. qrcode: "",
  268. corpId: "",
  269. qrcodeMsg: "",
  270. urlOption: {},
  271. bufferRate: 0, // 缓冲时间
  272. uuId: "",
  273. isEnded: false,
  274. // 是否允许拖动进度条
  275. linkType: 0,
  276. ip: null,
  277. checked: true,
  278. isFinish: 0, // 是否完课
  279. interval: null,
  280. intervalIntegral: null, // 积分定时
  281. options: {
  282. sources: [{
  283. src: ""
  284. }],
  285. poster: "",
  286. live: false /* 是否直播 */ ,
  287. controls: true,
  288. autoplay: false,
  289. licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323137866_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl,
  290. LicenseKey: 'bcc5bd9a14b798b48c52ff005a21d926',
  291. controlBar: {
  292. volumePanel: false,
  293. playbackRateMenuButton: false,
  294. QualitySwitcherMenuButton: false,
  295. // progressControl: false
  296. },
  297. plugins: {
  298. // ProgressMarker: false,
  299. ContextMenu: {
  300. statistic: false
  301. }
  302. },
  303. },
  304. // 错误请求次数
  305. errorCount: 0,
  306. answerPopup: false,
  307. sortLink:"",
  308. // 课程是否过期
  309. isExpire: false,
  310. menuButtonLeft: 281,
  311. menuButtonH: 45,
  312. timer: null,
  313. flag: false,
  314. msg:'',
  315. poster:''
  316. }
  317. },
  318. filters: {
  319. numberToChinese(number) {
  320. if (number) {
  321. const chineseNumber = ['一', '二', '三', '四', '五', '六', '七', '八', '九'];
  322. return chineseNumber[number - 1];
  323. } else {
  324. return ''
  325. }
  326. },
  327. },
  328. computed: {
  329. isAnswer() {
  330. return (item, name) => {
  331. if (item.type == 1) {
  332. return item.answer == name
  333. } else if (item.type == 2) {
  334. const array = item.answer.split(',')
  335. return array.some(i => i == name)
  336. } else {
  337. return false
  338. }
  339. }
  340. }
  341. },
  342. //发送给朋友
  343. onShareAppMessage(res) {
  344. return {
  345. title: "御君方互联网医院",
  346. path: '/pages/index/index',
  347. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  348. }
  349. },
  350. //分享到朋友圈
  351. onShareTimeline(res) {
  352. return {
  353. title: "御君方互联网医院",
  354. imageUrl: 'https://hos-1309931967.cos.ap-chongqing.myqcloud.com/fs/20230106/6b459adfb1004c1a96219bcdf07e337c.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  355. }
  356. },
  357. onLoad(option) {
  358. this.code = option.code
  359. this.urlOption = option.course ? JSON.parse(option.course) : {}
  360. this.videoId = this.urlOption.videoId
  361. this.qwUserId = this.urlOption.qwUserId || ''
  362. this.corpId = this.urlOption.corpId || ''
  363. this.linkType = this.urlOption.linkType || 0
  364. // if (this.code) {
  365. // this.loginByMp()
  366. // }
  367. var that=this;
  368. // this.videoId=769;
  369. // this.qwUserId=2110;
  370. // this.corpId='ww5a88c4f879f204c5';
  371. // this.linkType=0;
  372. // this.urlOption.videoId=769;
  373. // this.urlOption.courseId=79;
  374. // this.urlOption.companyId=170;
  375. // this.urlOption.companyUserId=3972;
  376. // this.urlOption.qwUserId=1;
  377. // this.urlOption.corpId='ww5a88c4f879f204c5';
  378. // this.urlOption.qwExternalId=6213064;
  379. // this.urlOption.qwUserId=2110;
  380. // this.urlOption.linkType=0;
  381. console.log(this.urlOption)
  382. this.sortLink = this.urlOption.link || ''
  383. this.getMenuButton()
  384. },
  385. onShow() {
  386. this.tipsOpen = false
  387. this.isExpand = true
  388. // this.isLogin = this.$isLoginCourse()
  389. this.uuId = generateRandomString(16)
  390. if (this.videoId) {
  391. this.getH5CourseByVideo()
  392. }
  393. if(this.sortLink){
  394. this.getLink()
  395. } else {
  396. uni.showToast({
  397. title: 'sortLink is not found',
  398. icon: 'none'
  399. });
  400. }
  401. },
  402. mounted() {
  403. this.getIP()
  404. this.getHeight()
  405. },
  406. onHide() {
  407. // this.player = uni.createVideoContext('video-content-box');
  408. if (this.player) {
  409. this.player.pause()
  410. }
  411. // if (this.interval != null) {
  412. // clearInterval(this.interval)
  413. // this.interval = null
  414. // }
  415. },
  416. onUnload() {
  417. if (this.interval != null) {
  418. clearInterval(this.interval)
  419. this.interval = null
  420. }
  421. this.clearIntegral()
  422. },
  423. beforeDestroy() {
  424. this.player = uni.createVideoContext('video-content-box');
  425. if (this.player) {
  426. this.player.stop()
  427. this.player = null
  428. }
  429. if (this.interval != null) {
  430. clearInterval(this.interval)
  431. this.interval = null
  432. }
  433. this.clearIntegral()
  434. },
  435. methods: {
  436. getMenuButton(){
  437. const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  438. this.menuButtonLeft = menuButtonInfo.left
  439. this.menuButtonH = menuButtonInfo.height
  440. },
  441. //播放时间更新事件方法
  442. onTimeUpdate(e){
  443. let currentTime = Math.round(e.detail.currentTime)
  444. if (this.playDurationSeek > 0) {
  445. this.playTime = this.playDurationSeek
  446. this.throttle(() => this.changeTime(this), 1000, false)
  447. } else {
  448. if (this.linkType != 1 && (currentTime - this.playTime > 3 || currentTime - this.playTime < -3)&&this.isFinish!=1) {
  449. uni.showToast({
  450. title: '不能快进哦',
  451. icon: 'none',
  452. });
  453. currentTime = this.playTime
  454. this.player.seek(this.playTime);
  455. }
  456. this.playTime = currentTime
  457. }
  458. },
  459. changeTime(that,e) {
  460. that.playDurationSeek = 0
  461. },
  462. videoErrorCallback(e) {
  463. this.clearIntegral()
  464. this.errorCount++
  465. if (this.errorCount > 3) return
  466. console.log(e)
  467. this.getErrMsg(e.target.errMsg)
  468. this.getH5CourseVideoDetails('error')
  469. },
  470. // 当开始/继续播放时触发play事件
  471. getPlay() {
  472. this.errorCount = 0
  473. this.judgeDuration()
  474. },
  475. getPause() {
  476. this.clearIntegral()
  477. },
  478. getEnded() {
  479. this.clearIntegral()
  480. this.isEnded = true
  481. this.getFinishCourseVideo()
  482. },
  483. getIP() {
  484. uni.request({
  485. url: 'https://ipinfo.io/json', //仅为示例,并非真实接口地址。
  486. method: 'GET',
  487. success: (res) => {
  488. this.ip = res.data.ip
  489. }
  490. });
  491. },
  492. getHeight() {
  493. this.$nextTick(() => {
  494. const query = uni.createSelectorQuery().in(this);
  495. query
  496. .select("#title-content")
  497. .boundingClientRect((data) => {
  498. this.height =
  499. `calc(100vh - ${data.height}px - 420rpx - ${this.statusBarHeight}px - 164rpx - 88rpx)`
  500. })
  501. .exec();
  502. })
  503. },
  504. getDescHeight() {
  505. this.$nextTick(() => {
  506. const query = uni.createSelectorQuery().in(this);
  507. query
  508. .select("#descbox-desc")
  509. .boundingClientRect((data) => {
  510. this.textHeight = data.height
  511. })
  512. .exec();
  513. })
  514. },
  515. numberToLetter(num) {
  516. // 将数字转换为字母的 ASCII 码
  517. let letterCode = num + 65;
  518. // 将 ASCII 码转换为大写字母
  519. let letter = String.fromCharCode(letterCode);
  520. return letter;
  521. },
  522. updateTime() {
  523. var that = this;
  524. if (this.interval != null) {
  525. clearInterval(this.interval)
  526. }
  527. this.interval = setInterval(function() {
  528. that.getFinishCourseVideo()
  529. that.getInternetTraffic()
  530. }, 60000);
  531. },
  532. judgeDuration() {
  533. var that = this;
  534. if (this.intervalIntegral != null) {
  535. clearInterval(this.intervalIntegral)
  536. this.intervalIntegral = null
  537. }
  538. // 观看10分钟获得积分
  539. this.intervalIntegral = setInterval(function() {
  540. that.getIntegralByH5Video()
  541. }, 600000);
  542. },
  543. clearIntegral() {
  544. if (this.intervalIntegral != null) {
  545. clearInterval(this.intervalIntegral)
  546. this.intervalIntegral = null
  547. }
  548. },
  549. // 展开简介
  550. handleExpand() {
  551. this.isExpand = !this.isExpand
  552. },
  553. getH5CourseByVideo() {
  554. this.loading = true
  555. getH5CourseByVideoId({
  556. videoId: this.videoId
  557. }).then(res => {
  558. this.loading = false
  559. if (res.code == 200) {
  560. this.courseInfo = res.data
  561. uni.setNavigationBarTitle({
  562. title: this.courseInfo && this.courseInfo.title ? this.courseInfo.title : ''
  563. });
  564. }
  565. this.getHeight()
  566. this.getDescHeight()
  567. },
  568. rej => {
  569. this.loading = false
  570. }
  571. ).catch(() => {
  572. this.loading = false
  573. })
  574. },
  575. getH5CourseVideoDetails(type) {
  576. getH5CourseVideoDetails(this.urlOption).then(res => {
  577. if (res.code == 200) {
  578. this.config = res.config || {}
  579. this.isFinish = res.isFinish || 0
  580. this.duration = res.course && res.course.duration ? res.course.duration : 0
  581. this.playDuration = res.playDuration || 0
  582. this.playDurationSeek = res.playDuration || 0
  583. this.tipsTime = res.tipsTime || 0
  584. let lineList = []
  585. if (res.course && res.course.lineOne) {
  586. lineList.push(res.course.lineOne)
  587. }
  588. if (res.course && res.course.lineTwo) {
  589. lineList.push(res.course.lineTwo)
  590. }
  591. if (res.course && res.course.lineThree) {
  592. lineList.push(res.course.lineThree)
  593. }
  594. this.lineList = lineList
  595. if (!this.player || type == 'error') {
  596. this.lineIndex = this.config.defaultLine
  597. this.videoUrl = lineList[this.lineIndex]
  598. this.poster= res.course && res.course.imgUrl ? res.course.imgUrl : ''
  599. // this.options.sources = [{
  600. // src: this.videoUrl
  601. // }]
  602. // this.options.poster = res.course && res.course.imgUrl ? res.course.imgUrl : ''
  603. // this.initVideo()
  604. this.playTime = this.playDuration >= this.duration ? 0 : this.playDuration
  605. setTimeout(()=>{
  606. this.player = uni.createVideoContext('video-content-box');
  607. this.player.seek(this.playTime)
  608. this.player.play();
  609. },500);
  610. } else {
  611. // let div = document.querySelector(".vjs-progress-control");
  612. // if(div) {
  613. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  614. // div.style.pointerEvents = "auto";
  615. // } else {
  616. // div.style.pointerEvents = "none"; //禁止所有事件
  617. // }
  618. // }
  619. this.playTime = this.playTime > this.playDuration ? this.playTime : this.playDuration >= this.duration ? 0 : this.playDuration
  620. this.player.seek(this.playTime)
  621. this.player.play();
  622. }
  623. this.updateTime();
  624. this.quesList = res.questions && res.questions.length > 0 ? res.questions : [],
  625. this.quesList = this.quesList.map(item => ({
  626. ...item,
  627. questionOption: JSON.parse(item.question),
  628. answer: ''
  629. }))
  630. }
  631. this.getHeight()
  632. this.getDescHeight()
  633. },
  634. rej => {}
  635. )
  636. },
  637. handleAnswer(item, option, idx) {
  638. let time = this.playTime
  639. if(this.isEnded) {
  640. time = this.duration
  641. } else {
  642. if(time < this.playDuration&&this.isFinish!=1) {
  643. // 没完课且小于续播的时间
  644. time = this.playDuration
  645. }
  646. }
  647. if(Number(this.duration || 0) == 0 || time < this.duration - 60) {
  648. uni.showToast({
  649. title: "请先观看完整课程再答题哦~",
  650. icon: "none"
  651. })
  652. return
  653. }
  654. if (item.type == 1) {
  655. // 单选option
  656. item.answer = option.name
  657. } else if (item.type == 2) {
  658. // 多选
  659. let answer = item.answer ? item.answer.split(',') : []
  660. if (answer.indexOf(option.name) === -1) {
  661. answer.push(option.name)
  662. item.answer = answer.join(',')
  663. } else {
  664. answer.splice(answer.indexOf(option.name), 1)
  665. item.answer = answer.join(',')
  666. }
  667. }
  668. },
  669. submit() {
  670. if(this.isExpire){
  671. uni.showToast({
  672. title: '课程已过期或链接无效',
  673. icon: 'none'
  674. });
  675. return
  676. }
  677. // 登录
  678. this.$isLoginCourse().then(
  679. res => {
  680. if(res){
  681. if (this.isAddKf == 1) {
  682. // 答题
  683. // 您已提交过答案,请领取红包
  684. this.courseAnswer()
  685. } else {
  686. // 添加客服
  687. if (this.videoId && this.qwUserId) {
  688. this.getIsAddKf()
  689. } else {
  690. uni.showToast({
  691. title: '请添加客服',
  692. icon: 'none'
  693. })
  694. }
  695. }
  696. } else{
  697. this.goLogin()
  698. }
  699. },
  700. rej => {}
  701. );
  702. },
  703. // 答题
  704. courseAnswer() {
  705. let time = this.playTime
  706. if (this.isEnded) {
  707. time = this.duration
  708. } else {
  709. if (time < this.playDuration && this.isFinish != 1) {
  710. // 没完课且小于续播的时间
  711. time = this.playDuration
  712. }
  713. }
  714. if (Number(this.duration || 0) == 0 || time < this.duration - 60) {
  715. uni.showToast({
  716. title: "请先观看完整课程再答题哦~",
  717. icon: "none"
  718. })
  719. return
  720. }
  721. if (this.quesList.some(item => !item.answer)) {
  722. uni.showToast({
  723. title: "请确认是否答完所有题目",
  724. icon: "none"
  725. })
  726. return
  727. }
  728. const questions = this.quesList.map(obj => {
  729. const {
  730. questionOption,
  731. ...rest
  732. } = obj;
  733. return rest;
  734. });
  735. const param = {
  736. ...this.urlOption,
  737. questions: questions,
  738. videoId: this.videoId,
  739. duration: this.playTime,
  740. }
  741. this.errTitle = ""
  742. this.errDesc = ""
  743. this.errQues = []
  744. courseAnswer(param).then(res => {
  745. if (res.code == 200) {
  746. if (res.incorrectQuestions) {
  747. // 答题失败
  748. if (res.incorrectQuestions.length > 0) {
  749. this.errQues = res.incorrectQuestions
  750. }
  751. this.remain = res.remain || 0
  752. if (res.remain > 0) {
  753. this.errTitle = "很遗憾答错了"
  754. this.errDesc = `<span style="color:#FF5C03">还有${res.remain}次机会,继续加油</span>`
  755. this.$refs.answerPopup.open("center")
  756. }
  757. } else {
  758. // 答题成功
  759. this.errTitle = "恭喜你,回答正确"
  760. this.errDesc = `请选择奖励`
  761. this.$refs.answerPopup.open("center")
  762. }
  763. } else {
  764. if (res.msg == "该课题到达答错次数限制") {
  765. this.errTitle = "答题次数超过限制"
  766. this.errDesc = "以后的课程要认真学习哦"
  767. this.$refs.answerPopup.open("center")
  768. } else {
  769. uni.showToast({
  770. title: res.msg,
  771. icon: "none"
  772. })
  773. }
  774. }
  775. },
  776. rej => {}
  777. )
  778. },
  779. // 选择
  780. rewardChange(e) {
  781. this.currentReward = e.detail.value
  782. },
  783. closeAnswerPopup() {
  784. this.$refs.answerPopup.close()
  785. if (this.errTitle == '恭喜你,回答正确') {
  786. const param = {
  787. ...this.urlOption,
  788. rewardType: Number(this.currentReward),
  789. source: 2,
  790. appId: 'wxa9be7360a11024a4'
  791. }
  792. sendReward(param).then(res => {
  793. uni.showToast({
  794. title: res.msg,
  795. icon: 'none'
  796. })
  797. // if(res.code == 200) {
  798. // //重构 发红包,后台通过OPENID发零钱到 账
  799. // //this.initWXConfig(res.package)
  800. // }else {
  801. // uni.showToast({
  802. // title: res.msg,
  803. // icon: 'none'
  804. // })
  805. // }
  806. })
  807. }
  808. },
  809. // 线路
  810. openPop() {
  811. this.$refs.popup.open('bottom')
  812. },
  813. close() {
  814. this.$refs.popup.close()
  815. },
  816. handleLine(index) {
  817. var that=this;
  818. if (this.lineIndex == index && this.videoUrl == this.lineList[index]) {
  819. this.close()
  820. return
  821. } else {
  822. // let div = document.querySelector(".vjs-progress-control");
  823. // if(div) {
  824. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  825. // div.style.pointerEvents = "auto";
  826. // } else {
  827. // div.style.pointerEvents = "none"; //禁止所有事件
  828. // }
  829. // }
  830. this.lineIndex = index
  831. this.videoUrl = this.lineList[index]
  832. this.tipsOpen = false
  833. this.playDurationSeek = this.playTime || 0
  834. this.player = uni.createVideoContext('video-content-box');
  835. setTimeout(function(){
  836. that.player.seek(that.playDurationSeek)
  837. that.player.play();
  838. },500);
  839. // this.player.src(this.lineList[index])
  840. // this.player.one('loadedmetadata', () => {
  841. // this.player.currentTime(this.playDurationSeek);
  842. // this.player.play();
  843. // });
  844. this.close()
  845. }
  846. },
  847. // 温馨提示
  848. openTipsPop() {
  849. this.$refs.tipsPopup.open()
  850. this.tipsOpen = true
  851. this.pause()
  852. },
  853. closeTipsPop() {
  854. this.$refs.tipsPopup.close()
  855. },
  856. // 客服
  857. getIsAddKf() {
  858. this.qrcode = ''
  859. this.qrcodeMsg = ''
  860. this.isAddKf = 0
  861. // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
  862. getIsAddKf(this.urlOption).then(res => {
  863. if (res.code == 200) {
  864. this.isAddKf = 1
  865. this.getH5CourseVideoDetails()
  866. } else if (res.code == 400) {
  867. this.isAddKf = 0
  868. this.qrcode = res.qrcode
  869. this.qrcodeMsg = res.msg
  870. this.$refs.kfPopup.open()
  871. } else if (res.code == 504) {
  872. // 登录
  873. this.goLogin()
  874. } else {
  875. this.isAddKf = 0
  876. uni.showToast({
  877. title: res.msg,
  878. icon: 'none'
  879. });
  880. }
  881. },
  882. err => {}
  883. );
  884. },
  885. closeKFPop() {
  886. this.$refs.kfPopup.close()
  887. },
  888. getFinishCourseVideo() {
  889. if (!this.playTime) return
  890. // {videoId: this.videoId,duration:this.playTime}
  891. const param = {
  892. duration: this.playTime,
  893. ...this.urlOption
  894. }
  895. getFinishCourseVideo(param)
  896. },
  897. // 每十分钟获得积分
  898. getIntegralByH5Video() {
  899. const param = {
  900. duration: this.playTime,
  901. ...this.urlOption
  902. }
  903. getIntegralByH5Video(param).then(res => {
  904. if (res.code == 200) {
  905. uni.showToast({
  906. title: "积分+10",
  907. icon: "none"
  908. })
  909. }
  910. })
  911. },
  912. progressChange(e) {
  913. this.bufferRate = Math.ceil(e.detail.buffered)
  914. },
  915. // 缓冲
  916. getInternetTraffic() {
  917. const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
  918. if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
  919. this.bufferRate = playVideoTime
  920. }
  921. if(this.bufferRate == 0 || Number(this.bufferRate.toFixed(2)) == 0) return
  922. const param = {
  923. uuId: dayjs().format('YYYYMMDD') + this.uuId,
  924. duration: this.playTime,
  925. bufferRate: Number(this.bufferRate.toFixed(2)),
  926. ...this.urlOption
  927. }
  928. getInternetTraffic(param)
  929. },
  930. getErrMsg(err) {
  931. let msgerr = {
  932. videoUrl: this.videoUrl,
  933. lineIndex: this.lineIndex,
  934. errTime: new Date(),
  935. ip: this.ip,
  936. errMsg: err
  937. }
  938. getErrMsg({
  939. msg: JSON.stringify(msgerr)
  940. })
  941. },
  942. goLogin() {
  943. let provider = 'weixin'
  944. uni.login({
  945. provider: provider,
  946. success: async loginRes => {
  947. console.log(loginRes)
  948. uni.getUserInfo({
  949. provider: provider,
  950. success: (infoRes)=> {
  951. uni.showToast({
  952. title: '处理中...',
  953. icon: 'loading'
  954. });
  955. console.log("code==",loginRes.code)
  956. loginByMp({
  957. code: loginRes.code,
  958. encryptedData:infoRes.encryptedData,
  959. iv:infoRes.iv,
  960. appId: 'wxa9be7360a11024a4'
  961. }).then(res=>{
  962. uni.hideLoading();
  963. if (res.code == 200) {
  964. uni.setStorageSync('AppTokenmini_RTCourse', res.token);
  965. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  966. this.isLogin = true
  967. this.getIsAddKf()
  968. } else {
  969. uni.showToast({
  970. title: res.msg,
  971. icon: 'none'
  972. });
  973. }
  974. }).catch(err=>{
  975. uni.hideLoading();
  976. uni.showToast({
  977. icon:'none',
  978. title: "登录失败,请重新登录",
  979. });
  980. });
  981. }
  982. });
  983. }
  984. })
  985. },
  986. getLink() {
  987. this.goLogin()
  988. return
  989. let that = this;
  990. this.msg = ''
  991. getRealLink({sortLink:this.sortLink}).then(res=>{
  992. if(res.code == 200) {
  993. this.isExpire = false
  994. // 如果响应中包含真实链接,则跳转到真实链接
  995. // window.location.href = res.realLink +"&sortLink="+this.sortLink+"&code="+this.code+"&time="+new Date().getTime()
  996. if (this.isLogin && this.isAddKf == 1) {
  997. this.getH5CourseVideoDetails()
  998. }
  999. if (this.videoId && this.isAddKf != 1) {
  1000. this.$isLoginCourse().then(
  1001. isLogin => {
  1002. this.isLogin = isLogin
  1003. if(isLogin){
  1004. this.getIsAddKf()
  1005. } else {
  1006. this.goLogin()
  1007. }
  1008. },
  1009. rej => {}
  1010. );
  1011. }
  1012. } else {
  1013. this.isExpire = true
  1014. this.msg = '课程已过期或链接无效'
  1015. uni.showToast({
  1016. title: '课程已过期或链接无效',
  1017. icon: 'none'
  1018. });
  1019. }
  1020. }).catch(err=>{
  1021. this.isExpire = true
  1022. this.msg = '发生错误,请稍后再试'
  1023. uni.showToast({
  1024. title: '发生错误,请稍后再试',
  1025. icon: 'none'
  1026. });
  1027. })
  1028. },
  1029. /**
  1030. * 节流原理:在一定时间内,只能触发一次
  1031. *
  1032. * @param {Function} func 要执行的回调函数
  1033. * @param {Number} wait 延时的时间
  1034. * @param {Boolean} immediate 是否立即执行
  1035. * @return null
  1036. */
  1037. throttle(func, wait = 500, immediate = true) {
  1038. if (immediate) {
  1039. if (!this.flag) {
  1040. this.flag = true
  1041. // 如果是立即执行,则在wait毫秒内开始时执行
  1042. typeof func === 'function' && func()
  1043. this.timer = setTimeout(() => {
  1044. this.flag = false
  1045. }, wait)
  1046. }
  1047. } else if (!this.flag) {
  1048. this.flag = true
  1049. // 如果是非立即执行,则在wait毫秒内的结束处执行
  1050. this.timer = setTimeout(() => {
  1051. this.flag = false
  1052. typeof func === 'function' && func()
  1053. }, wait)
  1054. }
  1055. }
  1056. }
  1057. }
  1058. </script>
  1059. <style scoped>
  1060. .full-width-popup {
  1061. width: 100%;
  1062. }
  1063. </style>
  1064. <style lang="scss" scoped>
  1065. @mixin u-flex($flexD, $alignI, $justifyC) {
  1066. display: flex;
  1067. flex-direction: $flexD;
  1068. align-items: $alignI;
  1069. justify-content: $justifyC;
  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) + 32rpx);
  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>