info.vue 91 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515
  1. <template>
  2. <view class="content">
  3. <view :style="{ height: statusBarHeight + 'px', width: '100%', background: '#000' }"></view>
  4. <view class="video-box">
  5. <!-- 返回按钮 -->
  6. <!-- #ifdef APP-PLUS -->
  7. <image class="back-img" @click.stop="$navBack()" src="@/static/image/hall/back_white_icon.png"></image>
  8. <!-- #endif -->
  9. <view class="cousrseImg x-c" v-show="!pickCatalog.url">
  10. <u-loading-icon size="30"></u-loading-icon>
  11. <!-- <image :src="data.imgUrl" mode="aspectFit"></image> -->
  12. </view>
  13. <!-- 视频 -->
  14. <view class="video-container" style="position: relative;height: 422rpx;" :videoPlayStatus="videoPlayStatus"
  15. :change:videoPlayStatus="xgplayer.changeVideo" :danmuFunInfo="danmuFunInfo"
  16. :change:danmuFunInfo="xgplayer.danmuFun">
  17. <view id="detail-video" :pickCatalog="pickCatalog" :change:pickCatalog="xgplayer.initJs"
  18. :exitFullscreen="exitFullscreen" :change:exitFullscreen="xgplayer.handleExitFullscreen"
  19. @click.stop="clickVideo"></view>
  20. <image class="back-img" v-if="fullScreen" @click.stop="videoback"
  21. src="@/static/image/hall/back_white_icon.png"></image>
  22. <!-- 疗法 -->
  23. <view v-if="showTherapy && fullScreen" class="horizontal" @tap.stop>
  24. <view class="goods" @tap.stop="goToPro(showTherapyItem.packageId)">
  25. <image :src="showTherapyItem.imgUrl" mode="aspectFill" class="goodsimg"></image>
  26. <view class="goodsname textOne">{{ showTherapyItem.packageName }}</view>
  27. </view>
  28. <view style="width: 20px;height: 20px;position: absolute;right:0rpx;top:0rpx;z-index:999">
  29. <image style="width: 20px;height: 20px" src="@/static/images/close40.png"
  30. @tap.stop="closeTherapy"></image>
  31. </view>
  32. </view>
  33. <view class="audiobox es es-ver es-ac es-pc" v-if="showAudio" @click.stop>
  34. <view class="audiobox-title">
  35. <image class="back" @click.stop="$navBack()" src="@/static/image/hall/back_white_icon.png">
  36. </image>
  37. <view class="textOne">
  38. {{ catalogueList[pickCatalogIdx] && catalogueList[pickCatalogIdx].title }}
  39. </view>
  40. </view>
  41. <view class="es es-ver es-ac es-pc">
  42. <view class="es es-ac es-pc">
  43. <image class="es-icon-52 es-icon-play-last" src="/static/images/other/video/play-last.png"
  44. @tap="endedPlayPrev()"></image>
  45. <image class="es-icon-88 es-ml-50 es-mr-50"
  46. :src="audioPlayIng ? '/static/images/other/video/play-stop.png' : '/static/image/hall/video_icon.png'"
  47. @tap="playAudioAction()"></image>
  48. <image class="es-icon-52 es-icon-play-next" src="/static/images/other/video/play-next.png"
  49. @tap="endedPlayNext('click')"></image>
  50. </view>
  51. <view class="audiobox-time">{{ $formatSeconds(tempAudioDuration) }} /
  52. {{ $formatSeconds(pickCatalog.seconds) }}
  53. </view>
  54. </view>
  55. <view class="audiobox-video x-ac" @tap="backPlayVideo">返回视频</view>
  56. </view>
  57. <!-- 视频控制栏 -->
  58. <view class="es"
  59. :style="{ paddingLeft: fullScreen ? statusBarHeight + 'px' : 0, display: isPause || isClickVideo ? 'flex' : 'none' }"
  60. style="width: 100%;height: 48px;position: absolute;z-index: 999;bottom: 0;left: 0;background: transparent;">
  61. <view class="xgplayer" id="controls_new_root" style="flex: 1;background:transparent;"></view>
  62. <view v-if="fullScreen" class="xgplayer-switch xgplayer-icon es es-ac es-pc"
  63. style="padding: 0 8px 8px 8px;">
  64. <view class="danmu-controls es es-ac es-pc" @click="openDanmu">
  65. 点我发弹幕
  66. </view>
  67. <view class="danmu-controls-r es es-ac es-pc">
  68. <image class="xg-img danmu-switch-open" v-show="danmuFunInfo.switch == 1"
  69. src="/static/images/other/course/danmu-on.png" @tap="switchDanmu(0)"></image>
  70. <image class="xg-img danmu-switch-open" v-show="danmuFunInfo.switch == 0"
  71. src="/static/images/other/course/danmu-off.png" @tap="switchDanmu(1)"></image>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 弹幕设置 -->
  76. <uni-popup ref="danmuPopup" type="bottom" style="z-index: 999;">
  77. <view class="danmuPopup" :style="{ marginLeft: fullScreen ? statusBarHeight + 'px' : 0 }">
  78. <view class="danmuPopup-head border-line" style="margin-bottom: 20px;">
  79. <image class="danmu-icon" v-show="danmuFunInfo.switch == 1"
  80. src="/static/images/other/course/danmu-on.png" @click="switchDanmu(0)"></image>
  81. <image class="danmu-icon" v-show="danmuFunInfo.switch == 0"
  82. src="/static/images/other/course/danmu-off.png" @click="switchDanmu(1)"></image>
  83. <image class="danmu-icon" src="/static/images/other/course/danmu-style-on.png"
  84. mode="aspectFill" @click="openDanmuStyle(2)"></image>
  85. <u--input class="danmuPopup-input" placeholder="发个弹幕吧~" border="surround" shape="circle"
  86. focus :adjustPosition="false" :autoBlur="true" maxlength="140" clearable
  87. v-model="danmuIput.txt"></u--input>
  88. <button class="danmuPopup-send" :disabled="danmubtnLoading" @click="sendDanmu">发送</button>
  89. </view>
  90. <view class="danmuPopup-con"
  91. :style="{ height: danmuboxHeight ? fullScreen ? `calc(${danmuboxHeight}px + 20px)` : danmuboxHeight + 'px' : 'auto' }">
  92. <view class="es" style="margin-bottom: 25px;">
  93. <view class="es-mr-24px">弹幕字号</view>
  94. <view class="es">
  95. <view class="es-mr-24px" v-for="size in danmuFontSize"
  96. :style="{ color: danmuIput.fontSize == size ? '#FF233C' : '#757575' }"
  97. @click="clickStyle('font', size)">{{ size == '16px' ? '默认' : '较小' }}</view>
  98. </view>
  99. </view>
  100. <view class="es" style="margin-bottom: 25px;">
  101. <view class="es-mr-24px">弹幕位置</view>
  102. <view class="es">
  103. <view class="es-mr-24px" v-for="mode in danmuMode"
  104. :style="{ color: danmuIput.mode == mode ? '#FF233C' : '#757575' }"
  105. @click="clickStyle('mode', mode)">
  106. {{ mode == 'top' ? '置顶' : mode == 'bottom' ? '置底' : '滚动' }}
  107. </view>
  108. </view>
  109. </view>
  110. <view class="es" style="margin-bottom: 25px;">
  111. <view class="es-mr-24px">弹幕颜色</view>
  112. <view class="es es-fx" style="flex-wrap: wrap;">
  113. <view class="es-mr-24px coloritem" v-for="color in colorList"
  114. :style="{ background: color, border: `2px solid ${danmuIput.color == color ? '#FF233C' : '#F5F7FA'}` }"
  115. @click="clickStyle('color', color)"></view>
  116. </view>
  117. </view>
  118. <view class="es">
  119. <view class="es-mr-24px">弹幕位置</view>
  120. <view class="es">
  121. <view class="es-mr-24px" v-for="item in danmuArea"
  122. :style="{ color: danmuFunInfo.area == item ? '#FF233C' : '#757575' }"
  123. @click="clickArea(item)">
  124. {{ item * 100 + '%' }}
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. </view>
  130. </uni-popup>
  131. </view>
  132. </view>
  133. <scroll-view class="scroll-Y" :scroll-y="true" :style="'height:' + clientHeight + 'px;'" v-show="!isShowList"
  134. @scrolltolower="getPageNewCommentData">
  135. <view class="video-info">
  136. <view class="video-info-header">
  137. <view class="video-info-headerl">
  138. <image v-if="false" mode="aspectFill" :src="data.talentAvatar"></image>
  139. <text class="textOne">{{ data.courseName }}</text>
  140. </view>
  141. <button v-if="false" class="follow-btn" @tap="doFollow()">
  142. <image v-show="!isFollow" src="@/static/image/hall/guanzhu_icon.png" mode="aspectFill"></image>
  143. <text>{{ isFollow ? "已关注" : "关注" }}</text>
  144. </button>
  145. </view>
  146. <view>
  147. <view class="video-info-voicebox2">
  148. <text class="boTextClass">{{ $formattedViewCount(data.views) }}次播放</text>
  149. <!-- <text>{{data.views}}次播放 · 总时长:{{data.totalDuration}}</text> -->
  150. <view class="x-c" @click="isExpand = !isExpand" v-if="showExpandText">
  151. <text>{{ isExpand ? '收起简介' : '展开简介' }}</text>
  152. <view :class="isExpand ? 'rotate' : ''"><uni-icons type="down" size="14"
  153. color="#bbbbbb"></uni-icons></view>
  154. </view>
  155. </view>
  156. <view :class="showDes || !showExpandText ? 'opacity video-info-desc' : 'video-info-desc'"
  157. id="descbox-desc" :style="{ height: isExpand ? 'auto' : '84rpx' }">
  158. {{ data.description }}
  159. <image v-show="!isExpand && showExpandText" class="desc-image x-c"
  160. src="/static/images/other/bg_bar.png"></image>
  161. </view>
  162. </view>
  163. <view v-if="false" class="video-info-footer">
  164. <view @tap="handleListen()">
  165. <image src="@/static/image/hall/sound_icon24.png" mode="aspectFill"></image>
  166. <text :style="{ color: showAudio ? '#FF233C' : '#757575' }">听声</text>
  167. </view>
  168. <view @tap="$navTo('./note?courseId=' + courseId)" v-if="!$qconfig.isAppStore">
  169. <image src="@/static/image/hall/note_icon24.png" mode="aspectFill"></image>
  170. <text>笔记</text>
  171. </view>
  172. <view @tap="doFavorite()">
  173. <image
  174. :src="isFavorite ? '/static/image/hall/collect_on_icon24.png' : '/static/image/hall/collect_icon24.png'"
  175. mode="aspectFill"></image>
  176. <text>{{ isFavorite ? "已收藏" : "收藏" }}</text>
  177. </view>
  178. <view @tap="doLike()">
  179. <image
  180. :src="isLike ? '/static/image/hall/like_on_icon.png' : '/static/image/hall/like_icon.png'"
  181. mode="aspectFill"></image>
  182. <text>{{ isLike ? "喜欢" : "喜欢" }}</text>
  183. </view>
  184. <view @tap="openShare()">
  185. <image src="@/static/image/hall/weixin_icon.png" mode="aspectFill"></image>
  186. <text>分享</text>
  187. </view>
  188. <view @tap="openDanmu()" :style="{ display: $isLogin() && !showAudio ? 'flex' : 'none' }">
  189. <image src="@/static/images/other/course/danmu-set.png" mode="aspectFill"></image>
  190. <text>弹幕</text>
  191. </view>
  192. </view>
  193. </view>
  194. <!-- 讲堂目录 -->
  195. <view class="video-directory">
  196. <view class="box-header">
  197. <view class="kechengLeftClass">
  198. <image class="kechengIconClass" src="/static/images/new/ke_list-icon.png" mode=""></image>
  199. <view class="box-header-title">课程目录</view>
  200. </view>
  201. <view class="box-header-r" @tap="goToCatalogue()">
  202. <text class="dataNumTextClass">共{{ catalogueList.length }}节</text>
  203. <image src="@/static/images/new/see_more.png" mode="aspectFill"></image>
  204. </view>
  205. </view>
  206. <scroll-view class="video-directory-scrollx" scroll-x="true" :scroll-into-view="scrollIntoViewId"
  207. scroll-with-animation="true" overflow-anchor="none">
  208. <view :id="'cataLogue' + index"
  209. :class="pickCatalogIdx == index ? 'active-scrollitem video-directory-scrollitem' : 'video-directory-scrollitem'"
  210. v-for="(item, index) in catalogueList" :key="index" @click="pickCatalogAction(index)">
  211. <view v-if="false"
  212. :class="index > 1 && canShowVip(item) ? 'freeflag freeflag-member' : 'freeflag freeflag-free'">
  213. {{ index > 1 && canShowVip(item) ? '限时特惠' : '限时免费' }}
  214. </view>
  215. <view class="freeflag freeflag-free">限时免费</view>
  216. <view class="video-directory-num">
  217. <text>第{{ item.courseSort }}讲</text>
  218. <image v-if='pickCatalogIdx == index' src="@/static/image/hall/hear_icon.png"></image>
  219. <view class="empty" v-else></view>
  220. </view>
  221. <view class="video-directory-title">
  222. <view class="textTwo">{{ item.title }}</view>
  223. <!-- <view class="imagebox">
  224. <view class="mask" v-if='pickCatalogIdx != index'>
  225. <image src="@/static/image/hall/video_icon.png" mode="aspectFill"></image>
  226. </view>
  227. <image class="video-directory-img" src="@/static/image/home1/logo.png" mode="aspectFill"></image>
  228. </view> -->
  229. </view>
  230. </view>
  231. </scroll-view>
  232. </view>
  233. <!-- 课程疗法 -->
  234. <view class="therapy" v-show="packageJsonList && packageJsonList.length > 0 && false">
  235. <view class="box-header-title" style="margin-bottom: 20rpx;">课程疗法</view>
  236. <scroll-view class="therapy-scrollx" scroll-x="true" :scroll-into-view="scrollIntoTherapy"
  237. scroll-with-animation="true" overflow-anchor="none">
  238. <view :class="therapyIndex == idx ? 'therapy-active therapy-scrollitem' : 'therapy-scrollitem'"
  239. :id="'therapy' + idx" v-for="(item, idx) in packageJsonList" :key="idx"
  240. @click="handleTherapy(item, idx)">
  241. <image mode="aspectFill" class="therapy-goodsimg" :src="item.imgUrl"></image>
  242. <view class="therapy-goodsname textTwo">{{ item.packageName }}</view>
  243. </view>
  244. </scroll-view>
  245. </view>
  246. <!-- 评论 -->
  247. <view class="video-comment" v-if="$qconfig.isAppStore">
  248. <view class="box-header">
  249. <view class="box-header-title">评论</view>
  250. <view v-if="false" class="box-header-r" @tap="goToComment()">
  251. <text>共{{ newCommentArrList.length }}条</text>
  252. <image src="@/static/image/hall/my_right_arrow_right_icon.png" mode="aspectFill"></image>
  253. </view>
  254. </view>
  255. <view style="padding: 0 24rpx 20rpx;">
  256. <!-- <commentList :commentList="data.commentList" /> -->
  257. <newCommentList :commentList="newCommentArrList" />
  258. </view>
  259. </view>
  260. <!-- 猜你喜欢 -->
  261. <view class="video-comment" v-if="false">
  262. <view class="box-header">
  263. <view class="box-header-title">猜你喜欢</view>
  264. <view class="box-header-r" v-if="false">
  265. <text>更多</text>
  266. <image src="@/static/image/hall/my_right_arrow_right_icon.png" mode="aspectFill"></image>
  267. </view>
  268. </view>
  269. <view class="hall-box">
  270. <hallItem class="gapitem" v-for="(item, index) in dataList" :key="index" :item="item"
  271. @click.native="navTo('/pages/course/info?courseId=' + item.courseId)" />
  272. </view>
  273. </view>
  274. </scroll-view>
  275. <view class="bottomCommentInputClass">
  276. <input type="text" v-model="inputComment" placeholder="发表我的态度" :maxlength="50" class="input-box"
  277. confirm-type="send" @confirm="sendCommentMsg" />
  278. <view class="send-btn" @click="sendCommentMsg">发送</view>
  279. <view class="icon-btn" @tap="openShare">
  280. <image src="/static/image/hall/share_icon.png" mode="aspectFill"></image>
  281. <text>分享</text>
  282. </view>
  283. </view>
  284. <!-- h5下载 -->
  285. <h5-down-app-tip :pageUrl="pageUrl" :type="'course'" :courseId="courseId" />
  286. <!-- 分享弹窗 -->
  287. <u-popup :show="showShare" @close="closeShareAct()">
  288. <share-box :shareItem="shareItem" @closeShare='closeShareAct()'></share-box>
  289. </u-popup>
  290. <!-- VIP特权弹窗 -->
  291. <uni-popup ref="popPrivilege" type="bottom" borderRadius="10rpx 10rpx 0px 0px">
  292. <view class="privilegeBox es es-ver es-br-38 es-pt-30 es-pb-30 ">
  293. <view class="es es-fx es-pc es-h-56 es-ml-48 es-mr-48">
  294. <image class="es-w-74 es-h-40" style="position: absolute;left:60rpx;top:0"
  295. src="../../static/image/course/xiangyun.png"></image>
  296. <view class="es-fs-40 es-h-56 es-fw-500" style="color: #FFDAA3;">开通VIP专享以下特权</view>
  297. <image class="es-w-74 es-h-40" style="position: absolute;right:60rpx;top:0"
  298. src="../../static/image/course/xiangyun2.png"></image>
  299. <image class="es-w-40 es-h-40" style="position: absolute;right:-20rpx;top:-10rpx"
  300. @tap="closePrivilege" src="/static/images/close40.png"></image>
  301. </view>
  302. <view class="sec1 es-mt-20 es-ml-48 es-mr-48">
  303. <view class="es x-bc es-pl-28 es-pt-12">
  304. <view class="l1">
  305. <view class="x-f">
  306. <image class="es-w-44 es-h-44" src="../../static/image/course/privilege/fozhu.png">
  307. </image>
  308. <view class="es-ml-8 es-c-white es-fs-32 es-fw-600">名家讲堂</view>
  309. </view>
  310. <view class="es-fs-30 es-mt-10 es-c-99">畅享10000+VIP视频</view>
  311. </view>
  312. <view class="es">
  313. <image src="../../static/image/course/zyx.png" class="es-w-183 es-h-98 es-br-15"></image>
  314. <!-- <view class="es-fs-20 es-br-8 es-w-80 es-h-30 es-fw-bold x-c" style="position:absolute; right: 0;top:10rpx;background: #000;opacity: 0.7;color: #FFDAA3;">10000+</view> -->
  315. </view>
  316. </view>
  317. </view>
  318. <view class="sec2 es es-fx es-pc es-h-56 es-mt-40 es-ml-48 es-mr-48">
  319. <!-- <image class="es-w-148 es-h-3" style="position: absolute;left:0;top:16rpx" src="../../static/image/course/privilege/line1.png"></image> -->
  320. <view class="es-fs-30 es-h-56 es-fw-bold" style="color: #FFDAA3;">超多权益待你开启</view>
  321. <!-- <image class="es-w-148 es-h-3" style="position: absolute;right:0;top:16rpx" src="../../static/image/course/privilege/line2.png"></image> -->
  322. </view>
  323. <view class="primenu-box es es-fx es-pc es-mt-20 es-ml-48 es-mr-48">
  324. <view class="content-inner">
  325. <!-- <view class="item">
  326. <image class="img" src="/static/image/course/privilege/she.png" mode="heightFix"></image>
  327. <text class="label">AI舌诊</text>
  328. </view> -->
  329. <view class="item">
  330. <image class="img jlxw" src="/static/image/course/privilege/tizhi.png" mode="heightFix">
  331. </image>
  332. <text class="label">体质检测</text>
  333. </view>
  334. <view class="item">
  335. <image class="img" src="/static/image/course/privilege/baike.png" mode="heightFix"></image>
  336. <text class="label">养生百科</text>
  337. </view>
  338. <view class="item">
  339. <image class="img" src="/static/image/course/privilege/yishu.png" mode="heightFix"></image>
  340. <text class="label">经典医书</text>
  341. </view>
  342. <view class="item">
  343. <image class="img" src="/static/image/course/privilege/more.png" mode="heightFix"></image>
  344. <text class="label">多设备登陆</text>
  345. </view>
  346. <view class="item">
  347. <image class="img" src="/static/image/course/privilege/ad.png" mode="heightFix"></image>
  348. <text class="label">去除广告</text>
  349. </view>
  350. </view>
  351. </view>
  352. <view class="es-ml-48 es-mr-48 es-mt-10 es-pt-10 es-pb-10 es-br-5" style="background:#2a2f32">
  353. <view v-for="(item, index) in vipMethods" :key="index" @tap="changeVipMethod(index)"
  354. class="vipMethodItem es x-bc">
  355. <view class="x-bc es-ml-14">
  356. <view class="es-fs-32 es-fw-500 es-ml-14">{{ item }}</view>
  357. </view>
  358. <image v-if="vipMethodIdx == index" class="es-w-40 es-h-40 es-br-ban es-mr-14 es-mr-26"
  359. src="../../static/image/course/vipBuy/check.png"></image>
  360. <view v-else class="es-w-40 es-h-40 es-br-ban es-mr-14 es-mr-26 circle"></view>
  361. </view>
  362. </view>
  363. <view v-if="isShowPayType" class="es-ml-48 es-mr-48 es-mt-40 x-bc" style="background:#2a2f32">
  364. <view v-for="(item, index) in payTypes" :key="index" @tap="changePayType(index)"
  365. class="payTypeItem es x-bc " :class="payType == index + 1 ? 'pt_ac' : ''">
  366. <view class="x-bc es-ml-14">
  367. <image class="es-w-59 es-h-52"
  368. :src="index == 0 ? '../../static/image/course/vipBuy/wx.png' : '../../static/image/course/vipBuy/zfb.png'">
  369. </image>
  370. <view class="es-fs-33 es-c-white es-fw-500 es-ml-14">{{ item }}</view>
  371. </view>
  372. <image v-if="payType == index + 1" src="../../static/image/course/vipBuy/check.png"
  373. class="es-w-40 es-h-40 es-br-ban es-mr-14"></image>
  374. <view v-else class="es-w-40 es-h-40 es-br-ban es-mr-14 circle"></view>
  375. </view>
  376. </view>
  377. <view class="es es-mt-40 es-ml-48 es-mr-48 x-c">
  378. <view @tap="doBuy()" class="es-h-94 x-c es-fw-700 es-fs-34 vipCourseBtn vipAc es-br-46"
  379. style="width: 310rpx;">
  380. 立即购买
  381. </view>
  382. </view>
  383. </view>
  384. </uni-popup>
  385. <uni-popup ref="popTip" type="dialog">
  386. <uni-popup-dialog cancelText="支付失败" confirmText="支付成功" mode="base" content="是否已支付成功?" title="提示"
  387. :duration="2000" :before-close="true" @close="confirmTip" @confirm="confirmTip"></uni-popup-dialog>
  388. </uni-popup>
  389. <!-- 评论弹窗 -->
  390. <popupBottom ref="mescrollItem" :visible.sync="specVisible" @close="closePop" :cmdId="courseId"
  391. :smsNum="data.commentNum" :title="data.commentNum + '条评论'" :type="1" radius="32" maxHeight="1200">
  392. </popupBottom>
  393. <!-- 右侧悬浮框 -->
  394. <answerFloatBox v-if="pickCatalog && pickCatalog.videoId && isShowPageEntryTimer"
  395. :typeNum="isShowPageEntryTimer" :pointsNum="answerPointsNum" :remainSeconds="pageEntryRequiredTime"
  396. @handleShowAnswer="handleAnswerMethods" @showTomorrowTipMethods="handleTomorrowTipMethods" />
  397. <!-- 答题弹窗 -->
  398. <questionsPopup v-if="pickCatalog && pickCatalog.videoId && isShowPageEntryTimer" :isShow="isShowQuestions"
  399. :remainSeconds="pageEntryRequiredTime" :videoId="pickCatalog.videoId" @closeMethod="questionsCloseMethod"
  400. @submitAnswer="handleSubmitAnswer" />
  401. <!-- 答题提示框和明日再来提示框 -->
  402. <answerPromptPopup v-if="pickCatalog && pickCatalog.videoId" :pointsNum="answerPointsNum"
  403. :isShow="isShowAnswerPrompt" :typeStatus="answerPromptType" @closeMethod="isShowAnswerPrompt = false" />
  404. </view>
  405. </template>
  406. <script>
  407. import {
  408. getUserInfo
  409. } from '@/api/user'
  410. import {
  411. getCourseById,
  412. getCourseList,
  413. getCourseVideoList,
  414. checkFavorite,
  415. checkFollow,
  416. checkLike,
  417. doFavorite,
  418. doFollow,
  419. doLike,
  420. addDuration,
  421. createCourseOrder,
  422. createIntegralOrder,
  423. getIntegral,
  424. createVipOrder,
  425. aliPayment,
  426. wxPayment,
  427. getCourseOrderById,
  428. getComments,
  429. saveMsg,
  430. getNewCommentListApi,
  431. addNewCommentApi,
  432. newPublicCourseAnswerApi,
  433. publicCourseAnswerStatusApi,
  434. publicCourseAnswerClaimIntegralApi,
  435. newGetInternetTrafficApi,
  436. } from '@/api/course'
  437. import {
  438. generateRandomString
  439. } from '@/utils/common.js';
  440. import dayjs from 'dayjs';
  441. import commentList from "./components/commentList.vue";
  442. import newCommentList from "./components/newCommentList.vue";
  443. import hallItem from "./components/hallItem.vue";
  444. import popupBottom from '@/components/popupBottom/popupBottom.vue'
  445. import MescrollCompMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-comp.js";
  446. import adMask from "@/components/adMask/adMask.vue"
  447. import answerFloatBox from "./components/answerFloatBox.vue"
  448. import questionsPopup from "./components/questionsPopup.vue"
  449. import answerPromptPopup from "./components/answerPromptPopup.vue"
  450. export default {
  451. mixins: [MescrollCompMixin],
  452. components: {
  453. popupBottom,
  454. commentList,
  455. newCommentList,
  456. hallItem,
  457. adMask,
  458. answerFloatBox,
  459. questionsPopup,
  460. answerPromptPopup
  461. },
  462. data() {
  463. return {
  464. player: null,
  465. Events: null,
  466. isH5: false,
  467. showDes: false,
  468. showExpandText: false,
  469. isExpand: true,
  470. textHeight: 0, //文本高度
  471. courseId: null,
  472. isShare: false,
  473. videoId: null,//当前视频(小节)章节ID(旧的,页面进入时带入的,后面没有更新,需要的话用pickCatalog.videoId来判断)
  474. isLearning: false,
  475. isShowQuestions: false,
  476. isShowAnswerPrompt: false,
  477. answerPromptType: 1,
  478. answerPointsNum: 0, // 答题获得的积分
  479. inputComment: '',
  480. newCommentArrList: [],
  481. data: {
  482. courseId: null,
  483. imgUrl: "",
  484. talentAvatar: "",
  485. price: "",
  486. remark: "",
  487. noteNum: 0,
  488. courseName: "",
  489. description: "",
  490. cataIndex: 0,
  491. isFast: 1,
  492. isAutoPlay: false,
  493. commentList: [{
  494. avatar: "",
  495. content: "",
  496. createTime: "",
  497. nickName: ""
  498. }]
  499. },
  500. dataList: [],
  501. talentId: null,
  502. studyLog: null,
  503. isNext: 0,
  504. user: {},
  505. isFavorite: 0,
  506. isFollow: 0,
  507. isLike: 0,
  508. clientHeight: 0,
  509. isShowList: false, // 是否展示讲堂目录列表
  510. catalogueList: [],
  511. scrollIntoViewId: 'cataLogue0',
  512. pickCatalog: {
  513. // videoUrl: "https://tcpv.ylrzcloud.com/course/20241014/1728890026184.mp4",
  514. videoUrl: "",
  515. thumbnail: "",
  516. duration: 0,
  517. videoId: 0,
  518. seconds: 0,
  519. studyTime: null,
  520. isFast: 1,
  521. },
  522. pickCatalogIdx: 0,
  523. packageJsonList: [],
  524. poster: '',
  525. showShare: false,
  526. shareItem: {
  527. imageUrl: "",
  528. title: "",
  529. path: ""
  530. },
  531. fullScreen: false,
  532. showTherapy: false,
  533. showTherapyItem: {},
  534. playDuration: 0, // 播放时长
  535. timer: null, // 定时器
  536. lookDuration: 0, // 观看时长
  537. countdowning: false, // 观看时长计时开关
  538. showAudio: false, //音频展示
  539. videoPlayStatus: {
  540. status: '',
  541. tempAudioDuration: 0,
  542. studyTime: 0,
  543. }, // 视频播放状态
  544. pageUrl: '',
  545. courseOrderId: 0,
  546. scrollIntoTherapy: 'therapy0',
  547. therapyIndex: null,
  548. allLookTimer: null, // 定时器
  549. allLookDuration: 0, //H5未登录状态播放五分钟就跳出登录页面
  550. tempAudioDuration: 0, //用于记录视频和音频播放的时间,达到无缝续播
  551. audioTimer: null,
  552. playTime: "00:00",
  553. studyTimes: 0,
  554. audioContext: null,
  555. audioPlayIng: false,
  556. isPostBack: true, //页面是否已初次加载
  557. specVisible: false,
  558. esComment: null,
  559. vipSelIndex: 0,
  560. vipMethods: ["开通会员"],
  561. vipMethodIdx: 0,
  562. isShowPayType: false,
  563. payTypes: ["微信支付", "支付宝支付"],
  564. payType: 1, //微信支付1 支付宝支付2
  565. createType: 3, //1直接购买,2福币兑换 3开通会员
  566. orderId: null,
  567. order: null,
  568. showPayTips: false,
  569. isPlayIng: false, //是否正在播放
  570. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  571. direction: "",
  572. nodeTime: 0,
  573. exitFullscreen: '', //是否退出全屏yes , no 加上时间戳
  574. danmubtnLoading: false,
  575. colorList: ['#ffffff', '#e70012', '#fcf103', '#009843', '#00a0ea', '#e2027f'],
  576. danmuMode: ['scroll', 'top', 'bottom'],
  577. danmuArea: [0.1, 0.25, 0.5, 0.75, 1],
  578. danmuFontSize: ['18px', '16px'],
  579. danmuIput: {
  580. txt: '',
  581. mode: 'scroll',
  582. color: '#ffffff',
  583. fontSize: '18px',
  584. },
  585. danmuItem: {
  586. //发送弹幕
  587. duration: 10000,
  588. id: '',
  589. txt: '',
  590. mode: 'scroll',
  591. style: {
  592. color: '#ffffff',
  593. fontSize: '18px',
  594. border: 'solid 1px #ffffff',
  595. borderRadius: '5px',
  596. padding: '2px 5px',
  597. backgroundColor: 'rgba(255, 255, 255, 0.1)'
  598. }
  599. },
  600. danmuFunInfo: {
  601. time: new Date().getTime(),
  602. event: '',
  603. switch: 1,
  604. area: 0.25
  605. },
  606. socket: null,
  607. // 页面一进入-答题奖励相关
  608. pageEntryTimer: null, // 页面一进入-答题奖励计时器
  609. pageEntryRequiredTime: 0, // 页面一进入-答题奖励当前小节后台设定的奖励时间(秒)(倒计时总时长)
  610. hasGotPageEntryReward: 0, // 页面一进入-答题奖励当前小节是否已领取奖励-答题状态:1未答题 2可以答题 3达到上限 4已完成;-1学习缺失 -2无看课 -3未完课
  611. isSocketOpen: false,
  612. isSend: true,
  613. reOpenSocket: false,
  614. pingpangTimes: null,
  615. danmuboxHeight: 0,
  616. isPause: true, // 视频是否暂停
  617. isClickVideo: false, // 是否点击视频
  618. commentPage: {
  619. pageNum: 1,
  620. pageSize: 10,
  621. total: 0,
  622. },
  623. // 流量记录相关
  624. lastInternetTrafficDuration: 0, // 上次触发时的播放时长
  625. }
  626. },
  627. computed: {
  628. isShowPageEntryTimer() {
  629. let newData = 0
  630. if (this.hasGotPageEntryReward == 1) {
  631. // 未答题
  632. newData = 4
  633. }
  634. if (this.hasGotPageEntryReward == 2) {
  635. // 答错了但未达上限- 可以答题
  636. newData = 3
  637. }
  638. if (this.hasGotPageEntryReward == 3) {
  639. // 答错了且达上限- 达到上限
  640. newData = 2
  641. }
  642. if (this.hasGotPageEntryReward == 4) {
  643. // 答对了获得积分- 已完成
  644. newData = 1
  645. }
  646. return newData
  647. }
  648. },
  649. onLoad(options) {
  650. this.courseId = options.courseId;
  651. this.isShare = options.isShare || false
  652. this.videoId = options.videoId || null;
  653. this.isLearning = options.isLearning || false;
  654. // #ifdef APP-PLUS
  655. uni.getSubNVueById('videoPopup').hide();
  656. uni.$on('getEventType', (data) => {
  657. uni.getSubNVueById('videoPopup').hide();
  658. if (data.type == 'confirm') {
  659. // 确认
  660. this.tipConfirm(data.extraData)
  661. } else {
  662. // 取消
  663. this.tipCancel(data.extraData)
  664. }
  665. })
  666. // #endif
  667. this.esComment = this.$refs["esComment"];
  668. let that = this;
  669. uni.$on('refreshTitle', (pingCount) => {
  670. that.data.commentNum = pingCount;
  671. });
  672. this.getCourseInfo();
  673. if (this.$isLogin()) {
  674. this.getUserInfo();
  675. this.checkFavorite();
  676. this.getNewCommentArrList();
  677. this.checkLike();
  678. // #ifndef H5
  679. uni.onKeyboardHeightChange(this.keyboardHeightChange);
  680. // #endif
  681. }
  682. },
  683. onShow() {
  684. this.exitFullscreen = 'no' + new Date().getTime()
  685. //#ifdef H5
  686. this.isH5 = true;
  687. //#endif
  688. //#ifdef APP-PLUS
  689. if (this.$isLogin()) {
  690. if (!this.timer) {
  691. this.timer = setInterval(() => {
  692. if (this.countdowning) { //观看时长计时开关开启
  693. this.lookDuration += 5;
  694. this.addIntegral();
  695. }
  696. }, 5000);
  697. }
  698. }
  699. //#endif
  700. if (!this.$isLogin()) {
  701. if (!this.allLookTimer) {
  702. this.allLookTimer = setInterval(() => {
  703. if (this.countdowning) { //观看时长计时开关开启
  704. this.allLookDuration += 5;
  705. }
  706. }, 5000);
  707. }
  708. }
  709. // 重新启动章节奖励计时器(如果符合条件)
  710. if (this.pickCatalog.videoId && (this.hasGotPageEntryReward == 1 || this.hasGotPageEntryReward == 2)) {
  711. this.startPageEntryTimer();
  712. }
  713. this.playFun()
  714. if (this.showPayTips) {
  715. this.$refs.popTip.open();
  716. this.showPayTips = false;
  717. }
  718. },
  719. onReady() {
  720. this.audioContext = uni.createInnerAudioContext();
  721. uni.getSystemInfo({
  722. success: (res) => {
  723. this.clientHeight = res.windowHeight - uni.upx2px(422) - res.statusBarHeight;
  724. }
  725. });
  726. },
  727. onHide() {
  728. const type = this.showAudio ? 'audio' : 'video'
  729. this.pauseFun(type);
  730. // 清理所有定时器,避免后台运行时资源泄漏
  731. this.endCountsTime();
  732. this.stopPageEntryTimer();
  733. // 关闭WebSocket连接和心跳
  734. if (this.socket != null) {
  735. this.socket.close()
  736. clearInterval(this.pingpangTimes)
  737. this.pingpangTimes = null
  738. this.socket = null
  739. }
  740. },
  741. onUnload() {
  742. if (this.socket != null) {
  743. this.socket.close()
  744. clearInterval(this.pingpangTimes)
  745. this.socket = null
  746. }
  747. // #ifndef H5
  748. uni.offKeyboardHeightChange(this.keyboardHeightChange);
  749. // #endif
  750. this.exitFullscreen = 'yes' + new Date().getTime()
  751. // 页面卸载时清除计时器
  752. this.endCountsTime();
  753. this.stopPageEntryTimer(); // 清理章节奖励计时器
  754. this.addStudyCourse();
  755. this.destoryAudio();
  756. // #ifdef APP-PLUS
  757. uni.$off('getEventType');
  758. // #endif
  759. uni.$emit('refreshStudyTime', {});
  760. uni.$off("backStudyTime");
  761. uni.$off("refreshUser");
  762. uni.$off("showPayTips");
  763. uni.$off("pickCatalogAction");
  764. uni.$off("refreshTitle");
  765. uni.$off("refreshCatalog");
  766. },
  767. methods: {
  768. // 获取新版-评论列表
  769. async getNewCommentArrList() {
  770. let params = {
  771. courseId: this.courseId,
  772. sortType: 2
  773. };
  774. const res = await getNewCommentListApi(params, this.commentPage.pageNum, this.commentPage.pageSize);
  775. if (res.code === 200 && res.data.list.length > 0) {
  776. this.commentPage.total = res.data.total;
  777. this.newCommentArrList = [...this.newCommentArrList, ...res.data.list];
  778. }
  779. },
  780. // 分页获取评论数据
  781. getPageNewCommentData() {
  782. if (this.commentPage.total <= this.newCommentArrList.length) {
  783. return;
  784. }
  785. this.commentPage.pageNum++;
  786. this.getNewCommentArrList();
  787. },
  788. // 点击答题
  789. handleAnswerMethods() {
  790. this.isShowQuestions = true
  791. },
  792. // 点击关闭答题弹窗
  793. questionsCloseMethod() {
  794. this.isShowQuestions = false
  795. },
  796. // 点击提交答案后
  797. handleSubmitAnswer(quesList) {
  798. let newData = quesList.map(item => ({ ...item, question: JSON.stringify(item.question) }));
  799. let param = {
  800. questions: newData,
  801. videoId: this.pickCatalog.videoId,
  802. courseId: this.courseId
  803. }
  804. uni.showLoading({
  805. title: '加载中'
  806. });
  807. newPublicCourseAnswerApi(param).then(res => {
  808. this.questionsCloseMethod()
  809. uni.hideLoading()
  810. if (res.code == 200) {
  811. if (res.msg == "答题成功") {
  812. // 答对
  813. this.answerPromptType = 1
  814. this.handleClaimIntegralMethods()
  815. } else {
  816. // 答错
  817. this.answerPromptType = 2
  818. }
  819. this.checkPageEntryStatus();
  820. this.isShowAnswerPrompt = true
  821. }
  822. })
  823. },
  824. // 答题成功后领取本节答题积分
  825. handleClaimIntegralMethods() {
  826. publicCourseAnswerClaimIntegralApi({
  827. videoId: this.pickCatalog.videoId,
  828. })
  829. },
  830. // 点击提示明日再来
  831. handleTomorrowTipMethods() {
  832. this.answerPromptType = 3
  833. this.isShowAnswerPrompt = true
  834. },
  835. // 发送评论
  836. sendCommentMsg() {
  837. if (this.inputComment == '' || this.inputComment.trim() == '') {
  838. uni.showToast({
  839. title: '评论不能为空~',
  840. icon: 'none'
  841. })
  842. return;
  843. }
  844. if (!this.$isLogin()) {
  845. uni.showToast({
  846. title: '请先登录后评论~',
  847. icon: 'none'
  848. })
  849. setTimeout(() => {
  850. this.$showLoginPage();
  851. }, 1500);
  852. }
  853. addNewCommentApi({
  854. courseId: this.courseId,
  855. type: 1,
  856. content: this.inputComment,
  857. toUserId: this.user.userId,
  858. }).then(res => {
  859. if (res.code == 200) {
  860. uni.showToast({
  861. title: '评论成功~',
  862. icon: 'none'
  863. })
  864. this.inputComment = '';
  865. this.commentPage.pageNum = 1;
  866. this.commentPage.total = 0;
  867. this.newCommentArrList = [];
  868. this.getNewCommentArrList();
  869. }
  870. });
  871. },
  872. endCountsTime() {
  873. if (this.timer) {
  874. clearInterval(this.timer);
  875. this.timer = null;
  876. }
  877. if (this.allLookTimer) {
  878. clearInterval(this.allLookTimer);
  879. this.allLookTimer = null;
  880. }
  881. },
  882. // 检查章节奖励领取状态
  883. checkPageEntryStatus() {
  884. this.hasGotPageEntryReward = 0;
  885. // 检查该章节是否已领取章节奖励
  886. publicCourseAnswerStatusApi({
  887. videoId: this.pickCatalog.videoId,
  888. courseId: this.courseId
  889. }).then(res => {
  890. if (res.code == 200) {
  891. this.hasGotPageEntryReward = Number(res.data.status);
  892. // 启动答题奖励计时器(需要先获取当前章节ID)
  893. if (this.pickCatalog.videoId && (this.hasGotPageEntryReward == 1 || this.hasGotPageEntryReward == 2)) {
  894. this.startPageEntryTimer();
  895. }
  896. }
  897. })
  898. },
  899. // 启动章节奖励计时器
  900. startPageEntryTimer() {
  901. // 启动前或切换章节都先重置计时
  902. this.stopPageEntryTimer();
  903. // 每秒计时
  904. this.pageEntryTimer = setInterval(() => {
  905. this.pageEntryRequiredTime--;
  906. if (this.pageEntryRequiredTime <= 0) {
  907. this.stopPageEntryTimer();
  908. }
  909. }, 1000);
  910. },
  911. // 重置-停止-清除章节奖励计时器
  912. stopPageEntryTimer() {
  913. if (this.pageEntryTimer) {
  914. clearInterval(this.pageEntryTimer);
  915. this.pageEntryTimer = null;
  916. }
  917. },
  918. getCourseInfo() {
  919. this.showDes = false
  920. getCourseById(this.courseId).then(res => {
  921. if (res.code == 200) {
  922. this.data = res.data;
  923. this.dataList = res.data.courseList;
  924. this.talentId = res.data.talentId;
  925. this.studyLog = res.data.studyLog;
  926. this.isNext = res.data.isNext;
  927. this.videoId = this.studyLog ? this.studyLog.videoId : null;
  928. this.vipMethods = ["开通会员"];
  929. if (this.data.isIntegral == 1) {
  930. this.vipMethods.push("福币兑换")
  931. }
  932. if (this.data.sellPrice > 0) {
  933. this.vipMethods.push(this.data.sellPrice + "元购买");
  934. }
  935. this.getDescHeight()
  936. this.getCourseVideoList();
  937. if (this.$isLogin()) {
  938. this.checkFollow();
  939. }
  940. }
  941. },
  942. rej => { }
  943. );
  944. },
  945. getDescHeight() {
  946. this.$nextTick(() => {
  947. const query = uni.createSelectorQuery().in(this);
  948. query
  949. .select("#descbox-desc")
  950. .boundingClientRect((data) => {
  951. this.textHeight = data.height
  952. this.isExpand = this.textHeight > uni.upx2px(84) ? false : true
  953. this.showExpandText = this.textHeight > uni.upx2px(84) ? true : false
  954. this.showDes = true
  955. })
  956. .exec();
  957. })
  958. },
  959. //课程目录
  960. getCourseVideoList() {
  961. let that = this;
  962. const params = {
  963. "courseId": this.courseId
  964. };
  965. getCourseVideoList(params, 1, 50).then(res => {
  966. if (res.code == 200) {
  967. this.catalogueList = res.data.list;
  968. if (this.catalogueList.length > 0) {
  969. this.pickCatalogIdx = this.getCatalogIdx();
  970. //开始播放计时
  971. if (this.data.isAutoPlay == 1) {
  972. this.pickCatalogMethod(this.pickCatalogIdx);
  973. setTimeout(() => {
  974. this.addStudyCourse();
  975. }, 300);
  976. }
  977. }
  978. }
  979. },
  980. rej => { }
  981. );
  982. },
  983. canShowVip(item) {
  984. return true;
  985. if (this.user.isVip) {
  986. return false;
  987. }
  988. return item.isVip == 1 && item.isBuy == 0;
  989. },
  990. getCatalogIdx() {
  991. let index = this.catalogueList.findIndex(item => item.videoId == this.videoId);
  992. if (!this.videoId || index < 0) {
  993. index = 0;
  994. }
  995. return index;
  996. },
  997. getUserInfo() {
  998. let that = this;
  999. getUserInfo().then(res => {
  1000. if (res.code == 200) {
  1001. if (res.user != null) {
  1002. uni.setStorageSync('userInfo', JSON.stringify(res.user));
  1003. this.user = res.user;
  1004. } else {
  1005. uni.showToast({
  1006. icon: 'none',
  1007. title: res.msg,
  1008. });
  1009. }
  1010. }
  1011. },
  1012. rej => { }
  1013. );
  1014. },
  1015. checkFavorite() {
  1016. checkFavorite(this.courseId).then(res => {
  1017. if (res.code == 200) {
  1018. this.isFavorite = res.isFavorite;
  1019. }
  1020. },
  1021. rej => { }
  1022. );
  1023. },
  1024. checkFollow() {
  1025. checkFollow(this.talentId).then(res => {
  1026. if (res.code == 200) {
  1027. this.isFollow = res.isFollow;
  1028. }
  1029. },
  1030. rej => { }
  1031. );
  1032. },
  1033. checkLike() {
  1034. checkLike(this.courseId).then(res => {
  1035. if (res.code == 200) {
  1036. this.isLike = res.isLike;
  1037. }
  1038. },
  1039. rej => { }
  1040. );
  1041. },
  1042. doFollow() {
  1043. if (!this.$isLogin()) {
  1044. this.$showLoginPage();
  1045. return;
  1046. }
  1047. uni.showLoading({
  1048. title: ""
  1049. });
  1050. doFollow(this.talentId).then(res => {
  1051. uni.hideLoading();
  1052. if (res.code == 200) {
  1053. uni.showToast({
  1054. title: '操作成功',
  1055. icon: 'none'
  1056. });
  1057. } else {
  1058. uni.showToast({
  1059. title: res.msg,
  1060. icon: 'none'
  1061. });
  1062. }
  1063. this.isFollow = !this.isFollow;
  1064. },
  1065. rej => { }
  1066. );
  1067. },
  1068. doFavorite() {
  1069. if (!this.$isLogin()) {
  1070. this.$showLoginPage();
  1071. return;
  1072. }
  1073. uni.showLoading({
  1074. title: ""
  1075. });
  1076. doFavorite(this.courseId).then(res => {
  1077. uni.hideLoading();
  1078. if (res.code == 200) {
  1079. uni.showToast({
  1080. title: '操作成功',
  1081. icon: 'none'
  1082. });
  1083. } else {
  1084. uni.showToast({
  1085. title: res.msg,
  1086. icon: 'none'
  1087. });
  1088. }
  1089. this.isFavorite = !this.isFavorite;
  1090. },
  1091. rej => { }
  1092. );
  1093. },
  1094. doLike() {
  1095. if (!this.$isLogin()) {
  1096. this.$showLoginPage();
  1097. return;
  1098. }
  1099. uni.showLoading({
  1100. title: ""
  1101. });
  1102. doLike(this.courseId).then(res => {
  1103. uni.hideLoading();
  1104. if (res.code == 200) {
  1105. uni.showToast({
  1106. title: '操作成功',
  1107. icon: 'none'
  1108. });
  1109. } else {
  1110. uni.showToast({
  1111. title: res.msg,
  1112. icon: 'none'
  1113. });
  1114. }
  1115. this.isLike = !this.isLike;
  1116. },
  1117. rej => { }
  1118. );
  1119. },
  1120. openShare() {
  1121. if (this.isH5) {
  1122. return;
  1123. }
  1124. if (this.$isEmpty(this.pickCatalog.title)) {
  1125. this.shareItem.title = this.data.courseName;
  1126. } else {
  1127. // this.shareItem.title = this.data.courseName + "-" + this.pickCatalog.title;
  1128. this.shareItem.title = this.pickCatalog.title;
  1129. }
  1130. this.shareItem.isMini = true
  1131. // this.shareItem.imageUrl = this.data.imgUrl;
  1132. this.shareItem.imageUrl = this.pickCatalog.thumbnail;
  1133. this.shareItem.compressImage = 0;
  1134. this.shareItem.courseId = this.courseId;
  1135. this.shareItem.summary = !this.$isEmpty(this.data.description) ? this.data.description : "";
  1136. // let cdn = uni.getStorageSync('h5Path');
  1137. let cdn = '';
  1138. this.shareItem.url = cdn + "/pages_index/courseDetail?courseId=" + this.courseId;
  1139. this.shareItem.path = "/pages_index/courseDetail?courseId=" + this.courseId;
  1140. this.showShare = true;
  1141. },
  1142. goToComment() {
  1143. if (this.isH5) {
  1144. this.specVisible = true;
  1145. } else {
  1146. // this.$navTo('./comment?courseId='+this.courseId);
  1147. // return;
  1148. const subNVue = uni.getSubNVueById('commentN');
  1149. subNVue.show('slide-in-bottom', 250);
  1150. uni.$emit('comment', {
  1151. videoId: this.pickCatalog.videoId,
  1152. courseId: this.courseId
  1153. });
  1154. }
  1155. },
  1156. closePop() {
  1157. this.specVisible = false;
  1158. },
  1159. navTo(url) {
  1160. uni.navigateTo({
  1161. url: url
  1162. });
  1163. },
  1164. openVipCourse(index) {
  1165. if (!this.isPostBack) {
  1166. this.isPostBack = true;
  1167. return;
  1168. }
  1169. this.showPopPrivilege(index);
  1170. },
  1171. showPopPrivilege(index) {
  1172. if (this.isH5) {
  1173. this.$refs.popPrivilege.open("bottom");
  1174. } else {
  1175. const subNVue = uni.getSubNVueById('privilege');
  1176. subNVue.show('slide-in-bottom', 250);
  1177. let pickCatalog = this.catalogueList[index];
  1178. uni.$emit('privilege', {
  1179. videoId: pickCatalog.videoId,
  1180. courseId: this.courseId,
  1181. sellPrice: this.data.sellPrice,
  1182. catalogIndex: index,
  1183. integral: this.data.integral,
  1184. });
  1185. }
  1186. },
  1187. changeVip(index) {
  1188. this.vipSelIndex = index;
  1189. if (index == 2) {
  1190. this.showPopPrivilege();
  1191. }
  1192. },
  1193. changeVipMethod(index) {
  1194. this.vipMethodIdx = index;
  1195. const vipMethod = this.vipMethods[index];
  1196. this.isShowPayType = false;
  1197. if (vipMethod.indexOf('元购买') != -1) { //直接购买
  1198. this.isShowPayType = true;
  1199. this.createType = 1;
  1200. }
  1201. if (vipMethod.indexOf('福币兑换') != -1) { //福币兑换
  1202. this.createType = 2;
  1203. }
  1204. if (vipMethod.indexOf('开通会员') != -1) { //开通会员
  1205. this.createType = 3;
  1206. }
  1207. },
  1208. changePayType(index) {
  1209. this.payType = index + 1;
  1210. },
  1211. doBuy() {
  1212. if (this.createType == 1) { //直接购买
  1213. this.createCourseOrder();
  1214. } else if (this.createType == 2) { //福币兑换
  1215. this.createIntegralOrder();
  1216. } else { //开通会员
  1217. this.$navTo('./vipBuy');
  1218. }
  1219. },
  1220. createCourseOrder() {
  1221. if (!this.$isLogin()) {
  1222. this.$showLoginPage();
  1223. return;
  1224. }
  1225. uni.showLoading({
  1226. title: ""
  1227. });
  1228. let params = {
  1229. "courseId": this.courseId,
  1230. "createType": this.createType,
  1231. "videoId": this.pickCatalog.videoId,
  1232. "payType": this.payType
  1233. };
  1234. createCourseOrder(params).then(res => {
  1235. uni.hideLoading();
  1236. if (res.code == 200) {
  1237. this.order = res.order;
  1238. if (this.payType == 1) { //微信支付
  1239. this.doWxPay();
  1240. } else { //支付宝
  1241. this.doAlipay();
  1242. }
  1243. } else {
  1244. uni.showToast({
  1245. title: res.msg,
  1246. icon: 'none'
  1247. });
  1248. }
  1249. },
  1250. rej => { }
  1251. );
  1252. },
  1253. createIntegralOrder() {
  1254. if (!this.$isLogin()) {
  1255. this.$showLoginPage();
  1256. return;
  1257. }
  1258. uni.showLoading({
  1259. title: ""
  1260. });
  1261. let params = {
  1262. "courseId": this.courseId,
  1263. "videoId": this.pickCatalog.videoId
  1264. };
  1265. createIntegralOrder(params).then(res => {
  1266. uni.hideLoading();
  1267. if (res.code == 200) {
  1268. // uni.showToast({
  1269. // title: res.msg,
  1270. // icon: 'success'
  1271. // });
  1272. } else {
  1273. uni.showToast({
  1274. title: res.msg,
  1275. icon: 'none'
  1276. });
  1277. }
  1278. },
  1279. rej => { }
  1280. );
  1281. },
  1282. doAlipay() {
  1283. var data = {
  1284. orderId: this.order.orderId
  1285. };
  1286. uni.showLoading();
  1287. aliPayment(data).then(res => {
  1288. uni.hideLoading()
  1289. this.$refs.popPrivilege.close();
  1290. if (res.code == 200) {
  1291. this.$refs.popTip.open();
  1292. if (uni.getSystemInfoSync().platform == 'android') {
  1293. var alipayScheme = 'alipays://platformapi/startApp?&saId=10000007&qrcode=' + res.data
  1294. .qr_code;
  1295. } else {
  1296. var alipayScheme = 'alipay://platformapi/startApp?&saId=10000007&qrcode=' + res.data
  1297. .qr_code;
  1298. }
  1299. console.log(alipayScheme)
  1300. // 在uni-app中使用plus.runtime.openURL打开URL
  1301. plus.runtime.openURL(alipayScheme, function (error) {
  1302. // console.error('打开支付宝失败: ' + error.message);
  1303. // 处理打开支付宝失败的情况,比如提示用户或者跳转到其他支付方式
  1304. });
  1305. } else {
  1306. uni.showToast({
  1307. title: res.msg,
  1308. icon: 'none'
  1309. })
  1310. }
  1311. },
  1312. rej => { }
  1313. );
  1314. },
  1315. doWxPay() {
  1316. var that = this;
  1317. plus.share.getServices(function (res) {
  1318. var sweixin = null;
  1319. for (var i = 0; i < res.length; i++) {
  1320. var t = res[i];
  1321. if (t.id == 'weixin') {
  1322. sweixin = t;
  1323. }
  1324. }
  1325. if (sweixin) {
  1326. console.log('调起小程序')
  1327. that.$refs.popPrivilege.close();
  1328. that.$refs.popTip.open()
  1329. //唤起微信跳转小程序
  1330. sweixin.launchMiniProgram({
  1331. id: getApp().globalData.miniprogamId,
  1332. path: 'pages_order/coursePayment?orderId=' + that.orderId + "&payMethod=app",
  1333. type: 0
  1334. }, function () {
  1335. console.log("微信唤起成功");
  1336. return true;
  1337. }, function (e) {
  1338. console.log("微信唤起失败", e);
  1339. uni.showToast({
  1340. title: '微信唤起失败,请检查是否有微信应用',
  1341. icon: 'none'
  1342. })
  1343. return false;
  1344. })
  1345. } else {
  1346. uni.showToast({
  1347. title: '微信唤起失败,请检查是否有微信应用',
  1348. icon: 'none',
  1349. duration: 3000
  1350. })
  1351. return false;
  1352. }
  1353. }, function (res) {
  1354. console.log(JSON.stringify(res));
  1355. });
  1356. },
  1357. goToCatalogue() {
  1358. if (this.isH5) {
  1359. let url = './catalogue?courseId=' + this.courseId + '&videoId=' + this.pickCatalog.videoId +
  1360. '&isAutoPlay=' + this.data.isAutoPlay + '&studyTimes=' + this.tempAudioDuration;
  1361. this.$navTo(url);
  1362. } else {
  1363. const subNVue = uni.getSubNVueById('catalogueN');
  1364. subNVue.show('slide-in-bottom', 250);
  1365. uni.$emit('catalogue', {
  1366. videoId: this.pickCatalog.videoId,
  1367. courseId: this.courseId,
  1368. pickCatalogIdx: this.pickCatalogIdx
  1369. });
  1370. }
  1371. },
  1372. pickCatalogAction(index, type) {
  1373. if (this.pickCatalogIdx === index) return;
  1374. if (type == 'catalogueN' && this.isNext == 1 && this.pickCatalogIdx != index - 1) {
  1375. const type = this.showAudio ? 'audio' : 'video'
  1376. this.pauseFun(type);
  1377. this.openTips(index)
  1378. return
  1379. }
  1380. this.pickCatalogActionFun(index, type)
  1381. },
  1382. pickCatalogActionFun(index, type) {
  1383. if (!this.$isLogin()) { //切换小节需要登录
  1384. this.$showLoginPage();
  1385. return;
  1386. }
  1387. if (this.isH5 && index > 1) {
  1388. uni.showToast({
  1389. title: "请下载App观看",
  1390. icon: 'none'
  1391. });
  1392. return;
  1393. }
  1394. //切换之前添加课程目录学习记录
  1395. this.addStudyCourse();
  1396. this.addIntegral(); //加福币
  1397. this.pickCatalogMethod(index, type);
  1398. },
  1399. pickCatalogMethod(index, type) {
  1400. setTimeout(() => {
  1401. this.scrollIntoViewId = 'cataLogue' + index;
  1402. }, 100)
  1403. let tempCatalogue = this.catalogueList[index];
  1404. console.log("qxj catalogueList", this.catalogueList);
  1405. this.lookDuration = 0; //重置观看当前小节的课程时长
  1406. // if(tempCatalogue.isVip==1){ //需要Vip才能观看
  1407. // if(!this.$isLogin()){
  1408. // this.$showLoginPage();
  1409. // return;
  1410. // }
  1411. // if(this.user==null){
  1412. // this.user=this.$getUserInfo();
  1413. // }
  1414. // if(this.user.isVip!=1 && tempCatalogue.isBuy!=1){
  1415. // this.openVipCourse(index);
  1416. // return;
  1417. // }
  1418. // }
  1419. this.pickCatalogIdx = index;
  1420. //传递消息给小节弹窗
  1421. uni.$emit('pickCatalogIdx', {
  1422. pickCatalogIdx: index,
  1423. type: type
  1424. });
  1425. this.pickCatalog = this.catalogueList[index];
  1426. // 获取章节看视频答题奖励后所得积分
  1427. this.answerPointsNum = this.pickCatalog.integralReward;
  1428. // 获取章节看视频答题奖励所需时间
  1429. this.pageEntryRequiredTime = Number(this.pickCatalog.watchDurationMinutes) * 60;
  1430. this.isShowQuestions = false
  1431. this.isShowAnswerPrompt = false
  1432. // 检查该章节是否已领取章节奖励-获取答题状态
  1433. this.checkPageEntryStatus();
  1434. this.pickCatalog.isFast = this.data.isFast
  1435. this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog
  1436. .packageJson) : []
  1437. this.initStudyTime(this.pickCatalog.studyTime || 0)
  1438. const url = this.pickCatalog.lineTwo ? this.pickCatalog.lineTwo : this.pickCatalog.videoUrl
  1439. this.resetAudioContext(url)
  1440. },
  1441. resetAudioContext(url) {
  1442. if (this.audioContext == null) {
  1443. this.audioContext = uni.createInnerAudioContext();
  1444. }
  1445. this.audioContext.src = url
  1446. // this.audioContext.src = this.pickCatalog.videoUrl;
  1447. this.audioContext.onTimeUpdate(() => {
  1448. this.initStudyTime(this.audioContext.currentTime)
  1449. })
  1450. },
  1451. changeLine(data) {
  1452. this.resetAudioContext(data.url)
  1453. },
  1454. endedPlayNext(type) {
  1455. let nextCatalog = this.catalogueList[this.pickCatalogIdx + 1];
  1456. if (!nextCatalog) {
  1457. return;
  1458. }
  1459. if (nextCatalog && this.pickCatalogIdx < this.catalogueList.length - 1) { //未播放到最后一节自动续播
  1460. this.pickCatalogAction(this.pickCatalogIdx + 1)
  1461. }
  1462. },
  1463. endedPlayPrev() {
  1464. if (this.pickCatalogIdx == 0) {
  1465. uni.showToast({
  1466. title: '已经是第一节视频了',
  1467. icon: 'none',
  1468. position: 'top',
  1469. duration: 2000
  1470. })
  1471. return
  1472. }
  1473. let nextCatalog = this.catalogueList[this.pickCatalogIdx - 1];
  1474. if (!nextCatalog) {
  1475. return;
  1476. }
  1477. this.pickCatalogAction(this.pickCatalogIdx - 1)
  1478. },
  1479. addStudyCourse() {
  1480. if (this.catalogueList.length == 0 || this.tempAudioDuration == 0) {
  1481. return;
  1482. }
  1483. // this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  1484. // this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog.packageJson) : []
  1485. // if(this.pickCatalog.isBuy==0){
  1486. // return;
  1487. // }
  1488. const parmas = {
  1489. "courseId": parseInt(this.courseId),
  1490. "duration": this.tempAudioDuration,
  1491. "videoId": this.pickCatalog.videoId
  1492. };
  1493. addDuration(parmas).then(res => {
  1494. if (res.code == 200) { }
  1495. },
  1496. rej => { }
  1497. );
  1498. },
  1499. addIntegral() {
  1500. // 观看到视频时长50%加一次福币
  1501. if (this.lookDuration == 0 || this.playDuration == 0) {
  1502. return;
  1503. }
  1504. // this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  1505. // this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog.packageJson) : []
  1506. if (this.lookDuration < this.pickCatalog.seconds * 0.5) {
  1507. return;
  1508. }
  1509. let data = {
  1510. videoId: this.pickCatalog.videoId,
  1511. duration: this.lookDuration
  1512. };
  1513. getIntegral(data).then(res => {
  1514. if (res.code == 200) {
  1515. uni.showToast({
  1516. icon: 'none',
  1517. title: res.msg,
  1518. duration: 3000,
  1519. position: 'bottom'
  1520. });
  1521. this.countdowning = false;
  1522. }
  1523. },
  1524. rej => { }
  1525. );
  1526. },
  1527. closeShareAct() {
  1528. this.showShare = false;
  1529. },
  1530. closeTherapy() {
  1531. this.showTherapy = false
  1532. },
  1533. goToPro(productId) {
  1534. this.exitFullscreen = 'yes' + new Date().getTime()
  1535. this.showTherapy = false
  1536. setTimeout(() => {
  1537. uni.navigateTo({
  1538. url: "/pages/store/packageDetails?packageId=" + productId
  1539. });
  1540. }, 500);
  1541. },
  1542. // 返回视频
  1543. backPlayVideo() {
  1544. this.showAudio = false;
  1545. this.audioPlayIng = false;
  1546. this.isLearning = false;
  1547. this.pauseFun('audio');
  1548. this.playFun();
  1549. },
  1550. // 点击视频
  1551. clickVideo() {
  1552. this.isClickVideo = true
  1553. setTimeout(() => {
  1554. this.isClickVideo = false
  1555. }, 3000)
  1556. },
  1557. changeCountdowning(data) {
  1558. this.countdowning = data.countdowning;
  1559. // 视频是否暂停
  1560. if (data.isXGPause == false) {
  1561. setTimeout(() => {
  1562. this.isPause = data.isXGPause
  1563. }, 3000)
  1564. } else {
  1565. this.isPause = data.isXGPause
  1566. }
  1567. },
  1568. onTimeUpdate(data) {
  1569. this.playDuration = Math.round(data.time)
  1570. this.initStudyTime(this.playDuration)
  1571. if (!this.$isLogin()) {
  1572. this.handleInternetTraffic(this.playDuration)
  1573. }
  1574. if (data.time >= this.pickCatalog.seconds) {
  1575. this.countdowning = false; //观看时长开关关闭
  1576. }
  1577. if (this.isH5) {
  1578. if (this.allLookDuration >= 300) { //H5未登录状态播放五分钟就跳出登录页面
  1579. if (!this.$isLogin()) {
  1580. this.$showLoginPage();
  1581. const type = this.showAudio ? 'audio' : 'video'
  1582. this.pauseFun(type);
  1583. }
  1584. }
  1585. } else {
  1586. if (this.allLookDuration >= 120) { //未登录状态播放两分钟就跳出登录页面
  1587. if (!this.$isLogin()) {
  1588. this.$showLoginPage();
  1589. const type = this.showAudio ? 'audio' : 'video'
  1590. this.pauseFun(type);
  1591. }
  1592. }
  1593. }
  1594. // uni.$u.throttle(this.checkTherapy, 1000,false);
  1595. },
  1596. // 新版视频播放中-流量记录
  1597. handleInternetTraffic(duration) {
  1598. // 使用视频播放时长判断是否是6秒的倍数
  1599. let currentDuration = Number(Math.round(duration).toFixed(2));
  1600. // 当前视频的时长
  1601. let curVideoDuration = Number(Math.round(this.pickCatalog.seconds).toFixed(2));
  1602. let trafficUuId = generateRandomString(16)
  1603. // 判断是否是6秒的倍数,且只在进入新的6秒区间时触发一次
  1604. if (currentDuration > 0 && currentDuration % 6 === 0) {
  1605. // 检查是否已经在这个时间点触发过(防止拖动到6倍数位置时重复触发)
  1606. if (this.lastInternetTrafficDuration !== currentDuration) {
  1607. let params = {
  1608. appId: "wx40dcfa2797d6fc2d",
  1609. bufferRate: Math.ceil((currentDuration / curVideoDuration) * 100),
  1610. companyId: 101,
  1611. courseId: this.courseId,
  1612. duration: currentDuration,
  1613. uuId: dayjs().format('YYYYMMDD') + trafficUuId,
  1614. videoId: this.pickCatalog.videoId,
  1615. };
  1616. newGetInternetTrafficApi(params)
  1617. this.lastInternetTrafficDuration = currentDuration;
  1618. }
  1619. }
  1620. },
  1621. // 展示疗法
  1622. checkTherapy() {
  1623. let currentTime = Math.round(this.tempAudioDuration || 0)
  1624. let node = this.packageJsonList.filter(item => item.duration == currentTime)
  1625. if (node && node.length > 0) {
  1626. this.nodeTime = node[0].duration
  1627. this.showTherapyItem = node[0]
  1628. if (!this.showTherapy) {
  1629. this.showTherapy = true
  1630. }
  1631. } else {
  1632. if (this.showTherapy && this.nodeTime && this.nodeTime > currentTime) {
  1633. this.showTherapy = false
  1634. }
  1635. }
  1636. },
  1637. // 打开集观看提示弹窗
  1638. openTips(index) {
  1639. // #ifdef APP-PLUS
  1640. uni.$emit('getTipShowType', {
  1641. index: index
  1642. })
  1643. uni.getSubNVueById('videoPopup').show();
  1644. // #endif
  1645. },
  1646. tipConfirm() { // 提示确认
  1647. // 继续播放
  1648. //传递消息给小节弹窗
  1649. uni.$emit('pickCatalogIdx', {
  1650. pickCatalogIdx: this.pickCatalogIdx,
  1651. type: 'catalogueN'
  1652. });
  1653. this.playFun()
  1654. },
  1655. tipCancel(index) { // 提示取消
  1656. // 播放选择的一节
  1657. this.pickCatalogActionFun(index, 'catalogueN')
  1658. },
  1659. // 听声
  1660. handleListen() {
  1661. if (this.showAudio) {
  1662. this.backPlayVideo()
  1663. } else {
  1664. // 打开音频
  1665. this.showAudio = true
  1666. this.pauseFun('video');
  1667. this.playFun()
  1668. }
  1669. },
  1670. // 播放音频
  1671. playAudioAction(type) {
  1672. if (!this.audioPlayIng) {
  1673. setTimeout(() => {
  1674. this.audioContext.play()
  1675. }, 200)
  1676. } else {
  1677. this.pauseAudioAction()
  1678. }
  1679. this.audioPlayIng = !this.audioPlayIng;
  1680. },
  1681. // 播放
  1682. playFun() {
  1683. // console.log("initSocket videoId:",this.pickCatalog.videoId)
  1684. this.reOpenSocket = false
  1685. if (this.pickCatalog.videoId) {
  1686. this.getDanmuList()
  1687. if (this.socket) {
  1688. this.socket.close({
  1689. success: () => {
  1690. this.reOpenSocket = true
  1691. clearInterval(this.pingpangTimes)
  1692. }
  1693. })
  1694. } else {
  1695. this.initSocket()
  1696. }
  1697. }
  1698. this.audioPlayIng = false
  1699. if (this.showAudio) {
  1700. const ended = this.tempAudioDuration == this.pickCatalog.seconds
  1701. this.audioContext.seek(ended ? 0 : this.tempAudioDuration);
  1702. // this.audioContext.onSeeked(() => {
  1703. this.playAudioAction()
  1704. // })
  1705. } else {
  1706. this.videoPlayStatus = {
  1707. status: 'play' + new Date().getTime(),
  1708. tempAudioDuration: this.tempAudioDuration || 0,
  1709. studyTime: this.pickCatalog.studyTime,
  1710. }
  1711. }
  1712. },
  1713. initStudyTime(time) {
  1714. this.tempAudioDuration = Math.round(time)
  1715. },
  1716. // 暂停音频
  1717. pauseAudioAction() {
  1718. if (this.audioContext) {
  1719. setTimeout(() => {
  1720. this.audioContext.pause();
  1721. }, 200)
  1722. clearInterval(this.audioTimer);
  1723. this.audioTimer = null;
  1724. }
  1725. },
  1726. destoryAudio() {
  1727. if (this.audioContext) {
  1728. this.audioContext.destroy();
  1729. clearInterval(this.audioTimer);
  1730. this.audioTimer = null;
  1731. }
  1732. },
  1733. // 暂停
  1734. pauseFun(type) {
  1735. this.audioPlayIng = true
  1736. if (type == 'audio') {
  1737. this.pauseAudioAction()
  1738. } else if (type == 'video') {
  1739. this.videoPlayStatus = {
  1740. status: 'pause' + new Date().getTime(),
  1741. tempAudioDuration: this.tempAudioDuration || 0,
  1742. studyTime: this.pickCatalog.studyTime,
  1743. }
  1744. }
  1745. },
  1746. closePrivilege() {
  1747. this.$refs.popPrivilege.close();
  1748. },
  1749. closeTip() {
  1750. this.$refs.popTip.close();
  1751. },
  1752. canShowVip(item) {
  1753. return true;
  1754. if (this.user.isVip) {
  1755. return false;
  1756. }
  1757. return item.isVip == 1 && item.isBuy == 0;
  1758. },
  1759. confirmTip() {
  1760. this.getUserInfo();
  1761. this.getCourseInfo();
  1762. this.$refs.popTip.close();
  1763. uni.showLoading({
  1764. title: "请稍侯...",
  1765. mask: true,
  1766. duration: 3000
  1767. });
  1768. setTimeout(() => {
  1769. this.getCourseOrderById();
  1770. }, 2000);
  1771. },
  1772. getCourseOrderById() {
  1773. getCourseOrderById(this.courseOrderId).then(res => {
  1774. uni.hideLoading();
  1775. if (res.code == 200) {
  1776. if (res.order.status == 2 || res.order.payTime != null) {
  1777. // #ifdef APP-PLUS
  1778. if (plus.runtime.channel == "baidu") { //获取渠道标识
  1779. let bdCmdType = uni.getStorageSync("bdCmdType");
  1780. if (bdCmdType != null && parseInt(bdCmdType) <= 2) {
  1781. //this.$registerIdCode("orders",2,res.order.payMoney.toString()); //已下单
  1782. }
  1783. }
  1784. // #endif
  1785. uni.showToast({
  1786. title: "支付成功",
  1787. icon: 'success'
  1788. });
  1789. } else if (res.order.status == 1) {
  1790. uni.showToast({
  1791. title: "课程待支付请稍侯",
  1792. icon: 'none'
  1793. });
  1794. } else {
  1795. uni.showToast({
  1796. title: "支付失败",
  1797. icon: 'error'
  1798. });
  1799. }
  1800. }
  1801. },
  1802. rej => { }
  1803. );
  1804. },
  1805. handleTherapy(item, idx) {
  1806. this.scrollIntoTherapy = 'therapy' + idx,
  1807. this.therapyIndex = idx
  1808. setTimeout(() => {
  1809. uni.navigateTo({
  1810. url: "/pages/store/packageDetails?packageId=" + item.packageId
  1811. });
  1812. }, 500);
  1813. },
  1814. onFullscreenChange(data) {
  1815. this.fullScreen = data.isFullscreen
  1816. // direction取为 vertical 或 horizontal
  1817. this.direction = data.direction
  1818. if (!data.isFullscreen) {
  1819. // 退出全屏,锁定竖屏
  1820. // #ifdef APP-PLUS
  1821. plus.screen.lockOrientation('portrait-primary');
  1822. // #endif
  1823. }
  1824. },
  1825. // 全屏返回
  1826. videoback() {
  1827. this.exitFullscreen = 'yes' + new Date().getTime()
  1828. },
  1829. // 弹幕
  1830. openDanmu() {
  1831. // #ifdef H5
  1832. uni.showToast({
  1833. title: "请下载app发弹幕",
  1834. icon: "none"
  1835. })
  1836. return
  1837. // #endif
  1838. this.danmuIput = {
  1839. txt: '',
  1840. mode: 'scroll',
  1841. color: '#ffffff',
  1842. fontSize: '18px',
  1843. }
  1844. this.$refs.danmuPopup.open()
  1845. },
  1846. keyboardHeightChange(res) {
  1847. // #ifndef H5
  1848. this.danmuboxHeight = res.height
  1849. // #endif
  1850. },
  1851. openDanmuStyle(type) {
  1852. if (type == 2) {
  1853. uni.hideKeyboard()
  1854. }
  1855. },
  1856. clickStyle(type, value) {
  1857. if (type == 'mode') {
  1858. this.danmuIput.mode = value
  1859. } else if (type == 'font') {
  1860. this.danmuIput.fontSize = value
  1861. } else if (type == 'color') {
  1862. this.danmuIput.color = value
  1863. this.danmuIput.border = `solid 1px ${value}`
  1864. }
  1865. },
  1866. clickArea(value) {
  1867. this.danmuFunInfo = {
  1868. time: new Date().getTime(),
  1869. event: 'setArea',
  1870. switch: this.danmuFunInfo.switch,
  1871. area: value
  1872. }
  1873. },
  1874. // 发送弹幕
  1875. sendDanmu() {
  1876. if (this.danmuIput.txt == '' || this.danmuIput.txt.trim() == '') {
  1877. uni.showToast({
  1878. title: '弹幕不能为空',
  1879. icon: 'none'
  1880. })
  1881. return;
  1882. }
  1883. if (!this.isSend) {
  1884. return;
  1885. }
  1886. const param = {
  1887. userId: this.user.userId || '',
  1888. userType: 2, // 1-管理员,2-用户
  1889. courseId: this.courseId,
  1890. videoId: this.pickCatalog.videoId,
  1891. type: 1, // 评论类型 1:评论,2:回复,目前没有回复,默认传1就行了
  1892. content: this.danmuIput.txt,
  1893. time: this.tempAudioDuration, // 弹幕对应视频时间节点()秒
  1894. fontSize: this.danmuIput.fontSize,
  1895. mode: this.danmuIput.mode,
  1896. color: this.danmuIput.color,
  1897. }
  1898. saveMsg(param).then(res => {
  1899. if (res.code == 200) {
  1900. const status = res.status ? 0 : 1
  1901. this.sendMsg(param, status);
  1902. } else {
  1903. uni.showToast({
  1904. title: res.msg,
  1905. icon: "none"
  1906. })
  1907. }
  1908. })
  1909. },
  1910. // 弹幕开关
  1911. switchDanmu(type) {
  1912. this.danmuFunInfo = {
  1913. time: new Date().getTime(),
  1914. event: 'switch',
  1915. switch: type,
  1916. area: this.danmuFunInfo.area
  1917. }
  1918. },
  1919. // 弹幕列表
  1920. getDanmuList() {
  1921. this.danmuFunInfo = {
  1922. time: new Date().getTime(),
  1923. event: 'clearDanmuList',
  1924. switch: this.danmuFunInfo.switch,
  1925. area: this.danmuFunInfo.area,
  1926. }
  1927. let patam = {
  1928. pageNum: 1,
  1929. pageSize: 300,
  1930. courseId: this.courseId,
  1931. videoId: this.pickCatalog.videoId,
  1932. openCommentStatus: 2, // 1-开启评论;2-开启弹幕;3-关闭
  1933. }
  1934. getComments(patam).then(res => {
  1935. let danmuList = []
  1936. if (res.code == 200 && res.data.list && res.data.list.length > 0) {
  1937. let arry = res.data.list.sort((a, b) => a.time - b.time)
  1938. danmuList = arry.map(item => ({
  1939. duration: this.danmuItem.duration,
  1940. id: item.commentId,
  1941. txt: item.content,
  1942. start: Number(item.time || 0) * 1000, // 单位:ms 毫秒
  1943. mode: item.mode || this.danmuItem.mode,
  1944. style: {
  1945. color: item.color || this.danmuItem.style.color,
  1946. fontSize: item.fontSize || this.danmuItem.style.fontSize,
  1947. padding: this.danmuItem.style.padding,
  1948. border: this.user.userId == item.userId ? item.color ?
  1949. `solid 1px ${item.color}` : this.danmuItem.style.border : 'none',
  1950. borderRadius: this.user.userId == item.userId ? this.danmuItem.style
  1951. .borderRadius : 0,
  1952. backgroundColor: this.user.userId == item.userId ? this.danmuItem.style
  1953. .backgroundColor : 'transparent'
  1954. }
  1955. }))
  1956. }
  1957. try {
  1958. this.danmuFunInfo = {
  1959. time: new Date().getTime(),
  1960. event: 'getDanmuList',
  1961. switch: this.danmuFunInfo.switch,
  1962. danmuList: danmuList,
  1963. area: this.danmuFunInfo.area
  1964. }
  1965. } catch (e) {
  1966. console.log('e', e)
  1967. }
  1968. })
  1969. },
  1970. //创建一个socket连接
  1971. initSocket() {
  1972. let userId = this.user.userId;
  1973. let that = this;
  1974. this.socket = uni.connectSocket({
  1975. // url: getApp().globalData.danmuWSUrl + "/ws/barrage/" + this.pickCatalog.videoId,
  1976. url: getApp().globalData.danmuWSUrl + "/app/webSocket/" + userId,
  1977. multiple: true,
  1978. // header: {
  1979. // 'token': uni.getStorageSync('AppToken')
  1980. // },
  1981. success: res => {
  1982. console.log('WebSocket连接已打开1!');
  1983. that.isSocketOpen = true
  1984. that.reOpenSocket = false
  1985. // 保持心跳
  1986. if (that.pingpangTimes) {
  1987. clearInterval(that.pingpangTimes)
  1988. that.pingpangTimes = null
  1989. }
  1990. that.pingpangTimes = setInterval(() => {
  1991. // let data={cmd:"heartbeat",userId: userId};
  1992. let data = {
  1993. userId: userId || '',
  1994. userType: 2, // 1-管理员,2-用户
  1995. courseId: that.courseId,
  1996. videoId: that.pickCatalog.videoId,
  1997. type: 1, // 评论类型 1:评论,2:回复,目前没有回复,默认传1就行了
  1998. cmd: 'heartbeat'
  1999. }
  2000. that.socket.send({
  2001. data: JSON.stringify(data),
  2002. success: () => {
  2003. // console.log('WebSocket发送心条数据!');
  2004. },
  2005. fail: () => {
  2006. that.isSocketOpen = false
  2007. }
  2008. });
  2009. }, 15000)
  2010. },
  2011. error: err => {
  2012. console.log(err)
  2013. },
  2014. })
  2015. this.socket.onMessage((res) => {
  2016. // console.log("收到消息parse",JSON.parse(res.data))
  2017. const redata = JSON.parse(res.data);
  2018. if (redata.cmd == "heartbeat") {
  2019. //心跳
  2020. // console.log("heartbeat")
  2021. } else if (redata.cmd == "sendMsg") {
  2022. that.isSend = true;
  2023. that.addMsg(redata);
  2024. }
  2025. })
  2026. //监听socket打开
  2027. this.socket.onOpen(() => {
  2028. console.log('WebSocket连接已打开2!');
  2029. that.isSocketOpen = true
  2030. that.reOpenSocket = false
  2031. that.isSend = true;
  2032. })
  2033. //监听socket关闭
  2034. this.socket.onClose(() => {
  2035. that.isSocketOpen = false
  2036. that.socket = null
  2037. console.log('WebSocket连接已关闭!', that.reOpenSocket);
  2038. if (that.pingpangTimes) {
  2039. clearInterval(that.pingpangTimes)
  2040. that.pingpangTimes = null
  2041. }
  2042. if (that.reOpenSocket) {
  2043. //重启
  2044. that.initSocket()
  2045. }
  2046. // that.msgEnd = true
  2047. })
  2048. //监听socket错误
  2049. this.socket.onError((err) => {
  2050. console.log("socket err:", err)
  2051. that.isSocketOpen = false
  2052. that.reOpenSocket = false
  2053. that.socket = null
  2054. if (that.pingpangTimes) {
  2055. clearInterval(that.pingpangTimes)
  2056. that.pingpangTimes = null
  2057. }
  2058. })
  2059. },
  2060. sendMsg(param, status) {
  2061. if (status == 1) {
  2062. this.isSend = true;
  2063. this.addMsg({
  2064. msg: param.content,
  2065. time: param.time
  2066. }, 2)
  2067. return
  2068. }
  2069. if (this.isSocketOpen) {
  2070. var userId = this.user.userId;
  2071. var data = {
  2072. userId: userId || '',
  2073. userType: 2, // 1-管理员,2-用户
  2074. courseId: this.courseId,
  2075. videoId: this.pickCatalog.videoId,
  2076. type: 1, // 评论类型 1:评论,2:回复,目前没有回复,默认传1就行了
  2077. msg: param.content,
  2078. cmd: 'sendMsg',
  2079. time: param.time,
  2080. fontSize: param.fontSize,
  2081. mode: param.mode,
  2082. color: param.color,
  2083. };
  2084. this.socket.send({
  2085. data: JSON.stringify(data),
  2086. success: () => {
  2087. console.log("发送成功", data)
  2088. this.$refs.danmuPopup.close()
  2089. this.isSend = false;
  2090. },
  2091. fail: () => {
  2092. console.log("发送失败")
  2093. }
  2094. });
  2095. }
  2096. },
  2097. // 收到消息
  2098. addMsg(data, type) {
  2099. let obj = {}
  2100. if (type == 2) {
  2101. obj = {
  2102. content: data.msg,
  2103. courseId: this.courseId,
  2104. type: 1,
  2105. userId: this.userId,
  2106. userType: 2,
  2107. videoId: this.pickCatalog.videoId,
  2108. nickName: '',
  2109. time: data.time,
  2110. fontSize: data.fontSize,
  2111. mode: data.mode,
  2112. color: data.color,
  2113. }
  2114. } else {
  2115. obj = {
  2116. content: data.msg,
  2117. courseId: this.courseId,
  2118. type: data.type,
  2119. userId: data.userId,
  2120. userType: data.userType,
  2121. videoId: this.pickCatalog.videoId,
  2122. nickName: data.nickName,
  2123. time: data.time,
  2124. fontSize: data.fontSize,
  2125. mode: data.mode,
  2126. color: data.color,
  2127. }
  2128. }
  2129. this.addDanmuMsg(obj)
  2130. },
  2131. addDanmuMsg(content) {
  2132. const id = content.userId + '_' + new Date().getTime()
  2133. const mystyle = {
  2134. color: content.color || this.danmuItem.style.color,
  2135. fontSize: content.fontSize || this.danmuItem.style.fontSize,
  2136. border: content.color ? `solid 1px ${content.color}` : this.danmuItem.style.border,
  2137. borderRadius: this.danmuItem.style.borderRadius,
  2138. padding: this.danmuItem.style.padding,
  2139. backgroundColor: this.danmuItem.style.backgroundColor
  2140. }
  2141. const otherstyle = {
  2142. color: content.color || this.danmuItem.style.color,
  2143. fontSize: content.fontSize || this.danmuItem.style.fontSize,
  2144. padding: this.danmuItem.style.padding,
  2145. }
  2146. const mode = content.mode || this.danmuItem.mode
  2147. const danmuItem = {
  2148. //发送弹幕
  2149. duration: content.duration ? content.duration : mode == 'scro11' ? this.danmuItem.duration : this
  2150. .danmuItem.duration,
  2151. id: content.id || id,
  2152. txt: content.content,
  2153. mode: mode,
  2154. style: this.user.userId == content.userId ? mystyle : otherstyle
  2155. }
  2156. this.danmuFunInfo = {
  2157. time: new Date().getTime(),
  2158. event: 'send',
  2159. switch: this.danmuFunInfo.switch,
  2160. danmuItem: danmuItem,
  2161. area: this.danmuFunInfo.area
  2162. }
  2163. },
  2164. },
  2165. created() {
  2166. let that = this;
  2167. uni.$on('backStudyTime', function (data) {
  2168. that.videoId = data.videoId;
  2169. that.pickCatalogIdx = that.getCatalogIdx();
  2170. that.pickCatalog = that.catalogueList[that.pickCatalogIdx];
  2171. that.pickCatalog.studyTime = data.studyTimes;
  2172. that.catalogueList[that.pickCatalogIdx] = that.pickCatalog;
  2173. that.packageJsonList = that.pickCatalog && that.pickCatalog.packageJson ? JSON.parse(that
  2174. .pickCatalog.packageJson) : []
  2175. that.pickCatalogMethod(that.pickCatalogIdx);
  2176. });
  2177. uni.$on('showPayTips', function (data) {
  2178. console.log("qxj showPayTips")
  2179. that.courseOrderId = data.courseOrderId;
  2180. //that.showPayTips=true;
  2181. that.$refs.popTip.open();
  2182. });
  2183. uni.$on('refreshUser', function (data) {
  2184. that.getUserInfo();
  2185. that.getCourseInfo();
  2186. });
  2187. uni.$on('pickCatalogAction', function (data) {
  2188. that.pickCatalogAction(data.index, data.type);
  2189. });
  2190. uni.$on('refreshCatalog', function (index) {
  2191. let catalog = that.catalogueList[index];
  2192. catalog.isBuy = true;
  2193. that.catalogueList[index] = catalog;
  2194. that.pickCatalogAction(index);
  2195. });
  2196. },
  2197. beforeDestroy() {
  2198. if (this.socket != null) {
  2199. this.socket.close()
  2200. }
  2201. if (this.pingpangTimes) {
  2202. clearInterval(this.pingpangTimes)
  2203. this.pingpangTimes = null
  2204. }
  2205. this.danmuFunInfo = {
  2206. time: new Date().getTime(),
  2207. event: '',
  2208. area: this.danmuFunInfo.area
  2209. }
  2210. },
  2211. destroyed() {
  2212. uni.$off("backStudyTime");
  2213. uni.$off("refreshUser");
  2214. uni.$off("showPayTips");
  2215. uni.$off("pickCatalogAction");
  2216. uni.$off("refreshTitle");
  2217. uni.$off("refreshCatalog");
  2218. // #ifdef APP-PLUS
  2219. uni.$off('getEventType');
  2220. // #endif
  2221. }
  2222. }
  2223. </script>
  2224. <script module="xgplayer" lang="renderjs">
  2225. // import Player from "xgplayer"
  2226. // import Mp4Plugin from "xgplayer-mp4"
  2227. // import 'xgplayer/dist/index.min.css';
  2228. import Danmu from 'xgplayer/es/plugins/danmu'
  2229. // import "xgplayer/es/plugins/danmu/index.css"
  2230. let xgPlayer
  2231. const openDanmu = '/static/images/other/course/danmukai.png';
  2232. const closeDanmu = '/static/images/other/course/danmukai_1.png';
  2233. export default {
  2234. data() {
  2235. return {
  2236. player: null,
  2237. ownerInstance: null,
  2238. ownerInstanceVideo: null,
  2239. isFullscreen: false,
  2240. isCSSFull: false,
  2241. lineName: "",
  2242. danmuInstance: null,
  2243. newDanmu: {
  2244. //发送弹幕
  2245. duration: 10000,
  2246. id: '',
  2247. txt: '',
  2248. mode: 'scroll',
  2249. style: {
  2250. color: '#ffffff',
  2251. fontSize: '18px',
  2252. border: 'solid 1px #ffffff',
  2253. borderRadius: '10px',
  2254. padding: '5px 11px',
  2255. backgroundColor: 'rgba(255, 255, 255, 0.1)'
  2256. }
  2257. },
  2258. isXGPause: true,
  2259. }
  2260. },
  2261. beforeDestroy() {
  2262. if (this.player) {
  2263. if (this.isFullscreen) {
  2264. if (this.isCSSFull) {
  2265. this.player.exitCssFullscreen()
  2266. } else {
  2267. this.player.exitFullscreen()
  2268. }
  2269. }
  2270. this.player.destroy() // 销毁播放器
  2271. this.player = null
  2272. }
  2273. },
  2274. methods: {
  2275. initJs(newValue, oldValue, ownerInstance) {
  2276. if (typeof window.Player === 'function') {
  2277. this.initPlayer(newValue, oldValue, ownerInstance)
  2278. } else {
  2279. // 动态引入较大类库避免影响页面展示
  2280. const script = document.createElement('script')
  2281. // view 层的页面运行在根目录
  2282. script.src = 'https://unpkg.byted-static.com/xgplayer/3.0.20/dist/index.min.js'
  2283. script.onload = this.initPlayer.bind(this, newValue, oldValue, ownerInstance)
  2284. document.head.appendChild(script)
  2285. const l_tag = document.createElement('link'); // 引入播放器css
  2286. l_tag.rel = 'stylesheet';
  2287. l_tag.href = 'https://unpkg.byted-static.com/xgplayer/3.0.20/dist/index.min.css';
  2288. document.body.appendChild(l_tag);
  2289. }
  2290. },
  2291. initPlayer(newValue, oldValue, ownerInstance) {
  2292. this.Events = window.Player.Events
  2293. if (!this.ownerInstance) this.ownerInstance = ownerInstance
  2294. let xgplayerOption = {
  2295. lang: 'zh',
  2296. url: "",
  2297. id: 'detail-video',
  2298. autoplay: false,
  2299. // height: uni.upx2px(422),
  2300. height: '100%',
  2301. width: '100%',
  2302. poster: "",
  2303. 'x5-video-player-type': 'h5', // 微信内置浏览器设置,防止被浏览器劫持
  2304. playsinline: true,
  2305. playbackRate: false,
  2306. ignores: ['volume', 'miniscreen', 'keyboard'],
  2307. plugins: [Danmu],
  2308. danmu: {
  2309. "comments": [],
  2310. "area": {
  2311. "start": 0,
  2312. "end": 0.25
  2313. },
  2314. "closeDefaultBtn": true,
  2315. "defaultOpen": true,
  2316. ext: {
  2317. channelSize: 30
  2318. }
  2319. },
  2320. startTime: 0, // 起始播放时间
  2321. fullscreenTarget: document.querySelector('.video-container'),
  2322. controls: {
  2323. root: document.getElementById('controls_new_root') // 指定播放器之外挂载dom
  2324. },
  2325. // icons: {
  2326. // openDanmu: openDanmu,
  2327. // closeDanmu: closeDanmu
  2328. // },
  2329. commonStyle: {
  2330. // 播放完成部分进度条底色
  2331. playedColor: '#FF233C',
  2332. cachedColor: 'transparent'
  2333. },
  2334. seekedStatus: 'auto',
  2335. disableGesture: true,
  2336. closeVideoTouch: true,
  2337. closeVideoDblclick: true,
  2338. closeVideoClick: false,
  2339. progress: {
  2340. isDraggingSeek: false,
  2341. isCloseClickSeek: true,
  2342. closeMoveSeek: true
  2343. },
  2344. fullscreen: {
  2345. useScreenOrientation: true,
  2346. lockOrientationType: 'landscape'
  2347. },
  2348. definition: {
  2349. defaultDefinition: "线路二"
  2350. }
  2351. }
  2352. xgplayerOption.url = newValue.lineTwo ? newValue.lineTwo : newValue.videoUrl
  2353. xgplayerOption.definition.defaultDefinition = newValue.lineTwo ? '线路二' : '线路一'
  2354. if (!xgplayerOption.url) return
  2355. xgplayerOption.poster = newValue.thumbnail
  2356. if (newValue.studyTime && newValue.seconds != newValue.studyTime) {
  2357. xgplayerOption.startTime = newValue.studyTime
  2358. }
  2359. if (newValue.isFast == 1) {
  2360. // 允许拖动进度条
  2361. xgplayerOption.progress.isCloseClickSeek = false
  2362. xgplayerOption.progress.closeMoveSeek = false
  2363. } else {
  2364. // 不允许拖动进度条
  2365. xgplayerOption.progress.isCloseClickSeek = true
  2366. xgplayerOption.progress.closeMoveSeek = true
  2367. }
  2368. if (this.player) {
  2369. // this.player.off()
  2370. this.player.playNext({
  2371. url: newValue.lineTwo ? newValue.lineTwo : newValue.videoUrl,
  2372. startTime: newValue.startTime || 0,
  2373. poster: xgplayerOption.thumbnail || '',
  2374. ignores: xgplayerOption.ignores,
  2375. progress: xgplayerOption.progress,
  2376. definition: xgplayerOption.definition,
  2377. })
  2378. } else {
  2379. this.player = new Player(xgplayerOption);
  2380. this.danmuInstance = this.player.getPlugin('danmu')
  2381. this.progressMove(xgplayerOption)
  2382. }
  2383. if (newValue.isFast == 1) {
  2384. this.player.getPlugin('progress').show()
  2385. } else {
  2386. this.player.getPlugin('progress').hide()
  2387. }
  2388. let lines = []
  2389. if (newValue.lineOne) {
  2390. lines.push({
  2391. name: '线路一',
  2392. definition: '线路一',
  2393. url: newValue.lineOne
  2394. })
  2395. }
  2396. if (newValue.lineTwo) {
  2397. lines.push({
  2398. name: '线路二',
  2399. definition: '线路二',
  2400. url: newValue.lineTwo
  2401. })
  2402. }
  2403. if (newValue.lineThree) {
  2404. lines.push({
  2405. name: '线路三',
  2406. definition: '线路三',
  2407. url: newValue.lineThree
  2408. })
  2409. }
  2410. this.player.emit('resourceReady', lines)
  2411. this.rjsPlayFun(xgplayerOption)
  2412. },
  2413. progressMove(data) {
  2414. const Events = this.Events
  2415. this.player.on(Events.PlAY, () => {
  2416. this.isXGPause = false
  2417. this.ownerInstance.callMethod("changeCountdowning", {
  2418. countdowning: true,
  2419. isXGPause: this.isXGPause
  2420. })
  2421. })
  2422. this.player.on(Events.PLAYING, () => {
  2423. // console.log("===播放Events.PLAYING")
  2424. this.isXGPause = false
  2425. this.ownerInstance.callMethod("changeCountdowning", {
  2426. countdowning: true,
  2427. isXGPause: this.isXGPause
  2428. })
  2429. })
  2430. this.player.on(Events.WAITING, () => {
  2431. this.ownerInstance.callMethod("changeCountdowning", {
  2432. countdowning: false,
  2433. isXGPause: this.isXGPause
  2434. })
  2435. })
  2436. this.player.on(Events.PAUSE, () => {
  2437. // console.log("===暂停Events.PAUSE")
  2438. this.isXGPause = true
  2439. this.ownerInstance.callMethod("changeCountdowning", {
  2440. countdowning: false,
  2441. isXGPause: this.isXGPause
  2442. })
  2443. })
  2444. this.player.on(Events.ERROR, (error) => {
  2445. console.log('video error:', error)
  2446. this.ownerInstance.callMethod("changeCountdowning", {
  2447. countdowning: false,
  2448. isXGPause: this.isXGPause
  2449. })
  2450. })
  2451. // 监听用户的播放进度
  2452. this.player.on(Events.TIME_UPDATE, () => {
  2453. this.ownerInstance.callMethod("onTimeUpdate", {
  2454. time: this.player.currentTime
  2455. });
  2456. })
  2457. this.player.on(Events.ENDED, () => {
  2458. this.ownerInstance.callMethod("changeCountdowning", {
  2459. countdowning: false,
  2460. isXGPause: this.isXGPause
  2461. })
  2462. this.ownerInstance.callMethod("endedPlayNext")
  2463. })
  2464. this.player.on(Events.FULLSCREEN_CHANGE, (isFullscreen) => {
  2465. if (this.isFullscreen == isFullscreen) return
  2466. this.isFullscreen = isFullscreen
  2467. plus.screen.lockOrientation('landscape')
  2468. this.ownerInstance.callMethod("onFullscreenChange", {
  2469. isFullscreen: isFullscreen
  2470. })
  2471. })
  2472. this.player.on(Events.CSS_FULLSCREEN_CHANGE, (isFullscreen) => {
  2473. if (this.isFullscreen == isFullscreen) return
  2474. this.isCSSFull = true
  2475. this.isFullscreen = isFullscreen
  2476. this.ownerInstance.callMethod("onFullscreenChange", {
  2477. isFullscreen: isFullscreen
  2478. })
  2479. })
  2480. // 清晰度发生变化
  2481. this.player.on(Events.DEFINITION_CHANGE, (res) => {
  2482. if (this.lineName == res.to.name) return
  2483. this.lineName = res.to.name
  2484. this.ownerInstance.callMethod("changeLine", {
  2485. url: res.to.url
  2486. })
  2487. })
  2488. },
  2489. rjsPlayFun(xgplayerOption) {
  2490. this.ownerInstance.callMethod("playFun", {
  2491. time: xgplayerOption.startTime
  2492. })
  2493. },
  2494. changeVideo(newValue, oldValue, ownerInstance) {
  2495. if (!this.ownerInstanceVideo) this.ownerInstanceVideo = ownerInstance
  2496. if (this.player) {
  2497. if (newValue.status.indexOf('play') > -1) {
  2498. const tempAudioDuration = newValue.tempAudioDuration
  2499. const flag = newValue.tempAudioDuration != newValue.studyTime
  2500. if (flag) {
  2501. this.player.seek(tempAudioDuration)
  2502. this.player.on(this.Events.SEEKED, () => {
  2503. setTimeout(() => {
  2504. this.player.play()
  2505. }, 200)
  2506. })
  2507. } else {
  2508. setTimeout(() => {
  2509. this.player.play()
  2510. }, 200)
  2511. }
  2512. } else if (newValue.status.indexOf('pause') > -1) {
  2513. this.player.pause()
  2514. }
  2515. }
  2516. },
  2517. handleExitFullscreen(newValue, oldValue, ownerInstance) {
  2518. // 退出全屏
  2519. if (this.player && this.isFullscreen && newValue.indexOf('yes') > -1) {
  2520. if (this.isCSSFull) {
  2521. this.player.exitCssFullscreen()
  2522. } else {
  2523. this.player.exitFullscreen()
  2524. }
  2525. }
  2526. },
  2527. // 发送弹幕
  2528. danmuFun(newValue, oldValue, ownerInstance) {
  2529. if (oldValue && newValue.event == oldValue.event && newValue.time == oldValue.time) {
  2530. return
  2531. }
  2532. if (newValue.event == 'send') {
  2533. // 发送弹幕
  2534. // console.log("===========发送弹幕",this.danmuInstance)
  2535. this.danmuInstance.sendComment(newValue.danmuItem)
  2536. } else if (newValue.event == 'switch') {
  2537. // 弹幕开关
  2538. // console.log("===========弹幕开关",newValue.switch)
  2539. if (newValue.switch == 1) {
  2540. this.danmuInstance.start()
  2541. } else {
  2542. this.danmuInstance.stop()
  2543. }
  2544. } else if (newValue.event == "getDanmuList") {
  2545. // console.log("===========弹幕列表")
  2546. this.danmuInstance.updateComments(newValue.danmuList, true)
  2547. } else if (newValue.event == "clearDanmuList") {
  2548. // console.log("===========清除列表")
  2549. this.danmuInstance.clear()
  2550. } else if (newValue.event == "setArea") {
  2551. this.danmuInstance.setArea({
  2552. start: 0,
  2553. end: newValue.area,
  2554. })
  2555. }
  2556. }
  2557. }
  2558. }
  2559. </script>
  2560. <style>
  2561. @import './danmu.css';
  2562. </style>
  2563. <style lang="scss" scoped>
  2564. @mixin u-flex($flexD, $alignI, $justifyC) {
  2565. display: flex;
  2566. flex-direction: $flexD;
  2567. align-items: $alignI;
  2568. justify-content: $justifyC;
  2569. }
  2570. .es-mr-24px {
  2571. margin-right: 24px;
  2572. }
  2573. .coloritem {
  2574. height: 24px;
  2575. width: 24px;
  2576. margin-bottom: 12px;
  2577. border-radius: 5px;
  2578. }
  2579. .danmu-controls {
  2580. background-color: #F5F7FA;
  2581. overflow: hidden;
  2582. font-family: PingFang SC, PingFang SC;
  2583. font-weight: 400;
  2584. font-size: 12px;
  2585. color: #999999;
  2586. padding: 0 10px;
  2587. border-radius: 50px 0 0 50px;
  2588. height: 28px;
  2589. overflow: hidden;
  2590. box-sizing: border-box;
  2591. &-r {
  2592. padding: 0 10px;
  2593. border-radius: 0 50px 50px 0;
  2594. height: 28px;
  2595. overflow: hidden;
  2596. box-sizing: border-box;
  2597. background-color: #fff;
  2598. image {
  2599. height: 20px;
  2600. width: 20px;
  2601. }
  2602. }
  2603. }
  2604. ::v-deep {
  2605. .danmu-switch-open,
  2606. .danmu-switch-closed {
  2607. height: 25px;
  2608. width: 25px;
  2609. }
  2610. }
  2611. .xgplayer-switch {
  2612. background-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, .37), rgba(0, 0, 0, .75), rgba(0, 0, 0, .75));
  2613. }
  2614. .danmuPopup {
  2615. background-color: #fff;
  2616. &-head {
  2617. width: 100%;
  2618. padding: 10px;
  2619. box-sizing: border-box;
  2620. overflow: hidden;
  2621. @include u-flex(row, center, flex-start);
  2622. .danmu-icon {
  2623. height: 24px;
  2624. width: 24px;
  2625. margin-right: 12px;
  2626. }
  2627. }
  2628. &-input {
  2629. flex: 1;
  2630. height: 35px;
  2631. }
  2632. &-send {
  2633. flex-shrink: 0;
  2634. height: 35px;
  2635. display: flex;
  2636. align-items: center;
  2637. justify-content: center;
  2638. padding: 5px 15px;
  2639. box-sizing: border-box;
  2640. background: #FF233C !important;
  2641. border-radius: 22px;
  2642. font-family: PingFang SC, PingFang SC;
  2643. font-weight: 500;
  2644. font-size: 15px;
  2645. color: #fff !important;
  2646. margin-left: 12px;
  2647. &::after {
  2648. border: none;
  2649. }
  2650. }
  2651. &-con {
  2652. background-color: #F5F7FA;
  2653. padding: 24px 12px 48px 12px;
  2654. font-family: PingFang SC, PingFang SC;
  2655. font-weight: 400;
  2656. font-size: 14px;
  2657. color: #757575;
  2658. }
  2659. }
  2660. .content {
  2661. background: #f7f7f7;
  2662. }
  2663. .cousrseImg {
  2664. position: absolute;
  2665. top: 0;
  2666. left: 0;
  2667. width: 100%;
  2668. height: 422rpx;
  2669. background-color: #000;
  2670. image {
  2671. width: 100%;
  2672. height: 100%;
  2673. }
  2674. }
  2675. .video-box {
  2676. width: 100%;
  2677. height: 422rpx;
  2678. overflow: hidden;
  2679. position: relative;
  2680. // padding-top: var(--status-bar-height);
  2681. }
  2682. .scroll-Y {
  2683. font-family: PingFang SC, PingFang SC;
  2684. font-weight: 400;
  2685. font-size: 28rpx;
  2686. color: #222222;
  2687. }
  2688. .horizontal {
  2689. width: 130px;
  2690. height: 150px;
  2691. position: absolute;
  2692. bottom: 50px;
  2693. left: 20px;
  2694. z-index: 999;
  2695. display: flex;
  2696. flex-direction: column;
  2697. align-items: center;
  2698. justify-content: flex-end;
  2699. background-color: transparent;
  2700. .es-w-40 {
  2701. width: 20px;
  2702. }
  2703. .es-h-40 {
  2704. height: 20px;
  2705. }
  2706. .goods {
  2707. width: 120px;
  2708. height: 140px;
  2709. border-radius: 10px;
  2710. background-color: rgba(255, 255, 255, 0.4);
  2711. overflow: hidden;
  2712. display: flex;
  2713. flex-direction: column;
  2714. align-items: center;
  2715. justify-content: center;
  2716. }
  2717. .goodsimg {
  2718. width: 100px;
  2719. height: 100px;
  2720. border-radius: 10px;
  2721. }
  2722. .goodsname {
  2723. width: 100px;
  2724. font-size: 12px;
  2725. box-sizing: border-box;
  2726. padding-top: 7px;
  2727. verflow: hidden;
  2728. word-break: break-all;
  2729. }
  2730. }
  2731. .rotate {
  2732. transform: rotate(-180deg);
  2733. }
  2734. .status_bar {
  2735. background-color: #000;
  2736. }
  2737. .back-img {
  2738. width: 25px;
  2739. height: 25px;
  2740. position: absolute;
  2741. top: 10px;
  2742. left: 34rpx;
  2743. z-index: 99;
  2744. }
  2745. .audiobox {
  2746. width: 100%;
  2747. height: 422rpx;
  2748. position: absolute;
  2749. top: 0;
  2750. left: 0;
  2751. background-color: #333;
  2752. z-index: 9990;
  2753. font-family: PingFang SC, PingFang SC;
  2754. font-weight: 400;
  2755. font-size: 26rpx;
  2756. color: #fff;
  2757. &-video {
  2758. background-color: rgba(255, 255, 255, 0.3);
  2759. padding: 8rpx 20rpx;
  2760. border-radius: 50rpx;
  2761. position: absolute;
  2762. bottom: 40rpx;
  2763. left: 50%;
  2764. transform: translateX(-50%);
  2765. z-index: 9991;
  2766. text-align: center;
  2767. }
  2768. &-title {
  2769. position: absolute;
  2770. top: 0;
  2771. left: 0;
  2772. z-index: 9991;
  2773. padding: 30rpx 40rpx;
  2774. width: 100%;
  2775. box-sizing: border-box;
  2776. background: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
  2777. display: flex;
  2778. align-items: center;
  2779. .back {
  2780. width: 50rpx;
  2781. height: 50rpx;
  2782. margin-right: 15rpx;
  2783. flex-shrink: 0;
  2784. }
  2785. }
  2786. &-time {
  2787. margin-top: 18rpx;
  2788. font-size: 24rpx;
  2789. }
  2790. }
  2791. .scroll-Y {
  2792. font-family: PingFang SC, PingFang SC;
  2793. font-weight: 400;
  2794. font-size: 28rpx;
  2795. color: #222222;
  2796. }
  2797. .video-info {
  2798. padding: 30rpx 24rpx;
  2799. background-color: #fff;
  2800. &-header {
  2801. width: 100%;
  2802. @include u-flex(row, center, space-between);
  2803. }
  2804. &-headerl {
  2805. flex: 1;
  2806. @include u-flex(row, center, flex-start);
  2807. font-weight: 600;
  2808. font-size: 40rpx;
  2809. color: rgba(0, 0, 0, 0.85);
  2810. overflow: hidden;
  2811. image {
  2812. flex-shrink: 0;
  2813. width: 88rpx;
  2814. height: 88rpx;
  2815. margin-right: 28rpx;
  2816. background: #F5F7FA;
  2817. border-radius: 50%;
  2818. overflow: hidden;
  2819. }
  2820. }
  2821. .follow-btn {
  2822. @include u-flex(row, center, center);
  2823. height: 56rpx;
  2824. min-width: 154rpx;
  2825. padding: 0 23rpx;
  2826. background: #FF233C;
  2827. border-radius: 28rpx 28rpx 28rpx 28rpx;
  2828. color: #FFFFFF;
  2829. font-size: 28rpx;
  2830. image {
  2831. height: 32rpx;
  2832. width: 32rpx;
  2833. margin-right: 6rpx;
  2834. }
  2835. }
  2836. &-voice {
  2837. width: 100%;
  2838. padding: 24rpx 20rpx 38rpx 28rpx;
  2839. margin-top: 26rpx;
  2840. background: #F5F7FA;
  2841. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2842. box-sizing: border-box;
  2843. image {
  2844. width: 48rpx;
  2845. height: 48rpx;
  2846. }
  2847. &-l {
  2848. @include u-flex(row, center, flex-start);
  2849. image {
  2850. margin-right: 20rpx;
  2851. }
  2852. }
  2853. }
  2854. &-voicebox1 {
  2855. @include u-flex(row, center, space-between);
  2856. }
  2857. &-voicebox2 {
  2858. padding: 20rpx 0;
  2859. @include u-flex(row, center, space-between);
  2860. font-weight: 400;
  2861. font-size: 26rpx;
  2862. color: #757575;
  2863. .boTextClass {
  2864. font-weight: 400;
  2865. font-size: 32rpx;
  2866. color: rgba(0, 0, 0, 0.45);
  2867. }
  2868. }
  2869. ::v-deep .uni-collapse-item__title-arrow {
  2870. margin-right: -8rpx;
  2871. }
  2872. .opacity {
  2873. position: relative !important;
  2874. opacity: 1 !important;
  2875. z-index: 1 !important;
  2876. }
  2877. &-desc {
  2878. // margin-bottom: 52rpx;
  2879. font-weight: 400;
  2880. font-size: 32rpx;
  2881. color: rgba(0, 0, 0, 0.65);
  2882. line-height: 44rpx;
  2883. word-break: break-all;
  2884. overflow: hidden;
  2885. position: absolute;
  2886. opacity: 0;
  2887. z-index: -1;
  2888. .desc-image {
  2889. height: 60rpx;
  2890. width: 100%;
  2891. position: absolute;
  2892. bottom: 0;
  2893. left: 0;
  2894. }
  2895. }
  2896. .text-clamp {
  2897. display: -webkit-box;
  2898. -webkit-line-clamp: 2;
  2899. /* 显示的行数 */
  2900. -webkit-box-orient: vertical;
  2901. /* 内容会垂直堆叠 */
  2902. overflow: hidden;
  2903. /* 隐藏溢出的内容 */
  2904. text-overflow: ellipsis;
  2905. /* 当内容被裁剪时显示省略号 */
  2906. }
  2907. &-footer {
  2908. @include u-flex(row, center, space-between);
  2909. color: #757575;
  2910. font-weight: 400;
  2911. font-size: 24rpx;
  2912. view {
  2913. width: 128rpx;
  2914. height: 104rpx;
  2915. @include u-flex(column, center, center);
  2916. }
  2917. image {
  2918. width: 48rpx;
  2919. height: 48rpx;
  2920. margin-bottom: 8rpx;
  2921. }
  2922. }
  2923. }
  2924. .box-header {
  2925. margin-bottom: 24rpx;
  2926. padding: 0 24rpx;
  2927. @include u-flex(row, center, space-between);
  2928. font-weight: 500;
  2929. font-size: 24rpx;
  2930. color: #999999;
  2931. .kechengLeftClass {
  2932. @include u-flex(row, center, center);
  2933. }
  2934. &-title {
  2935. font-weight: 600;
  2936. font-size: 36rpx;
  2937. color: #222222;
  2938. }
  2939. .kechengIconClass {
  2940. width: 30rpx;
  2941. height: 30rpx;
  2942. margin-right: 12rpx
  2943. }
  2944. &-r {
  2945. @include u-flex(row, center, center);
  2946. image {
  2947. width: 16rpx;
  2948. height: 16rpx;
  2949. margin-left: 10rpx;
  2950. }
  2951. }
  2952. }
  2953. .therapy {
  2954. background-color: #fff;
  2955. padding-left: 24rpx;
  2956. padding-bottom: 20rpx;
  2957. &-scrollx {
  2958. white-space: nowrap;
  2959. width: 100%;
  2960. // margin-left: 24rpx;
  2961. }
  2962. &-scrollitem {
  2963. display: inline-block;
  2964. overflow: hidden;
  2965. background: #F5F7FA;
  2966. padding: 10rpx;
  2967. margin-right: 20rpx;
  2968. border-radius: 10rpx;
  2969. overflow: hidden;
  2970. border: 1rpx solid #F5F7FA;
  2971. box-sizing: border-box;
  2972. position: relative;
  2973. overflow: hidden;
  2974. image {
  2975. width: 200rpx;
  2976. height: 200rpx;
  2977. border-radius: 10rpx;
  2978. background-color: #F5F7FA;
  2979. }
  2980. &::after {
  2981. content: '查看详情';
  2982. background-color: #F5F7FA;
  2983. position: absolute;
  2984. top: 0;
  2985. left: 0;
  2986. font-weight: 400;
  2987. font-size: 20rpx;
  2988. padding: 4rpx 14rpx;
  2989. border-radius: 10rpx 0 10rpx 0;
  2990. color: #757575;
  2991. }
  2992. }
  2993. &-active {
  2994. background: #fff;
  2995. border: 1rpx solid #FF233C;
  2996. .therapy-goodsname {
  2997. color: #FF233C !important;
  2998. }
  2999. &::after {
  3000. background: #fff;
  3001. color: #FF233C !important;
  3002. }
  3003. }
  3004. &-goodsname {
  3005. margin-top: 6rpx;
  3006. width: 200rpx;
  3007. min-height: 64rpx;
  3008. font-size: 24rpx;
  3009. color: #757575;
  3010. word-break: break-all;
  3011. white-space: normal;
  3012. }
  3013. }
  3014. .video-directory {
  3015. background-color: #fff;
  3016. padding-top: 24rpx;
  3017. margin-top: 20rpx;
  3018. &-scrollx {
  3019. white-space: nowrap;
  3020. width: calc(100% - 24rpx);
  3021. margin-left: 24rpx;
  3022. }
  3023. &-scrollitem {
  3024. display: inline-block;
  3025. width: 280rpx;
  3026. height: 192rpx;
  3027. background: #F5F5F5;
  3028. border-radius: 20rpx;
  3029. margin-right: 24rpx;
  3030. padding: 24rpx;
  3031. box-sizing: border-box;
  3032. position: relative;
  3033. margin-bottom: 20rpx;
  3034. }
  3035. .freeflag {
  3036. min-width: 132rpx;
  3037. height: 44rpx;
  3038. padding: 0 12rpx;
  3039. text-align: center;
  3040. position: absolute;
  3041. right: 0;
  3042. top: 0;
  3043. font-size: 28rpx;
  3044. color: #FFFFFF;
  3045. border-radius: 0rpx 20rpx 0rpx 20rpx;
  3046. &-free {
  3047. // background: url('@/static/image/hall/free_lable_bg.png') no-repeat right / 100% 32rpx;
  3048. background-color: #FF233C;
  3049. }
  3050. &-member {
  3051. // background: url('@/static/image/hall/member_label_bg.png') no-repeat right / 100% 32rpx;
  3052. background-color: #FFB205;
  3053. }
  3054. }
  3055. &-num {
  3056. font-weight: 600;
  3057. font-size: 32rpx;
  3058. @include u-flex(row, center, flex-start);
  3059. margin-bottom: 12rpx;
  3060. image,
  3061. .empty {
  3062. width: 32rpx;
  3063. height: 32rpx;
  3064. margin-left: 10rpx;
  3065. }
  3066. }
  3067. &-title {
  3068. @include u-flex(row, center, space-between);
  3069. font-size: 32rpx;
  3070. color: #757575;
  3071. line-height: 44rpx;
  3072. word-break: break-all;
  3073. white-space: normal;
  3074. .imagebox {
  3075. flex-shrink: 0;
  3076. margin: 0 8rpx;
  3077. position: relative;
  3078. image {
  3079. width: 92rpx;
  3080. height: 72rpx;
  3081. border-radius: 8rpx 8rpx 8rpx 8rpx;
  3082. overflow: hidden;
  3083. }
  3084. }
  3085. }
  3086. .mask {
  3087. width: 92rpx;
  3088. height: 72rpx;
  3089. border-radius: 8rpx 8rpx 8rpx 8rpx;
  3090. background: rgba(0, 0, 0, 0.2);
  3091. overflow: hidden;
  3092. position: absolute;
  3093. top: 0;
  3094. left: 0;
  3095. z-index: 1;
  3096. @include u-flex(row, center, center);
  3097. image {
  3098. width: 24rpx;
  3099. height: 24rpx;
  3100. }
  3101. }
  3102. .active-scrollitem {
  3103. background: #FFF0F2FF;
  3104. color: #FF233CFF;
  3105. .video-directory-title {
  3106. color: #FF233CFF;
  3107. }
  3108. }
  3109. }
  3110. .video-comment {
  3111. background-color: #fff;
  3112. padding-top: 12rpx;
  3113. margin-top: 20rpx;
  3114. }
  3115. .hall-box {
  3116. @include u-flex(row, center, flex-start);
  3117. flex-wrap: wrap;
  3118. margin: 0 -18rpx -18rpx 0;
  3119. padding: 12rpx 24rpx 24rpx 24rpx;
  3120. .gapitem {
  3121. margin: 0 18rpx 18rpx 0;
  3122. }
  3123. }
  3124. .popbox {
  3125. background-color: #fff;
  3126. position: relative;
  3127. .box-header {
  3128. padding-top: 12rpx;
  3129. padding-bottom: 12rpx;
  3130. box-sizing: border-box;
  3131. background-color: #fff;
  3132. }
  3133. .popbox-body {
  3134. .comment,
  3135. .directoryinfo {
  3136. padding: 24rpx;
  3137. }
  3138. }
  3139. .search-box {
  3140. @include u-flex(row, center, space-between);
  3141. padding: 10px 24rpx;
  3142. .search {
  3143. padding: 0;
  3144. flex: 1;
  3145. image {
  3146. width: 24rpx;
  3147. height: 24rpx;
  3148. padding-left: 16rpx;
  3149. }
  3150. }
  3151. }
  3152. }
  3153. .search-btn {
  3154. flex-shrink: 0;
  3155. height: 68rpx;
  3156. padding: 0 42rpx;
  3157. margin-left: 20rpx;
  3158. background: #eef5fd;
  3159. border-radius: 34rpx 34rpx 34rpx 34rpx;
  3160. font-family: PingFang SC, PingFang SC;
  3161. font-weight: 600;
  3162. font-size: 26rpx;
  3163. color: #FF233C;
  3164. text-align: center;
  3165. line-height: 68rpx;
  3166. }
  3167. .comment-inputbox {
  3168. @include u-flex(row, center, space-between);
  3169. padding: 28rpx 24rpx;
  3170. box-sizing: border-box;
  3171. background: #FFFFFF;
  3172. .inputbox {
  3173. flex: 1;
  3174. height: 72rpx;
  3175. padding-left: 24rpx;
  3176. background: #F5F7FA;
  3177. border-radius: 36rpx 36rpx 36rpx 36rpx;
  3178. font-family: PingFang SC, PingFang SC;
  3179. font-weight: 400;
  3180. font-size: 26rpx;
  3181. color: #999999;
  3182. line-height: 72rpx;
  3183. }
  3184. .release-btn {
  3185. @extend .search-btn;
  3186. }
  3187. }
  3188. .audio {
  3189. display: flex;
  3190. flex-direction: row;
  3191. align-items: center;
  3192. font-family: PingFang SC, PingFang SC;
  3193. font-weight: 500;
  3194. font-size: 24rpx;
  3195. color: #757575;
  3196. &-play {
  3197. display: flex;
  3198. flex-direction: row;
  3199. align-items: center;
  3200. }
  3201. &-icon {
  3202. width: 48rpx;
  3203. height: 48rpx;
  3204. }
  3205. &-slider {
  3206. flex: 1;
  3207. }
  3208. &-time {
  3209. flex-shrink: 0;
  3210. }
  3211. }
  3212. .vipCourseBtn {
  3213. background: #1B1F22;
  3214. border-radius: 46rpx;
  3215. border: 1px solid #FFDAA3;
  3216. color: #FFDAA3;
  3217. width: calc(33.33333% - 46.6666rpx);
  3218. }
  3219. .vipAc {
  3220. background: linear-gradient(90deg, #FFE0B2, #F8BA8B);
  3221. border-radius: 46rpx;
  3222. border: 1px solid #FFDAA3;
  3223. color: #1B1F22;
  3224. }
  3225. .privilegeBox {
  3226. background-color: #171a1d;
  3227. box-sizing: border-box;
  3228. }
  3229. .primenu-box {
  3230. border-radius: 16rpx;
  3231. margin-top: 0rpx;
  3232. padding: 10rpx 20rpx;
  3233. }
  3234. .content-inner {
  3235. display: flex;
  3236. flex-wrap: wrap;
  3237. min-height: 310rpx;
  3238. }
  3239. .content-inner .item {
  3240. width: calc(33.3333333%);
  3241. height: 150rpx;
  3242. display: flex;
  3243. flex-direction: column;
  3244. align-items: center;
  3245. justify-content: center;
  3246. margin-top: 0rpx;
  3247. }
  3248. .content-inner .item .img {
  3249. width: 84rpx;
  3250. height: 84rpx;
  3251. margin-bottom: 8rpx;
  3252. }
  3253. .content-inner .item .label {
  3254. font-size: 32rpx;
  3255. color: #83878A;
  3256. }
  3257. .vipMethodItem {
  3258. border-radius: 10rpx;
  3259. width: calc(100%);
  3260. height: 70rpx;
  3261. color: #FDD8A1;
  3262. }
  3263. .payTypeItem {
  3264. background-color: #1B1F22;
  3265. border: 1px solid #fff;
  3266. border-radius: 10rpx;
  3267. width: calc(50% - 15rpx);
  3268. height: 94rpx;
  3269. }
  3270. .circle {
  3271. border: 1px solid #FDD8A1;
  3272. }
  3273. .pt_ac {
  3274. border: 1px solid #FDD8A1;
  3275. }
  3276. .slider-box {
  3277. flex: 1
  3278. }
  3279. .dataNumTextClass {
  3280. font-weight: 400;
  3281. font-size: 32rpx;
  3282. color: rgba(0, 0, 0, 0.45);
  3283. }
  3284. .bottomCommentInputClass {
  3285. position: fixed;
  3286. left: 0;
  3287. right: 0;
  3288. z-index: 900;
  3289. bottom: 0;
  3290. width: 100%;
  3291. height: 160rpx;
  3292. background-color: #fff;
  3293. padding: 0 24rpx 10rpx;
  3294. display: flex;
  3295. align-items: center;
  3296. padding-bottom: constant(safe-area-inset-bottom);
  3297. padding-bottom: env(safe-area-inset-bottom);
  3298. .input-box {
  3299. flex: 1;
  3300. background-color: #f5f5f5;
  3301. height: 96rpx;
  3302. border-radius: 48rpx;
  3303. padding: 0 30rpx;
  3304. font-size: 32rpx;
  3305. margin-right: 24rpx;
  3306. }
  3307. .send-btn {
  3308. width: 160rpx;
  3309. height: 96rpx;
  3310. background: linear-gradient(135deg, #FF5267 0%, #FF233C 100%);
  3311. border-radius: 48rpx;
  3312. font-weight: 600;
  3313. font-size: 40rpx;
  3314. text-align: center;
  3315. color: #FFFFFF;
  3316. line-height: 96rpx;
  3317. margin-right: 25rpx;
  3318. }
  3319. .icon-btn {
  3320. display: flex;
  3321. flex-direction: column;
  3322. align-items: center;
  3323. justify-content: center;
  3324. image {
  3325. width: 52rpx;
  3326. height: 52rpx;
  3327. }
  3328. text {
  3329. font-weight: 600;
  3330. font-size: 32rpx;
  3331. color: #222222;
  3332. margin-top: 4rpx;
  3333. }
  3334. }
  3335. }
  3336. </style>