videoDetail.vue 63 KB

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