video.vue 60 KB

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