info.vue 91 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518
  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. if (this.catalogueList.length == 0) {
  1484. return;
  1485. }
  1486. // this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  1487. // this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog.packageJson) : []
  1488. // if(this.pickCatalog.isBuy==0){
  1489. // return;
  1490. // }
  1491. const parmas = {
  1492. "courseId": parseInt(this.courseId),
  1493. "duration": this.tempAudioDuration || 1,
  1494. "videoId": this.pickCatalog.videoId
  1495. };
  1496. addDuration(parmas).then(res => {
  1497. if (res.code == 200) { }
  1498. },
  1499. rej => { }
  1500. );
  1501. },
  1502. addIntegral() {
  1503. // 观看到视频时长50%加一次福币
  1504. if (this.lookDuration == 0 || this.playDuration == 0) {
  1505. return;
  1506. }
  1507. // this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
  1508. // this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog.packageJson) : []
  1509. if (this.lookDuration < this.pickCatalog.seconds * 0.5) {
  1510. return;
  1511. }
  1512. let data = {
  1513. videoId: this.pickCatalog.videoId,
  1514. duration: this.lookDuration
  1515. };
  1516. getIntegral(data).then(res => {
  1517. if (res.code == 200) {
  1518. uni.showToast({
  1519. icon: 'none',
  1520. title: res.msg,
  1521. duration: 3000,
  1522. position: 'bottom'
  1523. });
  1524. this.countdowning = false;
  1525. }
  1526. },
  1527. rej => { }
  1528. );
  1529. },
  1530. closeShareAct() {
  1531. this.showShare = false;
  1532. },
  1533. closeTherapy() {
  1534. this.showTherapy = false
  1535. },
  1536. goToPro(productId) {
  1537. this.exitFullscreen = 'yes' + new Date().getTime()
  1538. this.showTherapy = false
  1539. setTimeout(() => {
  1540. uni.navigateTo({
  1541. url: "/pages/store/packageDetails?packageId=" + productId
  1542. });
  1543. }, 500);
  1544. },
  1545. // 返回视频
  1546. backPlayVideo() {
  1547. this.showAudio = false;
  1548. this.audioPlayIng = false;
  1549. this.isLearning = false;
  1550. this.pauseFun('audio');
  1551. this.playFun();
  1552. },
  1553. // 点击视频
  1554. clickVideo() {
  1555. this.isClickVideo = true
  1556. setTimeout(() => {
  1557. this.isClickVideo = false
  1558. }, 3000)
  1559. },
  1560. changeCountdowning(data) {
  1561. this.countdowning = data.countdowning;
  1562. // 视频是否暂停
  1563. if (data.isXGPause == false) {
  1564. setTimeout(() => {
  1565. this.isPause = data.isXGPause
  1566. }, 3000)
  1567. } else {
  1568. this.isPause = data.isXGPause
  1569. }
  1570. },
  1571. onTimeUpdate(data) {
  1572. this.playDuration = Math.round(data.time)
  1573. this.initStudyTime(this.playDuration)
  1574. if (!this.$isLogin()) {
  1575. this.handleInternetTraffic(this.playDuration)
  1576. }
  1577. if (data.time >= this.pickCatalog.seconds) {
  1578. this.countdowning = false; //观看时长开关关闭
  1579. }
  1580. if (this.isH5) {
  1581. if (this.allLookDuration >= 300) { //H5未登录状态播放五分钟就跳出登录页面
  1582. if (!this.$isLogin()) {
  1583. this.$showLoginPage();
  1584. const type = this.showAudio ? 'audio' : 'video'
  1585. this.pauseFun(type);
  1586. }
  1587. }
  1588. } else {
  1589. if (this.allLookDuration >= 120) { //未登录状态播放两分钟就跳出登录页面
  1590. if (!this.$isLogin()) {
  1591. this.$showLoginPage();
  1592. const type = this.showAudio ? 'audio' : 'video'
  1593. this.pauseFun(type);
  1594. }
  1595. }
  1596. }
  1597. // uni.$u.throttle(this.checkTherapy, 1000,false);
  1598. },
  1599. // 新版视频播放中-流量记录
  1600. handleInternetTraffic(duration) {
  1601. // 使用视频播放时长判断是否是6秒的倍数
  1602. let currentDuration = Number(Math.round(duration).toFixed(2));
  1603. // 当前视频的时长
  1604. let curVideoDuration = Number(Math.round(this.pickCatalog.seconds).toFixed(2));
  1605. let trafficUuId = generateRandomString(16)
  1606. // 判断是否是6秒的倍数,且只在进入新的6秒区间时触发一次
  1607. if (currentDuration > 0 && currentDuration % 6 === 0) {
  1608. // 检查是否已经在这个时间点触发过(防止拖动到6倍数位置时重复触发)
  1609. if (this.lastInternetTrafficDuration !== currentDuration) {
  1610. let params = {
  1611. appId: "wx40dcfa2797d6fc2d",
  1612. bufferRate: Math.ceil((currentDuration / curVideoDuration) * 100),
  1613. companyId: 101,
  1614. courseId: this.courseId,
  1615. duration: currentDuration,
  1616. uuId: dayjs().format('YYYYMMDD') + trafficUuId,
  1617. videoId: this.pickCatalog.videoId,
  1618. };
  1619. newGetInternetTrafficApi(params)
  1620. this.lastInternetTrafficDuration = currentDuration;
  1621. }
  1622. }
  1623. },
  1624. // 展示疗法
  1625. checkTherapy() {
  1626. let currentTime = Math.round(this.tempAudioDuration || 0)
  1627. let node = this.packageJsonList.filter(item => item.duration == currentTime)
  1628. if (node && node.length > 0) {
  1629. this.nodeTime = node[0].duration
  1630. this.showTherapyItem = node[0]
  1631. if (!this.showTherapy) {
  1632. this.showTherapy = true
  1633. }
  1634. } else {
  1635. if (this.showTherapy && this.nodeTime && this.nodeTime > currentTime) {
  1636. this.showTherapy = false
  1637. }
  1638. }
  1639. },
  1640. // 打开集观看提示弹窗
  1641. openTips(index) {
  1642. // #ifdef APP-PLUS
  1643. uni.$emit('getTipShowType', {
  1644. index: index
  1645. })
  1646. uni.getSubNVueById('videoPopup').show();
  1647. // #endif
  1648. },
  1649. tipConfirm() { // 提示确认
  1650. // 继续播放
  1651. //传递消息给小节弹窗
  1652. uni.$emit('pickCatalogIdx', {
  1653. pickCatalogIdx: this.pickCatalogIdx,
  1654. type: 'catalogueN'
  1655. });
  1656. this.playFun()
  1657. },
  1658. tipCancel(index) { // 提示取消
  1659. // 播放选择的一节
  1660. this.pickCatalogActionFun(index, 'catalogueN')
  1661. },
  1662. // 听声
  1663. handleListen() {
  1664. if (this.showAudio) {
  1665. this.backPlayVideo()
  1666. } else {
  1667. // 打开音频
  1668. this.showAudio = true
  1669. this.pauseFun('video');
  1670. this.playFun()
  1671. }
  1672. },
  1673. // 播放音频
  1674. playAudioAction(type) {
  1675. if (!this.audioPlayIng) {
  1676. setTimeout(() => {
  1677. this.audioContext.play()
  1678. }, 200)
  1679. } else {
  1680. this.pauseAudioAction()
  1681. }
  1682. this.audioPlayIng = !this.audioPlayIng;
  1683. },
  1684. // 播放
  1685. playFun() {
  1686. // console.log("initSocket videoId:",this.pickCatalog.videoId)
  1687. this.reOpenSocket = false
  1688. if (this.pickCatalog.videoId) {
  1689. this.getDanmuList()
  1690. if (this.socket) {
  1691. this.socket.close({
  1692. success: () => {
  1693. this.reOpenSocket = true
  1694. clearInterval(this.pingpangTimes)
  1695. }
  1696. })
  1697. } else {
  1698. this.initSocket()
  1699. }
  1700. }
  1701. this.audioPlayIng = false
  1702. if (this.showAudio) {
  1703. const ended = this.tempAudioDuration == this.pickCatalog.seconds
  1704. this.audioContext.seek(ended ? 0 : this.tempAudioDuration);
  1705. // this.audioContext.onSeeked(() => {
  1706. this.playAudioAction()
  1707. // })
  1708. } else {
  1709. this.videoPlayStatus = {
  1710. status: 'play' + new Date().getTime(),
  1711. tempAudioDuration: this.tempAudioDuration || 0,
  1712. studyTime: this.pickCatalog.studyTime,
  1713. }
  1714. }
  1715. },
  1716. initStudyTime(time) {
  1717. this.tempAudioDuration = Math.round(time)
  1718. },
  1719. // 暂停音频
  1720. pauseAudioAction() {
  1721. if (this.audioContext) {
  1722. setTimeout(() => {
  1723. this.audioContext.pause();
  1724. }, 200)
  1725. clearInterval(this.audioTimer);
  1726. this.audioTimer = null;
  1727. }
  1728. },
  1729. destoryAudio() {
  1730. if (this.audioContext) {
  1731. this.audioContext.destroy();
  1732. clearInterval(this.audioTimer);
  1733. this.audioTimer = null;
  1734. }
  1735. },
  1736. // 暂停
  1737. pauseFun(type) {
  1738. this.audioPlayIng = true
  1739. if (type == 'audio') {
  1740. this.pauseAudioAction()
  1741. } else if (type == 'video') {
  1742. this.videoPlayStatus = {
  1743. status: 'pause' + new Date().getTime(),
  1744. tempAudioDuration: this.tempAudioDuration || 0,
  1745. studyTime: this.pickCatalog.studyTime,
  1746. }
  1747. }
  1748. },
  1749. closePrivilege() {
  1750. this.$refs.popPrivilege.close();
  1751. },
  1752. closeTip() {
  1753. this.$refs.popTip.close();
  1754. },
  1755. canShowVip(item) {
  1756. return true;
  1757. if (this.user.isVip) {
  1758. return false;
  1759. }
  1760. return item.isVip == 1 && item.isBuy == 0;
  1761. },
  1762. confirmTip() {
  1763. this.getUserInfo();
  1764. this.getCourseInfo();
  1765. this.$refs.popTip.close();
  1766. uni.showLoading({
  1767. title: "请稍侯...",
  1768. mask: true,
  1769. duration: 3000
  1770. });
  1771. setTimeout(() => {
  1772. this.getCourseOrderById();
  1773. }, 2000);
  1774. },
  1775. getCourseOrderById() {
  1776. getCourseOrderById(this.courseOrderId).then(res => {
  1777. uni.hideLoading();
  1778. if (res.code == 200) {
  1779. if (res.order.status == 2 || res.order.payTime != null) {
  1780. // #ifdef APP-PLUS
  1781. if (plus.runtime.channel == "baidu") { //获取渠道标识
  1782. let bdCmdType = uni.getStorageSync("bdCmdType");
  1783. if (bdCmdType != null && parseInt(bdCmdType) <= 2) {
  1784. //this.$registerIdCode("orders",2,res.order.payMoney.toString()); //已下单
  1785. }
  1786. }
  1787. // #endif
  1788. uni.showToast({
  1789. title: "支付成功",
  1790. icon: 'success'
  1791. });
  1792. } else if (res.order.status == 1) {
  1793. uni.showToast({
  1794. title: "课程待支付请稍侯",
  1795. icon: 'none'
  1796. });
  1797. } else {
  1798. uni.showToast({
  1799. title: "支付失败",
  1800. icon: 'error'
  1801. });
  1802. }
  1803. }
  1804. },
  1805. rej => { }
  1806. );
  1807. },
  1808. handleTherapy(item, idx) {
  1809. this.scrollIntoTherapy = 'therapy' + idx,
  1810. this.therapyIndex = idx
  1811. setTimeout(() => {
  1812. uni.navigateTo({
  1813. url: "/pages/store/packageDetails?packageId=" + item.packageId
  1814. });
  1815. }, 500);
  1816. },
  1817. onFullscreenChange(data) {
  1818. this.fullScreen = data.isFullscreen
  1819. // direction取为 vertical 或 horizontal
  1820. this.direction = data.direction
  1821. if (!data.isFullscreen) {
  1822. // 退出全屏,锁定竖屏
  1823. // #ifdef APP-PLUS
  1824. plus.screen.lockOrientation('portrait-primary');
  1825. // #endif
  1826. }
  1827. },
  1828. // 全屏返回
  1829. videoback() {
  1830. this.exitFullscreen = 'yes' + new Date().getTime()
  1831. },
  1832. // 弹幕
  1833. openDanmu() {
  1834. // #ifdef H5
  1835. uni.showToast({
  1836. title: "请下载app发弹幕",
  1837. icon: "none"
  1838. })
  1839. return
  1840. // #endif
  1841. this.danmuIput = {
  1842. txt: '',
  1843. mode: 'scroll',
  1844. color: '#ffffff',
  1845. fontSize: '18px',
  1846. }
  1847. this.$refs.danmuPopup.open()
  1848. },
  1849. keyboardHeightChange(res) {
  1850. // #ifndef H5
  1851. this.danmuboxHeight = res.height
  1852. // #endif
  1853. },
  1854. openDanmuStyle(type) {
  1855. if (type == 2) {
  1856. uni.hideKeyboard()
  1857. }
  1858. },
  1859. clickStyle(type, value) {
  1860. if (type == 'mode') {
  1861. this.danmuIput.mode = value
  1862. } else if (type == 'font') {
  1863. this.danmuIput.fontSize = value
  1864. } else if (type == 'color') {
  1865. this.danmuIput.color = value
  1866. this.danmuIput.border = `solid 1px ${value}`
  1867. }
  1868. },
  1869. clickArea(value) {
  1870. this.danmuFunInfo = {
  1871. time: new Date().getTime(),
  1872. event: 'setArea',
  1873. switch: this.danmuFunInfo.switch,
  1874. area: value
  1875. }
  1876. },
  1877. // 发送弹幕
  1878. sendDanmu() {
  1879. if (this.danmuIput.txt == '' || this.danmuIput.txt.trim() == '') {
  1880. uni.showToast({
  1881. title: '弹幕不能为空',
  1882. icon: 'none'
  1883. })
  1884. return;
  1885. }
  1886. if (!this.isSend) {
  1887. return;
  1888. }
  1889. const param = {
  1890. userId: this.user.userId || '',
  1891. userType: 2, // 1-管理员,2-用户
  1892. courseId: this.courseId,
  1893. videoId: this.pickCatalog.videoId,
  1894. type: 1, // 评论类型 1:评论,2:回复,目前没有回复,默认传1就行了
  1895. content: this.danmuIput.txt,
  1896. time: this.tempAudioDuration, // 弹幕对应视频时间节点()秒
  1897. fontSize: this.danmuIput.fontSize,
  1898. mode: this.danmuIput.mode,
  1899. color: this.danmuIput.color,
  1900. }
  1901. saveMsg(param).then(res => {
  1902. if (res.code == 200) {
  1903. const status = res.status ? 0 : 1
  1904. this.sendMsg(param, status);
  1905. } else {
  1906. uni.showToast({
  1907. title: res.msg,
  1908. icon: "none"
  1909. })
  1910. }
  1911. })
  1912. },
  1913. // 弹幕开关
  1914. switchDanmu(type) {
  1915. this.danmuFunInfo = {
  1916. time: new Date().getTime(),
  1917. event: 'switch',
  1918. switch: type,
  1919. area: this.danmuFunInfo.area
  1920. }
  1921. },
  1922. // 弹幕列表
  1923. getDanmuList() {
  1924. this.danmuFunInfo = {
  1925. time: new Date().getTime(),
  1926. event: 'clearDanmuList',
  1927. switch: this.danmuFunInfo.switch,
  1928. area: this.danmuFunInfo.area,
  1929. }
  1930. let patam = {
  1931. pageNum: 1,
  1932. pageSize: 300,
  1933. courseId: this.courseId,
  1934. videoId: this.pickCatalog.videoId,
  1935. openCommentStatus: 2, // 1-开启评论;2-开启弹幕;3-关闭
  1936. }
  1937. getComments(patam).then(res => {
  1938. let danmuList = []
  1939. if (res.code == 200 && res.data.list && res.data.list.length > 0) {
  1940. let arry = res.data.list.sort((a, b) => a.time - b.time)
  1941. danmuList = arry.map(item => ({
  1942. duration: this.danmuItem.duration,
  1943. id: item.commentId,
  1944. txt: item.content,
  1945. start: Number(item.time || 0) * 1000, // 单位:ms 毫秒
  1946. mode: item.mode || this.danmuItem.mode,
  1947. style: {
  1948. color: item.color || this.danmuItem.style.color,
  1949. fontSize: item.fontSize || this.danmuItem.style.fontSize,
  1950. padding: this.danmuItem.style.padding,
  1951. border: this.user.userId == item.userId ? item.color ?
  1952. `solid 1px ${item.color}` : this.danmuItem.style.border : 'none',
  1953. borderRadius: this.user.userId == item.userId ? this.danmuItem.style
  1954. .borderRadius : 0,
  1955. backgroundColor: this.user.userId == item.userId ? this.danmuItem.style
  1956. .backgroundColor : 'transparent'
  1957. }
  1958. }))
  1959. }
  1960. try {
  1961. this.danmuFunInfo = {
  1962. time: new Date().getTime(),
  1963. event: 'getDanmuList',
  1964. switch: this.danmuFunInfo.switch,
  1965. danmuList: danmuList,
  1966. area: this.danmuFunInfo.area
  1967. }
  1968. } catch (e) {
  1969. console.log('e', e)
  1970. }
  1971. })
  1972. },
  1973. //创建一个socket连接
  1974. initSocket() {
  1975. let userId = this.user.userId;
  1976. let that = this;
  1977. this.socket = uni.connectSocket({
  1978. // url: getApp().globalData.danmuWSUrl + "/ws/barrage/" + this.pickCatalog.videoId,
  1979. url: getApp().globalData.danmuWSUrl + "/app/webSocket/" + userId,
  1980. multiple: true,
  1981. // header: {
  1982. // 'token': uni.getStorageSync('AppToken')
  1983. // },
  1984. success: res => {
  1985. console.log('WebSocket连接已打开1!');
  1986. that.isSocketOpen = true
  1987. that.reOpenSocket = false
  1988. // 保持心跳
  1989. if (that.pingpangTimes) {
  1990. clearInterval(that.pingpangTimes)
  1991. that.pingpangTimes = null
  1992. }
  1993. that.pingpangTimes = setInterval(() => {
  1994. // let data={cmd:"heartbeat",userId: userId};
  1995. let data = {
  1996. userId: userId || '',
  1997. userType: 2, // 1-管理员,2-用户
  1998. courseId: that.courseId,
  1999. videoId: that.pickCatalog.videoId,
  2000. type: 1, // 评论类型 1:评论,2:回复,目前没有回复,默认传1就行了
  2001. cmd: 'heartbeat'
  2002. }
  2003. that.socket.send({
  2004. data: JSON.stringify(data),
  2005. success: () => {
  2006. // console.log('WebSocket发送心条数据!');
  2007. },
  2008. fail: () => {
  2009. that.isSocketOpen = false
  2010. }
  2011. });
  2012. }, 15000)
  2013. },
  2014. error: err => {
  2015. console.log(err)
  2016. },
  2017. })
  2018. this.socket.onMessage((res) => {
  2019. // console.log("收到消息parse",JSON.parse(res.data))
  2020. const redata = JSON.parse(res.data);
  2021. if (redata.cmd == "heartbeat") {
  2022. //心跳
  2023. // console.log("heartbeat")
  2024. } else if (redata.cmd == "sendMsg") {
  2025. that.isSend = true;
  2026. that.addMsg(redata);
  2027. }
  2028. })
  2029. //监听socket打开
  2030. this.socket.onOpen(() => {
  2031. console.log('WebSocket连接已打开2!');
  2032. that.isSocketOpen = true
  2033. that.reOpenSocket = false
  2034. that.isSend = true;
  2035. })
  2036. //监听socket关闭
  2037. this.socket.onClose(() => {
  2038. that.isSocketOpen = false
  2039. that.socket = null
  2040. console.log('WebSocket连接已关闭!', that.reOpenSocket);
  2041. if (that.pingpangTimes) {
  2042. clearInterval(that.pingpangTimes)
  2043. that.pingpangTimes = null
  2044. }
  2045. if (that.reOpenSocket) {
  2046. //重启
  2047. that.initSocket()
  2048. }
  2049. // that.msgEnd = true
  2050. })
  2051. //监听socket错误
  2052. this.socket.onError((err) => {
  2053. console.log("socket err:", err)
  2054. that.isSocketOpen = false
  2055. that.reOpenSocket = false
  2056. that.socket = null
  2057. if (that.pingpangTimes) {
  2058. clearInterval(that.pingpangTimes)
  2059. that.pingpangTimes = null
  2060. }
  2061. })
  2062. },
  2063. sendMsg(param, status) {
  2064. if (status == 1) {
  2065. this.isSend = true;
  2066. this.addMsg({
  2067. msg: param.content,
  2068. time: param.time
  2069. }, 2)
  2070. return
  2071. }
  2072. if (this.isSocketOpen) {
  2073. var userId = this.user.userId;
  2074. var data = {
  2075. userId: userId || '',
  2076. userType: 2, // 1-管理员,2-用户
  2077. courseId: this.courseId,
  2078. videoId: this.pickCatalog.videoId,
  2079. type: 1, // 评论类型 1:评论,2:回复,目前没有回复,默认传1就行了
  2080. msg: param.content,
  2081. cmd: 'sendMsg',
  2082. time: param.time,
  2083. fontSize: param.fontSize,
  2084. mode: param.mode,
  2085. color: param.color,
  2086. };
  2087. this.socket.send({
  2088. data: JSON.stringify(data),
  2089. success: () => {
  2090. console.log("发送成功", data)
  2091. this.$refs.danmuPopup.close()
  2092. this.isSend = false;
  2093. },
  2094. fail: () => {
  2095. console.log("发送失败")
  2096. }
  2097. });
  2098. }
  2099. },
  2100. // 收到消息
  2101. addMsg(data, type) {
  2102. let obj = {}
  2103. if (type == 2) {
  2104. obj = {
  2105. content: data.msg,
  2106. courseId: this.courseId,
  2107. type: 1,
  2108. userId: this.userId,
  2109. userType: 2,
  2110. videoId: this.pickCatalog.videoId,
  2111. nickName: '',
  2112. time: data.time,
  2113. fontSize: data.fontSize,
  2114. mode: data.mode,
  2115. color: data.color,
  2116. }
  2117. } else {
  2118. obj = {
  2119. content: data.msg,
  2120. courseId: this.courseId,
  2121. type: data.type,
  2122. userId: data.userId,
  2123. userType: data.userType,
  2124. videoId: this.pickCatalog.videoId,
  2125. nickName: data.nickName,
  2126. time: data.time,
  2127. fontSize: data.fontSize,
  2128. mode: data.mode,
  2129. color: data.color,
  2130. }
  2131. }
  2132. this.addDanmuMsg(obj)
  2133. },
  2134. addDanmuMsg(content) {
  2135. const id = content.userId + '_' + new Date().getTime()
  2136. const mystyle = {
  2137. color: content.color || this.danmuItem.style.color,
  2138. fontSize: content.fontSize || this.danmuItem.style.fontSize,
  2139. border: content.color ? `solid 1px ${content.color}` : this.danmuItem.style.border,
  2140. borderRadius: this.danmuItem.style.borderRadius,
  2141. padding: this.danmuItem.style.padding,
  2142. backgroundColor: this.danmuItem.style.backgroundColor
  2143. }
  2144. const otherstyle = {
  2145. color: content.color || this.danmuItem.style.color,
  2146. fontSize: content.fontSize || this.danmuItem.style.fontSize,
  2147. padding: this.danmuItem.style.padding,
  2148. }
  2149. const mode = content.mode || this.danmuItem.mode
  2150. const danmuItem = {
  2151. //发送弹幕
  2152. duration: content.duration ? content.duration : mode == 'scro11' ? this.danmuItem.duration : this
  2153. .danmuItem.duration,
  2154. id: content.id || id,
  2155. txt: content.content,
  2156. mode: mode,
  2157. style: this.user.userId == content.userId ? mystyle : otherstyle
  2158. }
  2159. this.danmuFunInfo = {
  2160. time: new Date().getTime(),
  2161. event: 'send',
  2162. switch: this.danmuFunInfo.switch,
  2163. danmuItem: danmuItem,
  2164. area: this.danmuFunInfo.area
  2165. }
  2166. },
  2167. },
  2168. created() {
  2169. let that = this;
  2170. uni.$on('backStudyTime', function (data) {
  2171. that.videoId = data.videoId;
  2172. that.pickCatalogIdx = that.getCatalogIdx();
  2173. that.pickCatalog = that.catalogueList[that.pickCatalogIdx];
  2174. that.pickCatalog.studyTime = data.studyTimes;
  2175. that.catalogueList[that.pickCatalogIdx] = that.pickCatalog;
  2176. that.packageJsonList = that.pickCatalog && that.pickCatalog.packageJson ? JSON.parse(that
  2177. .pickCatalog.packageJson) : []
  2178. that.pickCatalogMethod(that.pickCatalogIdx);
  2179. });
  2180. uni.$on('showPayTips', function (data) {
  2181. console.log("qxj showPayTips")
  2182. that.courseOrderId = data.courseOrderId;
  2183. //that.showPayTips=true;
  2184. that.$refs.popTip.open();
  2185. });
  2186. uni.$on('refreshUser', function (data) {
  2187. that.getUserInfo();
  2188. that.getCourseInfo();
  2189. });
  2190. uni.$on('pickCatalogAction', function (data) {
  2191. that.pickCatalogAction(data.index, data.type);
  2192. });
  2193. uni.$on('refreshCatalog', function (index) {
  2194. let catalog = that.catalogueList[index];
  2195. catalog.isBuy = true;
  2196. that.catalogueList[index] = catalog;
  2197. that.pickCatalogAction(index);
  2198. });
  2199. },
  2200. beforeDestroy() {
  2201. if (this.socket != null) {
  2202. this.socket.close()
  2203. }
  2204. if (this.pingpangTimes) {
  2205. clearInterval(this.pingpangTimes)
  2206. this.pingpangTimes = null
  2207. }
  2208. this.danmuFunInfo = {
  2209. time: new Date().getTime(),
  2210. event: '',
  2211. area: this.danmuFunInfo.area
  2212. }
  2213. },
  2214. destroyed() {
  2215. uni.$off("backStudyTime");
  2216. uni.$off("refreshUser");
  2217. uni.$off("showPayTips");
  2218. uni.$off("pickCatalogAction");
  2219. uni.$off("refreshTitle");
  2220. uni.$off("refreshCatalog");
  2221. // #ifdef APP-PLUS
  2222. uni.$off('getEventType');
  2223. // #endif
  2224. }
  2225. }
  2226. </script>
  2227. <script module="xgplayer" lang="renderjs">
  2228. // import Player from "xgplayer"
  2229. // import Mp4Plugin from "xgplayer-mp4"
  2230. // import 'xgplayer/dist/index.min.css';
  2231. import Danmu from 'xgplayer/es/plugins/danmu'
  2232. // import "xgplayer/es/plugins/danmu/index.css"
  2233. let xgPlayer
  2234. const openDanmu = '/static/images/other/course/danmukai.png';
  2235. const closeDanmu = '/static/images/other/course/danmukai_1.png';
  2236. export default {
  2237. data() {
  2238. return {
  2239. player: null,
  2240. ownerInstance: null,
  2241. ownerInstanceVideo: null,
  2242. isFullscreen: false,
  2243. isCSSFull: false,
  2244. lineName: "",
  2245. danmuInstance: null,
  2246. newDanmu: {
  2247. //发送弹幕
  2248. duration: 10000,
  2249. id: '',
  2250. txt: '',
  2251. mode: 'scroll',
  2252. style: {
  2253. color: '#ffffff',
  2254. fontSize: '18px',
  2255. border: 'solid 1px #ffffff',
  2256. borderRadius: '10px',
  2257. padding: '5px 11px',
  2258. backgroundColor: 'rgba(255, 255, 255, 0.1)'
  2259. }
  2260. },
  2261. isXGPause: true,
  2262. }
  2263. },
  2264. beforeDestroy() {
  2265. if (this.player) {
  2266. if (this.isFullscreen) {
  2267. if (this.isCSSFull) {
  2268. this.player.exitCssFullscreen()
  2269. } else {
  2270. this.player.exitFullscreen()
  2271. }
  2272. }
  2273. this.player.destroy() // 销毁播放器
  2274. this.player = null
  2275. }
  2276. },
  2277. methods: {
  2278. initJs(newValue, oldValue, ownerInstance) {
  2279. if (typeof window.Player === 'function') {
  2280. this.initPlayer(newValue, oldValue, ownerInstance)
  2281. } else {
  2282. // 动态引入较大类库避免影响页面展示
  2283. const script = document.createElement('script')
  2284. // view 层的页面运行在根目录
  2285. script.src = 'https://unpkg.byted-static.com/xgplayer/3.0.20/dist/index.min.js'
  2286. script.onload = this.initPlayer.bind(this, newValue, oldValue, ownerInstance)
  2287. document.head.appendChild(script)
  2288. const l_tag = document.createElement('link'); // 引入播放器css
  2289. l_tag.rel = 'stylesheet';
  2290. l_tag.href = 'https://unpkg.byted-static.com/xgplayer/3.0.20/dist/index.min.css';
  2291. document.body.appendChild(l_tag);
  2292. }
  2293. },
  2294. initPlayer(newValue, oldValue, ownerInstance) {
  2295. this.Events = window.Player.Events
  2296. if (!this.ownerInstance) this.ownerInstance = ownerInstance
  2297. let xgplayerOption = {
  2298. lang: 'zh',
  2299. url: "",
  2300. id: 'detail-video',
  2301. autoplay: false,
  2302. // height: uni.upx2px(422),
  2303. height: '100%',
  2304. width: '100%',
  2305. poster: "",
  2306. 'x5-video-player-type': 'h5', // 微信内置浏览器设置,防止被浏览器劫持
  2307. playsinline: true,
  2308. playbackRate: false,
  2309. ignores: ['volume', 'miniscreen', 'keyboard'],
  2310. plugins: [Danmu],
  2311. danmu: {
  2312. "comments": [],
  2313. "area": {
  2314. "start": 0,
  2315. "end": 0.25
  2316. },
  2317. "closeDefaultBtn": true,
  2318. "defaultOpen": true,
  2319. ext: {
  2320. channelSize: 30
  2321. }
  2322. },
  2323. startTime: 0, // 起始播放时间
  2324. fullscreenTarget: document.querySelector('.video-container'),
  2325. controls: {
  2326. root: document.getElementById('controls_new_root') // 指定播放器之外挂载dom
  2327. },
  2328. // icons: {
  2329. // openDanmu: openDanmu,
  2330. // closeDanmu: closeDanmu
  2331. // },
  2332. commonStyle: {
  2333. // 播放完成部分进度条底色
  2334. playedColor: '#FF233C',
  2335. cachedColor: 'transparent'
  2336. },
  2337. seekedStatus: 'auto',
  2338. disableGesture: true,
  2339. closeVideoTouch: true,
  2340. closeVideoDblclick: true,
  2341. closeVideoClick: false,
  2342. progress: {
  2343. isDraggingSeek: false,
  2344. isCloseClickSeek: true,
  2345. closeMoveSeek: true
  2346. },
  2347. fullscreen: {
  2348. useScreenOrientation: true,
  2349. lockOrientationType: 'landscape'
  2350. },
  2351. definition: {
  2352. defaultDefinition: "线路二"
  2353. }
  2354. }
  2355. xgplayerOption.url = newValue.lineTwo ? newValue.lineTwo : newValue.videoUrl
  2356. xgplayerOption.definition.defaultDefinition = newValue.lineTwo ? '线路二' : '线路一'
  2357. if (!xgplayerOption.url) return
  2358. xgplayerOption.poster = newValue.thumbnail
  2359. if (newValue.studyTime && newValue.seconds != newValue.studyTime) {
  2360. xgplayerOption.startTime = newValue.studyTime
  2361. }
  2362. if (newValue.isFast == 1) {
  2363. // 允许拖动进度条
  2364. xgplayerOption.progress.isCloseClickSeek = false
  2365. xgplayerOption.progress.closeMoveSeek = false
  2366. } else {
  2367. // 不允许拖动进度条
  2368. xgplayerOption.progress.isCloseClickSeek = true
  2369. xgplayerOption.progress.closeMoveSeek = true
  2370. }
  2371. if (this.player) {
  2372. // this.player.off()
  2373. this.player.playNext({
  2374. url: newValue.lineTwo ? newValue.lineTwo : newValue.videoUrl,
  2375. startTime: newValue.startTime || 0,
  2376. poster: xgplayerOption.thumbnail || '',
  2377. ignores: xgplayerOption.ignores,
  2378. progress: xgplayerOption.progress,
  2379. definition: xgplayerOption.definition,
  2380. })
  2381. } else {
  2382. this.player = new Player(xgplayerOption);
  2383. this.danmuInstance = this.player.getPlugin('danmu')
  2384. this.progressMove(xgplayerOption)
  2385. }
  2386. if (newValue.isFast == 1) {
  2387. this.player.getPlugin('progress').show()
  2388. } else {
  2389. this.player.getPlugin('progress').hide()
  2390. }
  2391. let lines = []
  2392. if (newValue.lineOne) {
  2393. lines.push({
  2394. name: '线路一',
  2395. definition: '线路一',
  2396. url: newValue.lineOne
  2397. })
  2398. }
  2399. if (newValue.lineTwo) {
  2400. lines.push({
  2401. name: '线路二',
  2402. definition: '线路二',
  2403. url: newValue.lineTwo
  2404. })
  2405. }
  2406. if (newValue.lineThree) {
  2407. lines.push({
  2408. name: '线路三',
  2409. definition: '线路三',
  2410. url: newValue.lineThree
  2411. })
  2412. }
  2413. this.player.emit('resourceReady', lines)
  2414. this.rjsPlayFun(xgplayerOption)
  2415. },
  2416. progressMove(data) {
  2417. const Events = this.Events
  2418. this.player.on(Events.PlAY, () => {
  2419. this.isXGPause = false
  2420. this.ownerInstance.callMethod("changeCountdowning", {
  2421. countdowning: true,
  2422. isXGPause: this.isXGPause
  2423. })
  2424. })
  2425. this.player.on(Events.PLAYING, () => {
  2426. // console.log("===播放Events.PLAYING")
  2427. this.isXGPause = false
  2428. this.ownerInstance.callMethod("changeCountdowning", {
  2429. countdowning: true,
  2430. isXGPause: this.isXGPause
  2431. })
  2432. })
  2433. this.player.on(Events.WAITING, () => {
  2434. this.ownerInstance.callMethod("changeCountdowning", {
  2435. countdowning: false,
  2436. isXGPause: this.isXGPause
  2437. })
  2438. })
  2439. this.player.on(Events.PAUSE, () => {
  2440. // console.log("===暂停Events.PAUSE")
  2441. this.isXGPause = true
  2442. this.ownerInstance.callMethod("changeCountdowning", {
  2443. countdowning: false,
  2444. isXGPause: this.isXGPause
  2445. })
  2446. })
  2447. this.player.on(Events.ERROR, (error) => {
  2448. console.log('video error:', error)
  2449. this.ownerInstance.callMethod("changeCountdowning", {
  2450. countdowning: false,
  2451. isXGPause: this.isXGPause
  2452. })
  2453. })
  2454. // 监听用户的播放进度
  2455. this.player.on(Events.TIME_UPDATE, () => {
  2456. this.ownerInstance.callMethod("onTimeUpdate", {
  2457. time: this.player.currentTime
  2458. });
  2459. })
  2460. this.player.on(Events.ENDED, () => {
  2461. this.ownerInstance.callMethod("changeCountdowning", {
  2462. countdowning: false,
  2463. isXGPause: this.isXGPause
  2464. })
  2465. this.ownerInstance.callMethod("endedPlayNext")
  2466. })
  2467. this.player.on(Events.FULLSCREEN_CHANGE, (isFullscreen) => {
  2468. if (this.isFullscreen == isFullscreen) return
  2469. this.isFullscreen = isFullscreen
  2470. plus.screen.lockOrientation('landscape')
  2471. this.ownerInstance.callMethod("onFullscreenChange", {
  2472. isFullscreen: isFullscreen
  2473. })
  2474. })
  2475. this.player.on(Events.CSS_FULLSCREEN_CHANGE, (isFullscreen) => {
  2476. if (this.isFullscreen == isFullscreen) return
  2477. this.isCSSFull = true
  2478. this.isFullscreen = isFullscreen
  2479. this.ownerInstance.callMethod("onFullscreenChange", {
  2480. isFullscreen: isFullscreen
  2481. })
  2482. })
  2483. // 清晰度发生变化
  2484. this.player.on(Events.DEFINITION_CHANGE, (res) => {
  2485. if (this.lineName == res.to.name) return
  2486. this.lineName = res.to.name
  2487. this.ownerInstance.callMethod("changeLine", {
  2488. url: res.to.url
  2489. })
  2490. })
  2491. },
  2492. rjsPlayFun(xgplayerOption) {
  2493. this.ownerInstance.callMethod("playFun", {
  2494. time: xgplayerOption.startTime
  2495. })
  2496. },
  2497. changeVideo(newValue, oldValue, ownerInstance) {
  2498. if (!this.ownerInstanceVideo) this.ownerInstanceVideo = ownerInstance
  2499. if (this.player) {
  2500. if (newValue.status.indexOf('play') > -1) {
  2501. const tempAudioDuration = newValue.tempAudioDuration
  2502. const flag = newValue.tempAudioDuration != newValue.studyTime
  2503. if (flag) {
  2504. this.player.seek(tempAudioDuration)
  2505. this.player.on(this.Events.SEEKED, () => {
  2506. setTimeout(() => {
  2507. this.player.play()
  2508. }, 200)
  2509. })
  2510. } else {
  2511. setTimeout(() => {
  2512. this.player.play()
  2513. }, 200)
  2514. }
  2515. } else if (newValue.status.indexOf('pause') > -1) {
  2516. this.player.pause()
  2517. }
  2518. }
  2519. },
  2520. handleExitFullscreen(newValue, oldValue, ownerInstance) {
  2521. // 退出全屏
  2522. if (this.player && this.isFullscreen && newValue.indexOf('yes') > -1) {
  2523. if (this.isCSSFull) {
  2524. this.player.exitCssFullscreen()
  2525. } else {
  2526. this.player.exitFullscreen()
  2527. }
  2528. }
  2529. },
  2530. // 发送弹幕
  2531. danmuFun(newValue, oldValue, ownerInstance) {
  2532. if (oldValue && newValue.event == oldValue.event && newValue.time == oldValue.time) {
  2533. return
  2534. }
  2535. if (newValue.event == 'send') {
  2536. // 发送弹幕
  2537. // console.log("===========发送弹幕",this.danmuInstance)
  2538. this.danmuInstance.sendComment(newValue.danmuItem)
  2539. } else if (newValue.event == 'switch') {
  2540. // 弹幕开关
  2541. // console.log("===========弹幕开关",newValue.switch)
  2542. if (newValue.switch == 1) {
  2543. this.danmuInstance.start()
  2544. } else {
  2545. this.danmuInstance.stop()
  2546. }
  2547. } else if (newValue.event == "getDanmuList") {
  2548. // console.log("===========弹幕列表")
  2549. this.danmuInstance.updateComments(newValue.danmuList, true)
  2550. } else if (newValue.event == "clearDanmuList") {
  2551. // console.log("===========清除列表")
  2552. this.danmuInstance.clear()
  2553. } else if (newValue.event == "setArea") {
  2554. this.danmuInstance.setArea({
  2555. start: 0,
  2556. end: newValue.area,
  2557. })
  2558. }
  2559. }
  2560. }
  2561. }
  2562. </script>
  2563. <style>
  2564. @import './danmu.css';
  2565. </style>
  2566. <style lang="scss" scoped>
  2567. @mixin u-flex($flexD, $alignI, $justifyC) {
  2568. display: flex;
  2569. flex-direction: $flexD;
  2570. align-items: $alignI;
  2571. justify-content: $justifyC;
  2572. }
  2573. .es-mr-24px {
  2574. margin-right: 24px;
  2575. }
  2576. .coloritem {
  2577. height: 24px;
  2578. width: 24px;
  2579. margin-bottom: 12px;
  2580. border-radius: 5px;
  2581. }
  2582. .danmu-controls {
  2583. background-color: #F5F7FA;
  2584. overflow: hidden;
  2585. font-family: PingFang SC, PingFang SC;
  2586. font-weight: 400;
  2587. font-size: 12px;
  2588. color: #999999;
  2589. padding: 0 10px;
  2590. border-radius: 50px 0 0 50px;
  2591. height: 28px;
  2592. overflow: hidden;
  2593. box-sizing: border-box;
  2594. &-r {
  2595. padding: 0 10px;
  2596. border-radius: 0 50px 50px 0;
  2597. height: 28px;
  2598. overflow: hidden;
  2599. box-sizing: border-box;
  2600. background-color: #fff;
  2601. image {
  2602. height: 20px;
  2603. width: 20px;
  2604. }
  2605. }
  2606. }
  2607. ::v-deep {
  2608. .danmu-switch-open,
  2609. .danmu-switch-closed {
  2610. height: 25px;
  2611. width: 25px;
  2612. }
  2613. }
  2614. .xgplayer-switch {
  2615. background-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, .37), rgba(0, 0, 0, .75), rgba(0, 0, 0, .75));
  2616. }
  2617. .danmuPopup {
  2618. background-color: #fff;
  2619. &-head {
  2620. width: 100%;
  2621. padding: 10px;
  2622. box-sizing: border-box;
  2623. overflow: hidden;
  2624. @include u-flex(row, center, flex-start);
  2625. .danmu-icon {
  2626. height: 24px;
  2627. width: 24px;
  2628. margin-right: 12px;
  2629. }
  2630. }
  2631. &-input {
  2632. flex: 1;
  2633. height: 35px;
  2634. }
  2635. &-send {
  2636. flex-shrink: 0;
  2637. height: 35px;
  2638. display: flex;
  2639. align-items: center;
  2640. justify-content: center;
  2641. padding: 5px 15px;
  2642. box-sizing: border-box;
  2643. background: #FF233C !important;
  2644. border-radius: 22px;
  2645. font-family: PingFang SC, PingFang SC;
  2646. font-weight: 500;
  2647. font-size: 15px;
  2648. color: #fff !important;
  2649. margin-left: 12px;
  2650. &::after {
  2651. border: none;
  2652. }
  2653. }
  2654. &-con {
  2655. background-color: #F5F7FA;
  2656. padding: 24px 12px 48px 12px;
  2657. font-family: PingFang SC, PingFang SC;
  2658. font-weight: 400;
  2659. font-size: 14px;
  2660. color: #757575;
  2661. }
  2662. }
  2663. .content {
  2664. background: #f7f7f7;
  2665. }
  2666. .cousrseImg {
  2667. position: absolute;
  2668. top: 0;
  2669. left: 0;
  2670. width: 100%;
  2671. height: 422rpx;
  2672. background-color: #000;
  2673. image {
  2674. width: 100%;
  2675. height: 100%;
  2676. }
  2677. }
  2678. .video-box {
  2679. width: 100%;
  2680. height: 422rpx;
  2681. overflow: hidden;
  2682. position: relative;
  2683. // padding-top: var(--status-bar-height);
  2684. }
  2685. .scroll-Y {
  2686. font-family: PingFang SC, PingFang SC;
  2687. font-weight: 400;
  2688. font-size: 28rpx;
  2689. color: #222222;
  2690. }
  2691. .horizontal {
  2692. width: 130px;
  2693. height: 150px;
  2694. position: absolute;
  2695. bottom: 50px;
  2696. left: 20px;
  2697. z-index: 999;
  2698. display: flex;
  2699. flex-direction: column;
  2700. align-items: center;
  2701. justify-content: flex-end;
  2702. background-color: transparent;
  2703. .es-w-40 {
  2704. width: 20px;
  2705. }
  2706. .es-h-40 {
  2707. height: 20px;
  2708. }
  2709. .goods {
  2710. width: 120px;
  2711. height: 140px;
  2712. border-radius: 10px;
  2713. background-color: rgba(255, 255, 255, 0.4);
  2714. overflow: hidden;
  2715. display: flex;
  2716. flex-direction: column;
  2717. align-items: center;
  2718. justify-content: center;
  2719. }
  2720. .goodsimg {
  2721. width: 100px;
  2722. height: 100px;
  2723. border-radius: 10px;
  2724. }
  2725. .goodsname {
  2726. width: 100px;
  2727. font-size: 12px;
  2728. box-sizing: border-box;
  2729. padding-top: 7px;
  2730. verflow: hidden;
  2731. word-break: break-all;
  2732. }
  2733. }
  2734. .rotate {
  2735. transform: rotate(-180deg);
  2736. }
  2737. .status_bar {
  2738. background-color: #000;
  2739. }
  2740. .back-img {
  2741. width: 25px;
  2742. height: 25px;
  2743. position: absolute;
  2744. top: 10px;
  2745. left: 34rpx;
  2746. z-index: 99;
  2747. }
  2748. .audiobox {
  2749. width: 100%;
  2750. height: 422rpx;
  2751. position: absolute;
  2752. top: 0;
  2753. left: 0;
  2754. background-color: #333;
  2755. z-index: 9990;
  2756. font-family: PingFang SC, PingFang SC;
  2757. font-weight: 400;
  2758. font-size: 26rpx;
  2759. color: #fff;
  2760. &-video {
  2761. background-color: rgba(255, 255, 255, 0.3);
  2762. padding: 8rpx 20rpx;
  2763. border-radius: 50rpx;
  2764. position: absolute;
  2765. bottom: 40rpx;
  2766. left: 50%;
  2767. transform: translateX(-50%);
  2768. z-index: 9991;
  2769. text-align: center;
  2770. }
  2771. &-title {
  2772. position: absolute;
  2773. top: 0;
  2774. left: 0;
  2775. z-index: 9991;
  2776. padding: 30rpx 40rpx;
  2777. width: 100%;
  2778. box-sizing: border-box;
  2779. background: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
  2780. display: flex;
  2781. align-items: center;
  2782. .back {
  2783. width: 50rpx;
  2784. height: 50rpx;
  2785. margin-right: 15rpx;
  2786. flex-shrink: 0;
  2787. }
  2788. }
  2789. &-time {
  2790. margin-top: 18rpx;
  2791. font-size: 24rpx;
  2792. }
  2793. }
  2794. .scroll-Y {
  2795. font-family: PingFang SC, PingFang SC;
  2796. font-weight: 400;
  2797. font-size: 28rpx;
  2798. color: #222222;
  2799. }
  2800. .video-info {
  2801. padding: 30rpx 24rpx;
  2802. background-color: #fff;
  2803. &-header {
  2804. width: 100%;
  2805. @include u-flex(row, center, space-between);
  2806. }
  2807. &-headerl {
  2808. flex: 1;
  2809. @include u-flex(row, center, flex-start);
  2810. font-weight: 600;
  2811. font-size: 40rpx;
  2812. color: rgba(0, 0, 0, 0.85);
  2813. overflow: hidden;
  2814. image {
  2815. flex-shrink: 0;
  2816. width: 88rpx;
  2817. height: 88rpx;
  2818. margin-right: 28rpx;
  2819. background: #F5F7FA;
  2820. border-radius: 50%;
  2821. overflow: hidden;
  2822. }
  2823. }
  2824. .follow-btn {
  2825. @include u-flex(row, center, center);
  2826. height: 56rpx;
  2827. min-width: 154rpx;
  2828. padding: 0 23rpx;
  2829. background: #FF233C;
  2830. border-radius: 28rpx 28rpx 28rpx 28rpx;
  2831. color: #FFFFFF;
  2832. font-size: 28rpx;
  2833. image {
  2834. height: 32rpx;
  2835. width: 32rpx;
  2836. margin-right: 6rpx;
  2837. }
  2838. }
  2839. &-voice {
  2840. width: 100%;
  2841. padding: 24rpx 20rpx 38rpx 28rpx;
  2842. margin-top: 26rpx;
  2843. background: #F5F7FA;
  2844. border-radius: 16rpx 16rpx 16rpx 16rpx;
  2845. box-sizing: border-box;
  2846. image {
  2847. width: 48rpx;
  2848. height: 48rpx;
  2849. }
  2850. &-l {
  2851. @include u-flex(row, center, flex-start);
  2852. image {
  2853. margin-right: 20rpx;
  2854. }
  2855. }
  2856. }
  2857. &-voicebox1 {
  2858. @include u-flex(row, center, space-between);
  2859. }
  2860. &-voicebox2 {
  2861. padding: 20rpx 0;
  2862. @include u-flex(row, center, space-between);
  2863. font-weight: 400;
  2864. font-size: 26rpx;
  2865. color: #757575;
  2866. .boTextClass {
  2867. font-weight: 400;
  2868. font-size: 32rpx;
  2869. color: rgba(0, 0, 0, 0.45);
  2870. }
  2871. }
  2872. ::v-deep .uni-collapse-item__title-arrow {
  2873. margin-right: -8rpx;
  2874. }
  2875. .opacity {
  2876. position: relative !important;
  2877. opacity: 1 !important;
  2878. z-index: 1 !important;
  2879. }
  2880. &-desc {
  2881. // margin-bottom: 52rpx;
  2882. font-weight: 400;
  2883. font-size: 32rpx;
  2884. color: rgba(0, 0, 0, 0.65);
  2885. line-height: 44rpx;
  2886. word-break: break-all;
  2887. overflow: hidden;
  2888. position: absolute;
  2889. opacity: 0;
  2890. z-index: -1;
  2891. .desc-image {
  2892. height: 60rpx;
  2893. width: 100%;
  2894. position: absolute;
  2895. bottom: 0;
  2896. left: 0;
  2897. }
  2898. }
  2899. .text-clamp {
  2900. display: -webkit-box;
  2901. -webkit-line-clamp: 2;
  2902. /* 显示的行数 */
  2903. -webkit-box-orient: vertical;
  2904. /* 内容会垂直堆叠 */
  2905. overflow: hidden;
  2906. /* 隐藏溢出的内容 */
  2907. text-overflow: ellipsis;
  2908. /* 当内容被裁剪时显示省略号 */
  2909. }
  2910. &-footer {
  2911. @include u-flex(row, center, space-between);
  2912. color: #757575;
  2913. font-weight: 400;
  2914. font-size: 24rpx;
  2915. view {
  2916. width: 128rpx;
  2917. height: 104rpx;
  2918. @include u-flex(column, center, center);
  2919. }
  2920. image {
  2921. width: 48rpx;
  2922. height: 48rpx;
  2923. margin-bottom: 8rpx;
  2924. }
  2925. }
  2926. }
  2927. .box-header {
  2928. margin-bottom: 24rpx;
  2929. padding: 0 24rpx;
  2930. @include u-flex(row, center, space-between);
  2931. font-weight: 500;
  2932. font-size: 24rpx;
  2933. color: #999999;
  2934. .kechengLeftClass {
  2935. @include u-flex(row, center, center);
  2936. }
  2937. &-title {
  2938. font-weight: 600;
  2939. font-size: 36rpx;
  2940. color: #222222;
  2941. }
  2942. .kechengIconClass {
  2943. width: 30rpx;
  2944. height: 30rpx;
  2945. margin-right: 12rpx
  2946. }
  2947. &-r {
  2948. @include u-flex(row, center, center);
  2949. image {
  2950. width: 16rpx;
  2951. height: 16rpx;
  2952. margin-left: 10rpx;
  2953. }
  2954. }
  2955. }
  2956. .therapy {
  2957. background-color: #fff;
  2958. padding-left: 24rpx;
  2959. padding-bottom: 20rpx;
  2960. &-scrollx {
  2961. white-space: nowrap;
  2962. width: 100%;
  2963. // margin-left: 24rpx;
  2964. }
  2965. &-scrollitem {
  2966. display: inline-block;
  2967. overflow: hidden;
  2968. background: #F5F7FA;
  2969. padding: 10rpx;
  2970. margin-right: 20rpx;
  2971. border-radius: 10rpx;
  2972. overflow: hidden;
  2973. border: 1rpx solid #F5F7FA;
  2974. box-sizing: border-box;
  2975. position: relative;
  2976. overflow: hidden;
  2977. image {
  2978. width: 200rpx;
  2979. height: 200rpx;
  2980. border-radius: 10rpx;
  2981. background-color: #F5F7FA;
  2982. }
  2983. &::after {
  2984. content: '查看详情';
  2985. background-color: #F5F7FA;
  2986. position: absolute;
  2987. top: 0;
  2988. left: 0;
  2989. font-weight: 400;
  2990. font-size: 20rpx;
  2991. padding: 4rpx 14rpx;
  2992. border-radius: 10rpx 0 10rpx 0;
  2993. color: #757575;
  2994. }
  2995. }
  2996. &-active {
  2997. background: #fff;
  2998. border: 1rpx solid #FF233C;
  2999. .therapy-goodsname {
  3000. color: #FF233C !important;
  3001. }
  3002. &::after {
  3003. background: #fff;
  3004. color: #FF233C !important;
  3005. }
  3006. }
  3007. &-goodsname {
  3008. margin-top: 6rpx;
  3009. width: 200rpx;
  3010. min-height: 64rpx;
  3011. font-size: 24rpx;
  3012. color: #757575;
  3013. word-break: break-all;
  3014. white-space: normal;
  3015. }
  3016. }
  3017. .video-directory {
  3018. background-color: #fff;
  3019. padding-top: 24rpx;
  3020. margin-top: 20rpx;
  3021. &-scrollx {
  3022. white-space: nowrap;
  3023. width: calc(100% - 24rpx);
  3024. margin-left: 24rpx;
  3025. }
  3026. &-scrollitem {
  3027. display: inline-block;
  3028. width: 280rpx;
  3029. height: 192rpx;
  3030. background: #F5F5F5;
  3031. border-radius: 20rpx;
  3032. margin-right: 24rpx;
  3033. padding: 24rpx;
  3034. box-sizing: border-box;
  3035. position: relative;
  3036. margin-bottom: 20rpx;
  3037. }
  3038. .freeflag {
  3039. min-width: 132rpx;
  3040. height: 44rpx;
  3041. padding: 0 12rpx;
  3042. text-align: center;
  3043. position: absolute;
  3044. right: 0;
  3045. top: 0;
  3046. font-size: 28rpx;
  3047. color: #FFFFFF;
  3048. border-radius: 0rpx 20rpx 0rpx 20rpx;
  3049. &-free {
  3050. // background: url('@/static/image/hall/free_lable_bg.png') no-repeat right / 100% 32rpx;
  3051. background-color: #FF233C;
  3052. }
  3053. &-member {
  3054. // background: url('@/static/image/hall/member_label_bg.png') no-repeat right / 100% 32rpx;
  3055. background-color: #FFB205;
  3056. }
  3057. }
  3058. &-num {
  3059. font-weight: 600;
  3060. font-size: 32rpx;
  3061. @include u-flex(row, center, flex-start);
  3062. margin-bottom: 12rpx;
  3063. image,
  3064. .empty {
  3065. width: 32rpx;
  3066. height: 32rpx;
  3067. margin-left: 10rpx;
  3068. }
  3069. }
  3070. &-title {
  3071. @include u-flex(row, center, space-between);
  3072. font-size: 32rpx;
  3073. color: #757575;
  3074. line-height: 44rpx;
  3075. word-break: break-all;
  3076. white-space: normal;
  3077. .imagebox {
  3078. flex-shrink: 0;
  3079. margin: 0 8rpx;
  3080. position: relative;
  3081. image {
  3082. width: 92rpx;
  3083. height: 72rpx;
  3084. border-radius: 8rpx 8rpx 8rpx 8rpx;
  3085. overflow: hidden;
  3086. }
  3087. }
  3088. }
  3089. .mask {
  3090. width: 92rpx;
  3091. height: 72rpx;
  3092. border-radius: 8rpx 8rpx 8rpx 8rpx;
  3093. background: rgba(0, 0, 0, 0.2);
  3094. overflow: hidden;
  3095. position: absolute;
  3096. top: 0;
  3097. left: 0;
  3098. z-index: 1;
  3099. @include u-flex(row, center, center);
  3100. image {
  3101. width: 24rpx;
  3102. height: 24rpx;
  3103. }
  3104. }
  3105. .active-scrollitem {
  3106. background: #FFF0F2FF;
  3107. color: #FF233CFF;
  3108. .video-directory-title {
  3109. color: #FF233CFF;
  3110. }
  3111. }
  3112. }
  3113. .video-comment {
  3114. background-color: #fff;
  3115. padding-top: 12rpx;
  3116. margin-top: 20rpx;
  3117. }
  3118. .hall-box {
  3119. @include u-flex(row, center, flex-start);
  3120. flex-wrap: wrap;
  3121. margin: 0 -18rpx -18rpx 0;
  3122. padding: 12rpx 24rpx 24rpx 24rpx;
  3123. .gapitem {
  3124. margin: 0 18rpx 18rpx 0;
  3125. }
  3126. }
  3127. .popbox {
  3128. background-color: #fff;
  3129. position: relative;
  3130. .box-header {
  3131. padding-top: 12rpx;
  3132. padding-bottom: 12rpx;
  3133. box-sizing: border-box;
  3134. background-color: #fff;
  3135. }
  3136. .popbox-body {
  3137. .comment,
  3138. .directoryinfo {
  3139. padding: 24rpx;
  3140. }
  3141. }
  3142. .search-box {
  3143. @include u-flex(row, center, space-between);
  3144. padding: 10px 24rpx;
  3145. .search {
  3146. padding: 0;
  3147. flex: 1;
  3148. image {
  3149. width: 24rpx;
  3150. height: 24rpx;
  3151. padding-left: 16rpx;
  3152. }
  3153. }
  3154. }
  3155. }
  3156. .search-btn {
  3157. flex-shrink: 0;
  3158. height: 68rpx;
  3159. padding: 0 42rpx;
  3160. margin-left: 20rpx;
  3161. background: #eef5fd;
  3162. border-radius: 34rpx 34rpx 34rpx 34rpx;
  3163. font-family: PingFang SC, PingFang SC;
  3164. font-weight: 600;
  3165. font-size: 26rpx;
  3166. color: #FF233C;
  3167. text-align: center;
  3168. line-height: 68rpx;
  3169. }
  3170. .comment-inputbox {
  3171. @include u-flex(row, center, space-between);
  3172. padding: 28rpx 24rpx;
  3173. box-sizing: border-box;
  3174. background: #FFFFFF;
  3175. .inputbox {
  3176. flex: 1;
  3177. height: 72rpx;
  3178. padding-left: 24rpx;
  3179. background: #F5F7FA;
  3180. border-radius: 36rpx 36rpx 36rpx 36rpx;
  3181. font-family: PingFang SC, PingFang SC;
  3182. font-weight: 400;
  3183. font-size: 26rpx;
  3184. color: #999999;
  3185. line-height: 72rpx;
  3186. }
  3187. .release-btn {
  3188. @extend .search-btn;
  3189. }
  3190. }
  3191. .audio {
  3192. display: flex;
  3193. flex-direction: row;
  3194. align-items: center;
  3195. font-family: PingFang SC, PingFang SC;
  3196. font-weight: 500;
  3197. font-size: 24rpx;
  3198. color: #757575;
  3199. &-play {
  3200. display: flex;
  3201. flex-direction: row;
  3202. align-items: center;
  3203. }
  3204. &-icon {
  3205. width: 48rpx;
  3206. height: 48rpx;
  3207. }
  3208. &-slider {
  3209. flex: 1;
  3210. }
  3211. &-time {
  3212. flex-shrink: 0;
  3213. }
  3214. }
  3215. .vipCourseBtn {
  3216. background: #1B1F22;
  3217. border-radius: 46rpx;
  3218. border: 1px solid #FFDAA3;
  3219. color: #FFDAA3;
  3220. width: calc(33.33333% - 46.6666rpx);
  3221. }
  3222. .vipAc {
  3223. background: linear-gradient(90deg, #FFE0B2, #F8BA8B);
  3224. border-radius: 46rpx;
  3225. border: 1px solid #FFDAA3;
  3226. color: #1B1F22;
  3227. }
  3228. .privilegeBox {
  3229. background-color: #171a1d;
  3230. box-sizing: border-box;
  3231. }
  3232. .primenu-box {
  3233. border-radius: 16rpx;
  3234. margin-top: 0rpx;
  3235. padding: 10rpx 20rpx;
  3236. }
  3237. .content-inner {
  3238. display: flex;
  3239. flex-wrap: wrap;
  3240. min-height: 310rpx;
  3241. }
  3242. .content-inner .item {
  3243. width: calc(33.3333333%);
  3244. height: 150rpx;
  3245. display: flex;
  3246. flex-direction: column;
  3247. align-items: center;
  3248. justify-content: center;
  3249. margin-top: 0rpx;
  3250. }
  3251. .content-inner .item .img {
  3252. width: 84rpx;
  3253. height: 84rpx;
  3254. margin-bottom: 8rpx;
  3255. }
  3256. .content-inner .item .label {
  3257. font-size: 32rpx;
  3258. color: #83878A;
  3259. }
  3260. .vipMethodItem {
  3261. border-radius: 10rpx;
  3262. width: calc(100%);
  3263. height: 70rpx;
  3264. color: #FDD8A1;
  3265. }
  3266. .payTypeItem {
  3267. background-color: #1B1F22;
  3268. border: 1px solid #fff;
  3269. border-radius: 10rpx;
  3270. width: calc(50% - 15rpx);
  3271. height: 94rpx;
  3272. }
  3273. .circle {
  3274. border: 1px solid #FDD8A1;
  3275. }
  3276. .pt_ac {
  3277. border: 1px solid #FDD8A1;
  3278. }
  3279. .slider-box {
  3280. flex: 1
  3281. }
  3282. .dataNumTextClass {
  3283. font-weight: 400;
  3284. font-size: 32rpx;
  3285. color: rgba(0, 0, 0, 0.45);
  3286. }
  3287. .bottomCommentInputClass {
  3288. position: fixed;
  3289. left: 0;
  3290. right: 0;
  3291. z-index: 900;
  3292. bottom: 0;
  3293. width: 100%;
  3294. height: 160rpx;
  3295. background-color: #fff;
  3296. padding: 0 24rpx 10rpx;
  3297. display: flex;
  3298. align-items: center;
  3299. padding-bottom: constant(safe-area-inset-bottom);
  3300. padding-bottom: env(safe-area-inset-bottom);
  3301. .input-box {
  3302. flex: 1;
  3303. background-color: #f5f5f5;
  3304. height: 96rpx;
  3305. border-radius: 48rpx;
  3306. padding: 0 30rpx;
  3307. font-size: 32rpx;
  3308. margin-right: 24rpx;
  3309. }
  3310. .send-btn {
  3311. width: 160rpx;
  3312. height: 96rpx;
  3313. background: linear-gradient(135deg, #FF5267 0%, #FF233C 100%);
  3314. border-radius: 48rpx;
  3315. font-weight: 600;
  3316. font-size: 40rpx;
  3317. text-align: center;
  3318. color: #FFFFFF;
  3319. line-height: 96rpx;
  3320. margin-right: 25rpx;
  3321. }
  3322. .icon-btn {
  3323. display: flex;
  3324. flex-direction: column;
  3325. align-items: center;
  3326. justify-content: center;
  3327. image {
  3328. width: 52rpx;
  3329. height: 52rpx;
  3330. }
  3331. text {
  3332. font-weight: 600;
  3333. font-size: 32rpx;
  3334. color: #222222;
  3335. margin-top: 4rpx;
  3336. }
  3337. }
  3338. }
  3339. </style>