video.vue 45 KB

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