video.vue 59 KB

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