videovip.vue 61 KB

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