video.vue 61 KB

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