video.vue 60 KB

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