video.vue 59 KB

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