video.vue 44 KB

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