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