info.vue 82 KB

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