videovip.vue 62 KB

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