video.vue 61 KB

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