video.vue 61 KB

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