video.vue 61 KB

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