video.vue 62 KB

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