video.vue 62 KB

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