video.vue 60 KB

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