videovip.vue 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436
  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. this.errTitle = "恭喜你,回答正确"
  1259. uni.login({
  1260. provider: 'weixin',
  1261. success: async loginRes => {
  1262. console.log(loginRes)
  1263. var code=loginRes
  1264. this.closeAnswerPopup(loginRes.code)
  1265. }
  1266. })
  1267. // 答题成功
  1268. // this.errDesc = `请选择奖励`
  1269. // this.$refs.answerPopup.open("center")
  1270. // this.answerPopup=true
  1271. }
  1272. } else {
  1273. if (res.msg == "该课题到达答错次数限制") {
  1274. this.errTitle = "答题次数超过限制"
  1275. this.errDesc = "以后的课程要认真学习哦"
  1276. // this.$refs.answerPopup.open("center")
  1277. this.answerPopup=true
  1278. } else {
  1279. uni.showToast({
  1280. title: res.msg,
  1281. icon: "none"
  1282. })
  1283. }
  1284. }
  1285. },
  1286. rej => {}
  1287. )
  1288. },
  1289. // 选择
  1290. rewardChange(e) {
  1291. this.currentReward = e.detail.value
  1292. },
  1293. closeAnswerPopup(code) {
  1294. // this.$refs.answerPopup.close()
  1295. uni.showLoading({
  1296. title: "加载中..."
  1297. })
  1298. if (this.errTitle == '恭喜你,回答正确') {
  1299. const param = {
  1300. ...this.urlOption,
  1301. userId:this.userInfo.userId,
  1302. // rewardType: Number(this.currentReward),
  1303. source: 2, // 小程序
  1304. appId: this.appid,
  1305. code:code
  1306. }
  1307. sendReward(param).then(res => {
  1308. if(res.code == 200) {
  1309. uni.hideLoading()
  1310. // this.answerPopup=!this.answerPopup
  1311. console.log('红包',res)
  1312. if(res.isNew&&res.isNew==1) {
  1313. console.log('红包配置',res)
  1314. const packageInfo = res.data.packageInfo || ''
  1315. if(packageInfo) {
  1316. uni.setStorageSync('receive_package',packageInfo)
  1317. uni.setStorageSync('mchId',res.mchId)
  1318. uni.navigateTo({
  1319. url: '/pages_course/reward'
  1320. })
  1321. }
  1322. } else {
  1323. uni.showToast({
  1324. title: res.msg,
  1325. icon: 'none'
  1326. })
  1327. }
  1328. }else {
  1329. uni.hideLoading()
  1330. uni.showToast({
  1331. title: res.msg,
  1332. icon: 'none'
  1333. })
  1334. }
  1335. // if(res.code == 200) {
  1336. // //重构 发红包,后台通过OPENID发零钱到 账
  1337. // //this.initWXConfig(res.package)
  1338. // }else {
  1339. // uni.showToast({
  1340. // title: res.msg,
  1341. // icon: 'none'
  1342. // })
  1343. // }
  1344. })
  1345. }else{
  1346. uni.hideLoading()
  1347. this.answerPopup=!this.answerPopup
  1348. }
  1349. },
  1350. // 线路
  1351. openPop() {
  1352. this.$refs.popup.open('bottom')
  1353. },
  1354. close() {
  1355. this.$refs.popup.close()
  1356. },
  1357. handleLine(index) {
  1358. var that=this;
  1359. if (this.lineIndex == index && this.videoUrl == this.lineList[index]) {
  1360. this.close()
  1361. return
  1362. } else {
  1363. // let div = document.querySelector(".vjs-progress-control");
  1364. // if(div) {
  1365. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  1366. // div.style.pointerEvents = "auto";
  1367. // } else {
  1368. // div.style.pointerEvents = "none"; //禁止所有事件
  1369. // }
  1370. // }
  1371. this.lineIndex = index
  1372. this.videoUrl = this.lineList[index]
  1373. this.tipsOpen = false
  1374. this.playDurationSeek = this.playTime || 0
  1375. this.player = uni.createVideoContext('video-content-box');
  1376. setTimeout(function(){
  1377. that.player.seek(that.playDurationSeek)
  1378. that.player.play();
  1379. },500);
  1380. // this.player.src(this.lineList[index])
  1381. // this.player.one('loadedmetadata', () => {
  1382. // this.player.currentTime(this.playDurationSeek);
  1383. // this.player.play();
  1384. // });
  1385. this.close()
  1386. }
  1387. },
  1388. // 温馨提示
  1389. openTipsPop() {
  1390. // this.$refs.tipsPopup.open()
  1391. this.tipsPopup=true
  1392. // 暂停视频
  1393. this.videoContext.pause()
  1394. // this.tipsOpen = true
  1395. // this.pause()
  1396. },
  1397. closeTipsPop() {
  1398. // this.$refs.tipsPopup.close()
  1399. this.videoContext.play()
  1400. this.tipsPopup=!this.tipsPopup
  1401. },
  1402. // 客服
  1403. getIsAddKf() {
  1404. this.qrcode = ''
  1405. this.qrcodeMsg = ''
  1406. this.isAddKf = 0
  1407. const data = {
  1408. videoId:this.videoId,
  1409. userId:this.userInfo.userId,
  1410. companyUserId:this.companyUserId,
  1411. companyId:this.companyId,
  1412. courseId:this.courseId,
  1413. periodId:this.periodId
  1414. }
  1415. // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
  1416. getIsAddKf(data).then(res => {
  1417. if (res.code == 200) {
  1418. this.isLogin = true
  1419. if(res.data){
  1420. this.isAddKf = 1
  1421. this.getH5CourseVideoDetails()
  1422. }
  1423. // else{
  1424. // uni.showToast({
  1425. // title: '请联系管理员,注册为会员!',
  1426. // icon: 'none'
  1427. // });
  1428. // }
  1429. }else if(res.code==1002){
  1430. this.isAddKf = 0
  1431. this.qrcode=res.ext
  1432. this.kfPopup=true
  1433. uni.showToast({
  1434. title: "请添加管理员微信,成为会员!",
  1435. icon: 'none'
  1436. });
  1437. }else if(res.code==505){
  1438. this.isAddKf = 0
  1439. this.qrcode=res.ext
  1440. this.kfPopup=true
  1441. uni.showToast({
  1442. title: "管理员开启了会员审核,请等待审核!",
  1443. icon: 'none'
  1444. });
  1445. }else if(res.code==406){
  1446. uni.hideLoading();
  1447. uni.showToast({
  1448. icon:'none',
  1449. title: '该用户已成为其他销售会员',
  1450. });
  1451. }else if(res.code==504){
  1452. this.isAddKf = 0
  1453. this.iskftype=1
  1454. uni.showToast({
  1455. title: res.msg,
  1456. icon: 'none'
  1457. });
  1458. }
  1459. else {
  1460. this.isAddKf = 0
  1461. uni.showToast({
  1462. title: res.msg,
  1463. icon: 'none'
  1464. });
  1465. }
  1466. },
  1467. err => {}
  1468. );
  1469. },
  1470. closeKFPop() {
  1471. // this.$refs.kfPopup.close()
  1472. // this.kfPopup=!this.kfPopup
  1473. },
  1474. getFinishCourseVideo() {
  1475. if (!this.playTime) return
  1476. // {videoId: this.videoId,duration:this.playTime}
  1477. const param = {
  1478. duration: this.playTime,
  1479. videoId:this.videoId,
  1480. userId:this.userInfo.userId,
  1481. companyUserId:this.companyUserId
  1482. }
  1483. getFinishCourseVideo(param)
  1484. },
  1485. // 每十分钟获得积分
  1486. getIntegralByH5Video() {
  1487. const param = {
  1488. duration: this.playTime,
  1489. ...this.urlOption
  1490. }
  1491. getIntegralByH5Video(param).then(res => {
  1492. if (res.code == 200) {
  1493. uni.showToast({
  1494. title: "积分+10",
  1495. icon: "none"
  1496. })
  1497. }
  1498. })
  1499. },
  1500. progressChange(e) {
  1501. this.bufferRate = Math.ceil(e.detail.buffered)
  1502. // console.log('缓冲结果',this.bufferRate)
  1503. // console.log('缓冲',this.playTime,this.duration)
  1504. },
  1505. // 缓冲
  1506. getInternetTraffic() {
  1507. const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
  1508. // console.log('播放百分比',playVideoTime)
  1509. if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
  1510. this.bufferRate = playVideoTime
  1511. console.log(this.bufferRate)
  1512. }
  1513. if(this.bufferRate == 0 || Number(this.bufferRate.toFixed(2)) == 0) return
  1514. const param = {
  1515. uuId: dayjs().format('YYYYMMDD') + this.uuId,
  1516. duration: this.playTime,
  1517. bufferRate: Number(this.bufferRate.toFixed(2)),
  1518. userId:this.userId,
  1519. periodId:this.periodId,
  1520. ...this.urlOption
  1521. }
  1522. getInternetTraffic(param)
  1523. },
  1524. getErrMsg(err) {
  1525. let msgerr = {
  1526. videoUrl: this.videoUrl,
  1527. lineIndex: this.lineIndex,
  1528. errTime: new Date(),
  1529. // ip: this.ip,
  1530. errMsg: err
  1531. }
  1532. getErrMsg({
  1533. msg: JSON.stringify(msgerr)
  1534. })
  1535. },
  1536. goLogin() {
  1537. },
  1538. getLink() {
  1539. this.goLogin()
  1540. return
  1541. let that = this;
  1542. this.msg = ''
  1543. getRealLink({sortLink:this.sortLink}).then(res=>{
  1544. if(res.code == 200) {
  1545. this.isExpire = false
  1546. // 如果响应中包含真实链接,则跳转到真实链接
  1547. // window.location.href = res.realLink +"&sortLink="+this.sortLink+"&code="+this.code+"&time="+new Date().getTime()
  1548. if (this.isLogin && this.isAddKf == 1) {
  1549. this.getH5CourseVideoDetails()
  1550. }
  1551. if (this.videoId && this.isAddKf != 1) {
  1552. this.$isLoginCourse().then(
  1553. isLogin => {
  1554. this.isLogin = isLogin
  1555. if(isLogin){
  1556. this.getIsAddKf()
  1557. } else {
  1558. this.goLogin()
  1559. }
  1560. },
  1561. rej => {}
  1562. );
  1563. }
  1564. } else {
  1565. this.isExpire = true
  1566. this.msg = '课程已过期或链接无效'
  1567. uni.showToast({
  1568. title: '课程已过期或链接无效',
  1569. icon: 'none'
  1570. });
  1571. }
  1572. }).catch(err=>{
  1573. this.isExpire = true
  1574. this.msg = '发生错误,请稍后再试'
  1575. uni.showToast({
  1576. title: '发生错误,请稍后再试',
  1577. icon: 'none'
  1578. });
  1579. })
  1580. },
  1581. /**
  1582. * 节流原理:在一定时间内,只能触发一次
  1583. *
  1584. * @param {Function} func 要执行的回调函数
  1585. * @param {Number} wait 延时的时间
  1586. * @param {Boolean} immediate 是否立即执行
  1587. * @return null
  1588. */
  1589. throttle(func, wait = 500, immediate = true) {
  1590. if (immediate) {
  1591. if (!this.flag) {
  1592. this.flag = true
  1593. // 如果是立即执行,则在wait毫秒内开始时执行
  1594. typeof func === 'function' && func()
  1595. this.timer = setTimeout(() => {
  1596. this.flag = false
  1597. }, wait)
  1598. }
  1599. } else if (!this.flag) {
  1600. this.flag = true
  1601. // 如果是非立即执行,则在wait毫秒内的结束处执行
  1602. this.timer = setTimeout(() => {
  1603. this.flag = false
  1604. typeof func === 'function' && func()
  1605. }, wait)
  1606. }
  1607. }
  1608. }
  1609. }
  1610. </script>
  1611. <style scoped>
  1612. .full-width-popup {
  1613. width: 100%;
  1614. }
  1615. </style>
  1616. <style lang="scss" scoped>
  1617. .subname{
  1618. background-color: #00aa00;
  1619. color: #fff;
  1620. }
  1621. .subavt{
  1622. background-color: #fff;
  1623. border: 2rpx #0a0 solid;
  1624. color: #00aa00;
  1625. }
  1626. .boxweixin{
  1627. width: 44rpx;
  1628. height: 44rpx;
  1629. border-radius: 50%;
  1630. text-align: center;
  1631. line-height: 34rpx;
  1632. color: #0a0;
  1633. }
  1634. .boxnosel{
  1635. border: #757575 4rpx solid;
  1636. }
  1637. .boxsel{
  1638. border: #0a0 4rpx solid;
  1639. }
  1640. .button-container {
  1641. position: relative;
  1642. width: 240rpx;
  1643. }
  1644. .hidden-input {
  1645. position: absolute;
  1646. top: 0;
  1647. left: 0;
  1648. width: 100%;
  1649. height: 100%;
  1650. opacity: 0;
  1651. z-index: 2;
  1652. }
  1653. .custom-button {
  1654. position: relative;
  1655. z-index: 1;
  1656. /* 其他样式 */
  1657. width:100%;
  1658. margin: 0 auto;
  1659. height: 80rpx;
  1660. line-height: 60rpx;
  1661. font-size: 28rpx;
  1662. padding: 10rpx 20rpx;
  1663. }
  1664. .submitname{
  1665. width: 90%;
  1666. margin: 0 auto;
  1667. text-align: center;
  1668. padding: 30rpx;
  1669. margin-top: 40rpx;
  1670. }
  1671. .sub{
  1672. background-color: #f0f0f0;
  1673. color: #0a0;
  1674. }
  1675. .subact{
  1676. background-color: #0a0;
  1677. color: #fff;
  1678. }
  1679. .userlogo{
  1680. height: 760rpx;
  1681. }
  1682. .getlogo{
  1683. width:240rpx;
  1684. background-color: #fff;
  1685. // padding: 10rpx 20rpx;
  1686. }
  1687. @mixin u-flex($flexD, $alignI, $justifyC) {
  1688. display: flex;
  1689. flex-direction: $flexD;
  1690. align-items: $alignI;
  1691. justify-content: $justifyC;
  1692. }
  1693. .footer-tips {
  1694. position: fixed;
  1695. width: 100%;
  1696. bottom: 144rpx;
  1697. text-align: center;
  1698. font-family: PingFang SC,PingFang SC;
  1699. font-weight: 500;
  1700. font-size: 12px;
  1701. color: #bbb;
  1702. transform: scale(0.8);
  1703. }
  1704. .btns{
  1705. position: relative;
  1706. width: 100%;
  1707. height: 80rpx;
  1708. .author-btn{
  1709. z-index:100;
  1710. position: absolute;
  1711. width: 100%;
  1712. height: 80rpx;
  1713. background: #ff5c03;
  1714. border-radius: 40rpx;
  1715. font-size: 36rpx;
  1716. font-family: PingFang SC;
  1717. font-weight: 500;
  1718. text-align: center;
  1719. line-height: 80rpx;
  1720. color: rgba(255, 255, 255, 1);
  1721. }
  1722. }
  1723. .textOne {
  1724. overflow: hidden;
  1725. white-space: nowrap;
  1726. text-overflow: ellipsis;
  1727. }
  1728. .textTwo {
  1729. overflow: hidden;
  1730. text-overflow: ellipsis;
  1731. display: -webkit-box;
  1732. -webkit-line-clamp: 2;
  1733. -webkit-box-orient: vertical;
  1734. }
  1735. .header-nav {
  1736. height: 88rpx;
  1737. @include u-flex(row, center, flex-start);
  1738. overflow: hidden;
  1739. background-color: #fff;
  1740. box-sizing: border-box;
  1741. .header-title {
  1742. text-align: center;
  1743. overflow: hidden;
  1744. white-space: nowrap;
  1745. text-overflow: ellipsis;
  1746. padding: 0 10rpx 0 100rpx;
  1747. font-family: PingFang SC,PingFang SC;
  1748. font-weight: 500;
  1749. font-size: 15px;
  1750. color: #000;
  1751. box-sizing: border-box;
  1752. }
  1753. }
  1754. .reward-list {
  1755. width: 100%;
  1756. margin-top: 20rpx;
  1757. margin-bottom: -40rpx;
  1758. &-group {
  1759. font-family: PingFang SC, PingFang SC;
  1760. font-weight: 400;
  1761. font-size: 14px;
  1762. color: #222222;
  1763. @include u-flex(row, center, center);
  1764. }
  1765. &-option {
  1766. @include u-flex(row, center, flex-start);
  1767. &:first-child {
  1768. margin-right: 40rpx;
  1769. }
  1770. }
  1771. }
  1772. .err {
  1773. color: #f56c6c !important;
  1774. }
  1775. .kfqrcode-box {
  1776. background-color: #fff;
  1777. border-radius: 16rpx;
  1778. max-width: 560rpx;
  1779. padding: 60rpx 40rpx;
  1780. margin-top: -100rpx;
  1781. box-sizing: border-box;
  1782. @include u-flex(column, center, flex-start);
  1783. font-family: PingFang SC, PingFang SC;
  1784. font-weight: 400;
  1785. font-size: 34rpx;
  1786. color: #222;
  1787. position: relative;
  1788. text-align: center;
  1789. .kfqrcode {
  1790. // height: 460rpx;
  1791. width: 460rpx;
  1792. }
  1793. }
  1794. .kfqrcode-close {
  1795. width: 64rpx;
  1796. height: 64rpx;
  1797. position: absolute;
  1798. bottom: -100rpx;
  1799. left: 50%;
  1800. transform: translateX(-50%);
  1801. }
  1802. .tipsPopup-mask {
  1803. position: relative;
  1804. width: 560rpx;
  1805. background-color: transparent;
  1806. .red_envelope_top {
  1807. width: 480rpx;
  1808. height: 360rpx;
  1809. margin: 0 auto;
  1810. display: inherit;
  1811. }
  1812. }
  1813. .tipsPopup-btn-box {
  1814. width: 456rpx;
  1815. height: 104rpx;
  1816. padding: 4rpx;
  1817. box-sizing: border-box;
  1818. background: linear-gradient(180deg, rgba(252, 209, 94, 1), rgba(254, 253, 251, 1));
  1819. border-radius: 52rpx;
  1820. }
  1821. .tipsPopup-btn {
  1822. width: 100%;
  1823. height: 100%;
  1824. background: linear-gradient(180deg, #FF9F22 0%, #FA1E05 100%);
  1825. border-radius: 52rpx 52rpx 52rpx 52rpx;
  1826. font-family: PingFang SC, PingFang SC;
  1827. font-weight: 500;
  1828. font-size: 36rpx;
  1829. color: #FFFFFF;
  1830. line-height: 96rpx;
  1831. text-align: center;
  1832. }
  1833. .tipsPopup {
  1834. width: 560rpx;
  1835. padding: 12rpx;
  1836. margin-top: -72rpx;
  1837. box-sizing: border-box;
  1838. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1839. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1840. position: relative;
  1841. &-close {
  1842. width: 64rpx;
  1843. height: 64rpx;
  1844. position: absolute;
  1845. right: 0;
  1846. top: -188rpx;
  1847. }
  1848. &-line {
  1849. padding: 3rpx;
  1850. box-sizing: border-box;
  1851. background: linear-gradient(180deg, rgba(247, 245, 220, 1), rgba(250, 220, 157, 1));
  1852. border-radius: 24rpx;
  1853. }
  1854. &-box {
  1855. padding: 0 40rpx 40rpx 40rpx;
  1856. box-sizing: border-box;
  1857. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1858. border-radius: 24rpx;
  1859. @include u-flex(column, center, flex-start);
  1860. }
  1861. &-head {
  1862. @include u-flex(row, center, center);
  1863. &-title {
  1864. width: 364rpx;
  1865. height: auto;
  1866. margin-top: -22rpx;
  1867. }
  1868. }
  1869. &-content {
  1870. margin: 48rpx 0;
  1871. font-family: PingFang SC, PingFang SC;
  1872. font-weight: 500;
  1873. font-size: 32rpx;
  1874. color: #222222;
  1875. text-align: center;
  1876. &-title {
  1877. margin-bottom: 26rpx;
  1878. font-weight: 600;
  1879. font-size: 40rpx;
  1880. color: #FF5C03;
  1881. }
  1882. }
  1883. }
  1884. .video-controls-box {
  1885. width: 100%;
  1886. height: 420rpx;
  1887. overflow: hidden;
  1888. position: absolute;
  1889. bottom: 0;
  1890. left: 0;
  1891. z-index: 2;
  1892. background: rgba(0, 0, 0, 0.2);
  1893. .video-play {
  1894. height: 72rpx;
  1895. width: 72rpx;
  1896. position: absolute;
  1897. top: 50%;
  1898. left: 50%;
  1899. transform: translate(-50%, -50%);
  1900. }
  1901. }
  1902. .video-controls {
  1903. width: 100%;
  1904. height: 80rpx;
  1905. padding: 0 28rpx;
  1906. box-sizing: border-box;
  1907. position: absolute;
  1908. bottom: 0;
  1909. left: 0;
  1910. display: flex;
  1911. align-items: center;
  1912. justify-content: space-between;
  1913. background: linear-gradient(to top, #222 0%, transparent 80%);
  1914. .video-icon {
  1915. height: 44rpx;
  1916. width: 44rpx;
  1917. }
  1918. }
  1919. .errQuesbox {
  1920. width: 100%;
  1921. max-height: 260rpx;
  1922. overflow-y: auto;
  1923. margin-top: 24rpx;
  1924. font-family: PingFang SC, PingFang SC;
  1925. font-weight: 500;
  1926. font-size: 30rpx;
  1927. color: #222222;
  1928. &-item {
  1929. width: 100%;
  1930. height: 128rpx;
  1931. line-height: 128rpx;
  1932. margin-bottom: 24rpx;
  1933. padding: 0 30rpx;
  1934. box-sizing: border-box;
  1935. overflow: hidden;
  1936. background: #fff;
  1937. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1938. position: relative;
  1939. &::after {
  1940. content: "题目";
  1941. min-width: 64rpx;
  1942. height: 36rpx;
  1943. padding: 0 12rpx;
  1944. line-height: 36rpx;
  1945. background: #FF5C03;
  1946. box-sizing: border-box;
  1947. border-radius: 0rpx 0rpx 16rpx 0rpx;
  1948. text-align: center;
  1949. font-family: PingFang SC, PingFang SC;
  1950. font-weight: 500;
  1951. font-size: 20rpx;
  1952. color: #fff;
  1953. position: absolute;
  1954. left: 0;
  1955. top: 0;
  1956. }
  1957. }
  1958. }
  1959. .bg {
  1960. background: #fff !important;
  1961. }
  1962. .timepopbox{
  1963. width: 560rpx;
  1964. padding: 32rpx;
  1965. box-sizing: border-box;
  1966. }
  1967. .answerPopup {
  1968. &-box {
  1969. width: 560rpx;
  1970. background: linear-gradient(180deg, #FFFAF6 0%, #FEECD8 100%);
  1971. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1972. background-color: #fff;
  1973. font-weight: 400;
  1974. padding: 32rpx;
  1975. box-sizing: border-box;
  1976. position: relative;
  1977. @include u-flex(column, center, flex-start);
  1978. font-family: PingFang SC, PingFang SC;
  1979. font-weight: 400;
  1980. .tipimg {
  1981. width: 206rpx;
  1982. height: 206rpx;
  1983. margin-bottom: 16rpx;
  1984. }
  1985. }
  1986. &-title {
  1987. font-weight: 600;
  1988. font-size: 36rpx;
  1989. color: #222222;
  1990. }
  1991. &-desc {
  1992. margin-top: 10rpx;
  1993. font-size: 28rpx;
  1994. color: #757575;
  1995. }
  1996. &-btn {
  1997. width: 464rpx;
  1998. height: 84rpx;
  1999. margin-top: 54rpx;
  2000. margin-bottom: 16rpx;
  2001. background: #FF5C03;
  2002. border-radius: 42rpx;
  2003. font-weight: 500;
  2004. font-size: 32rpx;
  2005. color: #FFFFFF;
  2006. text-align: center;
  2007. line-height: 84rpx;
  2008. }
  2009. }
  2010. .popupbox {
  2011. width: 100%;
  2012. background-color: #fff;
  2013. border-radius: 16rpx 16rpx 0 0;
  2014. padding: 24rpx 32rpx;
  2015. position: relative;
  2016. &-head {
  2017. height: 60rpx;
  2018. margin-bottom: 30rpx;
  2019. text-align: center;
  2020. overflow-y: auto;
  2021. color: #414858;
  2022. font-size: 32rpx;
  2023. font-weight: bold;
  2024. position: relative;
  2025. .close-icon {
  2026. position: absolute;
  2027. right: 0;
  2028. top: 0;
  2029. height: 40rpx;
  2030. width: 40rpx;
  2031. }
  2032. }
  2033. &-content {
  2034. height: 20vh;
  2035. overflow-y: auto;
  2036. display: flex;
  2037. align-items: flex-start;
  2038. flex-wrap: wrap;
  2039. gap: 32rpx;
  2040. .line-item {
  2041. display: inline-block;
  2042. min-width: 200rpx;
  2043. min-height: 60rpx;
  2044. padding: 0 20rpx;
  2045. box-sizing: border-box;
  2046. border-radius: 50rpx;
  2047. overflow: hidden;
  2048. background-color: #f7f7f7;
  2049. text-align: center;
  2050. color: #414858;
  2051. font-size: 28rpx;
  2052. line-height: 60rpx;
  2053. }
  2054. .line-active {
  2055. color: #f56c6c !important;
  2056. background-color: #fef0f0 !important;
  2057. }
  2058. }
  2059. }
  2060. .content {
  2061. padding-bottom: calc(var(--window-bottom) + 164rpx);
  2062. .video-box {
  2063. width: 100%;
  2064. height: 420rpx;
  2065. overflow: hidden;
  2066. position: relative;
  2067. #myVideo {
  2068. width: 100%;
  2069. height: 100%;
  2070. }
  2071. }
  2072. .video-poster {
  2073. width: 100%;
  2074. height: 420rpx;
  2075. }
  2076. .miantitlebox {
  2077. padding: 30rpx 0;
  2078. border-bottom: 2rpx solid #F5F7FA;
  2079. font-family: PingFang SC, PingFang SC;
  2080. font-weight: 500;
  2081. font-size: 40rpx;
  2082. color: #222222;
  2083. }
  2084. .subtitlebox {
  2085. padding: 30rpx 0;
  2086. border-bottom: 2rpx solid #F5F7FA;
  2087. font-family: PingFang SC, PingFang SC;
  2088. font-weight: 500;
  2089. font-size: 40rpx;
  2090. color: #222222;
  2091. }
  2092. .title-content {
  2093. padding: 0 32rpx;
  2094. background-color: #fff;
  2095. font-size: 28rpx;
  2096. line-height: 1.6;
  2097. .title {
  2098. font-size: 36rpx;
  2099. font-weight: 500;
  2100. color: #414858;
  2101. }
  2102. .time-or-subtitle {
  2103. margin-top: 12rpx;
  2104. color: #666666;
  2105. }
  2106. }
  2107. .descbox {
  2108. padding: 36rpx 32rpx;
  2109. margin-bottom: 20rpx;
  2110. background-color: #fff;
  2111. font-family: PingFang SC, PingFang SC;
  2112. font-weight: 400;
  2113. font-size: 28rpx;
  2114. color: #222222;
  2115. line-height: 42rpx;
  2116. word-break: break-word;
  2117. &-title {
  2118. margin-bottom: 24rpx;
  2119. font-weight: 500;
  2120. font-size: 32rpx;
  2121. }
  2122. &-info {
  2123. margin-bottom: 24rpx;
  2124. @include u-flex(row, center, space-between);
  2125. font-size: 26rpx;
  2126. color: #757575;
  2127. &-l {
  2128. flex: 1;
  2129. @include u-flex(row, center, flex-start);
  2130. }
  2131. &-time {
  2132. margin-left: 18rpx;
  2133. padding-left: 18rpx;
  2134. position: relative;
  2135. &::after {
  2136. content: "";
  2137. width: 4rpx;
  2138. height: 4rpx;
  2139. background: #999999;
  2140. border-radius: 50%;
  2141. position: absolute;
  2142. left: 0;
  2143. top: 50%;
  2144. transform: translateY(-50%);
  2145. }
  2146. }
  2147. &-r {
  2148. background: transparent;
  2149. }
  2150. }
  2151. &-desc {
  2152. overflow: hidden;
  2153. position: relative;
  2154. }
  2155. }
  2156. .expand {
  2157. flex-shrink: 0;
  2158. @include u-flex(row, center, flex-end);
  2159. color: #FF5C03;
  2160. font-weight: 400;
  2161. font-size: 24rpx;
  2162. image {
  2163. width: 32rpx;
  2164. height: 32rpx;
  2165. }
  2166. }
  2167. .expand-ab {
  2168. position: absolute;
  2169. top: 0;
  2170. right: 0;
  2171. box-shadow: -50rpx 0 20rpx 8rpx #FFFFFF;
  2172. background-color: #fff;
  2173. }
  2174. .ques-content {
  2175. background-color: #fff;
  2176. padding: 40rpx 32rpx;
  2177. box-sizing: border-box;
  2178. font-family: PingFang SC, PingFang SC;
  2179. font-weight: 400;
  2180. font-size: 28rpx;
  2181. color: #222222;
  2182. }
  2183. .ques-content-tit {
  2184. font-family: PingFang SC, PingFang SC;
  2185. font-weight: 600;
  2186. font-size: 36rpx;
  2187. color: #222222;
  2188. }
  2189. .ques-title {
  2190. margin: 48rpx 0 34rpx 0;
  2191. font-weight: 500;
  2192. font-size: 32rpx;
  2193. white-space: normal;
  2194. }
  2195. .ques-type {
  2196. flex-shrink: 0;
  2197. min-width: 72rpx;
  2198. min-height: 40rpx;
  2199. padding: 0 12rpx;
  2200. margin: 0 12rpx;
  2201. box-sizing: border-box;
  2202. background: #FF5C03;
  2203. border-radius: 8rpx 8rpx 8rpx 8rpx;
  2204. line-height: 40rpx;
  2205. text-align: center;
  2206. font-family: PingFang SC, PingFang SC;
  2207. font-weight: 400;
  2208. font-size: 24rpx;
  2209. color: #FFFFFF;
  2210. display: inline-block;
  2211. }
  2212. .ques-option {
  2213. min-height: 88rpx;
  2214. padding: 24rpx 32rpx;
  2215. box-sizing: border-box;
  2216. margin-bottom: 24rpx;
  2217. background: #F5F7FA;
  2218. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2219. display: flex;
  2220. align-items: center;
  2221. &-active {
  2222. color: #FF5C03 !important;
  2223. background: #FCF0E7 !important;
  2224. }
  2225. }
  2226. .video-line {
  2227. min-width: 140rpx;
  2228. max-width: 200rpx;
  2229. height: 60rpx;
  2230. padding: 0 20rpx;
  2231. box-sizing: border-box;
  2232. border-radius: 50rpx 0 0 50rpx;
  2233. overflow: hidden;
  2234. background-color: #fff;
  2235. text-align: center;
  2236. color: #888;
  2237. font-size: 28rpx;
  2238. line-height: 60rpx;
  2239. display: inline-flex;
  2240. align-items: center;
  2241. justify-content: center;
  2242. position: fixed;
  2243. right: 0;
  2244. z-index: 9;
  2245. bottom: calc(var(--window-bottom) + 280rpx);
  2246. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .12);
  2247. image {
  2248. flex-shrink: 0;
  2249. height: 30rpx;
  2250. width: 30rpx;
  2251. margin-right: 6rpx;
  2252. }
  2253. }
  2254. .footer {
  2255. border-top: 1rpx solid #ededef;
  2256. background: #fff;
  2257. width: 100%;
  2258. position: fixed;
  2259. bottom: 0;
  2260. padding: 32rpx;
  2261. // padding-bottom: calc(var(--window-bottom) + 14rpx);
  2262. box-sizing: border-box;
  2263. z-index: 0;
  2264. &-btn {
  2265. width: 100%;
  2266. height: 98rpx;
  2267. background: #FF5C03;
  2268. border-radius: 49rpx 49rpx 49rpx 49rpx;
  2269. line-height: 98rpx;
  2270. text-align: center;
  2271. font-family: PingFang SC, PingFang SC;
  2272. font-weight: 600;
  2273. font-size: 32rpx;
  2274. color: #FFFFFF;
  2275. @include u-flex(row, center, center);
  2276. &-img {
  2277. flex-shrink: 0;
  2278. width: 144rpx;
  2279. height: 144rpx;
  2280. margin-right: 8rpx;
  2281. margin-top: -24rpx;
  2282. }
  2283. }
  2284. &-btn-border {
  2285. position: relative;
  2286. &::after {
  2287. content: "";
  2288. background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  2289. position: absolute;
  2290. top: -2rpx;
  2291. left: 0;
  2292. height: 103rpx;
  2293. width: 100%;
  2294. z-index: -1;
  2295. border-radius: 49rpx 49rpx 49rpx 49rpx;
  2296. box-shadow: 0rpx 8rpx 11rpx 0rpx rgba(255, 92, 3, 0.3);
  2297. overflow: hidden;
  2298. }
  2299. }
  2300. }
  2301. }
  2302. .agreement {
  2303. display: inline-flex;
  2304. margin-top: 16rpx;
  2305. font-size: 24rpx;
  2306. color: #525252;
  2307. align-items: center;
  2308. justify-content: center;
  2309. }
  2310. .nocourse {
  2311. display: flex;
  2312. flex-direction: column;
  2313. align-items: center;
  2314. padding-bottom: 88rpx;
  2315. justify-content: center;
  2316. font-family: PingFang SC, PingFang SC;
  2317. font-weight: 400;
  2318. font-size: 32rpx;
  2319. color: #757575;
  2320. line-height: 48rpx;
  2321. text-align: center;
  2322. image {
  2323. width: 328rpx;
  2324. height: auto;
  2325. margin-bottom: 30rpx;
  2326. }
  2327. }
  2328. .logo {
  2329. display: inline-block;
  2330. width: 30px;
  2331. height: auto;
  2332. margin: 20px 0 0 10px;
  2333. pointer-events: none;
  2334. object-fit: cover;
  2335. }
  2336. .logo-full {
  2337. display: inline-block;
  2338. width: 40px;
  2339. height: auto;
  2340. margin: 50px 0 0 30px;
  2341. pointer-events: none;
  2342. object-fit: cover;
  2343. }
  2344. </style>