video.vue 61 KB

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