video.vue 61 KB

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