info.vue 79 KB

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