videovip.vue 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464
  1. <template>
  2. <view class="content " >
  3. <!-- <view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
  4. <u-icon name="arrow-left" size="28" @click="tosales" v-if="appToken"></u-icon>
  5. <view class="header-title" :style="{width:menuButtonLeft + 'px',height:menuButtonH+'px',lineHeight:menuButtonH+'px'}">{{courseInfo.title}}</view>
  6. </view> -->
  7. <view class="video-box" v-if="!videoItem">
  8. <image v-if="!isLogin || isAddKf!=1" class="video-poster" :src="courseInfo.imgUrl" mode="aspectFill">
  9. </image>
  10. <video
  11. @timeupdate="onTimeUpdate"
  12. @progress="progressChange"
  13. @error="videoErrorCallback"
  14. @play="getPlay"
  15. @pause="getPause"
  16. @ended="getEnded"
  17. @fullscreenchange="fullscreenchange"
  18. :title="courseInfo.title"
  19. style="width: 100%;height: 420rpx;"
  20. :poster="poster"
  21. id="video-content-box"
  22. controls
  23. :auto-pause-if-open-native="true"
  24. :auto-pause-if-navigate="true"
  25. :enable-progress-gesture="false"
  26. :show-progress="true"
  27. :picture-in-picture-mode="[]"
  28. :show-background-playback-button="false"
  29. :src="videoUrl">
  30. <!-- <cover-image v-if="courseLogo" :class="isFull?'logo-full':'logo'" :src="courseLogo" mode="widthFix"></cover-image> -->
  31. </video>
  32. </view>
  33. <view class="video-box" v-else>
  34. <video
  35. id="video-content-box"
  36. style="width: 100%;height: 420rpx;"
  37. :src="videoItem.videoUrl"
  38. >
  39. </video>
  40. </view>
  41. <view class="justify-start align-center fs24 base-color-9" v-if="userInfo.userId">
  42. <view>{{nameuser?nameuser:'暂未授权昵称'}}#</view>
  43. <view>{{userInfo.userId}}</view>
  44. </view>
  45. <view class="title-content" id="title-content">
  46. <!-- 答题时展示小节课程名,其他展示课程名 -->
  47. <!-- 小节课程名 -->
  48. <view class="subtitlebox " v-if="isLogin&&isAddKf==1">
  49. {{courseInfo.title}}
  50. </view>
  51. <!-- 课程名字 -->
  52. <view class="miantitlebox" v-else>
  53. {{courseInfo.courseName}}
  54. </view>
  55. </view>
  56. <scroll-view class="scroll-view" :style="{height: height}" :scroll-top="scrollTop" scroll-y="true">
  57. <!-- 介绍 -->
  58. <view class="descbox">
  59. <template v-if="!isLogin||isAddKf!=1">
  60. <view class="descbox-title">{{courseInfo.title}}</view>
  61. <view class="descbox-info">
  62. <!-- <view class="descbox-info-l">
  63. <view>{{courseInfo.views}}次播放</view>
  64. <view class="descbox-info-time">总时长:{{courseInfo.totalDuration}}</view>
  65. </view> -->
  66. <view class="descbox-info-r expand" v-if="textHeight > 21">
  67. <text @click="handleExpand">{{isExpand ? '收起简介' : '展开简介'}}</text>
  68. <image :src="imgPath+'/app/image/course_arrow_up_icon.png'" v-show="isExpand"></image>
  69. <image :src="imgPath+'/app/image/course_arrow_down_icon.png'" v-show="!isExpand"></image>
  70. </view>
  71. </view>
  72. </template>
  73. <view class="descbox-desc" id="descbox-desc" :style="{height: isExpand ? 'auto': '42rpx'}">
  74. <text>{{courseInfo.description==null?'暂无简介':courseInfo.description}}</text>
  75. <view :class="isExpand ? 'expand': 'expand expand-ab'" v-if="isLogin&&isAddKf==1&&textHeight > 21">
  76. <text @click="handleExpand">{{isExpand ? '收起简介' : '展开简介'}}</text>
  77. <image :src="imgPath+'/app/image/course_arrow_up_icon.png'" v-show="isExpand"></image>
  78. <image :src="imgPath+'/app/image/course_arrow_down_icon.png'" v-show="!isExpand"></image>
  79. </view>
  80. </view>
  81. </view>
  82. <!-- 无效或者已过期 -->
  83. <view class="nocourse" v-if="msg">
  84. <image :src="imgPath+'/app/image/course_expiration_img.png'" mode="widthFix"></image>
  85. <view>{{msg}}</view>
  86. </view>
  87. <!-- 问题 -->
  88. <view class="ques-content" v-if="isLogin&&isAddKf==1">
  89. <view class="ques-content-tit" v-if="isLogin &&!isquestion" >问答题</view>
  90. <view v-for="(item,index) in quesList" :key="index">
  91. <view class="ques-title">
  92. <text >{{index + 1}}.</text>
  93. <view class="ques-type" v-show="item.type == 1 || item.type == 2">
  94. {{item.type == 1 ? '单选' : item.type == 2 ? '多选' : ''}}
  95. </view>
  96. <text class="fs40">{{item.title}}</text>
  97. </view>
  98. <view
  99. :class="isAnswer(item,option.name) ?'ques-option ques-option-active':'ques-option'"
  100. v-for="(option,idx) in item.questionOption"
  101. :key="idx"
  102. @click="handleAnswer(item,option)">
  103. <view class="fs40">
  104. {{numberToLetter(idx)}}.
  105. </view>
  106. <view class="fs40">{{option.name}}</view>
  107. </view>
  108. </view>
  109. </view>
  110. </scroll-view>
  111. <!-- 线路 -->
  112. <!-- <view class="video-line" @click="openPop" v-if="isLogin&&isAddKf==1">
  113. <image :src="imgPath+'/app/image/changePlayer-icon.png'"></image>
  114. <text>线路{{lineIndex + 1 | numberToChinese}}</text>
  115. </view> -->
  116. <!-- 线路弹窗 -->
  117. <!-- <uni-popup ref="popup" type="bottom" class="full-width-popup">
  118. <view class="popupbox">
  119. <view class="popupbox-head">
  120. <text>线路选择</text>
  121. <image class="close-icon" :src="imgPath+'/app/image/tc_close_icon.png'" mode="aspectFill" @click="close">
  122. </image>
  123. </view>
  124. <view class="popupbox-content">
  125. <view :class="lineIndex == index ? 'line-item line-active': 'line-item'"
  126. v-for="(it,index) in lineList" :key="index" @click="handleLine(index)">
  127. 线路{{index + 1 | numberToChinese}}</view>
  128. </view>
  129. </view>
  130. </uni-popup> -->
  131. <!-- 温馨提示弹窗 -->
  132. <u-popup :show="tipsPopup" mode="center" :closeOnClickOverlay='true' @close='tipsPopup=!tipsPopup'
  133. :safeAreaInsetBottom='false' round='12'>
  134. <view class="tipsPopup-mask">
  135. <image class="red_envelope_top" :src="imgPath+'/app/image/red_envelope_img.png'" mode="aspectFill"></image>
  136. <view class="tipsPopup">
  137. <image class="tipsPopup-close" :src="imgPath+'/app/image/course_close_white_icon.png'" mode="aspectFill"
  138. @click="closeTipsPop"></image>
  139. <view class="tipsPopup-line">
  140. <view class="tipsPopup-box">
  141. <view class="tipsPopup-head">
  142. <image class="tipsPopup-head-title" :src="imgPath+'/app/image/tips_title_img.png'"
  143. mode="widthFix"></image>
  144. </view>
  145. <view class="tipsPopup-content">
  146. <view class="tipsPopup-content-title">亲爱的用户,</view>
  147. <view>您已经观看课程{{timepath}}的时间了,请注意休息并保持专注。</view>
  148. </view>
  149. <view class="tipsPopup-btn-box">
  150. <view class="tipsPopup-btn" @click="closeTipsPop">继续观看领奖励</view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. </u-popup>
  157. <!-- 答题弹窗 -->
  158. <u-popup :show="answerPopup" mode="center" @close="closepop()" @open="open" closeOnClickOverlay
  159. :safeAreaInsetBottom='false' round='12'>
  160. <view :class="errTitle == '恭喜你,回答正确' ? 'answerPopup-box bg':'answerPopup-box'">
  161. <!-- 正确 -->
  162. <image class="tipimg" v-if="errTitle == '恭喜你,回答正确'" :src="imgPath+'/app/image/course_answer_img.png'"
  163. mode="aspectFill"></image>
  164. <!-- 错误 -->
  165. <image class="tipimg" v-else :src="imgPath+'/app/image/course_answer_incorrectly_img.png'" mode="aspectFill">
  166. </image>
  167. <view class="answerPopup-title">{{errTitle}}</view>
  168. <view class="answerPopup-desc" v-html="errDesc"></view>
  169. <!-- 选择奖励 -->
  170. <!-- 错误题目 -->
  171. <view class="errQuesbox" v-if="errQues&&errQues.length>0">
  172. <view class="errQuesbox-item textOne" v-for="(it,index) in errQues" :key="index">{{it.title}}</view>
  173. </view>
  174. <view class="answerPopup-btn" v-if="errTitle == '恭喜你,回答正确'" @click="closeAnswerPopup">点击领取红包</view>
  175. <view class="tipsPopup-btn-box" v-else
  176. :style="{marginTop: errQues&&errQues.length>0 ? '40rpx':'54rpx'}">
  177. <view class="tipsPopup-btn" @click="closeAnswerPopup">{{remain > 0 ? '重新答题': '确认'}}</view>
  178. </view>
  179. </view>
  180. </u-popup>
  181. <!-- 客服二维码弹窗 -->
  182. <u-popup :show="kfPopup" mode="center" :mask-click="false" round='12' @close="kefpop">
  183. <view class="kfqrcode-box">
  184. <view class="justify-start align-center fs24 base-color-9">
  185. <view>{{nameuser}}#</view>
  186. <view>{{userInfo.userId}}</view>
  187. </view>
  188. <view>请添加客服</view>
  189. <image class="kfqrcode" :src="qrcode" show-menu-by-longpress="true" mode="aspectFit"></image>
  190. <!-- <view v-show="qrcodeMsg" style="margin-top: 30rpx;" v-html="qrcodeMsg"></view> -->
  191. <!-- <image class="kfqrcode-close" :src="imgPath+'/app/image/course_close_white_icon.png'" mode="aspectFill"
  192. @click="closeKFPop"></image> -->
  193. </view>
  194. </u-popup>
  195. <u-popup :show="timepop" mode="center" round='12'>
  196. <view class="timepopbox center column">
  197. <view class="fs40 bold ">不在看课时间范围内</view>
  198. <view class="mtb20">看课时间</view>
  199. <view >{{videocont.startDateTime}}</view>
  200. <view>至</view>
  201. <view >{{videocont.endDateTime}}</view>
  202. <view class="base-bg-orange colorf p20 radius50 mt20"
  203. @click="getH5CourseVideoDetails">刷新时间</view>
  204. </view>
  205. </u-popup>
  206. <u-popup :show="userlogo" mode="bottom" round='12'>
  207. <view class="userlogo column">
  208. <view class="mtb30 justify-start align-center ml20">
  209. <u-avatar :src="imgPath+'/app/image/logo.png'" size="50"></u-avatar>
  210. <view class="bold mlr20">{{imgname}}</view>
  211. <view>申请</view>
  212. </view>
  213. <view class="bold fs36 ml20">授权你的昵称头像信息</view>
  214. <view class="mtb20 justify-between align-center plr20">
  215. <view class="justify-start align-center">
  216. <view class="boxweixin" :class="userinfos.nickname==''?'boxnosel':'boxsel'">
  217. <view v-if="userinfos.nickname">√</view>
  218. </view>
  219. <view class="ml20">
  220. <view class="base-color-3 bold">第一步</view>
  221. <view class="fs32 base-color-9">请点击授权微信昵称</view>
  222. </view>
  223. </view>
  224. <view class="button-container">
  225. <input
  226. type="nickname"
  227. class="hidden-input"
  228. @blur="onNickNameInput"
  229. @input="onNickNameInput"
  230. />
  231. <button class="custom-button" :class="nameuser==''?'subname':'subavt'">{{nameuser?"已授权":'允许授权'}}</button>
  232. </view>
  233. </view>
  234. <view class="mtb20 justify-between align-center plr20 mt40">
  235. <view class="justify-start align-center">
  236. <view class="boxweixin" :class="userinfos.nickname==''?'boxnosel':'boxsel'">
  237. <view v-if="userinfos.avatar">√</view>
  238. </view>
  239. <view class="ml20">
  240. <view class="base-color-3 bold">第二步</view>
  241. <view class="fs32 base-color-9">请点击授权微信头像</view>
  242. </view>
  243. </view>
  244. <view class="button-container">
  245. <button open-type="chooseAvatar" @chooseavatar="onChooseAvatar" class="hidden-input"
  246. v-if="nameuser">
  247. 允许授权
  248. </button>
  249. <button class="custom-button sub" @click="shouquan" v-if="nameuser==''">允许授权</button>
  250. <button class="custom-button " :class="avataruser==''?'subname':'subavt'"
  251. v-else>{{avataruser?"已授权":'允许授权'}}</button>
  252. </view>
  253. </view>
  254. <view class="submitname" @click="confimrname" :class="nameuser&&avataruser?'subact':'sub'">确定</view>
  255. </view>
  256. </u-popup>
  257. <view class="footer-tips">重庆云联融智提供技术支持</view>
  258. <!-- footer -->
  259. <view class="footer" v-if="videoId">
  260. <view class="btns" >
  261. <!-- <button
  262. class="author-btn"
  263. open-type="getphonenumber"
  264. @getphonenumber="phoneLogin"
  265. >{{isLogin&&isAddKf==1 ? '提交答案领取奖励' : '立即学习'}}</button> -->
  266. <button
  267. class="author-btn"
  268. open-type="getPhoneNumber"
  269. @getphonenumber="phoneLogin" v-if="!isquestion&&authType==1">{{isLogin&&isAddKf==1 ? '提交答案领取奖励' : '立即学习'}}</button>
  270. <button
  271. class="author-btn"
  272. open-type="getUserInfo" :disabled="userdisabled"
  273. @getuserinfo="userInfologin" v-if="authType==0&&!isquestion">{{isLogin&&isAddKf==1 ? '提交答案领取奖励' : '立即学习'}}</button>
  274. <!-- <view class="author-btn" @click="phoneLogin"> {{isLogin&&isAddKf==1 ? '提交答案领取奖励' : '立即学习'}}</view> -->
  275. <button class="author-btn" v-if="isLogin &&!isquestion"
  276. @click="submit">{{isLogin&&isAddKf==1 ?'提交答案领取奖励' : '立即学习'}}</button>
  277. </view>
  278. </view>
  279. <u-loading-page :loading="viewload" iconSize="32" loadingColor="#3c9cff" fontSize="24"
  280. :loading-text="loadingtext"></u-loading-page>
  281. </view>
  282. </template>
  283. <script>
  284. import { generateRandomString} from "@/utils/common.js"
  285. import dayjs from 'dayjs';
  286. import {
  287. getErrMsg,
  288. getH5CourseByVideoId,
  289. getH5CourseVideoDetails,
  290. courseAnswer,
  291. getFinishCourseVideo,
  292. getIsAddKf,
  293. getInternetTraffic,
  294. getIntegralByH5Video,
  295. sendReward,
  296. getRealLink,
  297. checkUserInfo,
  298. editUser,
  299. loginByMiniApp
  300. } from "@/api/courseLook.js"
  301. export default {
  302. data() {
  303. return {
  304. videoItem:{},
  305. viewload:true,
  306. loadingtext:"数据加载中...",
  307. baseUrl:uni.getStorageSync('requestPath'),
  308. // 1 红包 2 积分
  309. rewardType: [{
  310. name: '红包奖励',
  311. value: 1
  312. }, {
  313. name: '积分奖励',
  314. value: 2
  315. }],
  316. currentReward: 1,
  317. player: null,
  318. loading: true,
  319. progress: 0,
  320. code: null,
  321. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  322. scrollTop: 0,
  323. height: '0px',
  324. isLogin: false,
  325. videoUrl: "",
  326. videoId: "",
  327. //现在的时长
  328. playTime: 0,
  329. //总时长
  330. duration: 0,
  331. playDuration: 0,
  332. // 用于续播
  333. playDurationSeek: 0,
  334. // 温馨提醒时间节点,
  335. tipsTime: 0,
  336. tipsOpen: false,
  337. config: {},
  338. courseInfo: {},
  339. quesList: [],
  340. lineList: [],
  341. // 错题
  342. errQues: [],
  343. // 答题机会
  344. remain: 0,
  345. errTitle: "",
  346. errDesc: "",
  347. showPlay: true,
  348. showControls: false,
  349. playStatus: "",
  350. isFull: false,
  351. isAddKf: 0,
  352. lineIndex: 0,
  353. // 是否展开
  354. isExpand: true,
  355. textHeight: 0, //文本高度
  356. qwUserId: "",
  357. qrcode: "",
  358. corpId: "",
  359. periodId:"",//营期id
  360. companyUserId:"",//销售id
  361. companyId:"",//公司id
  362. courseId:"",//课程id
  363. qrcodeMsg: "",
  364. urlOption: {},
  365. bufferRate: 0, // 缓冲时间
  366. uuId: "",
  367. isEnded: false,
  368. // 是否允许拖动进度条
  369. ip: null,
  370. checked: true,
  371. isFinish: 0, // 是否完课
  372. interval: null,
  373. intervalIntegral: null, // 积分定时
  374. options: {
  375. sources: [{
  376. src: ""
  377. }],
  378. poster: "",
  379. live: false /* 是否直播 */ ,
  380. controls: true,
  381. autoplay: false,
  382. licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1323137866_1/v_cube.license', // license 地址,参考准备工作部分,在视立方控制台申请 license 后可获得 licenseUrl,
  383. LicenseKey: 'bcc5bd9a14b798b48c52ff005a21d926',
  384. controlBar: {
  385. volumePanel: false,
  386. playbackRateMenuButton: false,
  387. QualitySwitcherMenuButton: false,
  388. // progressControl: false
  389. },
  390. plugins: {
  391. // ProgressMarker: false,
  392. ContextMenu: {
  393. statistic: false
  394. }
  395. },
  396. },
  397. // 错误请求次数
  398. errorCount: 0,
  399. answerPopup: false,
  400. sortLink:"",
  401. // 课程是否过期
  402. isExpire: false,
  403. menuButtonLeft: 281,
  404. menuButtonH: 45,
  405. timer: null,
  406. flag: false,
  407. msg:'',
  408. poster:'',
  409. userInfo:{},
  410. timeid:'',
  411. videocont:{},
  412. timepop:false,
  413. appToken:'',
  414. kfPopup:false,
  415. iskftype:0,
  416. courseLogo: '',
  417. isquestion:false,
  418. tipsPopup:false,
  419. timepath:'3分之1',
  420. tipsTime2:0,
  421. userlogo:false,
  422. userinfos:{
  423. nickname:"",
  424. avatar:""
  425. },
  426. headImg:'',
  427. authType:0,//0微信登录 1手机号登录
  428. userdisabled:false,
  429. projectId:''
  430. }
  431. },
  432. filters: {
  433. numberToChinese(number) {
  434. if (number) {
  435. const chineseNumber = ['一', '二', '三', '四', '五', '六', '七', '八', '九'];
  436. return chineseNumber[number - 1];
  437. } else {
  438. return ''
  439. }
  440. },
  441. },
  442. computed: {
  443. isAnswer() {
  444. return (item, name) => {
  445. if (item.type == 1) {
  446. return item.answer == name
  447. } else if (item.type == 2) {
  448. const array = item.answer.split(',')
  449. return array.some(i => i == name)
  450. } else {
  451. return false
  452. }
  453. }
  454. },
  455. imgPath() {
  456. return this.$store.state.imgpath
  457. },
  458. imgname() {
  459. return this.$store.state.logoname
  460. },
  461. appid() {
  462. return this.$store.state.appid
  463. },
  464. nameuser() {
  465. return this.userinfos.nickname
  466. },
  467. avataruser() {
  468. return this.userinfos.avatar
  469. },
  470. },
  471. //发送给朋友
  472. // onShareAppMessage(res) {
  473. // return {
  474. // title: this.$store.state.logoname,
  475. // // path: '/pages/index/index',
  476. // imageUrl: this.$store.state.imgpath+'/app/image/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  477. // }
  478. // },
  479. // //分享到朋友圈
  480. // onShareTimeline(res) {
  481. // return {
  482. // title: this.$store.state.logoname,
  483. // imageUrl: this.$store.state.imgpath+'/app/image/logo.png' //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  484. // }
  485. // },
  486. onLoad(option) {
  487. console.log("option",option)
  488. this.videoContext = uni.createVideoContext('video-content-box', this)
  489. this.code = option.code
  490. if(uni.getStorageSync('userInfo')&&JSON.stringify(uni.getStorageSync('userInfo'))!='{}') {
  491. this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
  492. } else {
  493. this.userInfo = {}
  494. }
  495. this.appToken=uni.getStorageSync('companyUserInfo')
  496. // decodeURIComponent()
  497. if(!option.course&&!option.videoitem){
  498. const keys = decodeURIComponent(Object.keys(option)[0]);
  499. this.urlOption=JSON.parse(keys.split('course=')[1])
  500. }else if(option.videoitem){
  501. this.videoItem=option.videoitem ? JSON.parse(option.videoitem) : {}
  502. this.videoId=this.videoItem.videoId
  503. console.log("optionqqq",this.videoItem)
  504. console.log("option111",this.videoItem.videoId)
  505. return
  506. }else if(option.course){
  507. this.urlOption = option.course ? JSON.parse(option.course) : {}
  508. }
  509. this.projectId=this.urlOption.projectId
  510. this.videoId = this.urlOption.videoId
  511. this.courseId = this.urlOption.courseId
  512. this.periodId = this.urlOption.periodId
  513. this.companyId = this.urlOption.companyId
  514. this.companyUserId = this.urlOption.companyUserId
  515. this.timeid=this.urlOption.id
  516. console.log(this.urlOption)
  517. console.log(decodeURIComponent(option.course))
  518. // this.sortLink = this.urlOption.link || ''
  519. this.getMenuButton()
  520. // #ifdef MP-WEIXIN
  521. // if(this.$store.state.logoname!=='乐氏本源'&&!uni.getStorageSync('userInfos')){
  522. // this.userlogo=true
  523. // }
  524. console.log(uni.getStorageSync('userInfos'))
  525. if(!uni.getStorageSync('userInfos')&&this.$store.state.logoname=='乐氏本源'){
  526. uni.navigateTo({
  527. url:'/pages_course/webview'
  528. })
  529. return
  530. }
  531. // #endif
  532. },
  533. onShow() {
  534. this.tipsOpen = false
  535. this.isExpand = true
  536. this.uuId = generateRandomString(16)
  537. if (this.videoId) {
  538. this.getH5CourseByVideo()
  539. }
  540. const AppToken=uni.getStorageSync('TOKEN_WEXIN')
  541. console.log(AppToken)
  542. if(AppToken){
  543. // this.isLogin=true
  544. if(this.isAddKf == 1){
  545. this.getH5CourseVideoDetails()
  546. } else{
  547. this.checkUserInfoA()
  548. // this.getIsAddKf()
  549. }
  550. }
  551. // if(this.sortLink){
  552. // this.getLink()
  553. // } else {
  554. // uni.showToast({
  555. // title: 'sortLink is not found',
  556. // icon: 'none'
  557. // });
  558. // }
  559. },
  560. mounted() {
  561. // this.getIP()
  562. this.getHeight()
  563. },
  564. onHide() {
  565. // this.player = uni.createVideoContext('video-content-box');
  566. if (this.player) {
  567. this.player.pause()
  568. }
  569. // if (this.interval != null) {
  570. // clearInterval(this.interval)
  571. // this.interval = null
  572. // }
  573. },
  574. onUnload() {
  575. if (this.interval != null) {
  576. clearInterval(this.interval)
  577. this.interval = null
  578. }
  579. this.clearIntegral()
  580. },
  581. beforeDestroy() {
  582. this.player = uni.createVideoContext('video-content-box');
  583. if (this.player) {
  584. this.player.stop()
  585. this.player = null
  586. }
  587. if (this.interval != null) {
  588. clearInterval(this.interval)
  589. this.interval = null
  590. }
  591. this.clearIntegral()
  592. },
  593. methods: {
  594. //检查用户昵称以及头像
  595. checkUserInfoA(){
  596. checkUserInfo().then(res=>{
  597. if(res.code==200){
  598. this.isLogin = true
  599. this.userInfo= res.user
  600. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  601. console.log(uni.getStorageSync('userInfos'))
  602. if(this.nameuser==''){
  603. this.userinfos.nickname=this.userInfo.nickname
  604. }
  605. let that=this
  606. setTimeout(()=>{
  607. that.getIsAddKf()
  608. },100)
  609. }else if(res.code==500){
  610. if(res.authType==2){
  611. uni.setStorageSync('authUrl',res.domain)
  612. if(!uni.getStorageSync('userInfos')){
  613. uni.navigateTo({
  614. url:'/pages_course/webview'
  615. })
  616. return
  617. }
  618. this.editUserA()
  619. }else{
  620. this.userlogo=true
  621. }
  622. }else{
  623. uni.showToast({
  624. icon:'none',
  625. title:res.msg,
  626. });
  627. }
  628. })
  629. },
  630. //修改用户昵称以及头像
  631. editUserA(){
  632. this.userinfos=uni.getStorageSync('userInfos')?uni.getStorageSync('userInfos'):this.userinfos
  633. const data={
  634. nickname:this.userinfos.nickname,
  635. avatar:this.userinfos.avatar,
  636. }
  637. editUser(data).then(res=>{
  638. if(res.code==200){
  639. this.isLogin = true
  640. uni.showToast({
  641. icon:'none',
  642. title:'修改成功!',
  643. });
  644. setTimeout(()=>{
  645. this.getIsAddKf()
  646. },100)
  647. }else{
  648. uni.removeStorageSync('userInfos')
  649. uni.showToast({
  650. icon:'none',
  651. title:res.msg+'请重新点击立即学习',
  652. });
  653. }
  654. })
  655. },
  656. shouquan(){
  657. if(this.userinfos.nickname==''){
  658. uni.showToast({
  659. icon:'none',
  660. title: "请先授权微信昵称",
  661. });
  662. }
  663. },
  664. confimrname(){
  665. if(this.userinfos.nickname==''){
  666. uni.showToast({
  667. icon:'none',
  668. title: "请授权微信昵称",
  669. });
  670. return
  671. }
  672. if(this.userinfos.avatar==''){
  673. uni.showToast({
  674. icon:'none',
  675. title: "请授权微信头像",
  676. });
  677. return
  678. }
  679. uni.setStorageSync('userInfos',this.userinfos)
  680. this.editUserA()
  681. this.userlogo=false
  682. },
  683. onChooseAvatar(e){
  684. this.userinfos.avatar=e.detail.avatarUrl
  685. uni.uploadFile({
  686. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', //仅为示例,非真实的接口地址
  687. filePath: e.detail.avatarUrl,
  688. name: 'file',
  689. formData: {
  690. 'user': 'test' // 上传附带参数
  691. },
  692. success: (uploadFileRes) => {
  693. console.log(uploadFileRes)
  694. // 根据接口具体返回格式 赋值具体对应url
  695. var data=JSON.parse(uploadFileRes.data)
  696. this.headImg=uni.getStorageSync('requestPath')+data.fileName
  697. this.userinfos.avatar=data.url
  698. }
  699. });
  700. },
  701. onNickNameInput(e){
  702. console.log(e)
  703. this.userinfos.nickname=e.detail.value
  704. },
  705. kefpop(){
  706. if(this.appToken){
  707. this.kfPopup==false
  708. }
  709. },
  710. tosales(){
  711. uni.switchTab({
  712. url:"/pages/index/index"
  713. })
  714. },
  715. closepop(){
  716. this.answerPopup=false
  717. },
  718. open(){
  719. },
  720. userInfologin(e){
  721. console.log(e)
  722. this.userdisabled=true
  723. uni.showLoading({
  724. title: "处理中..."
  725. });
  726. if (e.mp.detail.errMsg == 'getUserInfo:ok') {
  727. this.utils.getProvider()
  728. .then(provider => {
  729. if (!provider) {
  730. this.userdisabled=false
  731. reject()
  732. }
  733. // uni登录
  734. uni.login({
  735. provider: provider,
  736. success: async loginRes => {
  737. console.log(loginRes)
  738. console.log(e)
  739. let code = loginRes.code // 获取开发code
  740. this.userinfos=uni.getStorageSync('userInfos')?uni.getStorageSync('userInfos'):this.userinfos
  741. loginByMiniApp({
  742. encryptedData: e.mp.detail.encryptedData,
  743. iv: e.mp.detail.iv,
  744. code: code,
  745. companyId : this.companyId || '',
  746. companyUserId:this.companyUserId || 0,
  747. nickname:this.userinfos.nickname ||'',
  748. avatar:this.userinfos.avatar||'',
  749. authType:this.authType,
  750. appId:this.appid,
  751. projectId:this.projectId
  752. })
  753. .then( res => {
  754. this.userdisabled=false
  755. if(res.code==200){
  756. console.log(res)
  757. uni.hideLoading();
  758. uni.showToast({
  759. icon:'none',
  760. title: "登录成功",
  761. });
  762. uni.setStorageSync('TOKEN_WEXIN', res.token);
  763. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  764. this.userInfo=res.user;
  765. uni.hideLoading()
  766. this.checkUserInfoA()
  767. // this.isLogin = true
  768. // setTimeout(()=>{
  769. // this.getIsAddKf()
  770. // },200)
  771. }else if(res.code==406){
  772. uni.hideLoading();
  773. uni.showToast({
  774. icon:'none',
  775. title: '该用户已成为其他销售会员',
  776. });
  777. }else{
  778. uni.hideLoading();
  779. uni.showToast({
  780. icon:'none',
  781. title: res.msg,
  782. });
  783. }
  784. })
  785. .catch(res=>{
  786. this.userdisabled=false
  787. })
  788. },
  789. fail() {
  790. this.userdisabled=false
  791. }
  792. })
  793. })
  794. .catch(err => {
  795. this.userdisabled=false
  796. uni.showToast({
  797. icon:'none',
  798. title: err,
  799. });
  800. })
  801. } else {
  802. this.userdisabled=false
  803. uni.showToast({
  804. title: '已拒绝授权',
  805. icon: 'none',
  806. duration: 2000,
  807. })
  808. }
  809. },
  810. phoneLogin(e) {
  811. console.log(e)
  812. this.userdisabled=false
  813. uni.showLoading({
  814. title: "处理中..."
  815. });
  816. if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
  817. this.utils.getProvider()
  818. .then(provider => {
  819. if (!provider) {
  820. this.userdisabled=false
  821. reject()
  822. }
  823. // uni登录
  824. uni.login({
  825. provider: provider,
  826. success: async loginRes => {
  827. this.userdisabled=false
  828. console.log(loginRes)
  829. console.log(e)
  830. let code = loginRes.code // 获取开发code
  831. this.userinfos=uni.getStorageSync('userInfos')?uni.getStorageSync('userInfos'):this.userinfos
  832. loginByMiniApp({
  833. encryptedData: e.mp.detail.encryptedData,
  834. iv: e.mp.detail.iv,
  835. code: code,
  836. companyId : this.companyId || '',
  837. companyUserId:this.companyUserId || 0,
  838. nickname:this.userinfos.nickname||'',
  839. avatar:this.userinfos.avatar||"",
  840. authType:this.authType,
  841. appId:this.appid,
  842. projectId:this.projectId
  843. })
  844. .then( res => {
  845. this.userdisabled=false
  846. if(res.code==200){
  847. console.log(res)
  848. uni.hideLoading();
  849. uni.showToast({
  850. icon:'none',
  851. title: "登录成功",
  852. });
  853. uni.setStorageSync('TOKEN_WEXIN', res.token);
  854. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  855. this.userInfo=res.user;
  856. uni.hideLoading()
  857. this.checkUserInfoA()
  858. // this.isLogin = true
  859. // setTimeout(()=>{
  860. // this.getIsAddKf()
  861. // },200)
  862. }else if(res.code==406){
  863. uni.hideLoading();
  864. uni.showToast({
  865. icon:'none',
  866. title: '该用户已成为其他销售会员',
  867. });
  868. }else{
  869. uni.hideLoading();
  870. uni.showToast({
  871. icon:'none',
  872. title: res.msg,
  873. });
  874. }
  875. })
  876. .catch(res=>{
  877. this.userdisabled=false
  878. })
  879. },
  880. fail() {
  881. this.userdisabled=false
  882. }
  883. })
  884. })
  885. .catch(err => {
  886. this.userdisabled=false
  887. uni.showToast({
  888. icon:'none',
  889. title: err,
  890. });
  891. })
  892. } else {
  893. this.userdisabled=false
  894. uni.showToast({
  895. title: '已拒绝授权',
  896. icon: 'none',
  897. duration: 2000,
  898. })
  899. }
  900. },
  901. getMenuButton(){
  902. const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  903. this.menuButtonLeft = menuButtonInfo.left
  904. this.menuButtonH = menuButtonInfo.height
  905. },
  906. //播放时间更新事件方法
  907. onTimeUpdate(e){
  908. let currentTime = Math.round(e.detail.currentTime)
  909. if (this.playDurationSeek > 0) {
  910. this.playTime = this.playDurationSeek
  911. this.throttle(() => this.changeTime(this), 1000, false)
  912. } else {
  913. // console.log(this.isFinish)
  914. if (this.linkType != 1 && (currentTime - this.playTime > 3 || currentTime - this.playTime < -3)&&this.isFinish!=1) {
  915. uni.showToast({
  916. title: '不能快进哦',
  917. icon: 'none',
  918. });
  919. currentTime = this.playTime
  920. this.player.seek(this.playTime);
  921. }
  922. if (Math.floor(e.detail.currentTime) != this.flagTime) {
  923. this.flagTime = Math.floor(e.detail.currentTime)
  924. // 中途弹窗逻辑
  925. if(!this.tipsOpen&&this.tipsTime && this.playTime == this.tipsTime) {
  926. this.timepath='33%'
  927. this.openTipsPop()
  928. }
  929. if(!this.tipsOpen&&this.tipsTime2 && this.playTime == this.tipsTime2) {
  930. this.timepath='66%'
  931. this.openTipsPop()
  932. }
  933. }
  934. this.playTime = currentTime
  935. }
  936. },
  937. changeTime(that,e) {
  938. that.playDurationSeek = 0
  939. },
  940. videoErrorCallback(e) {
  941. this.clearIntegral()
  942. this.errorCount++
  943. if (this.errorCount > 3) return
  944. console.log(e)
  945. this.getErrMsg(e.target.errMsg)
  946. this.getH5CourseVideoDetails('error')
  947. },
  948. // 当开始/继续播放时触发play事件
  949. getPlay() {
  950. this.errorCount = 0
  951. // this.judgeDuration()
  952. },
  953. getPause() {
  954. this.clearIntegral()
  955. },
  956. getEnded() {
  957. this.clearIntegral()
  958. this.isEnded = true
  959. this.isFinish=1
  960. this.getFinishCourseVideo()
  961. },
  962. getIP() {
  963. uni.request({
  964. url: 'https://ipinfo.io/json', //仅为示例,并非真实接口地址。
  965. method: 'GET',
  966. success: (res) => {
  967. this.ip = res.data.ip
  968. }
  969. });
  970. },
  971. getHeight() {
  972. this.$nextTick(() => {
  973. const query = uni.createSelectorQuery().in(this);
  974. query
  975. .select("#title-content")
  976. .boundingClientRect((data) => {
  977. this.height =
  978. `calc(100vh - ${data.height}px - 420rpx - ${this.statusBarHeight}px - 120rpx )`
  979. })
  980. .exec();
  981. })
  982. },
  983. getDescHeight() {
  984. this.$nextTick(() => {
  985. const query = uni.createSelectorQuery().in(this);
  986. query
  987. .select("#descbox-desc")
  988. .boundingClientRect((data) => {
  989. this.textHeight = data.height
  990. })
  991. .exec();
  992. })
  993. },
  994. numberToLetter(num) {
  995. // 将数字转换为字母的 ASCII 码
  996. let letterCode = num + 65;
  997. // 将 ASCII 码转换为大写字母
  998. let letter = String.fromCharCode(letterCode);
  999. return letter;
  1000. },
  1001. updateTime() {
  1002. var that = this;
  1003. if (this.interval != null) {
  1004. clearInterval(this.interval)
  1005. }
  1006. this.interval = setInterval(function() {
  1007. that.getFinishCourseVideo()
  1008. that.getInternetTraffic()
  1009. }, 60000);
  1010. },
  1011. judgeDuration() {
  1012. var that = this;
  1013. if (this.intervalIntegral != null) {
  1014. clearInterval(this.intervalIntegral)
  1015. this.intervalIntegral = null
  1016. }
  1017. // 观看10分钟获得积分
  1018. this.intervalIntegral = setInterval(function() {
  1019. that.getIntegralByH5Video()
  1020. }, 600000);
  1021. },
  1022. clearIntegral() {
  1023. if (this.intervalIntegral != null) {
  1024. clearInterval(this.intervalIntegral)
  1025. this.intervalIntegral = null
  1026. }
  1027. },
  1028. // 展开简介
  1029. handleExpand() {
  1030. this.isExpand = !this.isExpand
  1031. },
  1032. getH5CourseByVideo() {
  1033. this.loading = true
  1034. getH5CourseByVideoId({
  1035. videoId: this.videoId
  1036. }).then(res => {
  1037. this.loading = false
  1038. if (res.code == 200) {
  1039. this.viewload=false
  1040. this.courseInfo = res.data
  1041. uni.setNavigationBarTitle({
  1042. title: this.courseInfo && this.courseInfo.title ? this.courseInfo.title : ''
  1043. });
  1044. }
  1045. this.getHeight()
  1046. this.getDescHeight()
  1047. },
  1048. rej => {
  1049. this.loading = false
  1050. }
  1051. ).catch(() => {
  1052. this.loading = false
  1053. })
  1054. },
  1055. getH5CourseVideoDetails(type) {
  1056. uni.showLoading({
  1057. title: '加载中'
  1058. })
  1059. const data={
  1060. videoId:this.videoId,
  1061. fsUserId:this.userInfo.userId,
  1062. courseId:this.courseId,
  1063. companyUserId:this.companyUserId,
  1064. periodId:this.periodId,
  1065. id:this.timeid
  1066. }
  1067. getH5CourseVideoDetails(data).then(res => {
  1068. if (res.code == 200) {
  1069. this.config = res.data.courseConfig || {}
  1070. this.isFinish = res.data.isFinish || 0
  1071. this.duration = res.data.courseVideoDetails &&
  1072. res.data.courseVideoDetails.duration ? res.data.courseVideoDetails.duration : 0
  1073. this.courseLogo = this.config&&JSON.stringify(this.config)!='{}'? this.config.courseLogo : ''
  1074. this.playDuration = res.data.playDuration || 0
  1075. this.playDurationSeek = res.data.playDuration || 0
  1076. // this.tipsTime = 38
  1077. this.tipsTime = res.data.tipsTime || 0
  1078. this.tipsTime2 = res.data.tipsTime2 || 0
  1079. let lineList = []
  1080. // if (res.course && res.course.lineOne) {
  1081. // lineList.push(res.course.lineOne)
  1082. // }
  1083. // if (res.course && res.course.lineTwo) {
  1084. // lineList.push(res.course.lineTwo)
  1085. // }
  1086. // if (res.course && res.course.lineThree) {
  1087. // lineList.push(res.course.lineThree)
  1088. // }
  1089. this.lineList = lineList
  1090. if (!this.player || type == 'error') {
  1091. uni.hideLoading();
  1092. this.lineIndex = this.config.defaultLine
  1093. this.videoUrl = res.data.courseVideoDetails.videoUrl
  1094. this.poster= res.data.courseVideoDetails &&
  1095. res.data.courseVideoDetails.thumbnail ? res.data.courseVideoDetails.thumbnail : ''
  1096. this.videocont=res.data
  1097. // this.options.sources = [{
  1098. // src: this.videoUrl
  1099. // }]
  1100. // this.options.poster = res.course && res.course.imgUrl ? res.course.imgUrl : ''
  1101. // this.initVideo()
  1102. this.playTime = this.playDuration >= this.duration ? 0 : this.playDuration
  1103. if(this.videocont.rang){
  1104. setTimeout(()=>{
  1105. this.player = uni.createVideoContext('video-content-box');
  1106. this.player.seek(this.playTime)
  1107. this.player.play();
  1108. },500);
  1109. this.timepop=false
  1110. }else{
  1111. this.timepop=true
  1112. }
  1113. } else {
  1114. // let div = document.querySelector(".vjs-progress-control");
  1115. // if(div) {
  1116. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  1117. // div.style.pointerEvents = "auto";
  1118. // } else {
  1119. // div.style.pointerEvents = "none"; //禁止所有事件
  1120. // }
  1121. // }
  1122. this.playTime = this.playTime > this.playDuration ? this.playTime : this.playDuration >= this.duration ? 0 : this.playDuration
  1123. this.player.seek(this.playTime)
  1124. this.player.play();
  1125. }
  1126. this.updateTime();
  1127. if(res.data.courseVideoDetails.questionBankList.length==0){
  1128. this.isquestion=true
  1129. }else{
  1130. this.isquestion=false
  1131. }
  1132. console.log('题目',res.data.courseVideoDetails.questionBankList)
  1133. this.quesList = res.data.courseVideoDetails.questionBankList
  1134. && res.data.courseVideoDetails.questionBankList.length > 0 ? res.data.courseVideoDetails.questionBankList : [],
  1135. this.quesList = this.quesList.map(item => ({
  1136. ...item,
  1137. questionOption: JSON.parse(item.question),
  1138. answer: ''
  1139. }))
  1140. }
  1141. this.getHeight()
  1142. this.getDescHeight()
  1143. },
  1144. rej => {}
  1145. )
  1146. },
  1147. handleAnswer(item, option, idx) {
  1148. let time = this.playTime
  1149. if(this.isEnded || this.isFinish==1) {
  1150. time = this.duration
  1151. } else {
  1152. if(time < this.playDuration&&this.isFinish!=1) {
  1153. // 没完课且小于续播的时间
  1154. time = this.playDuration
  1155. }
  1156. }
  1157. if(Number(this.duration || 0) == 0 || time < this.duration - 60) {
  1158. uni.showToast({
  1159. title: "请先观看完整课程再答题哦~",
  1160. icon: "none"
  1161. })
  1162. return
  1163. }
  1164. if (item.type == 1) {
  1165. // 单选option
  1166. item.answer = option.name
  1167. } else if (item.type == 2) {
  1168. // 多选
  1169. let answer = item.answer ? item.answer.split(',') : []
  1170. if (answer.indexOf(option.name) === -1) {
  1171. answer.push(option.name)
  1172. item.answer = answer.join(',')
  1173. } else {
  1174. answer.splice(answer.indexOf(option.name), 1)
  1175. item.answer = answer.join(',')
  1176. }
  1177. }
  1178. },
  1179. submit() {
  1180. if(this.isExpire){
  1181. uni.showToast({
  1182. title: '课程已过期或链接无效',
  1183. icon: 'none'
  1184. });
  1185. return
  1186. }
  1187. // 登录
  1188. this.$isLoginCourse().then(
  1189. res => {
  1190. console.log(res)
  1191. if(res){
  1192. console.log(res)
  1193. if (this.isAddKf == 1) {
  1194. // 答题
  1195. // 您已提交过答案,请领取红包
  1196. console.log(1223)
  1197. this.courseAnswer()
  1198. } else {
  1199. // 添加客服
  1200. if (this.videoId&&this.isLogin) {
  1201. console.log(12223131)
  1202. this.getIsAddKf()
  1203. } else if(this.iskftype==1){
  1204. uni.showToast({
  1205. title: '已看过其他销售分享的此课程,不能重复观看',
  1206. icon: 'none'
  1207. })
  1208. }
  1209. else {
  1210. // this.kfPopup=true
  1211. uni.removeStorageSync('TOKEN_WEXIN')
  1212. uni.showToast({
  1213. title: '已清除缓存,请重新进入页面!',
  1214. icon: 'none'
  1215. })
  1216. }
  1217. }
  1218. } else{
  1219. // this.goLogin()
  1220. }
  1221. },
  1222. rej => {}
  1223. );
  1224. },
  1225. // 答题
  1226. courseAnswer() {
  1227. let time = this.playTime
  1228. if (this.isEnded||this.isFinish==1) {
  1229. time = this.duration
  1230. } else {
  1231. if (time < this.playDuration && this.isFinish != 1) {
  1232. // 没完课且小于续播的时间
  1233. time = this.playDuration
  1234. }
  1235. }
  1236. if (Number(this.duration || 0) == 0 || time < this.duration - 60) {
  1237. uni.showToast({
  1238. title: "请先观看完整课程再答题哦~",
  1239. icon: "none"
  1240. })
  1241. return
  1242. }
  1243. if (this.quesList.some(item => !item.answer)) {
  1244. uni.showToast({
  1245. title: "请确认是否答完所有题目",
  1246. icon: "none"
  1247. })
  1248. return
  1249. }
  1250. const questions = this.quesList.map(obj => {
  1251. const {
  1252. questionOption,
  1253. ...rest
  1254. } = obj;
  1255. return rest;
  1256. });
  1257. const param = {
  1258. ...this.urlOption,
  1259. userId:this.userInfo.userId,
  1260. questions: questions,
  1261. videoId: this.videoId,
  1262. duration: this.playTime,
  1263. }
  1264. this.errTitle = ""
  1265. this.errDesc = ""
  1266. this.errQues = []
  1267. courseAnswer(param).then(res => {
  1268. if (res.code == 200) {
  1269. if (res.incorrectQuestions) {
  1270. // 答题失败
  1271. if (res.incorrectQuestions.length > 0) {
  1272. this.errQues = res.incorrectQuestions
  1273. }
  1274. this.remain = res.remain || 0
  1275. if (res.remain > 0) {
  1276. this.answerPopup=true
  1277. this.errTitle = "很遗憾答错了"
  1278. this.errDesc = `<span style="color:#FF5C03">还有${res.remain}次机会,继续加油</span>`
  1279. // this.$refs.answerPopup.open("center")
  1280. this.answerPopup=true
  1281. }
  1282. } else {
  1283. // 答题成功
  1284. this.errTitle = "恭喜你,回答正确"
  1285. // this.errDesc = `请选择奖励`
  1286. // this.$refs.answerPopup.open("center")
  1287. // this.answerPopup=true
  1288. if(res.msg=='答题成功'){
  1289. uni.login({
  1290. provider: 'weixin',
  1291. success: async loginRes => {
  1292. console.log(loginRes)
  1293. var code=loginRes
  1294. this.closeAnswerPopup(loginRes.code)
  1295. }
  1296. })
  1297. }
  1298. }
  1299. } else {
  1300. if (res.msg == "该课题到达答错次数限制") {
  1301. this.errTitle = "答题次数超过限制"
  1302. this.errDesc = "以后的课程要认真学习哦"
  1303. // this.$refs.answerPopup.open("center")
  1304. this.answerPopup=true
  1305. } else {
  1306. uni.showToast({
  1307. title: res.msg,
  1308. icon: "none"
  1309. })
  1310. }
  1311. }
  1312. },
  1313. rej => {}
  1314. )
  1315. },
  1316. // 选择
  1317. rewardChange(e) {
  1318. this.currentReward = e.detail.value
  1319. },
  1320. closeAnswerPopup() {
  1321. // this.$refs.answerPopup.close()
  1322. uni.showLoading({
  1323. title: "加载中..."
  1324. })
  1325. if (this.errTitle == '恭喜你,回答正确') {
  1326. const param = {
  1327. ...this.urlOption,
  1328. userId:this.userInfo.userId,
  1329. // rewardType: Number(this.currentReward),
  1330. source: 2, // 小程序
  1331. appId: this.appid
  1332. }
  1333. sendReward(param).then(res => {
  1334. if(res.code == 200) {
  1335. uni.hideLoading()
  1336. this.answerPopup=false
  1337. console.log('红包',res)
  1338. if(res.isNew&&res.isNew==1) {
  1339. console.log('红包配置',res)
  1340. const packageInfo = res.data.packageInfo || ''
  1341. if(packageInfo) {
  1342. uni.setStorageSync('receive_package',packageInfo)
  1343. uni.setStorageSync('mchId',res.mchId)
  1344. uni.navigateTo({
  1345. url: '/pages_course/reward'
  1346. })
  1347. }
  1348. } else {
  1349. uni.showToast({
  1350. title: res.msg,
  1351. icon: 'none'
  1352. })
  1353. }
  1354. }else {
  1355. uni.hideLoading()
  1356. uni.showToast({
  1357. title: res.msg,
  1358. icon: 'none'
  1359. })
  1360. }
  1361. // if(res.code == 200) {
  1362. // //重构 发红包,后台通过OPENID发零钱到 账
  1363. // //this.initWXConfig(res.package)
  1364. // }else {
  1365. // uni.showToast({
  1366. // title: res.msg,
  1367. // icon: 'none'
  1368. // })
  1369. // }
  1370. })
  1371. }else{
  1372. uni.hideLoading()
  1373. this.answerPopup=!this.answerPopup
  1374. }
  1375. },
  1376. // 线路
  1377. openPop() {
  1378. this.$refs.popup.open('bottom')
  1379. },
  1380. close() {
  1381. this.$refs.popup.close()
  1382. },
  1383. handleLine(index) {
  1384. var that=this;
  1385. if (this.lineIndex == index && this.videoUrl == this.lineList[index]) {
  1386. this.close()
  1387. return
  1388. } else {
  1389. // let div = document.querySelector(".vjs-progress-control");
  1390. // if(div) {
  1391. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  1392. // div.style.pointerEvents = "auto";
  1393. // } else {
  1394. // div.style.pointerEvents = "none"; //禁止所有事件
  1395. // }
  1396. // }
  1397. this.lineIndex = index
  1398. this.videoUrl = this.lineList[index]
  1399. this.tipsOpen = false
  1400. this.playDurationSeek = this.playTime || 0
  1401. this.player = uni.createVideoContext('video-content-box');
  1402. setTimeout(function(){
  1403. that.player.seek(that.playDurationSeek)
  1404. that.player.play();
  1405. },500);
  1406. // this.player.src(this.lineList[index])
  1407. // this.player.one('loadedmetadata', () => {
  1408. // this.player.currentTime(this.playDurationSeek);
  1409. // this.player.play();
  1410. // });
  1411. this.close()
  1412. }
  1413. },
  1414. // 温馨提示
  1415. openTipsPop() {
  1416. // this.$refs.tipsPopup.open()
  1417. this.tipsPopup=true
  1418. // 暂停视频
  1419. this.videoContext.pause()
  1420. // this.tipsOpen = true
  1421. // this.pause()
  1422. },
  1423. closeTipsPop() {
  1424. // this.$refs.tipsPopup.close()
  1425. this.videoContext.play()
  1426. this.tipsPopup=!this.tipsPopup
  1427. },
  1428. // 客服
  1429. getIsAddKf() {
  1430. this.qrcode = ''
  1431. this.qrcodeMsg = ''
  1432. this.isAddKf = 0
  1433. const data = {
  1434. videoId:this.videoId,
  1435. userId:this.userInfo.userId,
  1436. companyUserId:this.companyUserId,
  1437. companyId:this.companyId,
  1438. courseId:this.courseId,
  1439. periodId:this.periodId,
  1440. projectId:this.projectId
  1441. }
  1442. // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
  1443. getIsAddKf(data).then(res => {
  1444. if (res.code == 200) {
  1445. this.isLogin = true
  1446. if(res.data){
  1447. this.isAddKf = 1
  1448. this.getH5CourseVideoDetails()
  1449. }
  1450. // else{
  1451. // uni.showToast({
  1452. // title: '请联系管理员,注册为会员!',
  1453. // icon: 'none'
  1454. // });
  1455. // }
  1456. }else if(res.code==1002){
  1457. this.isAddKf = 0
  1458. this.qrcode=res.ext
  1459. this.kfPopup=true
  1460. uni.showToast({
  1461. title: "请添加管理员微信,成为会员!",
  1462. icon: 'none'
  1463. });
  1464. }else if(res.code==505){
  1465. this.isAddKf = 0
  1466. this.qrcode=res.ext
  1467. this.kfPopup=true
  1468. uni.showToast({
  1469. title: "管理员开启了会员审核,请等待审核!",
  1470. icon: 'none'
  1471. });
  1472. }else if(res.code==406){
  1473. uni.hideLoading();
  1474. uni.showToast({
  1475. icon:'none',
  1476. title: '该用户已成为其他销售会员',
  1477. });
  1478. }else if(res.code==504){
  1479. this.isAddKf = 0
  1480. this.iskftype=1
  1481. uni.showToast({
  1482. title: res.msg,
  1483. icon: 'none'
  1484. });
  1485. }else {
  1486. this.isAddKf = 0
  1487. uni.showToast({
  1488. title: res.msg,
  1489. icon: 'none'
  1490. });
  1491. }
  1492. },
  1493. err => {}
  1494. );
  1495. },
  1496. closeKFPop() {
  1497. // this.$refs.kfPopup.close()
  1498. // this.kfPopup=!this.kfPopup
  1499. },
  1500. getFinishCourseVideo() {
  1501. if (!this.playTime) return
  1502. // {videoId: this.videoId,duration:this.playTime}
  1503. const param = {
  1504. duration: this.playTime,
  1505. videoId:this.videoId,
  1506. userId:this.userInfo.userId,
  1507. companyUserId:this.companyUserId
  1508. }
  1509. getFinishCourseVideo(param)
  1510. },
  1511. // 每十分钟获得积分
  1512. getIntegralByH5Video() {
  1513. const param = {
  1514. duration: this.playTime,
  1515. ...this.urlOption
  1516. }
  1517. getIntegralByH5Video(param).then(res => {
  1518. if (res.code == 200) {
  1519. uni.showToast({
  1520. title: "积分+10",
  1521. icon: "none"
  1522. })
  1523. }
  1524. })
  1525. },
  1526. progressChange(e) {
  1527. this.bufferRate = Math.ceil(e.detail.buffered)
  1528. // console.log('缓冲结果',this.bufferRate)
  1529. // console.log('缓冲',this.playTime,this.duration)
  1530. },
  1531. // 缓冲
  1532. getInternetTraffic() {
  1533. const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
  1534. // console.log('播放百分比',playVideoTime)
  1535. if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
  1536. this.bufferRate = playVideoTime
  1537. console.log(this.bufferRate)
  1538. }
  1539. if(this.bufferRate == 0 || Number(this.bufferRate.toFixed(2)) == 0) return
  1540. const param = {
  1541. uuId: dayjs().format('YYYYMMDD') + this.uuId,
  1542. duration: this.playTime,
  1543. bufferRate: Number(this.bufferRate.toFixed(2)),
  1544. userId:this.userId,
  1545. periodId:this.periodId,
  1546. ...this.urlOption
  1547. }
  1548. getInternetTraffic(param)
  1549. },
  1550. getErrMsg(err) {
  1551. let msgerr = {
  1552. videoUrl: this.videoUrl,
  1553. lineIndex: this.lineIndex,
  1554. errTime: new Date(),
  1555. // ip: this.ip,
  1556. errMsg: err
  1557. }
  1558. getErrMsg({
  1559. msg: JSON.stringify(msgerr)
  1560. })
  1561. },
  1562. goLogin() {
  1563. },
  1564. getLink() {
  1565. this.goLogin()
  1566. return
  1567. let that = this;
  1568. this.msg = ''
  1569. getRealLink({sortLink:this.sortLink}).then(res=>{
  1570. if(res.code == 200) {
  1571. this.isExpire = false
  1572. // 如果响应中包含真实链接,则跳转到真实链接
  1573. // window.location.href = res.realLink +"&sortLink="+this.sortLink+"&code="+this.code+"&time="+new Date().getTime()
  1574. if (this.isLogin && this.isAddKf == 1) {
  1575. this.getH5CourseVideoDetails()
  1576. }
  1577. if (this.videoId && this.isAddKf != 1) {
  1578. this.$isLoginCourse().then(
  1579. isLogin => {
  1580. this.isLogin = isLogin
  1581. if(isLogin){
  1582. this.getIsAddKf()
  1583. } else {
  1584. this.goLogin()
  1585. }
  1586. },
  1587. rej => {}
  1588. );
  1589. }
  1590. } else {
  1591. this.isExpire = true
  1592. this.msg = '课程已过期或链接无效'
  1593. uni.showToast({
  1594. title: '课程已过期或链接无效',
  1595. icon: 'none'
  1596. });
  1597. }
  1598. }).catch(err=>{
  1599. this.isExpire = true
  1600. this.msg = '发生错误,请稍后再试'
  1601. uni.showToast({
  1602. title: '发生错误,请稍后再试',
  1603. icon: 'none'
  1604. });
  1605. })
  1606. },
  1607. /**
  1608. * 节流原理:在一定时间内,只能触发一次
  1609. *
  1610. * @param {Function} func 要执行的回调函数
  1611. * @param {Number} wait 延时的时间
  1612. * @param {Boolean} immediate 是否立即执行
  1613. * @return null
  1614. */
  1615. throttle(func, wait = 500, immediate = true) {
  1616. if (immediate) {
  1617. if (!this.flag) {
  1618. this.flag = true
  1619. // 如果是立即执行,则在wait毫秒内开始时执行
  1620. typeof func === 'function' && func()
  1621. this.timer = setTimeout(() => {
  1622. this.flag = false
  1623. }, wait)
  1624. }
  1625. } else if (!this.flag) {
  1626. this.flag = true
  1627. // 如果是非立即执行,则在wait毫秒内的结束处执行
  1628. this.timer = setTimeout(() => {
  1629. this.flag = false
  1630. typeof func === 'function' && func()
  1631. }, wait)
  1632. }
  1633. }
  1634. }
  1635. }
  1636. </script>
  1637. <style scoped>
  1638. .full-width-popup {
  1639. width: 100%;
  1640. }
  1641. </style>
  1642. <style lang="scss" scoped>
  1643. .subname{
  1644. background-color: #00aa00;
  1645. color: #fff;
  1646. }
  1647. .subavt{
  1648. background-color: #fff;
  1649. border: 2rpx #0a0 solid;
  1650. color: #00aa00;
  1651. }
  1652. .boxweixin{
  1653. width: 44rpx;
  1654. height: 44rpx;
  1655. border-radius: 50%;
  1656. text-align: center;
  1657. line-height: 34rpx;
  1658. color: #0a0;
  1659. }
  1660. .boxnosel{
  1661. border: #757575 4rpx solid;
  1662. }
  1663. .boxsel{
  1664. border: #0a0 4rpx solid;
  1665. }
  1666. .button-container {
  1667. position: relative;
  1668. width: 240rpx;
  1669. }
  1670. .hidden-input {
  1671. position: absolute;
  1672. top: 0;
  1673. left: 0;
  1674. width: 100%;
  1675. height: 100%;
  1676. opacity: 0;
  1677. z-index: 2;
  1678. }
  1679. .custom-button {
  1680. position: relative;
  1681. z-index: 1;
  1682. /* 其他样式 */
  1683. width:100%;
  1684. margin: 0 auto;
  1685. height: 80rpx;
  1686. line-height: 60rpx;
  1687. font-size: 28rpx;
  1688. padding: 10rpx 20rpx;
  1689. }
  1690. .submitname{
  1691. width: 90%;
  1692. margin: 0 auto;
  1693. text-align: center;
  1694. padding: 30rpx;
  1695. margin-top: 40rpx;
  1696. }
  1697. .sub{
  1698. background-color: #f0f0f0;
  1699. color: #0a0;
  1700. }
  1701. .subact{
  1702. background-color: #0a0;
  1703. color: #fff;
  1704. }
  1705. .userlogo{
  1706. height: 760rpx;
  1707. }
  1708. .getlogo{
  1709. width:240rpx;
  1710. background-color: #fff;
  1711. // padding: 10rpx 20rpx;
  1712. }
  1713. @mixin u-flex($flexD, $alignI, $justifyC) {
  1714. display: flex;
  1715. flex-direction: $flexD;
  1716. align-items: $alignI;
  1717. justify-content: $justifyC;
  1718. }
  1719. .footer-tips {
  1720. position: fixed;
  1721. width: 100%;
  1722. bottom: 144rpx;
  1723. text-align: center;
  1724. font-family: PingFang SC,PingFang SC;
  1725. font-weight: 500;
  1726. font-size: 12px;
  1727. color: #bbb;
  1728. transform: scale(0.8);
  1729. }
  1730. .btns{
  1731. position: relative;
  1732. width: 100%;
  1733. height: 80rpx;
  1734. .author-btn{
  1735. z-index:100;
  1736. position: absolute;
  1737. width: 100%;
  1738. height: 80rpx;
  1739. background: #ff5c03;
  1740. border-radius: 40rpx;
  1741. font-size: 36rpx;
  1742. font-family: PingFang SC;
  1743. font-weight: 500;
  1744. text-align: center;
  1745. line-height: 80rpx;
  1746. color: rgba(255, 255, 255, 1);
  1747. }
  1748. }
  1749. .textOne {
  1750. overflow: hidden;
  1751. white-space: nowrap;
  1752. text-overflow: ellipsis;
  1753. }
  1754. .textTwo {
  1755. overflow: hidden;
  1756. text-overflow: ellipsis;
  1757. display: -webkit-box;
  1758. -webkit-line-clamp: 2;
  1759. -webkit-box-orient: vertical;
  1760. }
  1761. .header-nav {
  1762. height: 88rpx;
  1763. @include u-flex(row, center, flex-start);
  1764. overflow: hidden;
  1765. background-color: #fff;
  1766. box-sizing: border-box;
  1767. .header-title {
  1768. text-align: center;
  1769. overflow: hidden;
  1770. white-space: nowrap;
  1771. text-overflow: ellipsis;
  1772. padding: 0 10rpx 0 100rpx;
  1773. font-family: PingFang SC,PingFang SC;
  1774. font-weight: 500;
  1775. font-size: 15px;
  1776. color: #000;
  1777. box-sizing: border-box;
  1778. }
  1779. }
  1780. .reward-list {
  1781. width: 100%;
  1782. margin-top: 20rpx;
  1783. margin-bottom: -40rpx;
  1784. &-group {
  1785. font-family: PingFang SC, PingFang SC;
  1786. font-weight: 400;
  1787. font-size: 14px;
  1788. color: #222222;
  1789. @include u-flex(row, center, center);
  1790. }
  1791. &-option {
  1792. @include u-flex(row, center, flex-start);
  1793. &:first-child {
  1794. margin-right: 40rpx;
  1795. }
  1796. }
  1797. }
  1798. .err {
  1799. color: #f56c6c !important;
  1800. }
  1801. .kfqrcode-box {
  1802. background-color: #fff;
  1803. border-radius: 16rpx;
  1804. max-width: 560rpx;
  1805. padding: 60rpx 40rpx;
  1806. margin-top: -100rpx;
  1807. box-sizing: border-box;
  1808. @include u-flex(column, center, flex-start);
  1809. font-family: PingFang SC, PingFang SC;
  1810. font-weight: 400;
  1811. font-size: 34rpx;
  1812. color: #222;
  1813. position: relative;
  1814. text-align: center;
  1815. .kfqrcode {
  1816. // height: 460rpx;
  1817. width: 460rpx;
  1818. }
  1819. }
  1820. .kfqrcode-close {
  1821. width: 64rpx;
  1822. height: 64rpx;
  1823. position: absolute;
  1824. bottom: -100rpx;
  1825. left: 50%;
  1826. transform: translateX(-50%);
  1827. }
  1828. .tipsPopup-mask {
  1829. position: relative;
  1830. width: 560rpx;
  1831. background-color: transparent;
  1832. .red_envelope_top {
  1833. width: 480rpx;
  1834. height: 360rpx;
  1835. margin: 0 auto;
  1836. display: inherit;
  1837. }
  1838. }
  1839. .tipsPopup-btn-box {
  1840. width: 456rpx;
  1841. height: 104rpx;
  1842. padding: 4rpx;
  1843. box-sizing: border-box;
  1844. background: linear-gradient(180deg, rgba(252, 209, 94, 1), rgba(254, 253, 251, 1));
  1845. border-radius: 52rpx;
  1846. }
  1847. .tipsPopup-btn {
  1848. width: 100%;
  1849. height: 100%;
  1850. background: linear-gradient(180deg, #FF9F22 0%, #FA1E05 100%);
  1851. border-radius: 52rpx 52rpx 52rpx 52rpx;
  1852. font-family: PingFang SC, PingFang SC;
  1853. font-weight: 500;
  1854. font-size: 36rpx;
  1855. color: #FFFFFF;
  1856. line-height: 96rpx;
  1857. text-align: center;
  1858. }
  1859. .tipsPopup {
  1860. width: 560rpx;
  1861. padding: 12rpx;
  1862. margin-top: -72rpx;
  1863. box-sizing: border-box;
  1864. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1865. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1866. position: relative;
  1867. &-close {
  1868. width: 64rpx;
  1869. height: 64rpx;
  1870. position: absolute;
  1871. right: 0;
  1872. top: -188rpx;
  1873. }
  1874. &-line {
  1875. padding: 3rpx;
  1876. box-sizing: border-box;
  1877. background: linear-gradient(180deg, rgba(247, 245, 220, 1), rgba(250, 220, 157, 1));
  1878. border-radius: 24rpx;
  1879. }
  1880. &-box {
  1881. padding: 0 40rpx 40rpx 40rpx;
  1882. box-sizing: border-box;
  1883. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1884. border-radius: 24rpx;
  1885. @include u-flex(column, center, flex-start);
  1886. }
  1887. &-head {
  1888. @include u-flex(row, center, center);
  1889. &-title {
  1890. width: 364rpx;
  1891. height: auto;
  1892. margin-top: -22rpx;
  1893. }
  1894. }
  1895. &-content {
  1896. margin: 48rpx 0;
  1897. font-family: PingFang SC, PingFang SC;
  1898. font-weight: 500;
  1899. font-size: 32rpx;
  1900. color: #222222;
  1901. text-align: center;
  1902. &-title {
  1903. margin-bottom: 26rpx;
  1904. font-weight: 600;
  1905. font-size: 40rpx;
  1906. color: #FF5C03;
  1907. }
  1908. }
  1909. }
  1910. .video-controls-box {
  1911. width: 100%;
  1912. height: 420rpx;
  1913. overflow: hidden;
  1914. position: absolute;
  1915. bottom: 0;
  1916. left: 0;
  1917. z-index: 2;
  1918. background: rgba(0, 0, 0, 0.2);
  1919. .video-play {
  1920. height: 72rpx;
  1921. width: 72rpx;
  1922. position: absolute;
  1923. top: 50%;
  1924. left: 50%;
  1925. transform: translate(-50%, -50%);
  1926. }
  1927. }
  1928. .video-controls {
  1929. width: 100%;
  1930. height: 80rpx;
  1931. padding: 0 28rpx;
  1932. box-sizing: border-box;
  1933. position: absolute;
  1934. bottom: 0;
  1935. left: 0;
  1936. display: flex;
  1937. align-items: center;
  1938. justify-content: space-between;
  1939. background: linear-gradient(to top, #222 0%, transparent 80%);
  1940. .video-icon {
  1941. height: 44rpx;
  1942. width: 44rpx;
  1943. }
  1944. }
  1945. .errQuesbox {
  1946. width: 100%;
  1947. max-height: 260rpx;
  1948. overflow-y: auto;
  1949. margin-top: 24rpx;
  1950. font-family: PingFang SC, PingFang SC;
  1951. font-weight: 500;
  1952. font-size: 30rpx;
  1953. color: #222222;
  1954. &-item {
  1955. width: 100%;
  1956. height: 128rpx;
  1957. line-height: 128rpx;
  1958. margin-bottom: 24rpx;
  1959. padding: 0 30rpx;
  1960. box-sizing: border-box;
  1961. overflow: hidden;
  1962. background: #fff;
  1963. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1964. position: relative;
  1965. &::after {
  1966. content: "题目";
  1967. min-width: 64rpx;
  1968. height: 36rpx;
  1969. padding: 0 12rpx;
  1970. line-height: 36rpx;
  1971. background: #FF5C03;
  1972. box-sizing: border-box;
  1973. border-radius: 0rpx 0rpx 16rpx 0rpx;
  1974. text-align: center;
  1975. font-family: PingFang SC, PingFang SC;
  1976. font-weight: 500;
  1977. font-size: 20rpx;
  1978. color: #fff;
  1979. position: absolute;
  1980. left: 0;
  1981. top: 0;
  1982. }
  1983. }
  1984. }
  1985. .bg {
  1986. background: #fff !important;
  1987. }
  1988. .timepopbox{
  1989. width: 560rpx;
  1990. padding: 32rpx;
  1991. box-sizing: border-box;
  1992. }
  1993. .answerPopup {
  1994. &-box {
  1995. width: 560rpx;
  1996. background: linear-gradient(180deg, #FFFAF6 0%, #FEECD8 100%);
  1997. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1998. background-color: #fff;
  1999. font-weight: 400;
  2000. padding: 32rpx;
  2001. box-sizing: border-box;
  2002. position: relative;
  2003. @include u-flex(column, center, flex-start);
  2004. font-family: PingFang SC, PingFang SC;
  2005. font-weight: 400;
  2006. .tipimg {
  2007. width: 206rpx;
  2008. height: 206rpx;
  2009. margin-bottom: 16rpx;
  2010. }
  2011. }
  2012. &-title {
  2013. font-weight: 600;
  2014. font-size: 36rpx;
  2015. color: #222222;
  2016. }
  2017. &-desc {
  2018. margin-top: 10rpx;
  2019. font-size: 28rpx;
  2020. color: #757575;
  2021. }
  2022. &-btn {
  2023. width: 464rpx;
  2024. height: 84rpx;
  2025. margin-top: 54rpx;
  2026. margin-bottom: 16rpx;
  2027. background: #FF5C03;
  2028. border-radius: 42rpx;
  2029. font-weight: 500;
  2030. font-size: 32rpx;
  2031. color: #FFFFFF;
  2032. text-align: center;
  2033. line-height: 84rpx;
  2034. }
  2035. }
  2036. .popupbox {
  2037. width: 100%;
  2038. background-color: #fff;
  2039. border-radius: 16rpx 16rpx 0 0;
  2040. padding: 24rpx 32rpx;
  2041. position: relative;
  2042. &-head {
  2043. height: 60rpx;
  2044. margin-bottom: 30rpx;
  2045. text-align: center;
  2046. overflow-y: auto;
  2047. color: #414858;
  2048. font-size: 32rpx;
  2049. font-weight: bold;
  2050. position: relative;
  2051. .close-icon {
  2052. position: absolute;
  2053. right: 0;
  2054. top: 0;
  2055. height: 40rpx;
  2056. width: 40rpx;
  2057. }
  2058. }
  2059. &-content {
  2060. height: 20vh;
  2061. overflow-y: auto;
  2062. display: flex;
  2063. align-items: flex-start;
  2064. flex-wrap: wrap;
  2065. gap: 32rpx;
  2066. .line-item {
  2067. display: inline-block;
  2068. min-width: 200rpx;
  2069. min-height: 60rpx;
  2070. padding: 0 20rpx;
  2071. box-sizing: border-box;
  2072. border-radius: 50rpx;
  2073. overflow: hidden;
  2074. background-color: #f7f7f7;
  2075. text-align: center;
  2076. color: #414858;
  2077. font-size: 28rpx;
  2078. line-height: 60rpx;
  2079. }
  2080. .line-active {
  2081. color: #f56c6c !important;
  2082. background-color: #fef0f0 !important;
  2083. }
  2084. }
  2085. }
  2086. .content {
  2087. padding-bottom: calc(var(--window-bottom) + 100rpx);
  2088. .video-box {
  2089. width: 100%;
  2090. height: 420rpx;
  2091. overflow: hidden;
  2092. position: relative;
  2093. #myVideo {
  2094. width: 100%;
  2095. height: 100%;
  2096. }
  2097. }
  2098. .video-poster {
  2099. width: 100%;
  2100. height: 420rpx;
  2101. }
  2102. .miantitlebox {
  2103. padding: 30rpx 0;
  2104. border-bottom: 2rpx solid #F5F7FA;
  2105. font-family: PingFang SC, PingFang SC;
  2106. font-weight: 500;
  2107. font-size: 40rpx;
  2108. color: #222222;
  2109. }
  2110. .subtitlebox {
  2111. padding: 30rpx 0;
  2112. border-bottom: 2rpx solid #F5F7FA;
  2113. font-family: PingFang SC, PingFang SC;
  2114. font-weight: 500;
  2115. font-size: 40rpx;
  2116. color: #222222;
  2117. }
  2118. .title-content {
  2119. padding: 0 32rpx;
  2120. background-color: #fff;
  2121. font-size: 28rpx;
  2122. line-height: 1.6;
  2123. .title {
  2124. font-size: 36rpx;
  2125. font-weight: 500;
  2126. color: #414858;
  2127. }
  2128. .time-or-subtitle {
  2129. margin-top: 12rpx;
  2130. color: #666666;
  2131. }
  2132. }
  2133. .descbox {
  2134. padding: 36rpx 32rpx;
  2135. margin-bottom: 20rpx;
  2136. background-color: #fff;
  2137. font-family: PingFang SC, PingFang SC;
  2138. font-weight: 400;
  2139. font-size: 28rpx;
  2140. color: #222222;
  2141. line-height: 42rpx;
  2142. word-break: break-word;
  2143. &-title {
  2144. margin-bottom: 24rpx;
  2145. font-weight: 500;
  2146. font-size: 32rpx;
  2147. }
  2148. &-info {
  2149. margin-bottom: 24rpx;
  2150. @include u-flex(row, center, space-between);
  2151. font-size: 26rpx;
  2152. color: #757575;
  2153. &-l {
  2154. flex: 1;
  2155. @include u-flex(row, center, flex-start);
  2156. }
  2157. &-time {
  2158. margin-left: 18rpx;
  2159. padding-left: 18rpx;
  2160. position: relative;
  2161. &::after {
  2162. content: "";
  2163. width: 4rpx;
  2164. height: 4rpx;
  2165. background: #999999;
  2166. border-radius: 50%;
  2167. position: absolute;
  2168. left: 0;
  2169. top: 50%;
  2170. transform: translateY(-50%);
  2171. }
  2172. }
  2173. &-r {
  2174. background: transparent;
  2175. }
  2176. }
  2177. &-desc {
  2178. overflow: hidden;
  2179. position: relative;
  2180. }
  2181. }
  2182. .expand {
  2183. flex-shrink: 0;
  2184. @include u-flex(row, center, flex-end);
  2185. color: #FF5C03;
  2186. font-weight: 400;
  2187. font-size: 24rpx;
  2188. image {
  2189. width: 32rpx;
  2190. height: 32rpx;
  2191. }
  2192. }
  2193. .expand-ab {
  2194. position: absolute;
  2195. top: 0;
  2196. right: 0;
  2197. box-shadow: -50rpx 0 20rpx 8rpx #FFFFFF;
  2198. background-color: #fff;
  2199. }
  2200. .ques-content {
  2201. background-color: #fff;
  2202. padding: 40rpx 32rpx;
  2203. box-sizing: border-box;
  2204. font-family: PingFang SC, PingFang SC;
  2205. font-weight: 400;
  2206. font-size: 28rpx;
  2207. color: #222222;
  2208. }
  2209. .ques-content-tit {
  2210. font-family: PingFang SC, PingFang SC;
  2211. font-weight: 600;
  2212. font-size: 36rpx;
  2213. color: #222222;
  2214. }
  2215. .ques-title {
  2216. margin: 48rpx 0 34rpx 0;
  2217. font-weight: 500;
  2218. font-size: 32rpx;
  2219. white-space: normal;
  2220. }
  2221. .ques-type {
  2222. flex-shrink: 0;
  2223. min-width: 72rpx;
  2224. min-height: 40rpx;
  2225. padding: 0 12rpx;
  2226. margin: 0 12rpx;
  2227. box-sizing: border-box;
  2228. background: #FF5C03;
  2229. border-radius: 8rpx 8rpx 8rpx 8rpx;
  2230. line-height: 40rpx;
  2231. text-align: center;
  2232. font-family: PingFang SC, PingFang SC;
  2233. font-weight: 400;
  2234. font-size: 24rpx;
  2235. color: #FFFFFF;
  2236. display: inline-block;
  2237. }
  2238. .ques-option {
  2239. min-height: 88rpx;
  2240. padding: 24rpx 32rpx;
  2241. box-sizing: border-box;
  2242. margin-bottom: 24rpx;
  2243. background: #F5F7FA;
  2244. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2245. display: flex;
  2246. align-items: center;
  2247. &-active {
  2248. color: #FF5C03 !important;
  2249. background: #FCF0E7 !important;
  2250. }
  2251. }
  2252. .video-line {
  2253. min-width: 140rpx;
  2254. max-width: 200rpx;
  2255. height: 60rpx;
  2256. padding: 0 20rpx;
  2257. box-sizing: border-box;
  2258. border-radius: 50rpx 0 0 50rpx;
  2259. overflow: hidden;
  2260. background-color: #fff;
  2261. text-align: center;
  2262. color: #888;
  2263. font-size: 28rpx;
  2264. line-height: 60rpx;
  2265. display: inline-flex;
  2266. align-items: center;
  2267. justify-content: center;
  2268. position: fixed;
  2269. right: 0;
  2270. z-index: 9;
  2271. bottom: calc(var(--window-bottom) + 280rpx);
  2272. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .12);
  2273. image {
  2274. flex-shrink: 0;
  2275. height: 30rpx;
  2276. width: 30rpx;
  2277. margin-right: 6rpx;
  2278. }
  2279. }
  2280. .footer {
  2281. border-top: 1rpx solid #ededef;
  2282. background: #fff;
  2283. width: 100%;
  2284. position: fixed;
  2285. bottom: 0;
  2286. padding: 32rpx;
  2287. // padding-bottom: calc(var(--window-bottom) + 14rpx);
  2288. box-sizing: border-box;
  2289. z-index: 0;
  2290. &-btn {
  2291. width: 100%;
  2292. height: 98rpx;
  2293. background: #FF5C03;
  2294. border-radius: 49rpx 49rpx 49rpx 49rpx;
  2295. line-height: 98rpx;
  2296. text-align: center;
  2297. font-family: PingFang SC, PingFang SC;
  2298. font-weight: 600;
  2299. font-size: 32rpx;
  2300. color: #FFFFFF;
  2301. @include u-flex(row, center, center);
  2302. &-img {
  2303. flex-shrink: 0;
  2304. width: 144rpx;
  2305. height: 144rpx;
  2306. margin-right: 8rpx;
  2307. margin-top: -24rpx;
  2308. }
  2309. }
  2310. &-btn-border {
  2311. position: relative;
  2312. &::after {
  2313. content: "";
  2314. background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  2315. position: absolute;
  2316. top: -2rpx;
  2317. left: 0;
  2318. height: 103rpx;
  2319. width: 100%;
  2320. z-index: -1;
  2321. border-radius: 49rpx 49rpx 49rpx 49rpx;
  2322. box-shadow: 0rpx 8rpx 11rpx 0rpx rgba(255, 92, 3, 0.3);
  2323. overflow: hidden;
  2324. }
  2325. }
  2326. }
  2327. }
  2328. .agreement {
  2329. display: inline-flex;
  2330. margin-top: 16rpx;
  2331. font-size: 24rpx;
  2332. color: #525252;
  2333. align-items: center;
  2334. justify-content: center;
  2335. }
  2336. .nocourse {
  2337. display: flex;
  2338. flex-direction: column;
  2339. align-items: center;
  2340. padding-bottom: 88rpx;
  2341. justify-content: center;
  2342. font-family: PingFang SC, PingFang SC;
  2343. font-weight: 400;
  2344. font-size: 32rpx;
  2345. color: #757575;
  2346. line-height: 48rpx;
  2347. text-align: center;
  2348. image {
  2349. width: 328rpx;
  2350. height: auto;
  2351. margin-bottom: 30rpx;
  2352. }
  2353. }
  2354. .logo {
  2355. display: inline-block;
  2356. width: 30px;
  2357. height: auto;
  2358. margin: 20px 0 0 10px;
  2359. pointer-events: none;
  2360. object-fit: cover;
  2361. }
  2362. .logo-full {
  2363. display: inline-block;
  2364. width: 40px;
  2365. height: auto;
  2366. margin: 50px 0 0 30px;
  2367. pointer-events: none;
  2368. object-fit: cover;
  2369. }
  2370. </style>