video.vue 59 KB

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