videoDetail.vue 60 KB

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