video.vue 61 KB

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