info.vue 81 KB

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