video.vue 57 KB

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