video.vue 60 KB

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