videoDetail.vue 63 KB

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