video.vue 60 KB

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