video.vue 60 KB

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