videovip.vue 62 KB

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