videoDetail.vue 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425
  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" v-if="qrcode" :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.quesList = res.questions && res.questions.length > 0 ? res.questions : []
  779. this.quesList = this.quesList.map(item => ({
  780. ...item,
  781. questionOption: JSON.parse(item.question),
  782. answer: ''
  783. }))
  784. this.courseLogo = res.config&&res.config.courseLogo
  785. this.viewCommentNum = res.config&&res.config.viewCommentNum || 200
  786. this.openCommentStatus = res.config&&res.config.openCommentStatus || 3;
  787. // this.openCommentStatus = source
  788. // console.log('socket===',socket,this.openCommentStatus)
  789. if(this.openCommentStatus == 3) {
  790. this.closeSocket()
  791. }else {
  792. this.initSocket()
  793. }
  794. this.currentTab = 1
  795. if(this.openCommentStatus!=2 || this.showDanmu!=1) {
  796. this.activeDanmus = []
  797. }
  798. this.fsUserCourseRewardRoundStatusVO = this.getBox(res)
  799. if (!this.player || type == 'error') {
  800. this.lineIndex = this.config.defaultLine
  801. this.videoUrl = lineList[this.lineIndex]
  802. this.poster= res.course && res.course.imgUrl ? res.course.imgUrl : ''
  803. // this.options.sources = [{
  804. // src: this.videoUrl
  805. // }]
  806. // this.options.poster = res.course && res.course.imgUrl ? res.course.imgUrl : ''
  807. // this.initVideo()
  808. this.playTime = this.playDuration >= this.duration ? 0 : this.playDuration
  809. this.playDurationSeek = this.playTime
  810. setTimeout(()=>{
  811. this.player = uni.createVideoContext('video-content-box');
  812. this.player.seek(this.playTime)
  813. this.player.play();
  814. },500);
  815. } else {
  816. // let div = document.querySelector(".vjs-progress-control");
  817. // if(div) {
  818. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  819. // div.style.pointerEvents = "auto";
  820. // } else {
  821. // div.style.pointerEvents = "none"; //禁止所有事件
  822. // }
  823. // }
  824. this.playTime = this.playTime > this.playDuration ? this.playTime : this.playDuration >= this.duration ? 0 : this.playDuration
  825. this.playDurationSeek = this.playTime
  826. this.player.seek(this.playTime)
  827. this.player.play();
  828. }
  829. this.updateTime();
  830. } else {
  831. uni.showToast({
  832. title: res.msg,
  833. icon: 'none'
  834. })
  835. }
  836. this.getHeight()
  837. this.$nextTick(()=>{
  838. this.$refs.descInfo&&this.$refs.descInfo.getDescHeight()
  839. this.$refs.descInfoNav&&this.$refs.descInfoNav.getDescHeight()
  840. })
  841. },
  842. rej => {}
  843. )
  844. },
  845. handleAnswer(val) {
  846. let {item, option,index} = val
  847. let time = this.playTime
  848. if(this.isEnded||this.isFinish==1) {
  849. time = this.duration
  850. } else {
  851. if(time < this.playDuration&&this.isFinish!=1) {
  852. // 没完课且小于续播的时间
  853. time = this.playDuration
  854. }
  855. }
  856. if(Number(this.duration || 0) == 0 || time < this.duration - 60) {
  857. uni.showToast({
  858. title: "请先观看完整课程再答题哦~",
  859. icon: "none"
  860. })
  861. return
  862. }
  863. if (this.quesList[index].type == 1) {
  864. // 单选option
  865. this.quesList[index].answer = option.name
  866. } else if (this.quesList[index].type == 2) {
  867. // 多选
  868. let answer = this.quesList[index].answer ? this.quesList[index].answer.split(',') : []
  869. if (answer.indexOf(option.name) === -1) {
  870. answer.push(option.name)
  871. this.quesList[index].answer = answer.join(',')
  872. } else {
  873. answer.splice(answer.indexOf(option.name), 1)
  874. this.quesList[index].answer = answer.join(',')
  875. }
  876. }
  877. },
  878. submit() {
  879. if(this.isExpire){
  880. uni.showToast({
  881. title: '课程已过期或链接无效',
  882. icon: 'none'
  883. });
  884. return
  885. }
  886. // 登录
  887. this.utils.isLoginCourse().then(
  888. res => {
  889. if(res){
  890. if (this.isAddKf == 1&&this.isCheckRealUrl) {
  891. // 答题
  892. // 您已提交过答案,请领取红包
  893. this.courseAnswer()
  894. } else {
  895. // 添加客服
  896. if (this.videoId && this.qwUserId) {
  897. this.getIsAddKf()
  898. } else {
  899. uni.showToast({
  900. title: '请添加客服',
  901. icon: 'none'
  902. })
  903. }
  904. }
  905. } else{
  906. this.goLogin()
  907. }
  908. },
  909. rej => {}
  910. );
  911. },
  912. // 答题
  913. courseAnswer() {
  914. let time = this.playTime
  915. if (this.isEnded || this.isFinish==1) {
  916. time = this.duration
  917. } else {
  918. if (time < this.playDuration && this.isFinish != 1) {
  919. // 没完课且小于续播的时间
  920. time = this.playDuration
  921. }
  922. }
  923. if (Number(this.duration || 0) == 0 || time < this.duration - 60) {
  924. uni.showToast({
  925. title: "请先观看完整课程再答题哦~",
  926. icon: "none"
  927. })
  928. return
  929. }
  930. if (this.quesList.some(item => !item.answer)) {
  931. uni.showToast({
  932. title: "请确认是否答完所有题目",
  933. icon: "none"
  934. })
  935. return
  936. }
  937. const questions = this.quesList.map(obj => {
  938. const {
  939. questionOption,
  940. ...rest
  941. } = obj;
  942. return rest;
  943. });
  944. if(!this.isCheckRealUrl) return;
  945. const param = {
  946. ...this.urlOption,
  947. questions: questions,
  948. videoId: this.videoId,
  949. duration: this.playTime,
  950. }
  951. this.errTitle = ""
  952. this.errDesc = ""
  953. this.errQues = []
  954. courseAnswer(param).then(res => {
  955. if (res.code == 200) {
  956. if (res.incorrectQuestions) {
  957. // 答题失败
  958. if (res.incorrectQuestions.length > 0) {
  959. this.errQues = res.incorrectQuestions
  960. }
  961. this.remain = res.remain || 0
  962. if (res.remain > 0) {
  963. this.errTitle = "很遗憾答错了"
  964. this.errDesc = `<span style="color:#FF5C03">还有${res.remain}次机会,继续加油</span>`
  965. this.$refs.answerPopup.open("center")
  966. }
  967. } else {
  968. // 答题成功
  969. this.errTitle = "恭喜你,回答正确"
  970. this.errDesc = `请选择奖励`
  971. this.currentReward = this.rewardType&&this.rewardType.length>0 ? this.rewardType[0].value : -1
  972. this.$refs.answerPopup.open("center")
  973. }
  974. } else {
  975. if (res.msg == "该课题到达答错次数限制") {
  976. this.errTitle = "答题次数超过限制"
  977. this.errDesc = "以后的课程要认真学习哦"
  978. this.$refs.answerPopup.open("center")
  979. } else {
  980. uni.showToast({
  981. title: res.msg,
  982. icon: "none"
  983. })
  984. }
  985. }
  986. },
  987. rej => {}
  988. )
  989. },
  990. // 选择
  991. rewardChange(e) {
  992. this.currentReward = e.value
  993. },
  994. closeAnswerPopup() {
  995. this.$refs.answerPopup.close()
  996. if(!this.isCheckRealUrl) return;
  997. if (this.errTitle == '恭喜你,回答正确') {
  998. if(this.currentReward==4) {
  999. this.$refs.turntableTwo.open(this.urlOption)
  1000. } else if(this.currentReward==3) {
  1001. this.$refs.turntableOne.open(this.urlOption)
  1002. } else {
  1003. this.sendRewardFun(this.currentReward)
  1004. }
  1005. }
  1006. },
  1007. sendRewardFun(currentReward) {
  1008. this.currentReward = currentReward
  1009. const param = {
  1010. ...this.urlOption,
  1011. rewardType: Number(this.currentReward),
  1012. source: 2,
  1013. appId: getApp().globalData.appId
  1014. }
  1015. sendReward(param).then(res => {
  1016. if(res.code == 200) {
  1017. if(currentReward == 4) {
  1018. this.$refs.turntableTwo.endSuccess(res.data)
  1019. }else if(currentReward == 3) {
  1020. this.$refs.turntableOne.endSuccess(res.data)
  1021. }else {
  1022. uni.showToast({
  1023. title: res.msg,
  1024. icon: 'none'
  1025. })
  1026. // this.openAppPop()
  1027. }
  1028. } else {
  1029. this.currentReward == 4 ? this.$refs.turntableTwo.close('close') : this.currentReward == 3? this.$refs.turntableOne.close('close'):''
  1030. uni.showToast({
  1031. title: res.msg,
  1032. icon: 'none'
  1033. })
  1034. }
  1035. })
  1036. },
  1037. openAppPop() {
  1038. this.$refs.appPopup.openPop()
  1039. },
  1040. // 线路
  1041. openPop() {
  1042. this.$refs.popup.open('bottom')
  1043. },
  1044. close() {
  1045. this.$refs.popup.close()
  1046. },
  1047. handleLine(index) {
  1048. var that=this;
  1049. if (this.lineIndex == index && this.videoUrl == this.lineList[index]) {
  1050. this.close()
  1051. return
  1052. } else {
  1053. // let div = document.querySelector(".vjs-progress-control");
  1054. // if(div) {
  1055. // if (this.isFinish == 1 || this.isEnded || this.linkType == 1) {
  1056. // div.style.pointerEvents = "auto";
  1057. // } else {
  1058. // div.style.pointerEvents = "none"; //禁止所有事件
  1059. // }
  1060. // }
  1061. this.lineIndex = index
  1062. this.videoUrl = this.lineList[index]
  1063. this.tipsOpen = false
  1064. this.playDurationSeek = this.playTime || 0
  1065. this.player = uni.createVideoContext('video-content-box');
  1066. setTimeout(function(){
  1067. that.player.seek(that.playDurationSeek)
  1068. that.player.play();
  1069. },500);
  1070. // this.player.src(this.lineList[index])
  1071. // this.player.one('loadedmetadata', () => {
  1072. // this.player.currentTime(this.playDurationSeek);
  1073. // this.player.play();
  1074. // });
  1075. this.close()
  1076. }
  1077. },
  1078. // 客服
  1079. getIsAddKf() {
  1080. this.qrcode = ''
  1081. this.qrcodeMsg = ''
  1082. this.isAddKf = 0
  1083. // {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
  1084. getIsAddKf(this.urlOption).then(res => {
  1085. if (res.code == 200) {
  1086. this.isAddKf = 1
  1087. this.isCheckRealUrl = true
  1088. this.getH5CourseVideoDetails()
  1089. } else if (res.code == 400) {
  1090. this.isAddKf = 0
  1091. this.isCheckRealUrl = false
  1092. this.qrcode = res.qrcode
  1093. this.qrcodeMsg = res.msg
  1094. this.$refs.kfPopup.open()
  1095. } else if (res.code == 566) {
  1096. // 官方群发通用链接
  1097. const url = res.courseLink.realLink.split('?course=')[1]
  1098. this.urlOption = JSON.parse(url)
  1099. this.isAddKf = 1
  1100. this.isCheckRealUrl = true
  1101. this.getH5CourseVideoDetails()
  1102. } else if (res.code == 567) {
  1103. // 群聊通用链接
  1104. this.urlOption = {
  1105. ...this.urlOption,
  1106. qwExternalId: res.qwExternalId
  1107. }
  1108. this.isAddKf = 1
  1109. this.isCheckRealUrl = true
  1110. this.getH5CourseVideoDetails()
  1111. }else {
  1112. this.isCheckRealUrl = false
  1113. this.isAddKf = 0
  1114. uni.showToast({
  1115. title: res.msg,
  1116. icon: 'none'
  1117. });
  1118. }
  1119. },
  1120. err => {}
  1121. ).catch((err) => {
  1122. uni.showToast({
  1123. title: err,
  1124. icon: 'none'
  1125. });
  1126. })
  1127. },
  1128. closeKFPop() {
  1129. this.$refs.kfPopup.close()
  1130. },
  1131. getFinishCourseVideo() {
  1132. if (!this.isLogin||!this.playTime || !this.isCheckRealUrl) return
  1133. // {videoId: this.videoId,duration:this.playTime}
  1134. const param = {
  1135. duration: this.playTime,
  1136. ...this.urlOption
  1137. }
  1138. getFinishCourseVideo(param)
  1139. },
  1140. // 每十分钟获得芳华币
  1141. getIntegralByH5Video() {
  1142. if(!this.isLogin||!this.isCheckRealUrl) return
  1143. const param = {
  1144. duration: this.playTime,
  1145. ...this.urlOption
  1146. }
  1147. getIntegralByH5Video(param).then(res => {
  1148. if (res.code == 200) {
  1149. uni.showToast({
  1150. title: "芳华币+10",
  1151. icon: "none"
  1152. })
  1153. }
  1154. })
  1155. },
  1156. progressChange(e) {
  1157. this.bufferRate = Math.ceil(e.detail.buffered)
  1158. },
  1159. // 缓冲
  1160. getInternetTraffic() {
  1161. if(!this.isLogin||!this.isCheckRealUrl) return
  1162. const playVideoTime = Math.ceil(this.playTime / this.duration * 100) // 播放百分比
  1163. if(this.bufferRate == 0 || this.bufferRate < playVideoTime) {
  1164. this.bufferRate = playVideoTime
  1165. }
  1166. if(this.bufferRate == 0 || Number(this.bufferRate.toFixed(2)) == 0) return
  1167. const param = {
  1168. ...this.urlOption,
  1169. uuId: dayjs().format('YYYYMMDD') + this.uuId,
  1170. duration: this.playTime,
  1171. bufferRate: Number(this.bufferRate.toFixed(2)),
  1172. }
  1173. if(!param.bufferRate) return
  1174. internetTraffic(param)
  1175. },
  1176. getErrMsg(err,type) {
  1177. let msgerr = {
  1178. errType: type || 'error',
  1179. videoUrl: this.videoUrl,
  1180. lineIndex: this.lineIndex,
  1181. errTime: new Date(),
  1182. ip: this.ip,
  1183. errMsg: err || ''
  1184. }
  1185. getErrMsg({
  1186. msg: JSON.stringify(msgerr)
  1187. })
  1188. },
  1189. goLogin() {
  1190. this.utils.getProvider().then(provider=>{
  1191. console.log('当前的环境商',provider)
  1192. if (!provider) {
  1193. reject()
  1194. }
  1195. uni.login({
  1196. provider: provider,
  1197. success: async loginRes => {
  1198. console.log(loginRes)
  1199. uni.getUserInfo({
  1200. provider: provider,
  1201. success: (infoRes)=> {
  1202. uni.showToast({
  1203. title: '处理中...',
  1204. icon: 'loading'
  1205. });
  1206. loginByMp({code: loginRes.code,encryptedData:infoRes.encryptedData,iv:infoRes.iv,appId:getApp().globalData.appId}).then(res=>{
  1207. uni.hideLoading();
  1208. if (res.code == 200) {
  1209. this.$store.commit('setCoureLogin', 1);
  1210. uni.setStorageSync('AppTokenmini_RTCourse', res.token);
  1211. uni.setStorageSync('auto_userInfo', JSON.stringify(res.user));
  1212. this.user = res.user
  1213. this.isLogin = true
  1214. this.getIsAddKf()
  1215. this.getVideoRewardTypes()
  1216. this.getUserPhoneDeviceType()
  1217. } else {
  1218. uni.showToast({
  1219. title: res.msg,
  1220. icon: 'none'
  1221. });
  1222. }
  1223. }).catch(err=>{
  1224. uni.hideLoading();
  1225. uni.showToast({
  1226. icon:'none',
  1227. title: "登录失败,请重新登录",
  1228. });
  1229. });
  1230. }
  1231. });
  1232. }
  1233. })
  1234. }).catch(err => {})
  1235. },
  1236. getLink() {
  1237. let that = this;
  1238. getRealLink({sortLink:this.sortLink}).then(res=>{
  1239. if(res.code == 200) {
  1240. this.isExpire = false
  1241. if(this.isLogin) {
  1242. this.getUserPhoneDeviceType()
  1243. }
  1244. // 如果响应中包含真实链接,则跳转到真实链接
  1245. // window.location.href = res.realLink +"&sortLink="+this.sortLink+"&code="+this.code+"&time="+new Date().getTime()
  1246. if (this.isLogin && this.isAddKf == 1&&this.isCheckRealUrl) {
  1247. this.getH5CourseVideoDetails()
  1248. }
  1249. if (this.videoId &&(this.isAddKf != 1 || !this.isCheckRealUrl)) {
  1250. this.utils.isLoginCourse().then(
  1251. isLogin => {
  1252. this.isLogin = isLogin
  1253. if(isLogin){
  1254. this.getIsAddKf()
  1255. this.getVideoRewardTypes()
  1256. } else {
  1257. this.goLogin()
  1258. }
  1259. },
  1260. rej => {}
  1261. );
  1262. }
  1263. } else {
  1264. this.isExpire = true
  1265. uni.showToast({
  1266. title: '课程已过期或链接无效',
  1267. icon: 'none'
  1268. });
  1269. }
  1270. }).catch(err=>{
  1271. this.isExpire = true
  1272. uni.showToast({
  1273. title: '发生错误,请稍后再试',
  1274. icon: 'none'
  1275. });
  1276. })
  1277. },
  1278. /**
  1279. * 节流原理:在一定时间内,只能触发一次
  1280. *
  1281. * @param {Function} func 要执行的回调函数
  1282. * @param {Number} wait 延时的时间
  1283. * @param {Boolean} immediate 是否立即执行
  1284. * @return null
  1285. */
  1286. throttle(func, wait = 500, immediate = true) {
  1287. if (immediate) {
  1288. if (!this.flag) {
  1289. this.flag = true
  1290. // 如果是立即执行,则在wait毫秒内开始时执行
  1291. typeof func === 'function' && func()
  1292. this.timer = setTimeout(() => {
  1293. this.flag = false
  1294. }, wait)
  1295. }
  1296. } else if (!this.flag) {
  1297. this.flag = true
  1298. // 如果是非立即执行,则在wait毫秒内的结束处执行
  1299. this.timer = setTimeout(() => {
  1300. this.flag = false
  1301. typeof func === 'function' && func()
  1302. }, wait)
  1303. }
  1304. },
  1305. // 弹幕
  1306. openDanmu(type) {
  1307. this.openDanmuType = type
  1308. this.inputText = ''
  1309. if(type == 1) {
  1310. this.player.exitFullScreen()
  1311. }
  1312. this.$refs.danmuPopup.open()
  1313. },
  1314. changeShowPopup(val) {
  1315. this.focus = val.show
  1316. },
  1317. switchDanmu() {
  1318. this.showDanmu = this.showDanmu == 1 ? 0:1
  1319. if(this.showDanmu == 0&&this.$refs.danmuBox) {
  1320. this.$refs.danmuPopup.close()
  1321. this.activeDanmus = []
  1322. this.$refs.danmuBox.activeDanmus = []
  1323. this.$refs.danmuBox.initTracks()
  1324. }
  1325. },
  1326. getScrollTop(res) {
  1327. if(this.currentTab == 2) {
  1328. this.scrollTop = res
  1329. } else {
  1330. this.scrollTop = 0
  1331. }
  1332. },
  1333. handleTab(index) {
  1334. this.currentTab = index
  1335. if(this.currentTab==2) {
  1336. if(this.$refs.commentBox) {
  1337. this.$refs.commentBox.msgs = []
  1338. this.$refs.commentBox.pageNum = 1
  1339. this.$refs.commentBox.getComments()
  1340. }
  1341. } else {
  1342. setTimeout(()=>{
  1343. this.scrollTop = 0
  1344. },100)
  1345. }
  1346. },
  1347. handleRefresher() {
  1348. this.triggered = true;
  1349. if (!this.isMore&&this.currentTab==2&&this.openCommentStatus==1) {
  1350. this.$nextTick(()=>{
  1351. this.$refs.commentBox&&this.$refs.commentBox.getComments()
  1352. })
  1353. }
  1354. setTimeout(() => {
  1355. this.triggered = false;
  1356. }, 500);
  1357. },
  1358. getMore(val) {
  1359. this.triggered = false;
  1360. this.isMore = val == 1
  1361. },
  1362. handleChatInput() {
  1363. this.inputText = this.inputText.trim()
  1364. if (this.inputText == "" || this.inputText.trim() == "") {
  1365. uni.showToast({
  1366. title: '请输入评论',
  1367. icon: "none"
  1368. })
  1369. return;
  1370. }
  1371. if(this.openCommentStatus==1) {
  1372. this.$refs.commentBox&&this.$refs.commentBox.handleInput(this.inputText)
  1373. } else if(this.openCommentStatus==2) {
  1374. this.$refs.danmuBox&&this.$refs.danmuBox.handleInput(this.inputText)
  1375. }
  1376. },
  1377. setInputText() {
  1378. this.inputText = ""
  1379. if(this.openCommentStatus==2) {
  1380. this.$refs.danmuPopup.close()
  1381. }
  1382. },
  1383. getActiveDanmus(val) {
  1384. this.activeDanmus = val.map(item=>({
  1385. ...item,
  1386. danmustyle: {
  1387. top: item.top + 'px',
  1388. ...item.style,
  1389. 'animation-duration': '8s'
  1390. }
  1391. }))
  1392. },
  1393. animationend(moveItem, i) {
  1394. // 移除动画结束的弹幕(性能优化)
  1395. if(this.openCommentStatus==2) {
  1396. this.$refs.danmuBox&&this.$refs.danmuBox.animationend(moveItem, i)
  1397. }
  1398. },
  1399. feedback() {
  1400. const userId = this.user.userId || ''
  1401. const courseId = this.urlOption.courseId || ''
  1402. const videoId = this.urlOption.videoId || ''
  1403. uni.navigateTo({
  1404. url: './feedback?userId='+userId+'&courseId='+courseId+'&videoId='+videoId
  1405. })
  1406. },
  1407. getBox(data) {
  1408. if(data.fsUserCourseRewardRoundStatusVO&&data.fsUserCourseRewardRoundStatusVO.length>0) {
  1409. const list = data.fsUserCourseRewardRoundStatusVO.map(item=>({
  1410. ...item,
  1411. time: Math.round(this.duration * Number(item.question || 0) * 0.01)
  1412. }))
  1413. return list
  1414. } else {
  1415. return []
  1416. }
  1417. },
  1418. claimFun(val) {
  1419. claim({
  1420. ...this.urlOption,
  1421. second: val.time,
  1422. rewardId: val.rewardId,
  1423. status: val.status
  1424. }).then(res=>{
  1425. if(res.code == 200) {
  1426. this.$refs.treasureChest.claimSuccess(val.status)
  1427. } else {
  1428. this.$refs.treasureChest.close()
  1429. }
  1430. if(res.msg!="success") {
  1431. uni.showToast({
  1432. title: res.msg,
  1433. icon: 'none',
  1434. duration: 3000
  1435. })
  1436. }
  1437. })
  1438. },
  1439. showBtnType(value) {
  1440. this.showBtn = value
  1441. this.getHeight()
  1442. },
  1443. getUserPhoneDeviceType(){
  1444. uni.getSystemInfo({
  1445. success: (result) => {
  1446. const param = {
  1447. os: result.osName || '',
  1448. deviceId: result.deviceId || '',
  1449. appId: getApp().globalData.appId
  1450. }
  1451. getUserPhoneDeviceType({param:JSON.stringify(param)})
  1452. },
  1453. fail: (error) => {
  1454. console.log('获取型号失败',JSON.stringify(error))
  1455. }
  1456. })
  1457. },
  1458. initSocket(type) {
  1459. const userId = this.user.userId; // 假设你已经获取了用户ID
  1460. const that = this;
  1461. // 如果已经存在连接,先关闭
  1462. if (this.socket) {
  1463. this.socket.onClose(() => {
  1464. console.log('旧的 WebSocket 连接已完全关闭');
  1465. that.socket = null;
  1466. if(that.pingpangTimes) {
  1467. clearInterval(that.pingpangTimes)
  1468. that.pingpangTimes= null
  1469. }
  1470. that.createNewSocket(type,userId);
  1471. });
  1472. this.socket.close();
  1473. return;
  1474. }
  1475. // 创建一个新的 WebSocket 连接
  1476. this.createNewSocket(type,userId);
  1477. },
  1478. createNewSocket(type,userId) {
  1479. if(this.openCommentStatus == 3) return
  1480. //创建一个socket连接
  1481. const that = this;
  1482. // if (this.socket) {
  1483. // this.socket.close()
  1484. // }
  1485. this.socket = uni.connectSocket({
  1486. url: getApp().globalData.wsUrl + "/app/webSocket/" + userId,
  1487. multiple: true,
  1488. success: res => {
  1489. that.isSocketOpen = true
  1490. console.log('WebSocket连接已打开1!');
  1491. // 保持心跳
  1492. if(that.pingpangTimes) {
  1493. clearInterval(that.pingpangTimes)
  1494. that.pingpangTimes= null
  1495. }
  1496. that.pingpangTimes=setInterval(()=>{
  1497. let data={
  1498. userId: userId || '',
  1499. userType: 2, // 1-管理员,2-用户
  1500. courseId: that.urlOption.courseId,
  1501. videoId: that.urlOption.videoId,
  1502. type:1, // 评论类型 1:评论,2:回复,目前没有回复,默认传1就行了
  1503. // msg: that.inputText,
  1504. cmd:'heartbeat'
  1505. };
  1506. that.socket.send({
  1507. data: JSON.stringify(data),
  1508. success: () => {
  1509. // console.log('WebSocket发送心条数据!');
  1510. },
  1511. fail: () => {
  1512. that.isSocketOpen=false
  1513. }
  1514. });
  1515. },15000)
  1516. },
  1517. error: res => {
  1518. console.log(res)
  1519. },
  1520. })
  1521. this.socket.onMessage((res) => {
  1522. // console.log("收到消息parse",JSON.parse(res.data))
  1523. const redata = JSON.parse(res.data);
  1524. if(redata.cmd=="heartbeat"){
  1525. //心跳
  1526. // console.log("heartbeat")
  1527. }else if(redata.cmd=="sendMsg"){
  1528. if(that.openCommentStatus==1) {
  1529. that.$refs.commentBox.isSend=true;
  1530. that.$refs.commentBox.addMsg(redata);
  1531. } else if(that.openCommentStatus==2) {
  1532. that.$refs.danmuBox.isSend=true;
  1533. that.$refs.danmuBox.addMsg(redata);
  1534. }
  1535. // that.isSend=true;
  1536. // that.addMsg(redata);
  1537. }
  1538. })
  1539. //监听socket打开
  1540. this.socket.onOpen(() => {
  1541. that.isSocketOpen = true
  1542. console.log('WebSocket连接已打开2!');
  1543. // that.isSend = true;
  1544. if(that.openCommentStatus==1) {
  1545. that.$refs.commentBox.isSend=true;
  1546. } else if(that.openCommentStatus==2) {
  1547. that.$refs.danmuBox.isSend=true;
  1548. }
  1549. if(type=='reStart') {
  1550. // 重连的时候重新发消息
  1551. if(that.openCommentStatus==1) {
  1552. that.$refs.commentBox.saveMsg()
  1553. } else if(that.openCommentStatus==2) {
  1554. that.$refs.danmuBox.saveMsg()
  1555. }
  1556. // this.saveMsg()
  1557. }
  1558. })
  1559. //监听socket关闭
  1560. this.socket.onClose(() => {
  1561. that.isSocketOpen = false
  1562. that.socket = null
  1563. console.log('WebSocket连接已关闭!');
  1564. if(that.pingpangTimes) {
  1565. clearInterval(that.pingpangTimes)
  1566. that.pingpangTimes= null
  1567. }
  1568. })
  1569. //监听socket错误
  1570. this.socket.onError((err) => {
  1571. console.log("socket err:",err)
  1572. that.isSocketOpen = false
  1573. that.socket = null
  1574. if(that.pingpangTimes) {
  1575. clearInterval(that.pingpangTimes)
  1576. that.pingpangTimes= null
  1577. }
  1578. })
  1579. },
  1580. socketSend(data) {
  1581. let that = this
  1582. this.socket.send({
  1583. data: JSON.stringify(data),
  1584. success: () => {
  1585. console.log("发送成功")
  1586. // this.isSend = false;
  1587. if(that.openCommentStatus==1) {
  1588. that.$refs.commentBox.isSend = false;
  1589. } else if(that.openCommentStatus==2) {
  1590. that.$refs.danmuBox.isSend = false;
  1591. }
  1592. },
  1593. fail: () => {
  1594. console.log("发送失败")
  1595. }
  1596. });
  1597. },
  1598. closeSocket() {
  1599. if (this.socket) {
  1600. this.socket.close();
  1601. }
  1602. if (this.pingpangTimes) {
  1603. clearInterval(this.pingpangTimes);
  1604. this.pingpangTimes = null;
  1605. }
  1606. }
  1607. }
  1608. }
  1609. </script>
  1610. <style scoped>
  1611. .full-width-popup {
  1612. width: 100%;
  1613. }
  1614. </style>
  1615. <style lang="scss" scoped>
  1616. @mixin u-flex($flexD, $alignI, $justifyC) {
  1617. display: flex;
  1618. flex-direction: $flexD;
  1619. align-items: $alignI;
  1620. justify-content: $justifyC;
  1621. }
  1622. .reward-list {
  1623. display: flex;
  1624. align-items: center;
  1625. flex-wrap: wrap;
  1626. margin-top: 40rpx;
  1627. margin-bottom: -24rpx;
  1628. }
  1629. .reward-item{
  1630. padding: 16rpx 10rpx;
  1631. box-sizing: border-box;
  1632. border-radius: 10rpx;
  1633. width: calc(50% - 14rpx);
  1634. overflow: hidden;
  1635. text-align: center;
  1636. border-radius: 8rpx;
  1637. border: 1rpx solid #ededef;
  1638. // margin: 10rpx 5px;
  1639. margin-bottom: 24rpx;
  1640. color: #222;
  1641. background-color: #fff;
  1642. &:nth-child(odd) {
  1643. margin-right: 20rpx;
  1644. }
  1645. }
  1646. .reward-active {
  1647. border: 1rpx solid #ff5c03 !important;
  1648. color: #ff5c03 !important;
  1649. background: #FCF0E7 !important;
  1650. }
  1651. .footer-tips {
  1652. margin-top: 14rpx;
  1653. text-align: center;
  1654. font-family: PingFang SC,PingFang SC;
  1655. font-weight: 500;
  1656. font-size: 12px;
  1657. color: #bbb;
  1658. }
  1659. .textOne {
  1660. overflow: hidden;
  1661. white-space: nowrap;
  1662. text-overflow: ellipsis;
  1663. }
  1664. .textTwo {
  1665. overflow: hidden;
  1666. text-overflow: ellipsis;
  1667. display: -webkit-box;
  1668. -webkit-line-clamp: 2;
  1669. -webkit-box-orient: vertical;
  1670. }
  1671. .header-nav {
  1672. height: 88rpx;
  1673. @include u-flex(row, center, flex-start);
  1674. overflow: hidden;
  1675. background-color: #fff;
  1676. box-sizing: border-box;
  1677. .header-title {
  1678. text-align: center;
  1679. overflow: hidden;
  1680. white-space: nowrap;
  1681. text-overflow: ellipsis;
  1682. padding: 0 10rpx 0 100rpx;
  1683. font-family: PingFang SC,PingFang SC;
  1684. font-weight: 500;
  1685. font-size: 15px;
  1686. color: #000;
  1687. box-sizing: border-box;
  1688. }
  1689. }
  1690. .reward-list {
  1691. width: 100%;
  1692. // margin-top: 20rpx;
  1693. // margin-bottom: -40rpx;
  1694. &-group {
  1695. font-family: PingFang SC, PingFang SC;
  1696. font-weight: 400;
  1697. font-size: 14px;
  1698. color: #222222;
  1699. @include u-flex(row, center, center);
  1700. }
  1701. &-option {
  1702. @include u-flex(row, center, flex-start);
  1703. &:first-child {
  1704. margin-right: 40rpx;
  1705. }
  1706. }
  1707. }
  1708. .err {
  1709. color: #f56c6c !important;
  1710. }
  1711. .kfqrcode-box {
  1712. background-color: #fff;
  1713. border-radius: 16rpx;
  1714. max-width: 560rpx;
  1715. padding: 60rpx 40rpx;
  1716. margin-top: -100rpx;
  1717. box-sizing: border-box;
  1718. @include u-flex(column, center, flex-start);
  1719. font-family: PingFang SC, PingFang SC;
  1720. font-weight: 400;
  1721. font-size: 34rpx;
  1722. color: #222;
  1723. position: relative;
  1724. text-align: center;
  1725. .kfqrcode {
  1726. height: 460rpx;
  1727. width: 460rpx;
  1728. }
  1729. }
  1730. .kfqrcode-close {
  1731. width: 64rpx;
  1732. height: 64rpx;
  1733. position: absolute;
  1734. bottom: -100rpx;
  1735. left: 50%;
  1736. transform: translateX(-50%);
  1737. }
  1738. .tipsPopup-mask {
  1739. position: relative;
  1740. width: 560rpx;
  1741. background-color: transparent;
  1742. .red_envelope_top {
  1743. width: 480rpx;
  1744. height: 360rpx;
  1745. margin: 0 auto;
  1746. display: inherit;
  1747. }
  1748. }
  1749. .tipsPopup-btn-box {
  1750. width: 456rpx;
  1751. height: 104rpx;
  1752. padding: 4rpx;
  1753. box-sizing: border-box;
  1754. background: linear-gradient(180deg, rgba(252, 209, 94, 1), rgba(254, 253, 251, 1));
  1755. border-radius: 52rpx;
  1756. }
  1757. .tipsPopup-btn {
  1758. width: 100%;
  1759. height: 100%;
  1760. background: linear-gradient(180deg, #FF9F22 0%, #FA1E05 100%);
  1761. border-radius: 52rpx 52rpx 52rpx 52rpx;
  1762. font-family: PingFang SC, PingFang SC;
  1763. font-weight: 500;
  1764. font-size: 36rpx;
  1765. color: #FFFFFF;
  1766. line-height: 96rpx;
  1767. text-align: center;
  1768. }
  1769. .tipsPopup {
  1770. width: 560rpx;
  1771. padding: 12rpx;
  1772. margin-top: -72rpx;
  1773. box-sizing: border-box;
  1774. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1775. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1776. position: relative;
  1777. &-close {
  1778. width: 64rpx;
  1779. height: 64rpx;
  1780. position: absolute;
  1781. right: 0;
  1782. top: -188rpx;
  1783. }
  1784. &-line {
  1785. padding: 3rpx;
  1786. box-sizing: border-box;
  1787. background: linear-gradient(180deg, rgba(247, 245, 220, 1), rgba(250, 220, 157, 1));
  1788. border-radius: 24rpx;
  1789. }
  1790. &-box {
  1791. padding: 0 40rpx 40rpx 40rpx;
  1792. box-sizing: border-box;
  1793. background: linear-gradient(180deg, #FFFBEF 0%, #FFFFF5 43%, #F5EAC2 100%);
  1794. border-radius: 24rpx;
  1795. @include u-flex(column, center, flex-start);
  1796. }
  1797. &-head {
  1798. @include u-flex(row, center, center);
  1799. &-title {
  1800. width: 364rpx;
  1801. height: auto;
  1802. margin-top: -22rpx;
  1803. }
  1804. }
  1805. &-content {
  1806. margin: 48rpx 0;
  1807. font-family: PingFang SC, PingFang SC;
  1808. font-weight: 500;
  1809. font-size: 32rpx;
  1810. color: #222222;
  1811. text-align: center;
  1812. &-title {
  1813. margin-bottom: 26rpx;
  1814. font-weight: 600;
  1815. font-size: 40rpx;
  1816. color: #FF5C03;
  1817. }
  1818. }
  1819. }
  1820. .video-controls-box {
  1821. width: 100%;
  1822. height: 420rpx;
  1823. overflow: hidden;
  1824. position: absolute;
  1825. bottom: 0;
  1826. left: 0;
  1827. z-index: 2;
  1828. background: rgba(0, 0, 0, 0.2);
  1829. .video-play {
  1830. height: 72rpx;
  1831. width: 72rpx;
  1832. position: absolute;
  1833. top: 50%;
  1834. left: 50%;
  1835. transform: translate(-50%, -50%);
  1836. }
  1837. }
  1838. .video-controls {
  1839. width: 100%;
  1840. height: 80rpx;
  1841. padding: 0 28rpx;
  1842. box-sizing: border-box;
  1843. position: absolute;
  1844. bottom: 0;
  1845. left: 0;
  1846. display: flex;
  1847. align-items: center;
  1848. justify-content: space-between;
  1849. background: linear-gradient(to top, #222 0%, transparent 80%);
  1850. .video-icon {
  1851. height: 44rpx;
  1852. width: 44rpx;
  1853. }
  1854. }
  1855. .errQuesbox {
  1856. width: 100%;
  1857. max-height: 260rpx;
  1858. overflow-y: auto;
  1859. margin-top: 24rpx;
  1860. font-family: PingFang SC, PingFang SC;
  1861. font-weight: 500;
  1862. font-size: 30rpx;
  1863. color: #222222;
  1864. &-item {
  1865. width: 100%;
  1866. height: 128rpx;
  1867. line-height: 128rpx;
  1868. margin-bottom: 24rpx;
  1869. padding: 0 30rpx;
  1870. box-sizing: border-box;
  1871. overflow: hidden;
  1872. background: #fff;
  1873. border-radius: 16rpx 16rpx 16rpx 16rpx;
  1874. position: relative;
  1875. &::after {
  1876. content: "题目";
  1877. min-width: 64rpx;
  1878. height: 36rpx;
  1879. padding: 0 12rpx;
  1880. line-height: 36rpx;
  1881. background: #FF5C03;
  1882. box-sizing: border-box;
  1883. border-radius: 0rpx 0rpx 16rpx 0rpx;
  1884. text-align: center;
  1885. font-family: PingFang SC, PingFang SC;
  1886. font-weight: 500;
  1887. font-size: 20rpx;
  1888. color: #fff;
  1889. position: absolute;
  1890. left: 0;
  1891. top: 0;
  1892. }
  1893. }
  1894. }
  1895. .bg {
  1896. background: #fff !important;
  1897. }
  1898. .answerPopup {
  1899. &-box {
  1900. width: 560rpx;
  1901. background: linear-gradient(180deg, #FFFAF6 0%, #FEECD8 100%);
  1902. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1903. background-color: #fff;
  1904. font-weight: 400;
  1905. padding: 32rpx;
  1906. box-sizing: border-box;
  1907. position: relative;
  1908. @include u-flex(column, center, flex-start);
  1909. font-family: PingFang SC, PingFang SC;
  1910. font-weight: 400;
  1911. .tipimg {
  1912. width: 206rpx;
  1913. height: 206rpx;
  1914. margin-bottom: 16rpx;
  1915. }
  1916. }
  1917. &-title {
  1918. font-weight: 600;
  1919. font-size: 36rpx;
  1920. color: #222222;
  1921. }
  1922. &-desc {
  1923. margin-top: 10rpx;
  1924. font-size: 28rpx;
  1925. color: #757575;
  1926. }
  1927. &-btn {
  1928. width: 464rpx;
  1929. height: 84rpx;
  1930. margin-top: 54rpx;
  1931. margin-bottom: 16rpx;
  1932. background: #FF5C03;
  1933. border-radius: 42rpx;
  1934. font-weight: 500;
  1935. font-size: 32rpx;
  1936. color: #FFFFFF;
  1937. text-align: center;
  1938. line-height: 84rpx;
  1939. }
  1940. }
  1941. .popupbox {
  1942. width: 100%;
  1943. background-color: #fff;
  1944. border-radius: 16rpx 16rpx 0 0;
  1945. padding: 24rpx 32rpx;
  1946. position: relative;
  1947. &-head {
  1948. height: 60rpx;
  1949. margin-bottom: 30rpx;
  1950. text-align: center;
  1951. overflow-y: auto;
  1952. color: #414858;
  1953. font-size: 32rpx;
  1954. font-weight: bold;
  1955. position: relative;
  1956. .close-icon {
  1957. position: absolute;
  1958. right: 0;
  1959. top: 0;
  1960. height: 40rpx;
  1961. width: 40rpx;
  1962. }
  1963. }
  1964. &-content {
  1965. height: 20vh;
  1966. overflow-y: auto;
  1967. display: flex;
  1968. align-items: flex-start;
  1969. flex-wrap: wrap;
  1970. gap: 32rpx;
  1971. .line-item {
  1972. display: inline-block;
  1973. min-width: 200rpx;
  1974. min-height: 60rpx;
  1975. padding: 0 20rpx;
  1976. box-sizing: border-box;
  1977. border-radius: 50rpx;
  1978. overflow: hidden;
  1979. background-color: #f7f7f7;
  1980. text-align: center;
  1981. color: #414858;
  1982. font-size: 28rpx;
  1983. line-height: 60rpx;
  1984. }
  1985. .line-active {
  1986. color: #f56c6c !important;
  1987. background-color: #fef0f0 !important;
  1988. }
  1989. }
  1990. }
  1991. .content {
  1992. padding-bottom: calc(var(--window-bottom));
  1993. .video-box {
  1994. width: 100%;
  1995. height: 420rpx;
  1996. overflow: hidden;
  1997. position: relative;
  1998. #myVideo {
  1999. width: 100%;
  2000. height: 100%;
  2001. }
  2002. }
  2003. .video-poster {
  2004. width: 100%;
  2005. height: 420rpx;
  2006. }
  2007. .miantitlebox {
  2008. padding: 30rpx 0;
  2009. border-bottom: 2rpx solid #F5F7FA;
  2010. font-family: PingFang SC, PingFang SC;
  2011. font-weight: 500;
  2012. font-size: 36rpx;
  2013. color: #222222;
  2014. }
  2015. .subtitlebox {
  2016. padding: 30rpx 0;
  2017. border-bottom: 2rpx solid #F5F7FA;
  2018. font-family: PingFang SC, PingFang SC;
  2019. font-weight: 500;
  2020. font-size: 36rpx;
  2021. color: #222222;
  2022. }
  2023. .title-content {
  2024. padding: 0 32rpx;
  2025. background-color: #fff;
  2026. font-size: 28rpx;
  2027. line-height: 1.6;
  2028. box-sizing: border-box;
  2029. @include u-flex(row, center, space-between);
  2030. .title {
  2031. font-size: 36rpx;
  2032. font-weight: 500;
  2033. color: #414858;
  2034. }
  2035. .time-or-subtitle {
  2036. margin-top: 12rpx;
  2037. color: #666666;
  2038. }
  2039. }
  2040. .warning {
  2041. flex-shrink: 0;
  2042. color: #888;
  2043. font-size: 24rpx;
  2044. @include u-flex(column, center, center);
  2045. image {
  2046. flex-shrink: 0;
  2047. height: 36rpx;
  2048. width: 36rpx;
  2049. }
  2050. }
  2051. .video-line {
  2052. min-width: 140rpx;
  2053. max-width: 200rpx;
  2054. height: 60rpx;
  2055. padding: 0 20rpx;
  2056. box-sizing: border-box;
  2057. border-radius: 50rpx 0 0 50rpx;
  2058. overflow: hidden;
  2059. background-color: #fff;
  2060. text-align: center;
  2061. color: #888;
  2062. font-size: 28rpx;
  2063. line-height: 60rpx;
  2064. display: inline-flex;
  2065. align-items: center;
  2066. justify-content: center;
  2067. position: fixed;
  2068. right: 0;
  2069. z-index: 9;
  2070. bottom: calc(var(--window-bottom) + 280rpx);
  2071. box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, .12);
  2072. image {
  2073. flex-shrink: 0;
  2074. height: 34rpx;
  2075. width: 34rpx;
  2076. margin-right: 6rpx;
  2077. }
  2078. }
  2079. .danmu-line {
  2080. bottom: calc(var(--window-bottom) + 370rpx);
  2081. word-break: keep-all;
  2082. .set_image {
  2083. height: 40rpx;
  2084. width: 40rpx;
  2085. }
  2086. }
  2087. .footer {
  2088. border-top: 1rpx solid #ededef;
  2089. background: #fff;
  2090. width: 100%;
  2091. position: fixed;
  2092. bottom: 0;
  2093. // padding: 32rpx;
  2094. padding-bottom: calc(var(--window-bottom));
  2095. box-sizing: border-box;
  2096. z-index: 9;
  2097. &-btn {
  2098. width: calc(100% - 64rpx);
  2099. height: 98rpx;
  2100. background: #FF5C03;
  2101. border-radius: 49rpx 49rpx 49rpx 49rpx;
  2102. line-height: 98rpx;
  2103. text-align: center;
  2104. font-family: PingFang SC, PingFang SC;
  2105. font-weight: 600;
  2106. font-size: 32rpx;
  2107. color: #FFFFFF;
  2108. @include u-flex(row, center, center);
  2109. margin: 24rpx 32rpx;
  2110. box-sizing: border-box;
  2111. &-img {
  2112. flex-shrink: 0;
  2113. width: 144rpx;
  2114. height: 144rpx;
  2115. margin-right: 8rpx;
  2116. margin-top: -24rpx;
  2117. }
  2118. }
  2119. &-btn-border {
  2120. position: relative;
  2121. &::after {
  2122. content: "";
  2123. background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
  2124. position: absolute;
  2125. top: -2rpx;
  2126. left: 0;
  2127. height: 103rpx;
  2128. width: 100%;
  2129. z-index: -1;
  2130. border-radius: 49rpx 49rpx 49rpx 49rpx;
  2131. box-shadow: 0rpx 8rpx 11rpx 0rpx rgba(255, 92, 3, 0.3);
  2132. overflow: hidden;
  2133. }
  2134. }
  2135. }
  2136. }
  2137. .agreement {
  2138. display: inline-flex;
  2139. margin-top: 16rpx;
  2140. font-size: 24rpx;
  2141. color: #525252;
  2142. align-items: center;
  2143. justify-content: center;
  2144. }
  2145. .video-danmu-btnbox {
  2146. width: 50px;
  2147. height: 50px;
  2148. border-radius: 50%;
  2149. overflow: hidden;
  2150. position: absolute;
  2151. right: 10px;
  2152. bottom: calc(50% - 50px);
  2153. transform: translateY(-50%);
  2154. padding: 8px;
  2155. box-sizing: border-box;
  2156. }
  2157. .video-danmu-image {
  2158. width: 100%;
  2159. height: 100%;
  2160. }
  2161. .danmuPopup {
  2162. background-color: #fff;
  2163. padding-bottom: calc(var(--window-bottom) + 10px);
  2164. .u-border {
  2165. flex: 1;
  2166. @include u-flex(row,center,flex-start);
  2167. padding: 0 6rpx;
  2168. border-radius: 6px;
  2169. }
  2170. &-head {
  2171. width: 100%;
  2172. padding: 10px;
  2173. box-sizing: border-box;
  2174. overflow: hidden;
  2175. @include u-flex(row,center,flex-start);
  2176. .danmu-icon {
  2177. height: 24px;
  2178. width: 24px;
  2179. margin-right: 10px;
  2180. }
  2181. }
  2182. &-input {
  2183. flex: 1;
  2184. height: 35px;
  2185. }
  2186. &-send {
  2187. flex-shrink: 0;
  2188. height: 35px;
  2189. display: flex;
  2190. align-items: center;
  2191. justify-content: center;
  2192. padding: 5px 15px;
  2193. box-sizing: border-box;
  2194. background: #FF5C03 !important;
  2195. border-radius: 6px;
  2196. font-family: PingFang SC, PingFang SC;
  2197. font-weight: 500;
  2198. font-size: 15px;
  2199. color: #fff !important;
  2200. margin-left: 12px;
  2201. &::after {
  2202. border: none;
  2203. }
  2204. }
  2205. &-con {
  2206. background-color: #F5F7FA;
  2207. padding: 24px 12px 48px 12px;
  2208. font-family: PingFang SC, PingFang SC;
  2209. font-weight: 400;
  2210. font-size: 14px;
  2211. color: #757575;
  2212. }
  2213. }
  2214. .danmu-icon{
  2215. height: 24px;
  2216. width: 24px;
  2217. margin-right: 12px;
  2218. }
  2219. .logo {
  2220. display: inline-block;
  2221. width: 30px;
  2222. height: auto;
  2223. margin: 20px 0 0 10px;
  2224. pointer-events: none;
  2225. object-fit: cover;
  2226. }
  2227. .logo-full {
  2228. display: inline-block;
  2229. width: 40px;
  2230. height: auto;
  2231. margin: 50px 0 0 30px;
  2232. pointer-events: none;
  2233. object-fit: cover;
  2234. }
  2235. .tabbox-bar {
  2236. @include u-flex(row, center, flex-start);
  2237. background-color: #fff;
  2238. .warning {
  2239. flex-shrink: 0;
  2240. padding-right: 20rpx;
  2241. }
  2242. }
  2243. .tabbox {
  2244. flex: 1;
  2245. @include u-flex(row, center, center);
  2246. border-bottom: 2rpx solid #F5F7FA;
  2247. height: 44px;
  2248. background-color: #fff;
  2249. view {
  2250. flex: 1;
  2251. padding: 20rpx 0;
  2252. margin-right: 40rpx;
  2253. text-align: center;
  2254. }
  2255. &-active {
  2256. position: relative;
  2257. &::after {
  2258. position: absolute;
  2259. bottom: 0;
  2260. left: 50%;
  2261. transform: translateX(-50%);
  2262. content: "";
  2263. width: 3rem;
  2264. border-bottom: 4px solid #FF5C03;
  2265. }
  2266. }
  2267. }
  2268. .chatinput {
  2269. position: fixed;
  2270. left: 32rpx;
  2271. right: 32rpx;
  2272. z-index: 999;
  2273. height: 96rpx;
  2274. background-color: green;
  2275. background: #FFFFFF;
  2276. box-shadow: 0rpx 8rpx 21rpx 0rpx rgba(0, 0, 0, 0.1);
  2277. border-radius: 24rpx 24rpx 24rpx 24rpx;
  2278. @include u-flex(row, center, center);
  2279. padding: 0 24rpx;
  2280. box-sizing: border-box;
  2281. .uni-input {
  2282. flex: 1;
  2283. margin-right: 32rpx;
  2284. font-size: 30rpx;
  2285. }
  2286. .send {
  2287. font-family: PingFang SC, PingFang SC;
  2288. font-weight: 400;
  2289. font-size: 28rpx;
  2290. color: #FFFFFF !important;
  2291. flex-shrink: 0;
  2292. padding: 0 20rpx;
  2293. height: 72rpx;
  2294. background: #FF5C03 !important;
  2295. border-radius: 8rpx 8rpx 8rpx 8rpx;
  2296. &::after {
  2297. border: none;
  2298. }
  2299. }
  2300. }
  2301. .answerTip {
  2302. position: fixed;
  2303. right: 0;
  2304. z-index: 9;
  2305. bottom: calc(var(--window-bottom) + 380rpx);
  2306. box-shadow: 0rpx 8rpx 21rpx 0rpx rgba(0, 0, 0, 0.1);
  2307. border-radius: 24rpx 24rpx 24rpx 24rpx;
  2308. background-color: #ff5c03;
  2309. color: #fff;
  2310. border-radius: 50%;
  2311. height: 100rpx;
  2312. width: 100rpx;
  2313. font-size: 25rpx;
  2314. text-align: center;
  2315. padding: 10rpx;
  2316. @include u-flex(row, center, center);
  2317. }
  2318. .danmu-item {
  2319. position: absolute;
  2320. top: 0;
  2321. white-space: nowrap;
  2322. font-size: 16px;
  2323. height: 20px;
  2324. display: inline-flex;
  2325. box-sizing: border-box;
  2326. align-items: center;
  2327. }
  2328. .danmuMove {
  2329. // animation: mymove 8s linear forwards;
  2330. // animation-duration: 8s;
  2331. animation-timing-function: linear;
  2332. animation-delay: 0s;
  2333. animation-iteration-count: 1;
  2334. animation-direction: normal;
  2335. animation-fill-mode: forwards;
  2336. animation-play-state: running;
  2337. animation-name: mymove;
  2338. will-change: transform;
  2339. }
  2340. @keyframes mymove {
  2341. from {
  2342. transform: translateX(100vw);
  2343. }
  2344. to {
  2345. transform: translateX(-100%);
  2346. }
  2347. }
  2348. .arrow-left-warning {
  2349. position: absolute;
  2350. left: 24rpx;
  2351. height: 88rpx;
  2352. overflow: hidden;
  2353. color: #888;
  2354. font-size: 24rpx;
  2355. @include u-flex(column, center, center);
  2356. image {
  2357. flex-shrink: 0;
  2358. height: 36rpx;
  2359. width: 36rpx;
  2360. }
  2361. }
  2362. </style>