video.vue 62 KB

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