123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916 |
- <template>
- <view class="content">
- <view :style="{height: statusBarHeight+'px',width: '100%',background:'#000'}"></view>
- <view class="video-box">
- <!-- 返回按钮 -->
- <!-- #ifdef APP-PLUS -->
- <image class="back-img" @click.stop="$navBack()" src="@/static/image/hall/back_white_icon.png"></image>
- <!-- #endif -->
- <view class="cousrseImg x-c" v-show="!pickCatalog.url">
- <u-loading-icon size="30"></u-loading-icon>
- <!-- <image :src="data.imgUrl" mode="aspectFit"></image> -->
- </view>
- <!-- 视频 -->
- <view class="video-container"
- style="position: relative;height: 422rpx;"
- :videoPlayStatus="videoPlayStatus"
- :change:videoPlayStatus="xgplayer.changeVideo"
- :danmuFunInfo="danmuFunInfo"
- :change:danmuFunInfo="xgplayer.danmuFun">
- <view id="detail-video"
- :pickCatalog="pickCatalog"
- :change:pickCatalog="xgplayer.initJs"
- :exitFullscreen="exitFullscreen"
- :change:exitFullscreen="xgplayer.handleExitFullscreen"
- @click.stop="clickVideo"
- ></view>
-
- <image class="back-img" v-if="fullScreen" @click.stop="videoback" src="@/static/image/hall/back_white_icon.png"></image>
- <!-- 疗法 -->
- <view v-if="showTherapy&&fullScreen" class="horizontal" @tap.stop>
- <view class="goods" @tap.stop="goToPro(showTherapyItem.packageId)">
- <image :src="showTherapyItem.imgUrl" mode="aspectFill" class="goodsimg"></image>
- <view class="goodsname textOne">{{showTherapyItem.packageName}}</view>
- </view>
- <view style="width: 20px;height: 20px;position: absolute;right:0rpx;top:0rpx;z-index:999">
- <image style="width: 20px;height: 20px" src="@/static/images/close40.png"
- @tap.stop="closeTherapy"></image>
- </view>
- </view>
- <view class="audiobox es es-ver es-ac es-pc" v-if="showAudio" @click.stop>
-
- <view class="audiobox-title">
- <image class="back" @click.stop="$navBack()" src="@/static/image/hall/back_white_icon.png"></image>
- <view class="textOne">
- {{catalogueList[pickCatalogIdx]&&catalogueList[pickCatalogIdx].title}}
- </view>
- </view>
- <view class="es es-ver es-ac es-pc">
- <view class="es es-ac es-pc">
- <image class="es-icon-52 es-icon-play-last"
- src="/static/images/other/video/play-last.png" @tap="endedPlayPrev()"></image>
- <image class="es-icon-88 es-ml-50 es-mr-50"
- :src="audioPlayIng?'/static/images/other/video/play-stop.png':'/static/image/hall/video_icon.png'" @tap="playAudioAction()"></image>
- <image class="es-icon-52 es-icon-play-next"
- src="/static/images/other/video/play-next.png" @tap="endedPlayNext('click')"></image>
- </view>
- <view class="audiobox-time">{{$formatSeconds(tempAudioDuration)}} / {{$formatSeconds(pickCatalog.seconds)}}</view>
- </view>
- <view class="audiobox-video x-ac" @tap="backPlayVideo">返回视频</view>
- </view>
- <!-- 视频控制栏 -->
- <view class="es"
- :style="{paddingLeft:fullScreen ? statusBarHeight+'px': 0,display: isPause||isClickVideo?'flex':'none'}"
- style="width: 100%;height: 48px;position: absolute;z-index: 999;bottom: 0;left: 0;background: transparent;">
- <view class="xgplayer" id="controls_new_root" style="flex: 1;background:transparent;"></view>
- <view v-if="fullScreen" class="xgplayer-switch xgplayer-icon es es-ac es-pc" style="padding: 0 8px 8px 8px;">
- <view class="danmu-controls es es-ac es-pc" @click="openDanmu">
- 点我发弹幕
- </view>
- <view class="danmu-controls-r es es-ac es-pc">
- <image class="xg-img danmu-switch-open" v-show="danmuFunInfo.switch==1" src="/static/images/other/course/danmu-on.png" @tap="switchDanmu(0)"></image>
- <image class="xg-img danmu-switch-open" v-show="danmuFunInfo.switch==0" src="/static/images/other/course/danmu-off.png" @tap="switchDanmu(1)"></image>
- </view>
- </view>
- </view>
- <!-- 弹幕设置 -->
- <uni-popup ref="danmuPopup" type="bottom" style="z-index: 999;">
- <view class="danmuPopup" :style="{marginLeft:fullScreen ? statusBarHeight+'px': 0}">
- <view class="danmuPopup-head border-line" style="margin-bottom: 20px;">
- <image class="danmu-icon" v-show="danmuFunInfo.switch==1" src="/static/images/other/course/danmu-on.png" @click="switchDanmu(0)"></image>
- <image class="danmu-icon" v-show="danmuFunInfo.switch==0" src="/static/images/other/course/danmu-off.png" @click="switchDanmu(1)"></image>
- <image class="danmu-icon" src="/static/images/other/course/danmu-style-on.png" mode="aspectFill" @click="openDanmuStyle(2)"></image>
- <u--input class="danmuPopup-input" placeholder="发个弹幕吧~" border="surround" shape="circle" focus :adjustPosition="false" :autoBlur="true" maxlength="140" clearable v-model="danmuIput.txt"></u--input>
- <button class="danmuPopup-send"
- :disabled="danmubtnLoading"
- @click="sendDanmu"
- >发送</button>
- </view>
- <view
- class="danmuPopup-con"
- :style="{height: danmuboxHeight ? fullScreen ? `calc(${danmuboxHeight}px + 20px)` : danmuboxHeight+'px' : 'auto'}"
- >
- <view class="es" style="margin-bottom: 25px;">
- <view class="es-mr-24px">弹幕字号</view>
- <view class="es">
- <view class="es-mr-24px" v-for="size in danmuFontSize" :style="{color: danmuIput.fontSize==size ?'#FF5C03':'#757575'}" @click="clickStyle('font',size)">{{size=='16px'?'默认':'较小'}}</view>
- </view>
- </view>
- <view class="es" style="margin-bottom: 25px;">
- <view class="es-mr-24px">弹幕位置</view>
- <view class="es">
- <view class="es-mr-24px" v-for="mode in danmuMode" :style="{color: danmuIput.mode==mode ?'#FF5C03':'#757575'}" @click="clickStyle('mode',mode)">
- {{mode=='top'?'置顶':mode=='bottom'?'置底':'滚动'}}
- </view>
- </view>
- </view>
- <view class="es" style="margin-bottom: 25px;">
- <view class="es-mr-24px">弹幕颜色</view>
- <view class="es es-fx" style="flex-wrap: wrap;">
- <view class="es-mr-24px coloritem" v-for="color in colorList"
- :style="{background: color,border:`2px solid ${danmuIput.color== color ?'#FF5C03':'#F5F7FA'}`}"
- @click="clickStyle('color',color)"></view>
- </view>
- </view>
- <view class="es">
- <view class="es-mr-24px">弹幕位置</view>
- <view class="es">
- <view class="es-mr-24px" v-for="item in danmuArea" :style="{color: danmuFunInfo.area==item ?'#FF5C03':'#757575'}" @click="clickArea(item)">
- {{item*100+'%'}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </uni-popup>
- </view>
- </view>
- <scroll-view class="scroll-Y" :scroll-y="true" :style="'height:' + clientHeight + 'px;'" v-show="!isShowList">
- <view class="video-info">
- <view class="video-info-header">
- <view class="video-info-headerl">
- <image mode="aspectFill" :src="data.talentAvatar"></image>
- <text class="textOne">{{data.courseName}}</text>
- </view>
- <button class="follow-btn" @tap="doFollow()">
- <image v-show="!isFollow" src="@/static/image/hall/guanzhu_icon.png" mode="aspectFill"></image>
- <text>{{isFollow?"已关注":"关注"}}</text>
- </button>
- </view>
- <view>
- <view class="video-info-voicebox2">
- <text>{{data.views}}次播放 · 总时长:{{data.totalDuration}}</text>
- <view class="x-c" @click="isExpand = !isExpand" v-if="showExpandText">
- <text>{{isExpand ? '收起简介' : '展开简介'}}</text>
- <view :class="isExpand ? 'rotate':''"><uni-icons type="down" size="14"
- color="#bbbbbb"></uni-icons></view>
- </view>
- </view>
- <view :class="showDes|| !showExpandText? 'opacity video-info-desc':'video-info-desc' "
- id="descbox-desc" :style="{height: isExpand ? 'auto': '84rpx'}">
- {{data.description}}
- <image v-show="!isExpand&&showExpandText" class="desc-image x-c"
- src="/static/images/other/bg_bar.png"></image>
- </view>
- </view>
- <view class="video-info-footer">
- <view @tap="handleListen()">
- <image src="@/static/image/hall/sound_icon24.png" mode="aspectFill"></image>
- <text :style="{color: showAudio ? '#FF5C03':'#757575'}">听声</text>
- </view>
- <view @tap="$navTo('./note?courseId='+courseId)" v-if="!$qconfig.isAppStore">
- <image src="@/static/image/hall/note_icon24.png" mode="aspectFill"></image>
- <text>笔记</text>
- </view>
- <view @tap="doFavorite()">
- <image
- :src="isFavorite?'/static/image/hall/collect_on_icon24.png':'/static/image/hall/collect_icon24.png'"
- mode="aspectFill"></image>
- <text>{{isFavorite?"已收藏":"收藏"}}</text>
- </view>
- <view @tap="doLike()">
- <image :src="isLike?'/static/image/hall/like_on_icon.png':'/static/image/hall/like_icon.png'"
- mode="aspectFill"></image>
- <text>{{isLike?"喜欢":"喜欢"}}</text>
- </view>
- <view @tap="openShare()">
- <image src="@/static/image/hall/weixin_icon.png" mode="aspectFill"></image>
- <text>分享</text>
- </view>
- <view @tap="openDanmu()" :style="{display: $isLogin()&&!showAudio ? 'flex':'none'}">
- <image src="@/static/images/other/course/danmu-set.png" mode="aspectFill"></image>
- <text>弹幕</text>
- </view>
- </view>
- </view>
- <!-- 讲堂目录 -->
- <view class="video-directory">
- <view class="box-header">
- <view class="box-header-title">讲堂目录</view>
- <view class="box-header-r" @tap="goToCatalogue()">
- <text>共{{catalogueList.length}}节</text>
- <image src="@/static/image/hall/my_right_arrow_right_icon.png" mode="aspectFill"></image>
- </view>
- </view>
- <scroll-view class="video-directory-scrollx" scroll-x="true" :scroll-into-view="scrollIntoViewId"
- scroll-with-animation="true" overflow-anchor="none">
- <view :id="'cataLogue' + index"
- :class="pickCatalogIdx == index ? 'active-scrollitem video-directory-scrollitem':'video-directory-scrollitem'"
- v-for="(item,index) in catalogueList" :key="index" @click="pickCatalogAction(index)">
- <view
- :class="index>1 && canShowVip(item) ? 'freeflag freeflag-member':'freeflag freeflag-free'">
- {{ index>1 && canShowVip(item) ? '限时特惠' : '免费'}}
- </view>
- <view class="video-directory-num">
- <text>第{{item.courseSort}}讲</text>
- <image v-if='pickCatalogIdx == index' src="@/static/image/hall/hear_icon.png"></image>
- <view class="empty" v-else></view>
- </view>
- <view class="video-directory-title">
- <view class="textTwo">{{item.title}}</view>
- <!-- <view class="imagebox">
- <view class="mask" v-if='pickCatalogIdx != index'>
- <image src="@/static/image/hall/video_icon.png" mode="aspectFill"></image>
- </view>
- <image class="video-directory-img" src="@/static/image/home1/logo.png" mode="aspectFill"></image>
- </view> -->
- </view>
- </view>
- </scroll-view>
- </view>
- <!-- 课程疗法 -->
- <view class="therapy" v-show="packageJsonList&&packageJsonList.length > 0">
- <view class="box-header-title" style="margin-bottom: 20rpx;">课程疗法</view>
- <scroll-view class="therapy-scrollx" scroll-x="true" :scroll-into-view="scrollIntoTherapy"
- scroll-with-animation="true" overflow-anchor="none">
- <view :class="therapyIndex == idx ? 'therapy-active therapy-scrollitem':'therapy-scrollitem'"
- :id="'therapy' + idx" v-for="(item,idx) in packageJsonList" :key="idx"
- @click="handleTherapy(item,idx)">
- <image mode="aspectFill" class="therapy-goodsimg" :src="item.imgUrl"></image>
- <view class="therapy-goodsname textTwo">{{item.packageName}}</view>
- </view>
- </scroll-view>
- </view>
- <!-- 评论 -->
- <view class="video-comment" v-if="$qconfig.isAppStore">
- <view class="box-header">
- <view class="box-header-title">评论</view>
- <view class="box-header-r" @tap="goToComment()">
- <text>共{{data.commentNum}}条</text>
- <image src="@/static/image/hall/my_right_arrow_right_icon.png" mode="aspectFill"></image>
- </view>
- </view>
- <view style="padding: 20rpx 24rpx;">
- <commentList :commentList="data.commentList" />
- </view>
- </view>
- <!-- 猜你喜欢 -->
- <view class="video-comment">
- <view class="box-header">
- <view class="box-header-title">猜你喜欢</view>
- <view class="box-header-r" v-if="false">
- <text>更多</text>
- <image src="@/static/image/hall/my_right_arrow_right_icon.png" mode="aspectFill"></image>
- </view>
- </view>
- <view class="hall-box">
- <hallItem class="gapitem" v-for="(item, index) in dataList " :key="index" :item="item"
- @click="navTo('/pages/course/info?courseId='+item.courseId)" />
- </view>
- </view>
- </scroll-view>
- <!-- h5下载 -->
- <h5-down-app-tip :pageUrl="pageUrl" :type="'course'" :courseId="courseId" />
- <!-- 分享弹窗 -->
- <u-popup :show="showShare" @close="closeShareAct()">
- <share-box :shareItem="shareItem" @closeShare='closeShareAct()'></share-box>
- </u-popup>
- <!-- VIP特权弹窗 -->
- <uni-popup ref="popPrivilege" type="bottom" borderRadius="10rpx 10rpx 0px 0px">
- <view class="privilegeBox es es-ver es-br-38 es-pt-30 es-pb-30 ">
- <view class="es es-fx es-pc es-h-56 es-ml-48 es-mr-48">
- <image class="es-w-74 es-h-40" style="position: absolute;left:60rpx;top:0"
- src="../../static/image/course/xiangyun.png"></image>
- <view class="es-fs-40 es-h-56 es-fw-500" style="color: #FFDAA3;">开通VIP专享以下特权</view>
- <image class="es-w-74 es-h-40" style="position: absolute;right:60rpx;top:0"
- src="../../static/image/course/xiangyun2.png"></image>
- <image class="es-w-40 es-h-40" style="position: absolute;right:-20rpx;top:-10rpx"
- @tap="closePrivilege" src="/static/images/close40.png"></image>
- </view>
- <view class="sec1 es-mt-20 es-ml-48 es-mr-48">
- <view class="es x-bc es-pl-28 es-pt-12">
- <view class="l1">
- <view class="x-f">
- <image class="es-w-44 es-h-44" src="../../static/image/course/privilege/fozhu.png">
- </image>
- <view class="es-ml-8 es-c-white es-fs-32 es-fw-600">名家讲堂</view>
- </view>
- <view class="es-fs-30 es-mt-10 es-c-99">畅享10000+VIP视频</view>
- </view>
- <view class="es">
- <image src="../../static/image/course/zyx.png" class="es-w-183 es-h-98 es-br-15"></image>
- <!-- <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> -->
- </view>
- </view>
- </view>
- <view class="sec2 es es-fx es-pc es-h-56 es-mt-40 es-ml-48 es-mr-48">
- <!-- <image class="es-w-148 es-h-3" style="position: absolute;left:0;top:16rpx" src="../../static/image/course/privilege/line1.png"></image> -->
- <view class="es-fs-30 es-h-56 es-fw-bold" style="color: #FFDAA3;">超多权益待你开启</view>
- <!-- <image class="es-w-148 es-h-3" style="position: absolute;right:0;top:16rpx" src="../../static/image/course/privilege/line2.png"></image> -->
- </view>
- <view class="primenu-box es es-fx es-pc es-mt-20 es-ml-48 es-mr-48">
- <view class="content-inner">
- <view class="item">
- <image class="img" src="/static/image/course/privilege/she.png" mode="heightFix"></image>
- <text class="label">AI舌诊</text>
- </view>
- <view class="item">
- <image class="img jlxw" src="/static/image/course/privilege/tizhi.png" mode="heightFix">
- </image>
- <text class="label">体质检测</text>
- </view>
- <view class="item">
- <image class="img" src="/static/image/course/privilege/baike.png" mode="heightFix"></image>
- <text class="label">养生百科</text>
- </view>
- <view class="item">
- <image class="img" src="/static/image/course/privilege/yishu.png" mode="heightFix"></image>
- <text class="label">经典医书</text>
- </view>
- <view class="item">
- <image class="img" src="/static/image/course/privilege/more.png" mode="heightFix"></image>
- <text class="label">多设备登陆</text>
- </view>
- <view class="item">
- <image class="img" src="/static/image/course/privilege/ad.png" mode="heightFix"></image>
- <text class="label">去除广告</text>
- </view>
- </view>
- </view>
- <view class="es-ml-48 es-mr-48 es-mt-10 es-pt-10 es-pb-10 es-br-5" style="background:#2a2f32">
- <view v-for="(item, index) in vipMethods" :key="index" @tap="changeVipMethod(index)"
- class="vipMethodItem es x-bc">
- <view class="x-bc es-ml-14">
- <view class="es-fs-32 es-fw-500 es-ml-14">{{item}}</view>
- </view>
- <image v-if="vipMethodIdx==index" class="es-w-40 es-h-40 es-br-ban es-mr-14 es-mr-26"
- src="../../static/image/course/vipBuy/check.png"></image>
- <view v-else class="es-w-40 es-h-40 es-br-ban es-mr-14 es-mr-26 circle"></view>
- </view>
- </view>
- <view v-if="isShowPayType" class="es-ml-48 es-mr-48 es-mt-40 x-bc" style="background:#2a2f32">
- <view v-for="(item, index) in payTypes" :key="index" @tap="changePayType(index)"
- class="payTypeItem es x-bc " :class="payType==index+1?'pt_ac':''">
- <view class="x-bc es-ml-14">
- <image class="es-w-59 es-h-52"
- :src="index==0?'../../static/image/course/vipBuy/wx.png':'../../static/image/course/vipBuy/zfb.png'">
- </image>
- <view class="es-fs-33 es-c-white es-fw-500 es-ml-14">{{item}}</view>
- </view>
- <image v-if="payType==index+1" src="../../static/image/course/vipBuy/check.png"
- class="es-w-40 es-h-40 es-br-ban es-mr-14"></image>
- <view v-else class="es-w-40 es-h-40 es-br-ban es-mr-14 circle"></view>
- </view>
- </view>
- <view class="es es-mt-40 es-ml-48 es-mr-48 x-c">
- <view @tap="doBuy()" class="es-h-94 x-c es-fw-700 es-fs-34 vipCourseBtn vipAc es-br-46"
- style="width: 310rpx;">
- 立即购买
- </view>
- </view>
- </view>
- </uni-popup>
- <uni-popup ref="popTip" type="dialog">
- <uni-popup-dialog cancelText="支付失败" confirmText="支付成功" mode="base" content="是否已支付成功?" title="提示"
- :duration="2000" :before-close="true" @close="confirmTip" @confirm="confirmTip"></uni-popup-dialog>
- </uni-popup>
- <!-- 评论弹窗 -->
- <popupBottom ref="mescrollItem" :visible.sync="specVisible" @close="closePop" :cmdId="courseId"
- :smsNum="data.commentNum" :title="data.commentNum+'条评论'" :type="1" radius="32" maxHeight="1200">
- </popupBottom>
- </view>
- </template>
- <script>
- import {getUserInfo} from '@/api/user'
- import { getCourseById,getCourseList,getCourseVideoList,checkFavorite,checkFollow,checkLike,doFavorite,doFollow,doLike,addDuration,
- createCourseOrder,createIntegralOrder,getIntegral,createVipOrder,aliPayment,wxPayment,getCourseOrderById,getDanmuList } from '@/api/course'
- import commentList from "./components/commentList.vue";
- import hallItem from "./components/hallItem.vue";
- import popupBottom from '@/components/popupBottom/popupBottom.vue'
- import MescrollCompMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-comp.js";
- import adMask from "@/components/adMask/adMask.vue"
- import "xgplayer/es/plugins/danmu/index.css";
- export default {
- mixins: [MescrollCompMixin],
- components: {
- popupBottom,
- commentList,
- hallItem,
- adMask
- },
- data() {
- return {
- player: null,
- Events: null,
- isH5: false,
- showDes: false,
- showExpandText: false,
- isExpand: true,
- textHeight: 0, //文本高度
- courseId: null,
- isShare: false,
- videoId: null,
- isLearning: false,
- data: {
- courseId: null,
- imgUrl: "",
- talentAvatar: "",
- price: "",
- remark: "",
- noteNum: 0,
- courseName: "",
- description: "",
- cataIndex: 0,
- isFast: 1,
- isAutoPlay: false,
- commentList: [{
- avatar: "",
- content: "",
- createTime: "",
- nickName: ""
- }]
- },
- dataList: [],
- talentId: null,
- studyLog: null,
- isNext: 0,
- user: {},
- isFavorite: 0,
- isFollow: 0,
- isLike: 0,
- clientHeight: 0,
- isShowList: false, // 是否展示讲堂目录列表
- catalogueList: [],
- scrollIntoViewId: 'cataLogue0',
- pickCatalog: {
- // videoUrl: "https://tcpv.ylrzcloud.com/course/20241014/1728890026184.mp4",
- videoUrl:"",
- thumbnail: "",
- duration: 0,
- videoId: 0,
- seconds: 0,
- studyTime: null,
- isFast: 1,
- },
- pickCatalogIdx: 0,
- packageJsonList: [],
- poster: '',
- showShare: false,
- shareItem: {
- imageUrl: "",
- title: "",
- path: ""
- },
- fullScreen: false,
- showTherapy: false,
- showTherapyItem: {},
- playDuration:0, // 播放时长
- timer: null, // 定时器
- lookDuration: 0 ,// 观看时长
- countdowning: false, // 观看时长计时开关
- showAudio: false, //音频展示
- videoPlayStatus:{
- status: '',
- tempAudioDuration: 0,
- studyTime: 0,
- }, // 视频播放状态
- pageUrl: '',
- courseOrderId:0,
- scrollIntoTherapy: 'therapy0',
- therapyIndex: null,
- allLookTimer: null, // 定时器
- allLookDuration:0,//H5未登录状态播放五分钟就跳出登录页面
- tempAudioDuration:0, //用于记录视频和音频播放的时间,达到无缝续播
- audioTimer:null,
- playTime:"00:00",
- studyTimes:0,
- audioContext: null,
- audioPlayIng:false,
- isPostBack:true,//页面是否已初次加载
- specVisible: false,
- esComment:null,
- vipSelIndex:0,
- vipMethods:["开通会员"],
- vipMethodIdx:0,
- isShowPayType:false,
- payTypes:["微信支付","支付宝支付"],
- payType:1,//微信支付1 支付宝支付2
- createType:3,//1直接购买,2芳华币兑换 3开通会员
- orderId:null,
- order:null,
- showPayTips:false,
- isPlayIng:false,//是否正在播放
- statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
- direction: "",
- nodeTime: 0,
- exitFullscreen: '', //是否退出全屏yes , no 加上时间戳
- danmubtnLoading: false,
- colorList:['#ffffff','#e70012','#fcf103','#009843','#00a0ea','#e2027f'],
- danmuMode:['scroll','top','bottom'],
- danmuArea:[0.1,0.25,0.5,0.75,1],
- danmuFontSize: ['16px','14px'],
- danmuIput: {
- txt: '',
- mode: 'scroll',
- color: '#ffffff',
- fontSize: '16px',
- },
- danmuItem:{
- //发送弹幕
- duration: 10000,
- id: '',
- txt: '',
- mode: 'scroll',
- style: {
- color: '#ffffff',
- fontSize: '16px',
- border: 'solid 1px #ffffff',
- borderRadius: '5px',
- padding: '2px 5px',
- backgroundColor: 'rgba(255, 255, 255, 0.1)'
- }
- },
- danmuFunInfo: {
- time: new Date().getTime(),
- event: '',
- switch: 1,
- area: 1
- },
- socket:null,
- isSocketOpen: false,
- isSend:true,
- reOpenSocket: false,
- pingpangTimes:null,
- danmuboxHeight: 0,
- isPause: true, // 视频是否暂停
- isClickVideo: false, // 是否点击视频
- }
- },
- onLoad(options) {
- this.courseId = options.courseId;
- this.isShare = options.isShare || false
- this.videoId = options.videoId || null;
- this.isLearning = options.isLearning || false;
- // #ifdef APP-PLUS
- uni.getSubNVueById('videoPopup').hide();
- uni.$on('getEventType', (data) => {
- uni.getSubNVueById('videoPopup').hide();
- if(data.type == 'confirm') {
- // 确认
- this.tipConfirm(data.extraData)
- } else {
- // 取消
- this.tipCancel(data.extraData)
- }
- })
- // #endif
- this.esComment=this.$refs["esComment"];
-
- let that=this;
- uni.$on('refreshTitle', (pingCount) => {
- that.data.commentNum=pingCount;
- });
- this.getCourseInfo();
- if (this.$isLogin()) {
- this.getUserInfo();
- this.checkFavorite();
- this.checkLike();
- // #ifndef H5
- uni.onKeyboardHeightChange(this.keyboardHeightChange);
- // #endif
- }
- },
- onShow() {
- this.exitFullscreen = 'no'+ new Date().getTime()
- //#ifdef H5
- this.isH5 = true;
- //#endif
-
- //#ifdef APP-PLUS
- if(this.$isLogin()){
- if(!this.timer){
- this.timer=setInterval(() => {
- if(this.countdowning){ //观看时长计时开关开启
- this.lookDuration+=5;
- this.addIntegral();
- }
- }, 5000);
- }
- }
- //#endif
- if(!this.$isLogin()){
- if(!this.allLookTimer){
- this.allLookTimer=setInterval(() => {
- if(this.countdowning){ //观看时长计时开关开启
- this.allLookDuration+=5;
- }
- }, 5000);
- }
- }
- this.playFun()
- if(this.showPayTips){
- this.$refs.popTip.open();
- this.showPayTips=false;
- }
- },
- onReady() {
- this.audioContext = uni.createInnerAudioContext();
- uni.getSystemInfo({
- success: (res) => {
- this.clientHeight = res.windowHeight - uni.upx2px(422) - res.statusBarHeight;
- }
- });
- },
- onHide() {
- const type = this.showAudio ? 'audio' : 'video'
- this.pauseFun(type);
- },
- onUnload() {
- if(this.socket!=null){
- this.socket.close()
- clearInterval(this.pingpangTimes)
- this.socket = null
- }
- // #ifndef H5
- uni.offKeyboardHeightChange(this.keyboardHeightChange);
- // #endif
- this.exitFullscreen = 'yes'+ new Date().getTime()
- // 页面卸载时清除计时器
- this.endCountsTime();
- this.addStudyCourse();
- this.destoryAudio();
- // #ifdef APP-PLUS
- uni.$off('getEventType');
- // #endif
- uni.$emit('refreshStudyTime', {});
- uni.$off("backStudyTime");
- uni.$off("refreshUser");
- uni.$off("showPayTips");
- uni.$off("pickCatalogAction");
- uni.$off("refreshTitle");
- uni.$off("refreshCatalog");
- },
- methods: {
- endCountsTime(){
- if (this.timer) {
- clearInterval(this.timer);
- this.timer = null;
- }
- if (this.allLookTimer) {
- clearInterval(this.allLookTimer);
- this.allLookTimer = null;
- }
- },
- getCourseInfo() {
- this.showDes = false
- getCourseById(this.courseId).then(res => {
- if (res.code == 200) {
- this.data = res.data;
- this.dataList = res.data.courseList;
- this.talentId = res.data.talentId;
- this.studyLog = res.data.studyLog;
- this.isNext = res.data.isNext;
- this.videoId = this.studyLog ? this.studyLog.videoId : null;
- this.vipMethods = ["开通会员"];
- if (this.data.isIntegral == 1) {
- this.vipMethods.push("芳华币兑换")
- }
- if (this.data.sellPrice > 0) {
- this.vipMethods.push(this.data.sellPrice + "元购买");
- }
- this.getDescHeight()
- this.getCourseVideoList();
- if (this.$isLogin()) {
- this.checkFollow();
- }
- }
- },
- rej => {}
- );
- },
- getDescHeight() {
- this.$nextTick(() => {
- const query = uni.createSelectorQuery().in(this);
- query
- .select("#descbox-desc")
- .boundingClientRect((data) => {
- this.textHeight = data.height
- this.isExpand = this.textHeight > uni.upx2px(84) ? false : true
- this.showExpandText = this.textHeight > uni.upx2px(84) ? true : false
- this.showDes = true
- })
- .exec();
- })
- },
- //课程目录
- getCourseVideoList() {
- let that = this;
- const params = {
- "courseId": this.courseId
- };
- getCourseVideoList(params, 1, 50).then(res => {
- if (res.code == 200) {
- this.catalogueList = res.data.list;
- if (this.catalogueList.length > 0) {
- this.pickCatalogIdx = this.getCatalogIdx();
- //开始播放计时
- if (this.data.isAutoPlay == 1) {
- this.pickCatalogMethod(this.pickCatalogIdx);
- }
- }
- }
- },
- rej => {}
- );
- },
- canShowVip(item) {
- return true;
- if (this.user.isVip) {
- return false;
- }
- return item.isVip == 1 && item.isBuy == 0;
- },
- getCatalogIdx() {
- let index = this.catalogueList.findIndex(item => item.videoId == this.videoId);
- if (!this.videoId || index < 0) {
- index = 0;
- }
- return index;
- },
- getUserInfo() {
- let that = this;
- getUserInfo().then(res => {
- if (res.code == 200) {
- if (res.user != null) {
- uni.setStorageSync('userInfo', JSON.stringify(res.user));
- this.user = res.user;
- } else {
- uni.showToast({
- icon: 'none',
- title: res.msg,
- });
- }
- }
- },
- rej => {}
- );
- },
- checkFavorite() {
- checkFavorite(this.courseId).then(res => {
- if (res.code == 200) {
- this.isFavorite = res.isFavorite;
- }
- },
- rej => {}
- );
- },
- checkFollow() {
- checkFollow(this.talentId).then(res => {
- if (res.code == 200) {
- this.isFollow = res.isFollow;
- }
- },
- rej => {}
- );
- },
- checkLike() {
- checkLike(this.courseId).then(res => {
- if (res.code == 200) {
- this.isLike = res.isLike;
- }
- },
- rej => {}
- );
- },
- doFollow() {
- if (!this.$isLogin()) {
- this.$showLoginPage();
- return;
- }
- uni.showLoading({
- title: ""
- });
- doFollow(this.talentId).then(res => {
- uni.hideLoading();
- if (res.code == 200) {
- uni.showToast({
- title: '操作成功',
- icon: 'none'
- });
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- this.isFollow = !this.isFollow;
- },
- rej => {}
- );
- },
- doFavorite() {
- if (!this.$isLogin()) {
- this.$showLoginPage();
- return;
- }
- uni.showLoading({
- title: ""
- });
- doFavorite(this.courseId).then(res => {
- uni.hideLoading();
- if (res.code == 200) {
- uni.showToast({
- title: '操作成功',
- icon: 'none'
- });
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- this.isFavorite = !this.isFavorite;
- },
- rej => {}
- );
- },
- doLike() {
- if (!this.$isLogin()) {
- this.$showLoginPage();
- return;
- }
- uni.showLoading({
- title: ""
- });
- doLike(this.courseId).then(res => {
- uni.hideLoading();
- if (res.code == 200) {
- uni.showToast({
- title: '操作成功',
- icon: 'none'
- });
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- });
- }
- this.isLike = !this.isLike;
- },
- rej => {}
- );
- },
- openShare() {
- if (this.isH5) {
- return;
- }
- console.log("qxj title:" + this.pickCatalog.title);
- if (this.$isEmpty(this.pickCatalog.title)) {
- this.shareItem.title = this.data.courseName;
- } else {
- this.shareItem.title = this.data.courseName + "-" + this.pickCatalog.title;
- }
- this.shareItem.isMini = false
- this.shareItem.imageUrl = this.data.imgUrl;
- this.shareItem.compressImage = 1;
- this.shareItem.courseId = this.courseId;
- this.shareItem.summary = !this.$isEmpty(this.data.description) ? this.data.description : "";
- let cdn = uni.getStorageSync('h5Path');
- this.shareItem.url = cdn + "/pages/course/info?courseId=" + this.courseId;
- this.showShare = true;
- },
- goToComment(){
- if(this.isH5){
- this.specVisible=true;
- }
- else{
- // this.$navTo('./comment?courseId='+this.courseId);
- // return;
- const subNVue = uni.getSubNVueById('commentN');
- subNVue.show('slide-in-bottom', 250);
- uni.$emit('comment', {
- videoId: this.pickCatalog.videoId,
- courseId: this.courseId
- });
- }
- },
- closePop(){
- this.specVisible=false;
- },
- navTo(url) {
- uni.navigateTo({
- url: url
- });
- },
- openVipCourse(index) {
- if(!this.isPostBack){
- this.isPostBack=true;
- return;
- }
- this.showPopPrivilege(index);
- },
- showPopPrivilege(index){
- if(this.isH5){
- this.$refs.popPrivilege.open("bottom");
- }
- else{
- const subNVue = uni.getSubNVueById('privilege');
- subNVue.show('slide-in-bottom', 250);
- let pickCatalog=this.catalogueList[index];
- uni.$emit('privilege', {
- videoId: pickCatalog.videoId,
- courseId: this.courseId,
- sellPrice:this.data.sellPrice,
- catalogIndex:index,
- integral: this.data.integral,
- });
- }
- },
- changeVip(index){
- this.vipSelIndex=index;
- if(index==2){
- this.showPopPrivilege();
- }
- },
- changeVipMethod(index){
- this.vipMethodIdx=index;
- const vipMethod=this.vipMethods[index];
- this.isShowPayType=false;
- if(vipMethod.indexOf('元购买')!=-1){ //直接购买
- this.isShowPayType=true;
- this.createType=1;
- }
- if(vipMethod.indexOf('芳华币兑换')!=-1){ //芳华币兑换
- this.createType=2;
- }
- if(vipMethod.indexOf('开通会员')!=-1){ //开通会员
- this.createType=3;
- }
- },
- changePayType(index){
- this.payType=index+1;
- },
- doBuy(){
- if(this.createType==1){ //直接购买
- this.createCourseOrder();
- }
- else if(this.createType==2){ //芳华币兑换
- this.createIntegralOrder();
- }
- else{ //开通会员
- this.$navTo('./vipBuy');
- }
- },
- createCourseOrder(){
- if(!this.$isLogin()){
- this.$showLoginPage();
- return;
- }
- uni.showLoading({title:""});
- let params={"courseId":this.courseId,"createType":this.createType,"videoId":this.pickCatalog.videoId,"payType":this.payType};
- createCourseOrder(params).then(res => {
- uni.hideLoading();
- if(res.code==200){
- this.order=res.order;
- if(this.payType==1){ //微信支付
- this.doWxPay();
- }else{ //支付宝
- this.doAlipay();
- }
- }else{
- uni.showToast({title: res.msg,icon: 'none'});
- }
- },
- rej => {}
- );
- },
- createIntegralOrder(){
- if(!this.$isLogin()){
- this.$showLoginPage();
- return;
- }
- uni.showLoading({title:""});
- let params={"courseId":this.courseId,"videoId":this.pickCatalog.videoId};
- createIntegralOrder(params).then(res => {
- uni.hideLoading();
- if(res.code==200){
- uni.showToast({title: res.msg,icon: 'success'});
-
- }else{
- uni.showToast({title: res.msg,icon: 'none'});
- }
- },
- rej => {}
- );
- },
- doAlipay(){
- var data = {orderId:this.order.orderId};
- uni.showLoading();
- aliPayment(data).then(res => {
- uni.hideLoading()
- this.$refs.popPrivilege.close();
- if(res.code==200){
- this.$refs.popTip.open();
- if (uni.getSystemInfoSync().platform == 'android') {
- var alipayScheme ='alipays://platformapi/startApp?&saId=10000007&qrcode=' + res.data.qr_code;
-
- }else{
- var alipayScheme ='alipay://platformapi/startApp?&saId=10000007&qrcode=' + res.data.qr_code;
-
- }
- console.log(alipayScheme)
- // 在uni-app中使用plus.runtime.openURL打开URL
- plus.runtime.openURL(alipayScheme, function(error) {
- // console.error('打开支付宝失败: ' + error.message);
- // 处理打开支付宝失败的情况,比如提示用户或者跳转到其他支付方式
- });
- }
- else{
- uni.showToast({
- title:res.msg,
- icon:'none'
- })
-
- }
- },
- rej => {}
- );
- },
- doWxPay(){
- var that=this;
- plus.share.getServices(function(res){
- var sweixin = null;
- for(var i=0;i<res.length;i++){
- var t = res[i];
- if(t.id == 'weixin'){
- sweixin = t;
- }
- }
- if(sweixin){
- console.log('调起小程序')
- that.$refs.popPrivilege.close();
- that.$refs.popTip.open()
- //唤起微信跳转小程序
- sweixin.launchMiniProgram({
- id:"gh_7a6a32e5ef61",
- path:'pages_order/coursePayment?orderId='+that.orderId+"&payMethod=app",
- type:0
- },function(){
- console.log("微信唤起成功");
- return true;
- },function(e){
- console.log("微信唤起失败",e);
- uni.showToast({
- title:'微信唤起失败,请检查是否有微信应用',
- icon:'none'
- })
- return false;
- })
-
- }else{
- uni.showToast({
- title:'微信唤起失败,请检查是否有微信应用',
- icon:'none',
- duration:3000
- })
- return false;
- }
-
- },function(res){
- console.log(JSON.stringify(res));
- });
- },
- goToCatalogue(){
- if(this.isH5){
- let url='./catalogue?courseId='+this.courseId+'&videoId='+this.pickCatalog.videoId+'&isAutoPlay='+this.data.isAutoPlay+'&studyTimes='+this.tempAudioDuration;
- this.$navTo(url);
- }
- else{
- const subNVue = uni.getSubNVueById('catalogueN');
- subNVue.show('slide-in-bottom', 250);
- uni.$emit('catalogue', {
- videoId: this.pickCatalog.videoId,
- courseId: this.courseId,
- pickCatalogIdx:this.pickCatalogIdx
- });
- }
- },
- pickCatalogAction(index,type){
- if (this.pickCatalogIdx === index) return;
- if(type == 'catalogueN'&&this.isNext == 1 && this.pickCatalogIdx != index - 1) {
- const type = this.showAudio ? 'audio' : 'video'
- this.pauseFun(type);
- this.openTips(index)
- return
- }
- this.pickCatalogActionFun(index,type)
- },
- pickCatalogActionFun(index,type) {
- if(!this.$isLogin()){ //切换小节需要登录
- this.$showLoginPage();
- return;
- }
- if(this.isH5 && index>1){
- uni.showToast({title: "请下载App观看",icon: 'none'});
- return;
- }
- //切换之前添加课程目录学习记录
- this.addStudyCourse();
- this.addIntegral(); //加芳华币
- this.pickCatalogMethod(index,type);
- this.scrollIntoViewId = 'cataLogue' + index;
- },
- pickCatalogMethod(index,type){
- let tempCatalogue=this.catalogueList[index];
- this.lookDuration=0;//重置观看当前小节的课程时长
- if(tempCatalogue.isVip==1){ //需要Vip才能观看
- if(!this.$isLogin()){
- this.$showLoginPage();
- return;
- }
- if(this.user==null){
- this.user=this.$getUserInfo();
- }
- if(this.user.isVip!=1 && tempCatalogue.isBuy!=1){
- this.openVipCourse(index);
- return;
- }
- }
- this.pickCatalogIdx=index;
- //传递消息给小节弹窗
- uni.$emit('pickCatalogIdx', {pickCatalogIdx:index,type:type});
- this.pickCatalog=this.catalogueList[index];
- this.pickCatalog.isFast = this.data.isFast
- this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog.packageJson) : []
- this.initStudyTime(this.pickCatalog.studyTime || 0)
- const url = this.pickCatalog.lineTwo ? this.pickCatalog.lineTwo : this.pickCatalog.videoUrl
- this.resetAudioContext(url)
- },
- resetAudioContext(url) {
- if (this.audioContext==null) {
- this.audioContext = uni.createInnerAudioContext();
- }
- this.audioContext.src = url
- // this.audioContext.src = this.pickCatalog.videoUrl;
- this.audioContext.onTimeUpdate(()=>{
- this.initStudyTime(this.audioContext.currentTime)
- })
- },
- changeLine(data) {
- this.resetAudioContext(data.url)
- },
- endedPlayNext(type){
- let nextCatalog=this.catalogueList[this.pickCatalogIdx+1];
- if(!nextCatalog){
- return;
- }
- if(nextCatalog && this.pickCatalogIdx<this.catalogueList.length-1){ //未播放到最后一节自动续播
- this.pickCatalogAction(this.pickCatalogIdx+1)
- }
- },
- endedPlayPrev(){
- if(this.pickCatalogIdx == 0) {
- uni.showToast({
- title: '已经是第一节视频了',
- icon: 'none',
- position: 'top',
- duration: 2000
- })
- return
- }
- let nextCatalog=this.catalogueList[this.pickCatalogIdx-1];
- if(!nextCatalog){
- return;
- }
- this.pickCatalogAction(this.pickCatalogIdx-1)
- },
- addStudyCourse(){
- if(this.catalogueList.length==0 || this.tempAudioDuration==0){
- return;
- }
- // this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
- // this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog.packageJson) : []
- if(this.pickCatalog.isBuy==0){
- return;
- }
- const parmas={"courseId":parseInt(this.courseId),"duration":this.tempAudioDuration,"videoId":this.pickCatalog.videoId};
- addDuration(parmas).then(res => {
- if(res.code==200){
-
- }
- },
- rej => {}
- );
- },
- addIntegral(){
- // 观看到视频时长50%加一次芳华币
- if(this.lookDuration==0 || this.playDuration==0){
- return;
- }
- // this.pickCatalog=this.catalogueList[this.pickCatalogIdx];
- // this.packageJsonList = this.pickCatalog && this.pickCatalog.packageJson ? JSON.parse(this.pickCatalog.packageJson) : []
- if(this.lookDuration<this.pickCatalog.seconds*0.5){
- return;
- }
- let data={videoId:this.pickCatalog.videoId,duration:this.lookDuration};
- getIntegral(data).then(res => {
- if(res.code==200){
- uni.showToast({icon:'none',title:res.msg,duration:3000,position:'bottom'});
- this.countdowning=false;
- }
- },
- rej => {}
- );
- },
- closeShareAct(){
- this.showShare=false;
- },
- closeTherapy() {
- this.showTherapy = false
- },
- goToPro(productId) {
- this.exitFullscreen = 'yes'+ new Date().getTime()
- this.showTherapy = false
- setTimeout(()=> {
- uni.navigateTo({
- url: "/pages/store/packageDetails?packageId="+productId
- });
- }, 500);
- },
- // 返回视频
- backPlayVideo() {
- this.showAudio = false;
- this.audioPlayIng = false;
- this.isLearning=false;
- this.pauseFun('audio');
- this.playFun();
- },
- // 点击视频
- clickVideo() {
- this.isClickVideo = true
- setTimeout(()=>{
- this.isClickVideo = false
- },3000)
- },
- changeCountdowning(data) {
- this.countdowning=data.countdowning;
- // 视频是否暂停
- if(data.isXGPause==false) {
- setTimeout(()=>{
- this.isPause = data.isXGPause
- },3000)
- } else {
- this.isPause = data.isXGPause
- }
- },
- onTimeUpdate(data) {
- this.playDuration = Math.round(data.time)
- this.initStudyTime(this.playDuration)
- if(data.time>=this.pickCatalog.seconds){
- this.countdowning = false; //观看时长开关关闭
- }
- if(this.isH5){
- if(this.allLookDuration>=300){ //H5未登录状态播放五分钟就跳出登录页面
- if(!this.$isLogin()){
- this.$showLoginPage();
- const type = this.showAudio ? 'audio' : 'video'
- this.pauseFun(type);
- }
- }
- }
- else{
- if(this.allLookDuration>=120){ //未登录状态播放两分钟就跳出登录页面
- if(!this.$isLogin()){
- this.$showLoginPage();
- const type = this.showAudio ? 'audio' : 'video'
- this.pauseFun(type);
- }
- }
- }
- uni.$u.throttle(this.checkTherapy, 1000,false);
- },
- checkTherapy() {
- let currentTime = Math.round(this.tempAudioDuration || 0)
- let node = this.packageJsonList.filter(item => item.duration == currentTime)
- if(node&&node.length > 0) {
- this.nodeTime = node[0].duration
- this.showTherapyItem = node[0]
- if(!this.showTherapy) {
- this.showTherapy = true
- }
- } else {
- if(this.showTherapy && this.nodeTime && this.nodeTime > currentTime) {
- this.showTherapy = false
- }
- }
- },
- // 打开集观看提示弹窗
- openTips(index){
- // #ifdef APP-PLUS
- uni.$emit('getTipShowType', {index:index})
- uni.getSubNVueById('videoPopup').show();
- // #endif
- },
- tipConfirm() { // 提示确认
- // 继续播放
- //传递消息给小节弹窗
- uni.$emit('pickCatalogIdx', {pickCatalogIdx:this.pickCatalogIdx,type: 'catalogueN'});
- this.playFun()
- },
- tipCancel(index) { // 提示取消
- // 播放选择的一节
- this.pickCatalogActionFun(index,'catalogueN')
- },
- // 听声
- handleListen() {
- if(this.showAudio) {
- this.backPlayVideo()
- } else {
- // 打开音频
- this.showAudio = true
- this.pauseFun('video');
- this.playFun()
- }
- },
- // 播放音频
- playAudioAction(type) {
- if(!this.audioPlayIng){
- setTimeout(()=>{
- this.audioContext.play()
- },200)
- }
- else{
- this.pauseAudioAction()
- }
- this.audioPlayIng=!this.audioPlayIng;
- },
- // 播放
- playFun() {
- // console.log("initSocket videoId:",this.pickCatalog.videoId)
- this.reOpenSocket = false
- if(this.pickCatalog.videoId) {
- this.getDanmuList()
- if (this.socket) {
- this.socket.close({
- success:()=>{
- this.reOpenSocket = true
- clearInterval(this.pingpangTimes)
- }
- })
- } else {
- this.initSocket()
- }
- }
- this.audioPlayIng = false
- if(this.showAudio) {
- const ended = this.tempAudioDuration == this.pickCatalog.seconds
- this.audioContext.seek(ended ? 0: this.tempAudioDuration);
- // this.audioContext.onSeeked(() => {
- this.playAudioAction()
- // })
- } else {
- this.videoPlayStatus={
- status: 'play'+ new Date().getTime(),
- tempAudioDuration: this.tempAudioDuration || 0,
- studyTime: this.pickCatalog.studyTime,
- }
- }
- },
- initStudyTime(time){
- this.tempAudioDuration = Math.round(time)
- },
- // 暂停音频
- pauseAudioAction() {
- if(this.audioContext) {
- setTimeout(()=>{
- this.audioContext.pause();
- },200)
- clearInterval(this.audioTimer);
- this.audioTimer=null;
- }
- },
- destoryAudio() {
- if(this.audioContext) {
- this.audioContext.destroy();
- clearInterval(this.audioTimer);
- this.audioTimer=null;
- }
- },
- // 暂停
- pauseFun(type) {
- this.audioPlayIng = true
- if(type == 'audio') {
- this.pauseAudioAction()
- } else if(type == 'video'){
- this.videoPlayStatus={
- status: 'pause'+ new Date().getTime(),
- tempAudioDuration: this.tempAudioDuration || 0,
- studyTime: this.pickCatalog.studyTime,
- }
- }
- },
- closePrivilege(){
- this.$refs.popPrivilege.close();
- },
- closeTip(){
- this.$refs.popTip.close();
- },
- canShowVip(item){
- return true;
- if(this.user.isVip){
- return false;
- }
- return item.isVip==1 && item.isBuy==0;
- },
- confirmTip() {
- this.getUserInfo();
- this.getCourseInfo();
- this.$refs.popTip.close();
- uni.showLoading({title:"请稍侯...",mask:true,duration:3000});
- setTimeout(()=>{
- this.getCourseOrderById();
- },2000);
- },
- getCourseOrderById(){
- getCourseOrderById(this.courseOrderId).then(res => {
- uni.hideLoading();
- if(res.code==200){
- if(res.order.status==2 || res.order.payTime!=null){
- // #ifdef APP-PLUS
- if(plus.runtime.channel=="baidu"){ //获取渠道标识
- let bdCmdType=uni.getStorageSync("bdCmdType");
- if(bdCmdType!=null && parseInt(bdCmdType)<=2){
- //this.$registerIdCode("orders",2,res.order.payMoney.toString()); //已下单
- }
- }
- // #endif
- uni.showToast({title:"支付成功",icon:'success'});
- }
- else if(res.order.status==1){
- uni.showToast({title:"课程待支付请稍侯",icon:'none'});
- }
- else{
- uni.showToast({title:"支付失败",icon:'error'});
- }
- }
- },
- rej => {}
- );
- },
- handleTherapy(item,idx) {
- this.scrollIntoTherapy = 'therapy' + idx,
- this.therapyIndex = idx
- setTimeout(()=> {
- uni.navigateTo({
- url: "/pages/store/packageDetails?packageId="+item.packageId
- });
- }, 500);
- },
- onFullscreenChange(data) {
- this.fullScreen = data.isFullscreen
- // direction取为 vertical 或 horizontal
- this.direction = data.direction
- if (!data.isFullscreen) {
- // 退出全屏,锁定竖屏
- // #ifdef APP-PLUS
- plus.screen.lockOrientation('portrait-primary');
- // #endif
- }
- },
- // 全屏返回
- videoback() {
- this.exitFullscreen = 'yes'+ new Date().getTime()
- },
- // 弹幕
- openDanmu() {
- // #ifdef H5
- uni.showToast({
- title: "请下载app发弹幕",
- icon: "none"
- })
- return
- // #endif
- this.danmuIput= {
- txt: '',
- mode: 'scroll',
- color: '#ffffff',
- fontSize: '16px',
- }
- this.$refs.danmuPopup.open()
- },
- keyboardHeightChange(res) {
- // #ifndef H5
- this.danmuboxHeight = res.height
- // #endif
- },
- openDanmuStyle(type) {
- if(type==2) {
- uni.hideKeyboard()
- }
- },
- clickStyle(type,value) {
- if(type=='mode') {
- this.danmuIput.mode = value
- } else if(type=='font') {
- this.danmuIput.fontSize = value
- } else if(type=='color') {
- this.danmuIput.color = value
- this.danmuIput.border = `solid 1px ${value}`
- }
- },
- clickArea(value) {
- this.danmuFunInfo = {
- time: new Date().getTime(),
- event: 'setArea',
- switch: this.danmuFunInfo.switch,
- area: value
- }
- },
- // 发送弹幕
- sendDanmu() {
- if(this.danmuIput.txt==''||this.danmuIput.txt.trim()=='') {
- uni.showToast({
- title: '弹幕不能为空',
- icon: 'none'
- })
- return;
- }
- this.sendMsg()
- },
- // 弹幕开关
- switchDanmu(type) {
- this.danmuFunInfo = {
- time: new Date().getTime(),
- event: 'switch',
- switch: type,
- area: this.danmuFunInfo.area
- }
- },
- // 弹幕列表
- getDanmuList(){
- this.danmuFunInfo = {
- time: new Date().getTime(),
- event: 'clearDanmuList',
- switch: this.danmuFunInfo.switch,
- area: this.danmuFunInfo.area
- }
- getDanmuList(this.pickCatalog.videoId).then(res=>{
- if(res.code == 200) {
- let danmuList = res.data.map(item=>({
- duration: this.danmuItem.duration,
- id: item.id,
- txt: item.content,
- start: item.timePoint ? Number(item.timePoint) * 1000 : this.tempAudioDuration*1000,
- mode: item.mode|| this.danmuItem.mode,
- style: {
- color: item.color || this.danmuItem.style.color,
- fontSize: item.isColor==1 ? item.fontSize || this.danmuItem.style.fontSize : this.danmuItem.style.fontSize, //是否彩色1是0否
- padding: this.danmuItem.style.padding,
- border:this.user.userId ==item.userId ? item.color ? `solid 1px ${item.color}`: this.danmuItem.style.border : 'none',
- borderRadius: this.user.userId==item.userId ? this.danmuItem.style.borderRadius : 0,
- backgroundColor: this.user.userId==item.userId ? this.danmuItem.style.backgroundColor : 'transparent'
- }
- }))
- try {
- this.danmuFunInfo = {
- time: new Date().getTime(),
- event: 'getDanmuList',
- switch: this.danmuFunInfo.switch,
- danmuList: danmuList,
- area: this.danmuFunInfo.area
- }
- } catch (e) {
- console.log('e',e)
- }
- }
- })
- },
- //创建一个socket连接
- initSocket() {
- let userId = this.user.userId;
- let that = this;
- this.socket = uni.connectSocket({
- url: getApp().globalData.danmuWSUrl + "/ws/barrage/" + this.pickCatalog.videoId,
- multiple: true,
- header: {
- 'token': uni.getStorageSync('AppToken')
- },
- success: res => {
- console.log('WebSocket连接已打开1!');
- that.isSocketOpen = true
- that.reOpenSocket = false
-
- // 保持心跳
- if(that.pingpangTimes) {
- clearInterval(that.pingpangTimes)
- that.pingpangTimes= null
- }
- that.pingpangTimes=setInterval(()=>{
- let data={cmd:"heartbeat",userId: userId};
- that.socket.send({
- data: JSON.stringify(data),
- success: () => {
- // console.log('WebSocket发送心条数据!');
- },
- fail: () => {
- that.isSocketOpen=false
- }
- });
- },15000)
- },
- error: err => {
- console.log(err)
- },
- })
- this.socket.onMessage((res) => {
- // console.log("收到消息parse",JSON.parse(res.data))
- const redata = JSON.parse(res.data);
- if(redata.cmd=="heartbeat"){
- //心跳
- // console.log("heartbeat")
- }else if(redata.cmd=="danmu"){
- that.isSend=true;
- that.addMsg(1,redata);
- }
- })
- //监听socket打开
- this.socket.onOpen(() => {
- console.log('WebSocket连接已打开2!');
- that.isSocketOpen = true
- that.reOpenSocket = false
- that.isSend = true;
- })
- //监听socket关闭
- this.socket.onClose(() => {
- that.isSocketOpen = false
- that.socket = null
- console.log('WebSocket连接已关闭!',that.reOpenSocket);
- if(that.pingpangTimes) {
- clearInterval(that.pingpangTimes)
- that.pingpangTimes= null
- }
- if(that.reOpenSocket) {
- //重启
- that.initSocket()
- }
- // that.msgEnd = true
- })
- //监听socket错误
- this.socket.onError((err) => {
- console.log("socket err:",err)
- that.isSocketOpen = false
- that.reOpenSocket = false
- that.socket = null
- if(that.pingpangTimes) {
- clearInterval(that.pingpangTimes)
- that.pingpangTimes= null
- }
- })
- },
- sendMsg() {
- if (!this.isSend) {
- return;
- }
- if (this.isSocketOpen) {
- var userId = this.user.userId;
- var data = {
- cmd: 'danmu',
- userId: this.user.userId,
- videoId: this.pickCatalog.videoId,
- content: this.danmuIput.txt,
- timePoint: this.tempAudioDuration, // 弹幕对应视频时间节点()秒
- platform: 'app', //发送平台,app传值“app”,小程序传值“uniapp”
- fontSize: this.danmuIput.fontSize,
- mode: this.danmuIput.mode,
- color: this.danmuIput.color,
- };
- this.socket.send({
- data: JSON.stringify(data),
- success: () => {
- console.log("发送成功")
- this.$refs.danmuPopup.close()
- this.isSend = false;
- },
- fail: () => {
- console.log("发送失败")
- uni.showToast({
- title: '发送失败',
- icon: 'none'
- })
- }
- });
-
- }
-
- },
- // 收到消息
- addMsg(type, content) {
- if (this.isSocketOpen) {
- const id = content.userId +'_' + new Date().getTime()
- const mystyle = {
- color: content.color || this.danmuItem.style.color,
- fontSize: content.fontSize || this.danmuItem.style.fontSize,
- border: content.color ? `solid 1px ${content.color}`: this.danmuItem.style.border,
- borderRadius: this.danmuItem.style.borderRadius,
- padding: this.danmuItem.style.padding,
- backgroundColor: this.danmuItem.style.backgroundColor
- }
- const otherstyle = {
- color: content.color || this.danmuItem.style.color,
- fontSize: content.fontSize || this.danmuItem.style.fontSize,
- padding: this.danmuItem.style.padding,
- }
- const mode = content.mode || this.danmuItem.mode
- const danmuItem = {
- //发送弹幕
- duration: content.duration ? content.duration : mode=='scro11'? this.danmuItem.duration : this.danmuItem.duration,
- id: content.id || id,
- txt: content.content,
- mode: mode,
- style: this.user.userId == content.userId ? mystyle : otherstyle
- }
- this.danmuItem = danmuItem
- this.danmuFunInfo = {
- time: new Date().getTime(),
- event: 'send',
- switch: this.danmuFunInfo.switch,
- danmuItem: danmuItem,
- area: this.danmuFunInfo.area
- }
- }
- },
- },
- created() {
- let that = this;
- uni.$on('backStudyTime', function(data) {
- that.videoId=data.videoId;
- that.pickCatalogIdx=that.getCatalogIdx();
- that.pickCatalog=that.catalogueList[that.pickCatalogIdx];
- that.pickCatalog.studyTime=data.studyTimes;
- that.catalogueList[that.pickCatalogIdx]=that.pickCatalog;
-
- that.packageJsonList = that.pickCatalog && that.pickCatalog.packageJson ? JSON.parse(that.pickCatalog.packageJson) : []
- that.pickCatalogMethod(that.pickCatalogIdx);
- });
-
- uni.$on('showPayTips', function(data) {
- console.log("qxj showPayTips")
- that.courseOrderId=data.courseOrderId;
- //that.showPayTips=true;
- that.$refs.popTip.open();
- });
-
- uni.$on('refreshUser', function(data) {
- that.getUserInfo();
- that.getCourseInfo();
- });
-
- uni.$on('pickCatalogAction', function(data) {
- that.pickCatalogAction(data.index,data.type);
- });
- uni.$on('refreshCatalog', function(index) {
- let catalog=that.catalogueList[index];
- catalog.isBuy=true;
- that.catalogueList[index]=catalog;
- that.pickCatalogAction(index);
- });
- },
- destroyed() {
- // console.log("destroyed=====")
- if(this.socket!=null){
- this.socket.close()
- }
- if(this.pingpangTimes) {
- clearInterval(this.pingpangTimes)
- this.pingpangTimes= null
- }
- this.danmuFunInfo = {
- time: new Date().getTime(),
- event: '',
- area: this.danmuFunInfo.area
- }
- uni.$off("backStudyTime");
- uni.$off("refreshUser");
- uni.$off("showPayTips");
- uni.$off("pickCatalogAction");
- uni.$off("refreshTitle");
- uni.$off("refreshCatalog");
- // #ifdef APP-PLUS
- uni.$off('getEventType');
- // #endif
- }
- }
- </script>
- <script module="xgplayer" lang="renderjs">
- // import Player from "xgplayer"
- // import Mp4Plugin from "xgplayer-mp4"
- // import 'xgplayer/dist/index.min.css';
- import Danmu from 'xgplayer/es/plugins/danmu'
- // import "xgplayer/es/plugins/danmu/index.css"
- let xgPlayer
- const openDanmu='/static/images/other/course/danmukai.png';
- const closeDanmu='/static/images/other/course/danmukai_1.png';
- export default {
- data() {
- return {
- player: null,
- ownerInstance: null,
- ownerInstanceVideo: null,
- isFullscreen: false,
- isCSSFull: false,
- lineName:"",
- danmuInstance: null,
- newDanmu: {
- //发送弹幕
- duration: 10000,
- id: '',
- txt: '',
- mode: 'scroll',
- style: {
- color: '#ffffff',
- fontSize: '15px',
- border: 'solid 1px #ffffff',
- borderRadius: '10px',
- padding: '5px 11px',
- backgroundColor: 'rgba(255, 255, 255, 0.1)'
- }
- },
- isXGPause: true,
- }
- },
- beforeDestroy() {
- if(this.player) {
- if(this.isFullscreen) {
- if(this.isCSSFull) {
- this.player.exitCssFullscreen()
- } else {
- this.player.exitFullscreen()
- }
- }
- this.player.destroy() // 销毁播放器
- this.player = null
- }
- },
- methods: {
- initJs(newValue, oldValue,ownerInstance) {
- if (typeof window.Player === 'function') {
- this.initPlayer(newValue, oldValue,ownerInstance)
- } else {
- // 动态引入较大类库避免影响页面展示
- const script = document.createElement('script')
- // view 层的页面运行在根目录
- script.src = 'https://unpkg.byted-static.com/xgplayer/3.0.20/dist/index.min.js'
- script.onload = this.initPlayer.bind(this, newValue, oldValue,ownerInstance)
- document.head.appendChild(script)
- const l_tag = document.createElement('link'); // 引入播放器css
- l_tag.rel = 'stylesheet';
- l_tag.href = 'https://unpkg.byted-static.com/xgplayer/3.0.20/dist/index.min.css';
- document.body.appendChild(l_tag);
- }
- },
- initPlayer(newValue, oldValue,ownerInstance) {
- this.Events = window.Player.Events
- if (!this.ownerInstance) this.ownerInstance = ownerInstance
- let xgplayerOption = {
- lang: 'zh',
- url: "",
- id: 'detail-video',
- autoplay: false,
- // height: uni.upx2px(422),
- height: '100%',
- width: '100%',
- poster: "",
- 'x5-video-player-type': 'h5', // 微信内置浏览器设置,防止被浏览器劫持
- playsinline: true,
- playbackRate: false,
- ignores: ['volume', 'miniscreen', 'keyboard'],
- plugins: [Danmu],
- danmu: {
- "comments": [],
- "area": {
- "start": 0,
- "end": 1
- },
- "closeDefaultBtn": true,
- "defaultOpen": true,
- ext: {
- channelSize: 30
- }
- },
- startTime: 0, // 起始播放时间
- fullscreenTarget: document.querySelector('.video-container'),
- controls: {
- root: document.getElementById('controls_new_root') // 指定播放器之外挂载dom
- } ,
- // icons: {
- // openDanmu: openDanmu,
- // closeDanmu: closeDanmu
- // },
- commonStyle: {
- // 播放完成部分进度条底色
- playedColor: '#FF5C03',
- cachedColor: 'transparent'
- },
- seekedStatus: 'auto',
- disableGesture: true,
- closeVideoTouch: true,
- closeVideoDblclick: true,
- closeVideoClick: false,
- progress: {
- isDraggingSeek: false,
- isCloseClickSeek: true,
- closeMoveSeek: true
- },
- fullscreen:{
- useScreenOrientation: true,
- lockOrientationType: 'landscape'
- },
- definition: {
- defaultDefinition: "线路二"
- }
- }
- xgplayerOption.url = newValue.lineTwo ? newValue.lineTwo : newValue.videoUrl
- xgplayerOption.definition.defaultDefinition = newValue.lineTwo ? '线路二' :'线路一'
- if(!xgplayerOption.url) return
- xgplayerOption.poster = newValue.thumbnail
- if(newValue.studyTime && newValue.seconds != newValue.studyTime) {
- xgplayerOption.startTime = newValue.studyTime
- }
- if(newValue.isFast == 1) {
- // 允许拖动进度条
- xgplayerOption.progress.isCloseClickSeek = false
- xgplayerOption.progress.closeMoveSeek = false
- }else {
- // 不允许拖动进度条
- xgplayerOption.progress.isCloseClickSeek = true
- xgplayerOption.progress.closeMoveSeek = true
- }
- if(this.player) {
- // this.player.off()
- this.player.playNext({
- url: newValue.lineTwo ? newValue.lineTwo : newValue.videoUrl,
- startTime: newValue.startTime || 0,
- poster:xgplayerOption.thumbnail || '',
- ignores:xgplayerOption.ignores,
- progress: xgplayerOption.progress,
- definition: xgplayerOption.definition,
- })
- } else {
- this.player = new Player(xgplayerOption);
- this.danmuInstance = this.player.getPlugin('danmu')
- this.progressMove(xgplayerOption)
- }
- if(newValue.isFast == 1) {
- this.player.getPlugin('progress').show()
- }else {
- this.player.getPlugin('progress').hide()
- }
- let lines=[]
- if(newValue.lineOne) {
- lines.push({
- name: '线路一',
- definition: '线路一',
- url:newValue.lineOne
- })
- }
- if(newValue.lineTwo) {
- lines.push({
- name: '线路二',
- definition: '线路二',
- url:newValue.lineTwo
- })
- }
- if(newValue.lineThree) {
- lines.push({
- name: '线路三',
- definition: '线路三',
- url:newValue.lineThree
- })
- }
- this.player.emit('resourceReady', lines)
- // this.progressMove(xgplayerOption)
- this.rjsPlayFun(xgplayerOption)
- },
- progressMove(data) {
-
- const Events = this.Events
- this.player.on(Events.PlAY, () => {
- this.isXGPause = false
- this.ownerInstance.callMethod("changeCountdowning",{countdowning:true,isXGPause:this.isXGPause})
- })
- this.player.on(Events.PLAYING, () => {
- // console.log("===播放Events.PLAYING")
- this.isXGPause = false
- this.ownerInstance.callMethod("changeCountdowning",{countdowning:true,isXGPause:this.isXGPause})
- })
- this.player.on(Events.WAITING, () => {
- this.ownerInstance.callMethod("changeCountdowning",{countdowning:false,isXGPause:this.isXGPause})
- })
- this.player.on(Events.PAUSE, () => {
- // console.log("===暂停Events.PAUSE")
- this.isXGPause = true
- this.ownerInstance.callMethod("changeCountdowning",{countdowning:false,isXGPause:this.isXGPause})
- })
- this.player.on(Events.ERROR, (error) => {
- console.log('video error:', error)
- this.ownerInstance.callMethod("changeCountdowning",{countdowning:false,isXGPause:this.isXGPause})
- })
- // 监听用户的播放进度
- this.player.on(Events.TIME_UPDATE, () => {
- this.ownerInstance.callMethod("onTimeUpdate",{time: this.player.currentTime});
- })
- this.player.on(Events.ENDED, () => {
- this.ownerInstance.callMethod("changeCountdowning",{countdowning:false,isXGPause:this.isXGPause})
- this.ownerInstance.callMethod("endedPlayNext")
- })
- this.player.on(Events.FULLSCREEN_CHANGE, (isFullscreen) => {
- if(this.isFullscreen == isFullscreen) return
- this.isFullscreen = isFullscreen
- plus.screen.lockOrientation('landscape')
- this.ownerInstance.callMethod("onFullscreenChange",{isFullscreen:isFullscreen})
- })
- this.player.on(Events.CSS_FULLSCREEN_CHANGE, (isFullscreen) => {
- if(this.isFullscreen == isFullscreen) return
- this.isCSSFull = true
- this.isFullscreen = isFullscreen
- this.ownerInstance.callMethod("onFullscreenChange",{isFullscreen:isFullscreen})
- })
- // 清晰度发生变化
- this.player.on(Events.DEFINITION_CHANGE, (res) => {
- if(this.lineName == res.to.name) return
- this.lineName = res.to.name
- this.ownerInstance.callMethod("changeLine",{url: res.to.url})
- })
- },
- rjsPlayFun(xgplayerOption){
- this.ownerInstance.callMethod("playFun",{time: xgplayerOption.startTime})
- },
- changeVideo(newValue, oldValue,ownerInstance) {
- if (!this.ownerInstanceVideo) this.ownerInstanceVideo = ownerInstance
- if(this.player) {
- if(newValue.status.indexOf('play') > -1) {
- const tempAudioDuration = newValue.tempAudioDuration
- const flag = newValue.tempAudioDuration != newValue.studyTime
- if(flag) {
- this.player.seek(tempAudioDuration)
- this.player.on(this.Events.SEEKED, () => {
- setTimeout(()=>{
- this.player.play()
- },200)
- })
- } else {
- setTimeout(()=>{
- this.player.play()
- },200)
- }
- }else if(newValue.status.indexOf('pause') > -1) {
- this.player.pause()
- }
- }
- },
- handleExitFullscreen(newValue, oldValue,ownerInstance) {
- // 退出全屏
- if(this.player&&this.isFullscreen && newValue.indexOf('yes') > -1) {
- if(this.isCSSFull) {
- this.player.exitCssFullscreen()
- } else {
- this.player.exitFullscreen()
- }
- }
- },
- // 发送弹幕
- danmuFun(newValue, oldValue,ownerInstance) {
- if(newValue.event=='send') {
- // 发送弹幕
- // console.log("===========发送弹幕",newValue.danmuItem)
- this.danmuInstance.sendComment(newValue.danmuItem)
- }else if(newValue.event=='switch'){
- // 弹幕开关
- // console.log("===========弹幕开关",newValue.switch)
- if(newValue.switch == 1) {
- this.danmuInstance.start()
- } else {
- this.danmuInstance.stop()
- }
- } else if(newValue.event=="getDanmuList") {
- // console.log("===========弹幕列表")
- this.danmuInstance.updateComments(newValue.danmuList,true)
- } else if(newValue.event=="clearDanmuList") {
- // console.log("===========清除列表")
- this.danmuInstance.clear()
- } else if(newValue.event=="setArea"){
- this.danmuInstance.setArea({
- start: 0,
- end: newValue.area,
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @mixin u-flex($flexD, $alignI, $justifyC) {
- display: flex;
- flex-direction: $flexD;
- align-items: $alignI;
- justify-content: $justifyC;
- }
- .es-mr-24px {
- margin-right: 24px;
- }
- .coloritem {
- height: 24px;
- width: 24px;
- margin-bottom: 12px;
- border-radius: 5px;
- }
- .danmu-controls {
- background-color: #F5F7FA;
- overflow: hidden;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 12px;
- color: #999999;
- padding: 0 10px;
- border-radius: 50px 0 0 50px;
- height: 28px;
- overflow: hidden;
- box-sizing: border-box;
- &-r {
- padding: 0 10px;
- border-radius: 0 50px 50px 0;
- height: 28px;
- overflow: hidden;
- box-sizing: border-box;
- background-color: #fff;
- image {
- height: 20px;
- width: 20px;
- }
- }
- }
- ::v-deep {
- .danmu-switch-open, .danmu-switch-closed {
- height: 25px;
- width: 25px;
- }
- }
- .xgplayer-switch {
- background-image: linear-gradient(180deg,transparent,rgba(0,0,0,.37),rgba(0,0,0,.75),rgba(0,0,0,.75));
- }
- .danmuPopup {
- background-color: #fff;
- &-head {
- width: 100%;
- padding: 10px;
- box-sizing: border-box;
- overflow: hidden;
- @include u-flex(row,center,flex-start);
- .danmu-icon {
- height: 24px;
- width: 24px;
- margin-right: 12px;
- }
- }
- &-input {
- flex: 1;
- height: 35px;
- }
- &-send {
- flex-shrink: 0;
- height: 35px;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 5px 15px;
- box-sizing: border-box;
- background: #FF5C03 !important;
- border-radius: 22px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 15px;
- color: #fff !important;
- margin-left: 12px;
- &::after {
- border: none;
- }
- }
- &-con {
- background-color: #F5F7FA;
- padding: 24px 12px 48px 12px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 14px;
- color: #757575;
- }
- }
- .content {
- background: #f7f7f7;
- }
- .cousrseImg {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 422rpx;
- background-color: #000;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .video-box {
- width: 100%;
- height: 422rpx;
- overflow: hidden;
- position: relative;
- // padding-top: var(--status-bar-height);
- }
- .scroll-Y {
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #222222;
- }
- .horizontal {
- width: 130px;
- height: 150px;
- position: absolute;
- bottom: 50px;
- left: 20px;
- z-index: 999;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: flex-end;
- background-color: transparent;
- .es-w-40 {
- width: 20px;
- }
- .es-h-40 {
- height: 20px;
- }
- .goods {
- width: 120px;
- height: 140px;
- border-radius: 10px;
- background-color: rgba(255, 255, 255, 0.4);
- overflow: hidden;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .goodsimg {
- width: 100px;
- height: 100px;
- border-radius: 10px;
- }
- .goodsname {
- width: 100px;
- font-size: 12px;
- box-sizing: border-box;
- padding-top: 7px;
- verflow: hidden;
- word-break: break-all;
- }
- }
- .rotate {
- transform: rotate(-180deg);
- }
- .status_bar {
- background-color: #000;
- }
- .back-img {
- width: 25px;
- height: 25px;
- position: absolute;
- top: 10px;
- left: 34rpx;
- z-index: 99;
- }
- .audiobox {
- width: 100%;
- height: 422rpx;
- position: absolute;
- top: 0;
- left: 0;
- background-color: #333;
- z-index: 9990;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 26rpx;
- color: #fff;
- &-video {
- background-color: rgba(255, 255, 255, 0.3);
- padding: 8rpx 20rpx;
- border-radius: 50rpx;
- position: absolute;
- bottom: 40rpx;
- left: 50%;
- transform: translateX(-50%);
- z-index: 9991;
- text-align: center;
- }
- &-title {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 9991;
- padding: 30rpx 40rpx;
- width: 100%;
- box-sizing: border-box;
- background: linear-gradient(to top, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 100%);
- display: flex;
- align-items: center;
- .back {
- width: 50rpx;
- height: 50rpx;
- margin-right: 15rpx;
- flex-shrink: 0;
- }
- }
- &-time {
- margin-top: 18rpx;
- font-size: 24rpx;
- }
- }
- .scroll-Y {
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 28rpx;
- color: #222222;
- }
- .video-info {
- padding: 24rpx;
- background-color: #fff;
- &-header {
- width: 100%;
- @include u-flex(row, center, space-between);
- }
- &-headerl {
- flex: 1;
- @include u-flex(row, center, flex-start);
- font-weight: 500;
- font-size: 32rpx;
- overflow: hidden;
- image {
- flex-shrink: 0;
- width: 88rpx;
- height: 88rpx;
- margin-right: 28rpx;
- background: #F5F7FA;
- border-radius: 50%;
- overflow: hidden;
- }
- }
- .follow-btn {
- @include u-flex(row, center, center);
- height: 56rpx;
- min-width: 154rpx;
- padding: 0 23rpx;
- background: #FF5C03;
- border-radius: 28rpx 28rpx 28rpx 28rpx;
- color: #FFFFFF;
- font-size: 28rpx;
- image {
- height: 32rpx;
- width: 32rpx;
- margin-right: 6rpx;
- }
- }
- &-voice {
- width: 100%;
- padding: 24rpx 20rpx 38rpx 28rpx;
- margin-top: 26rpx;
- background: #F5F7FA;
- border-radius: 16rpx 16rpx 16rpx 16rpx;
- box-sizing: border-box;
- image {
- width: 48rpx;
- height: 48rpx;
- }
- &-l {
- @include u-flex(row, center, flex-start);
- image {
- margin-right: 20rpx;
- }
- }
- }
- &-voicebox1 {
- @include u-flex(row, center, space-between);
- }
- &-voicebox2 {
- padding: 24rpx 0;
- @include u-flex(row, center, space-between);
- font-weight: 400;
- font-size: 26rpx;
- color: #757575;
- }
- ::v-deep .uni-collapse-item__title-arrow {
- margin-right: -8rpx;
- }
- .opacity {
- position: relative !important;
- opacity: 1 !important;
- z-index: 1 !important;
- }
- &-desc {
- margin-bottom: 52rpx;
- font-weight: 400;
- font-size: 28rpx;
- color: #222222;
- word-break: break-all;
- overflow: hidden;
- line-height: 42rpx;
- position: absolute;
- opacity: 0;
- z-index: -1;
- .desc-image {
- height: 60rpx;
- width: 100%;
- position: absolute;
- bottom: 0;
- left: 0;
- }
- }
- .text-clamp {
- display: -webkit-box;
- -webkit-line-clamp: 2;
- /* 显示的行数 */
- -webkit-box-orient: vertical;
- /* 内容会垂直堆叠 */
- overflow: hidden;
- /* 隐藏溢出的内容 */
- text-overflow: ellipsis;
- /* 当内容被裁剪时显示省略号 */
- }
- &-footer {
- @include u-flex(row, center, space-between);
- color: #757575;
- font-weight: 400;
- font-size: 24rpx;
- view {
- width: 128rpx;
- height: 104rpx;
- @include u-flex(column, center, center);
- }
- image {
- width: 48rpx;
- height: 48rpx;
- margin-bottom: 8rpx;
- }
- }
- }
- .box-header {
- height: 80rpx;
- padding: 0 24rpx;
- @include u-flex(row, center, space-between);
- font-weight: 500;
- font-size: 24rpx;
- color: #999999;
- &-title {
- color: #222222;
- font-size: 34rpx;
- }
- &-r {
- @include u-flex(row, center, flex-start);
- image {
- width: 48rpx;
- height: 48rpx;
- }
- }
- }
- .therapy {
- background-color: #fff;
- padding-left: 24rpx;
- padding-bottom: 20rpx;
- &-scrollx {
- white-space: nowrap;
- width: 100%;
- // margin-left: 24rpx;
- }
- &-scrollitem {
- display: inline-block;
- overflow: hidden;
- background: #F5F7FA;
- padding: 10rpx;
- margin-right: 20rpx;
- border-radius: 10rpx;
- overflow: hidden;
- border: 1rpx solid #F5F7FA;
- box-sizing: border-box;
- position: relative;
- overflow: hidden;
- image {
- width: 200rpx;
- height: 200rpx;
- border-radius: 10rpx;
- background-color: #F5F7FA;
- }
- &::after {
- content: '查看详情';
- background-color: #F5F7FA;
- position: absolute;
- top: 0;
- left: 0;
- font-weight: 400;
- font-size: 20rpx;
- padding: 4rpx 14rpx;
- border-radius: 10rpx 0 10rpx 0;
- color: #757575;
- }
- }
- &-active {
- background: #fff;
- border: 1rpx solid #FF5C03;
- .therapy-goodsname {
- color: #FF5C03 !important;
- }
- &::after {
- background: #fff;
- color: #FF5C03 !important;
- }
- }
- &-goodsname {
- margin-top: 6rpx;
- width: 200rpx;
- min-height: 64rpx;
- font-size: 24rpx;
- color: #757575;
- word-break: break-all;
- white-space: normal;
- }
- }
- .video-directory {
- background-color: #fff;
- padding-top: 12rpx;
- margin-top: 20rpx;
- &-scrollx {
- white-space: nowrap;
- width: calc(100% - 24rpx);
- margin-left: 24rpx;
- }
- &-scrollitem {
- display: inline-block;
- width: 276rpx;
- height: 160rpx;
- background: #F5F7FA;
- border-radius: 8rpx 8rpx 8rpx 8rpx;
- margin-right: 18rpx;
- padding: 20rpx 12rpx 20rpx 20rpx;
- box-sizing: border-box;
- position: relative;
- margin-bottom: 20rpx;
- }
- .freeflag {
- min-width: 68rpx;
- height: 32rpx;
- padding: 0 12rpx 0 12rpx;
- text-align: center;
- line-height: 32rpx;
- position: absolute;
- right: 0;
- top: 0;
- font-weight: 500;
- font-size: 20rpx;
- color: #FFFFFF;
- border-radius: 0 8rpx 0 8rpx;
- &-free {
- // background: url('@/static/image/hall/free_lable_bg.png') no-repeat right / 100% 32rpx;
- background-color: #FF5C03;
- }
- &-member {
- // background: url('@/static/image/hall/member_label_bg.png') no-repeat right / 100% 32rpx;
- background-color: #FFB205;
- }
- }
- &-num {
- font-weight: 500;
- font-size: 28rpx;
- @include u-flex(row, center, flex-start);
- image,
- .empty {
- width: 48rpx;
- height: 48rpx;
- margin-left: 10rpx;
- }
- }
- &-title {
- @include u-flex(row, center, space-between);
- font-size: 24rpx;
- color: #757575;
- word-break: break-all;
- white-space: normal;
- .imagebox {
- flex-shrink: 0;
- margin: 0 8rpx;
- position: relative;
- image {
- width: 92rpx;
- height: 72rpx;
- border-radius: 8rpx 8rpx 8rpx 8rpx;
- overflow: hidden;
- }
- }
- }
- .mask {
- width: 92rpx;
- height: 72rpx;
- border-radius: 8rpx 8rpx 8rpx 8rpx;
- background: rgba(0, 0, 0, 0.2);
- overflow: hidden;
- position: absolute;
- top: 0;
- left: 0;
- z-index: 1;
- @include u-flex(row, center, center);
- image {
- width: 24rpx;
- height: 24rpx;
- }
- }
- .active-scrollitem {
- background: #FCF0E7;
- color: #FF5C03;
- .video-directory-title {
- color: #FF5C03;
- }
- }
- }
- .video-comment {
- background-color: #fff;
- padding-top: 12rpx;
- margin-top: 20rpx;
- }
- .hall-box {
- @include u-flex(row, center, flex-start);
- flex-wrap: wrap;
- margin: 0 -18rpx -18rpx 0;
- padding: 12rpx 24rpx 24rpx 24rpx;
- .gapitem {
- margin: 0 18rpx 18rpx 0;
- }
- }
- .popbox {
- background-color: #fff;
- position: relative;
- .box-header {
- padding-top: 12rpx;
- padding-bottom: 12rpx;
- box-sizing: border-box;
- background-color: #fff;
- }
- .popbox-body {
- .comment,
- .directoryinfo {
- padding: 24rpx;
- }
- }
- .search-box {
- @include u-flex(row, center, space-between);
- padding: 10px 24rpx;
- .search {
- padding: 0;
- flex: 1;
- image {
- width: 24rpx;
- height: 24rpx;
- padding-left: 16rpx;
- }
- }
- }
- }
- .search-btn {
- flex-shrink: 0;
- height: 68rpx;
- padding: 0 42rpx;
- margin-left: 20rpx;
- background: #FCF0E7;
- border-radius: 34rpx 34rpx 34rpx 34rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 600;
- font-size: 26rpx;
- color: #FF5C03;
- text-align: center;
- line-height: 68rpx;
- }
- .comment-inputbox {
- @include u-flex(row, center, space-between);
- padding: 28rpx 24rpx;
- box-sizing: border-box;
- background: #FFFFFF;
- .inputbox {
- flex: 1;
- height: 72rpx;
- padding-left: 24rpx;
- background: #F5F7FA;
- border-radius: 36rpx 36rpx 36rpx 36rpx;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 26rpx;
- color: #999999;
- line-height: 72rpx;
- }
- .release-btn {
- @extend .search-btn;
- }
- }
- .audio {
- display: flex;
- flex-direction: row;
- align-items: center;
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 24rpx;
- color: #757575;
- &-play {
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- &-icon {
- width: 48rpx;
- height: 48rpx;
- }
- &-slider {
- flex: 1;
- }
- &-time {
- flex-shrink: 0;
- }
- }
- .vipCourseBtn {
- background: #1B1F22;
- border-radius: 46rpx;
- border: 1px solid #FFDAA3;
- color: #FFDAA3;
- width: calc(33.33333% - 46.6666rpx);
- }
- .vipAc {
- background: linear-gradient(90deg, #FFE0B2, #F8BA8B);
- border-radius: 46rpx;
- border: 1px solid #FFDAA3;
- color: #1B1F22;
- }
- .privilegeBox {
- background-color: #171a1d;
- box-sizing: border-box;
- }
- .primenu-box {
- border-radius: 16rpx;
- margin-top: 0rpx;
- padding: 10rpx 20rpx;
- }
- .content-inner {
- display: flex;
- flex-wrap: wrap;
- min-height: 310rpx;
- }
- .content-inner .item {
- width: calc(33.3333333%);
- height: 150rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- margin-top: 0rpx;
- }
- .content-inner .item .img {
- width: 84rpx;
- height: 84rpx;
- margin-bottom: 8rpx;
- }
- .content-inner .item .label {
- font-size: 32rpx;
- color: #83878A;
- }
- .vipMethodItem {
- border-radius: 10rpx;
- width: calc(100%);
- height: 70rpx;
- color: #FDD8A1;
- }
- .payTypeItem {
- background-color: #1B1F22;
- border: 1px solid #fff;
- border-radius: 10rpx;
- width: calc(50% - 15rpx);
- height: 94rpx;
- }
- .circle {
- border: 1px solid #FDD8A1;
- }
- .pt_ac {
- border: 1px solid #FDD8A1;
- }
- .slider-box {
- flex: 1
- }
- </style>
|