12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895 |
- <template>
- <view class="polyv_detail">
- <!-- <nav-bar
- :title="detail.courseName || '课程详情'"
- v-show="navShow"
- ></nav-bar> -->
- <uni-nav-bar
- left-icon="back"
- :statusBar="true"
- fixed="true"
- :title="detail.courseName || '课程详情'"
- @clickLeft="clickLeft"
- ></uni-nav-bar>
- <view id="top">
- <view class="video_box" v-if="!startStatus">
- <image
- :src="$method.splitImgHost(goodsData.coverUrl)"
- mode="widthFix"
- style="width: 100%; height: 421rpx"
- ></image>
- <image
- v-if="false"
- class="video_play"
- src="/static/play.png"
- @click="startVideo"
- ></image>
- </view>
- <view v-else>
- <!-- v-if="playVID" -->
- <!-- #ifdef MP-WEIXIN -->
- <view class="video_box" style="width: 100%; height: 421rpx">
- <polyv-player
- v-if="playVID"
- id="playerVideo"
- playerId="playerVideo"
- height="421rpx"
- :vid="vid"
- :showSettingBtn="true"
- :enablePlayGesture="true"
- :custom-cache="false"
- :object-fit="'contain'"
- @statechange="onStateChange"
- @fullscreenchange="fullscreenchange"
- @error="playError"
- :autoplay="autoplay"
- :page-gesture="true"
- :vslide-gesture="true"
- :vslide-gesture-in-fullscreen="true"
- :isAllowSeek="isAllowSeek"
- :playbackRate="playbackRate"
- :enableAutoRotation="enableAutoRotation"
- @loadedmetadata="loadedmetadata"
- ></polyv-player>
- <!-- :startTime="startTime" -->
- <cover-view
- class="video-toast__close"
- v-if="videoToastShow"
- @click="closeToast()"
- >X</cover-view
- >
- <cover-view class="video-toast" v-if="videoToastShow">
- <cover-view class="video-toast__text"
- >您上次看到 {{ seekTime }},正在自动续播</cover-view
- >
- <cover-view class="video-toast__btn" @click="restart()"
- >从头播放</cover-view
- >
- </cover-view>
- </view>
- <!-- #endif -->
- <!-- #ifdef H5 -->
- <view class="video_box" style="width: 100%; height: 421rpx">
- <view v-show="vid" id="player"></view>
- <cover-view
- class="video-toast__close"
- v-if="videoToastShow"
- @click="closeToast()"
- >X</cover-view
- >
- <cover-view class="video-toast" v-if="videoToastShow">
- <cover-view class="video-toast__text"
- >您上次看到 {{ seekTime }},正在自动续播</cover-view
- >
- <cover-view class="video-toast__btn" @click="restart()"
- >从头播放</cover-view
- >
- </cover-view>
- </view>
- <!-- #endif -->
- <view
- class="video_box"
- style="width: 100%; height: 421rpx"
- v-if="playChannelId > 0"
- >
- <player
- class="plv-mp-demo-player"
- :videoOption="videoOption"
- :page-gesture="true"
- :vslide-gesture="true"
- :vslide-gesture-in-fullscreen="true"
- @onLiveStatusChange="playerLiveStatusChange"
- />
- </view>
- </view>
- <view class="course_name">
- <view class="course_titles">
- <view class="video_t1" :class="{ one: !goodsData.buyNote }">{{
- detail.courseName
- }}</view>
- <view class="notice_wrap" v-if="goodsData.buyNote">
- <view class="video_t1_t" @click="studyNotice"> 学员须知 </view>
- </view>
- <view
- class="toggle_course"
- v-if="goodsTeacher.length > 1"
- @click="changeCourses()"
- >
- <image
- class="img"
- src="/pages3/static/imgs/toggle.png"
- mode="widthFix"
- ></image>
- <view class="toggle_name">切换课程</view>
- <!-- courseTotal -->
- <view class="numbers">共{{ goodsTeacher.length }}门</view>
- </view>
- </view>
- </view>
- <u-line color="#D6D6DB" />
- <view>
- <view>
- <u-tabs
- :item-width="itemWidth()"
- :list="list"
- font-size="32"
- bar-width="24"
- :current="current"
- @change="change"
- active-color="#007AFF"
- ></u-tabs>
- </view>
- </view>
- <u-line color="#D6D6DB" />
- </view>
- <view class="box" :class="{ first_ml: current == 0 }">
- <scroll-view class="box_in" scroll-y="true">
- <!--目录 -->
- <view v-show="current == 0">
- <view
- class="top__header"
- v-if="livingItem"
- @click="goLive(livingItem)"
- >
- <image
- class="img"
- src="/pages3/static/imgs/live.png"
- mode="widthFix"
- ></image>
- <view class="note">正在直播中</view>
- <view class="title">{{ livingItem.sectionName }}</view>
- </view>
- <view
- v-if="teacherList && teacherList.length > 0"
- class="teacher_names"
- >
- <view
- v-for="(tea, index) in teacherList"
- :key="index"
- class="names"
- :class="{ nactive: teacherIndex == index }"
- @click="activeFunc(tea, index)"
- >
- {{ tea.aliasName }}
- </view>
- </view>
- <view
- class="menuBox onessss"
- v-for="(item, index) in menuList"
- :key="index"
- >
- <template v-if="!$method.isEmptyObject(sectionItem)">
- <!--模块 -->
- <view v-if="item.type == 1"
- ><courseModule
- v-if="reStart"
- :orderGoodsId="orderGoodsId"
- :sectionMaxNum="goodsData.sectionMaxNum"
- :needOpen="sectionItem.moduleId == item.menuId"
- :courseId="courseId"
- :preItem="menuList[index - 1]"
- :learningOrder="orderNum"
- :goodsId="goodsId"
- :gradeId="gradeId"
- :isBuy="true"
- :menuItem="item"
- :levelId="item.menuId"
- :goodsType="1"
- :menuAllList="menuAllList"
- :sectionItem="sectionItem"
- ></courseModule
- ></view>
- <!--章 -->
- <view v-if="item.type == 2"
- ><courseChapter
- v-if="reStart"
- :orderGoodsId="orderGoodsId"
- :sectionMaxNum="goodsData.sectionMaxNum"
- :needOpen="
- !sectionItem.moduleId &&
- sectionItem.chapterId == item.menuId
- "
- :courseId="courseId"
- :preItem="menuList[index - 1]"
- @playEnd="sectionPlayEnd($event, index)"
- :learningOrder="orderNum"
- :goodsId="goodsId"
- :gradeId="gradeId"
- :isBuy="true"
- :menuItem="item"
- :levelId="'0-' + item.menuId"
- :goodsType="1"
- :menuAllList="menuAllList"
- :sectionItem="sectionItem"
- ></courseChapter
- ></view>
- <!--节 -->
- <view v-if="item.type == 3"
- ><courseSection
- ref="MoudleSection"
- v-if="reStart"
- :orderGoodsId="orderGoodsId"
- :sectionMaxNum="goodsData.sectionMaxNum"
- @playEnd="sectionPlayEnd($event, index)"
- :courseId="courseId"
- :preItem="menuList[index - 1]"
- :learningOrder="orderNum"
- :goodsId="goodsId"
- :gradeId="gradeId"
- :isBuy="true"
- :menuItem="item"
- :levelId="'0-0-' + item.menuId"
- :goodsType="1"
- :testType="3"
- :menuAllList="menuAllList"
- ></courseSection
- ></view>
- </template>
- <!-- @togoBack="togoBack($event)" -->
- </view>
- </view>
- <!--讲义 -->
- <view v-show="current == 1">
- <handouts-box
- :handoutsId="goodsData.handoutsId"
- v-if="goodsData.handoutsId"
- ></handouts-box>
- </view>
- <!--笔记 -->
- <view v-show="current == 2">
- <view v-if="noteList.length == 0" style="text-align: center"
- >暂无笔记</view
- >
- <view v-for="(item, index) in noteList" :key="index">
- <view class="dateBox">{{
- $method.timestampToTime(item.dateNote)
- }}</view>
- <view class="noteBox">
- <view
- v-for="(item1, index1) in item.userNotes"
- :key="index1"
- style="margin-top: 30rpx"
- @click="jumpNote(item1)"
- >
- <view style="display: flex">
- <view class="left_ti">
- <view>
- <image
- src="/static/icon/note2.png"
- v-if="noteId != item1.noteId"
- style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
- ></image>
- <image
- src="/static/icon/note1.png"
- v-if="noteId == item1.noteId"
- style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
- ></image>
- </view>
- <view
- class="title"
- style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
- >{{ $method.secondToDate(item1.noteSecond) }}</view
- >
- </view>
- <view style="margin-left: 10rpx">
- <view class="t2Content leftPadding">{{
- item1.sectionName
- }}</view>
- <view class="tBox2">{{ item1.noteText }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!--答疑 -->
- <view v-show="current == 3" class="Answering">
- <view
- v-for="(item, index) in answerList"
- :key="index"
- style="background-color: #ffffff"
- class="answer_item"
- >
- <view class="chat_box" @click.stop="clearCtx">
- <view style="display: flex; flex: 1">
- <view
- ><image
- :src="
- item.assignUserId > 0 && !item.realname
- ? '/static/logo_xcx.png'
- : $method.splitImgHost(item.avatar)
- "
- style="width: 64rpx; height: 64rpx"
- ></image
- ></view>
- <view style="margin-left: 15rpx">
- <view class="chat1">{{
- item.assignUserId > 0 && !item.realname
- ? "祥粤老师"
- : item.realname
- }}</view>
- <view class="chat2">{{
- $method.timestampToTime(item.createTime, false)
- }}</view>
- <view class="chat3">
- <text v-if="item.assignUserId > 0">回复</text>
- <text v-if="item.assignUserId > 0" style="color: #007aff"
- >@{{ item.assignRealname }}</text
- >
- <view style="word-break: break-all">{{
- item.answerText
- }}</view>
- </view>
- </view>
- </view>
- <view
- class="btnReply"
- @click.stop="replyContent(item)"
- v-if="item.userId != userInfo.userId"
- >回复</view
- >
- <view v-else class="btnDel" @click.stop="delContent(item)"
- >删除</view
- >
- </view>
- <u-line color="#D6D6DB" />
- </view>
- <view v-if="answerList.length == 0" style="text-align: center"
- >暂无记录</view
- >
- </view>
- <!--目录 -->
- <view v-show="current == 4">
- <view
- class="menuBox"
- v-for="(item, index) in reMenuList"
- :key="index"
- >
- <!--模块 -->
- <view v-if="item.type == 1"
- ><courseModule
- :orderGoodsId="orderGoodsId"
- :sectionMaxNum="goodsData.sectionMaxNum"
- :courseId="courseId"
- :learningOrder="orderNum"
- :goodsId="goodsId"
- :gradeId="gradeId"
- :isRebuild="true"
- :isBuy="true"
- :menuItem="item"
- :levelId="item.menuId"
- :goodsType="1"
- :menuAllList="menuAllList"
- :sectionItem="sectionItem"
- ></courseModule
- ></view>
- <!--章 -->
- <view v-if="item.type == 2">
- <courseChapter
- :orderGoodsId="orderGoodsId"
- :courseId="courseId"
- :learningOrder="orderNum"
- :sectionMaxNum="goodsData.sectionMaxNum"
- @playEnd="sectionPlayEnd($event, index)"
- :gradeId="gradeId"
- :goodsId="goodsId"
- :isRebuild="true"
- :isBuy="true"
- :menuItem="item"
- :levelId="'0-' + item.menuId"
- :goodsType="1"
- :menuAllList="menuAllList"
- ></courseChapter>
- </view>
- <!--节 -->
- <view v-if="item.type == 3">
- <courseSection
- :orderGoodsId="orderGoodsId"
- :courseId="courseId"
- :learningOrder="orderNum"
- :sectionMaxNum="goodsData.sectionMaxNum"
- @playEnd="sectionPlayEnd($event, index)"
- :gradeId="gradeId"
- :goodsId="goodsId"
- :isRebuild="true"
- :isBuy="true"
- :nextMenuItem="findMenuNextSection(index)"
- :menuItem="item"
- :levelId="'0-0-' + item.menuId"
- :goodsType="1"
- :testType="3"
- :menuAllList="menuAllList"
- ></courseSection>
- </view>
- </view>
- </view>
- </scroll-view>
- <!-- 底部固定按钮 -->
- <!-- 笔记的输入框 -->
- <template v-if="current == 2">
- <view
- class="inputBottom"
- v-if="!(isPlayRebuild > 0) && playChannelId == 0"
- :style="{ bottom: bottomHeight + 'px' }"
- >
- <view style="width: 10%"
- ><image
- src="/static/icon/note3.png"
- style="width: 39rpx; height: 39rpx; margin: 0 29rpx"
- ></image
- ></view>
- <view style="width: 73%; height: 100%; padding: 10rpx 0">
- <input
- v-model="noteValue"
- height="60"
- fixed="true"
- placeholder="您可以在这里输入笔记内容"
- type="text"
- :custom-style="inputStyle"
- :adjust-position="false"
- class="input"
- @focus="focusNote"
- @blur="blurNote"
- />
- </view>
- <view
- style="
- color: #007aff;
- font-size: 30rpx;
- font-weight: bold;
- width: 15%;
- text-align: center;
- "
- @click="postNote"
- >提交</view
- >
- </view>
- </template>
- <!-- 答疑的输入框 -->
- <view
- v-if="current == 3"
- class="inputBottom"
- :style="{ bottom: bottomHeight + 'px' }"
- >
- <view class="flex_auto">
- <input
- v-model="ctxValue"
- height="60"
- fixed="true"
- :focus="isFocus"
- :placeholder="placeholder"
- type="text"
- :custom-style="inputStyle"
- :adjust-position="false"
- class="input"
- @focus="focusNote"
- @blur="blur"
- />
- </view>
- <view class="btn" @click="postContent">提交</view>
- </view>
- </view>
- <!-- 播放前拍照end -->
- <u-popup
- v-model="showSet"
- :mask-close-able="false"
- mode="center"
- border-radius="24"
- >
- <view
- style="
- align-items: center;
- padding: 0 40rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- "
- >
- <view
- style="
- font-weight: bold;
- color: #333333;
- font-size: 30rpx;
- margin-top: 30rpx;
- "
- >温馨提示</view
- >
- <view
- style="
- width: 457rpx;
- color: #666666;
- font-size: 30rpx;
- margin-top: 30rpx;
- "
- >学习过程中需要拍照验证学员身份, 拍照功能需要使用您的相机。
- 是否授权使用?</view
- >
- <view style="margin: 40rpx 0">
- <button
- open-type="openSetting"
- @bindopensetting="openSetting"
- class="btnSet"
- >
- 去授权
- </button>
- </view>
- </view>
- </u-popup>
- <u-popup
- v-model="photoPopup"
- mode="bottom"
- border-radius="40"
- :mask-close-able="false"
- >
- <!-- 播放前拍照start -->
- <!-- :mask-close-able="false" -->
- <!-- style="bottom: 0; position: fixed; width: 100%; z-index: 999" -->
- <view v-if="photoPopup">
- <view class="photoBox">
- <view class="photoTop">
- <view class="sqzz" v-if="false"
- ><u-icon
- name="close"
- color="#333333"
- size="30"
- @click="closePhoto"
- ></u-icon
- ></view>
- <view class="centersq">请正视手机屏幕</view>
- <view class="sqzz"></view>
- </view>
- <view class="photoCenter">
- <view class="center_camera" v-if="photoPopup && isTaking">
- <!-- #ifdef MP-WEIXIN -->
- <camera
- device-position="front"
- flash="off"
- @error="error"
- style="width: 100%; height: 100%"
- >
- <!-- 加人脸框 -->
- <cover-view class="head_take">
- <cover-view class="headTake_up color"></cover-view>
- <cover-view class="headTake_minddle">
- <cover-view class="min_left color"></cover-view>
- <cover-view class="min_img"></cover-view>
- <cover-view class="min_right color"></cover-view>
- </cover-view>
- <cover-view class="headTake_down color"></cover-view>
- </cover-view>
- </camera>
- <!-- #endif -->
- <!-- #ifdef H5 -->
- <video
- :controls="false"
- id="video"
- width="400"
- height="300"
- class="photo_v"
- ></video>
- <view class="mask"></view>
- <!-- #endif -->
- </view>
- <view class="custom" v-if="!isTaking">
- <!-- #ifdef MP-WEIXIN -->
- <image :src="avatarUrl" mode=""></image>
- <!-- #endif -->
- <!-- #ifdef H5 -->
- <image :src="faceUrl" mode=""></image>
- <!-- #endif -->
- </view>
- </view>
- <view class="btns">
- <!-- <view class="btnResult" v-if="isTaking" @click="takePhoto"
- >拍照</view
- > -->
- <view v-if="isTaking" class="takePhoto_btn">
- <view style="width: 100rpx; height: 2rpx"></view>
- <view class="middle_btn" @click="takePhoto">
- <view class="square"></view>
- </view>
- <view class="rights" @click="takePhTips()">
- <text>拍照提示</text>
- <u-icon name="arrow-right" color="#FFFFFF" size="30"></u-icon>
- </view>
- </view>
- <view class="btnResult" v-if="!isTaking" @click="reTake">重拍</view>
- <view class="btnResult" v-if="!isTaking" @click="submit">确认</view>
- </view>
- </view>
- </view>
- </u-popup>
- <u-popup
- v-model="noticeShow"
- class="notice_modal"
- mode="center"
- border-radius="28"
- width="650rpx"
- height="622rpx"
- :mask-close-able="false"
- @close="closeNotice"
- >
- <view class="content">
- <view class="title">学员须知</view>
- <scroll-view scroll-y="true">
- <view
- class="text"
- v-html="
- goodsData.buyNote && goodsData.buyNote.replace(/\n|\r\n/g, '<br>')
- "
- >
- </view>
- </scroll-view>
- <view
- class="had_read"
- :class="{ gray: CountTo >= 0 }"
- @click="noticeConfirm()"
- >
- <text v-if="CountTo >= 0">请阅读学员须知,30s后可关闭</text>
- <text v-else>我已阅读学员须知</text>
- <text v-if="CountTo >= 0">{{ " " + CountTo + "s" }}</text>
- </view>
- </view>
- </u-popup>
- <!-- 倒计时提交 -->
- <u-popup
- v-model="noticeShow1"
- class="notice_modal"
- mode="center"
- border-radius="28"
- width="650rpx"
- height="262rpx"
- :mask-close-able="false"
- >
- <view class="content">
- <view class="title">提示</view>
- <view class="had_read">
- <text v-if="CountTo1 >= 0">视频学习时长不达标,请等待</text>
- <text v-if="CountTo1 >= 0">{{ " " + CountTo1 + "s" }}</text>
- </view>
- </view>
- </u-popup>
- <u-modal
- v-model="showMark"
- title="提示"
- @confirm="markConfirm"
- @cancel="markCancel"
- confirm-text="复制学习网址"
- :show-cancel-button="true"
- cancel-text="关闭"
- >
- <view class="slot-content">
- <view>您的学习账号已经开通,请按照步骤操作,进行学习。</view>
- <view>1.复制学习地址:{{ markContent }}</view>
- <view>2.在【浏览器中】打开复制的学习网址</view>
- <view>3.打开学习网址后,选择【个人用户】进行登录</view>
- <view>(1)账号:您个人的身份证号码</view>
- <view>(2)密码:身份证号码,再加111111</view>
- </view>
- </u-modal>
- <!-- 切换课程弹窗 -->
- <u-popup
- v-model="toggleCourseShow"
- mode="bottom"
- border-radius="40"
- :mask-close-able="false"
- >
- <view class="popup_box">
- <view class="check_head">
- <view class="headers">
- <view class="grade">切换课程</view>
- <u-icon
- name="close"
- color="#9C9C9C"
- size="40"
- @click="closePop()"
- ></u-icon>
- </view>
- <view class="coruse_num">共{{ goodsTeacher.length }}门</view>
- <view class="menuSel">
- <scroll-view class="sub_sliper" scroll-x="true">
- <view
- v-for="(item, index) in subList"
- :key="index"
- style="margin-right: 50rpx; display: inline-block"
- >
- <view
- class="r_t1"
- :class="{ nactive: subIndex == index }"
- @click="cMenu(item, index)"
- >
- {{ item.subjectName }}
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- <view class="check_con">
- <scroll-view scroll-y="true" style="height: 700rpx">
- <view v-for="(courseItem, gTindex) in goodsTeacher" :key="gTindex">
- <view
- v-for="(item, index) in courseItem.courseList"
- :key="index"
- v-show="
- item.subjectId === newActiveSubjectId || !newActiveSubjectId
- "
- >
- <view class="course_items" v-if="item.show && item.show == 1">
- <view class="course_lefts">
- <view class="course_title">
- {{ item.courseName }}
- </view>
- <view
- v-if="courseItem.teaList && courseItem.teaList.length > 0"
- class="teacher_names"
- >
- <view
- v-for="(tea, tindex) in courseItem.teaList"
- :key="tindex"
- class="names"
- >{{ tea.aliasName }}</view
- >
- </view>
- <view class="course_pros">
- 学习进度
- <text>
- {{ item.stuAllNum + item.recordNum }}/{{
- item.secAllNum + item.examNum
- }}</text
- >
- </view>
- </view>
- <view
- class="course_rights"
- @click="jump(item, gTindex, 'jump')"
- >
- <view class="cicles">
- <u-icon
- name="arrow-right"
- color="#498AFE"
- size="20"
- ></u-icon>
- </view>
- <view class="intoStudy">进入学习</view>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </u-popup>
- <!-- 拍照提示 -->
- <popup-photo
- :popupPhotoShow.sync="popupPhotoShow"
- @takePhoto="toTakePhoto()"
- ></popup-photo>
- </view>
- </template>
- <script>
- import plv from "../static/polyv-sdk/index";
- import courseModule from "@/components/course/courseModule.vue";
- import courseChapter from "@/components/course/courseChapter.vue";
- import courseSection from "@/components/course/courseSection.vue";
- import handoutsBox from "@/components/course/handoutsBox.vue";
- import PopupPhoto from "@/components/popup/index.vue";
- import myCompressImage from "@/common/compressPhoto.js";
- import { mapGetters, mapMutations } from "vuex";
- var polyvPlayerContext = null;
- export default {
- components: {
- courseModule,
- courseChapter,
- courseSection,
- PopupPhoto,
- handoutsBox,
- },
- data() {
- return {
- markContent: "http://admin.zhujianpeixun.com/",
- showMark: false,
- hasStart: false,
- channelItem: null,
- lockTimer: null,
- orderGoodsId: 0,
- noticeShow: false,
- navShow: true,
- enableAutoRotation: true,
- seekTime: "",
- toastTimer: null,
- videoToastShow: false,
- initLiveOk: false,
- livePlay: false, //是否正在播放直播,不含暂停
- liveDuration: 0, //直播观看时长
- videoOption: {
- mode: "live",
- uid: "",
- cid: "",
- openId: "",
- isAutoChange: false,
- forceVideo: false,
- },
- liveDetail: {},
- showSet: false,
- startStatus: false,
- detail: {},
- courseId: 0,
- placeholder:
- "您可以在这里输入笔记内容\n还可以点击左侧图标为笔记加上时间标记",
- inputStyle: {
- background: "rgba(244, 244, 244, 0.98)",
- borderRadius: "24rpx",
- padding: "8rpx",
- marginBottom: "10rpx",
- },
- list: [],
- menuList: [],
- current: 0,
- vid: "",
- goodsId: 0,
- goodsData: {},
- photoPopup: false,
- goodsPlayConfig: null,
- autoplay: false,
- isAllowSeek: "no",
- playbackRate: [1.0],
- timer: null,
- goodsPhotographConfig: null,
- intervalTimeList: [], // 间隔拍照时长
- intervalTimeIndex: 0, //当前处于哪个时间段拍照
- playTime: 0, //页面播放时长,不含暂停
- currentTime: 0,
- avatarUrl: "",
- ossAvatarUrl: "",
- studyDuration: 0, // 当前视频时长
- gradeId: 0,
- chapterId: 0,
- moduleId: 0,
- reMenuList: [],
- answerList: [],
- assignUserId: 0,
- placeholder: "您可以在这里输入答疑内容",
- ctxValue: "",
- noteList: [],
- noteValue: "",
- noteId: 0,
- recordObj: 0,
- gradeDetail: {},
- isTaking: true, //是否正在拍照
- needSeek: false, //第一次播放是否需要跳转
- needProfileModal: false, //是否需要资料审核弹框
- liveObj: {},
- photoNum: 0,
- photoList: [], //拍照的时间点
- photoConfig: false, //是否配置好拍照次数
- photoIndex: 0, //当前位于拍照的区间下标 从0开始
- photoHistoryList: [], //已拍照历史的下标点
- sectionItem: {},
- businessData: {},
- showNotes: true,
- menuIndex: [],
- uploadLock: false, //上传图片
- isPlayRebuild: false, //是否正在播放重修视频
- isRebuild: false, //视频是否从重修目录点击
- isFocus: false,
- clearTimer: null,
- livingItem: "",
- option: null,
- muluStyle: false, //显示和隐藏目录样式
- bottomHeight: 0,
- toggleCourseShow: false, // 切换课程弹窗
- courseList: [], // 课程列表
- reStart: false, // 是否显示模块/章/节
- subList: [],
- subIndex: 0,
- goodsTeacher: [],
- teacherList: [],
- teacherIndex: 0,
- newActiveSubjectId: "", //当前选中ID
- compareFaceData: 0, // 拍照匹配相似度
- prendreAutoCarme: false, // 是否发起授权相机
- studyTimer: null, // 学习记录定时器
- CountTo: 30, // 倒计时
- CountTo1: 0,
- handoutTipLength: 0,
- menuAllList: [],
- popupPhotoShow: false,
- curPlayIndex: 0, // 正在播放的节的下标
- // h5
- vodPlayerJs: "https://player.polyv.net/resp/vod-player/latest/player.js",
- player: "",
- H5isAllowSeek: "on",
- // stream: null,
- faceUrl: "",
- erJianErZao: false,
- jjShiGongYuan: false,
- pauseTime: 0,
- pauseTimer: null,
- barTimer: null,
- isReach: false,
- noticeShow1: false,
- };
- },
- computed: {
- ...mapGetters([
- "userInfo",
- "playSectionId",
- "playChannelId",
- "playVID",
- "config",
- ]),
- playSecIsLearn() {
- return this.sectionItem.learning != 1;
- },
- orderNum() {
- return this.businessData.goodsLearningOrder;
- },
- },
- watch: {
- showSet(n) {
- if (n) {
- // var polyvPlayerContext = this.selectComponent("#playerVideo")
- if (polyvPlayerContext) {
- // #ifdef MP-WEIXIN
- polyvPlayerContext.pause();
- // #endif
- // #ifdef H5
- polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
- // #endif
- }
- }
- },
- photoPopup(n) {
- if (n) {
- if (this.prendreAutoCarme) {
- this.photoPopup = false;
- }
- this.showSet && (this.photoPopup = false);
- }
- },
- },
- onLoad(option) {
- if (option.isOther) {
- this.showMark = true;
- return;
- }
- this.courseId = Number(option.id) || "";
- this.goodsId = Number(option.goodsId);
- this.orderGoodsId = Number(option.orderGoodsId) || "";
- this.gradeId = Number(option.gradeId);
- this.option = option;
- // 公众号模板消息的数据埋点
- option.informId && this.clickOfficial(option.informId);
- },
- async onShow() {
- if (uni.getStorageSync("nofresh")) {
- uni.removeStorageSync("nofresh");
- return;
- }
- if (this.option.skipPort) {
- await this.$method.skipLogin(this.option.skipPort);
- }
- if (this.$method.isGoLogin()) {
- return;
- }
- this.option.isQ !== "" && (await this.qCheckIsCanLearn());
- !this.userInfo && this.$api.refreshUserInfo();
- this.closePhoto();
- this.courseCourseList();
- },
- onUnload() {
- console.log("onUnloadonUnloadonUnloadonUnload");
- this.originUnload();
- this.clears();
- clearInterval(this.lockTimer);
- },
- onHide() {
- this.originUnload();
- },
- mounted() {},
- methods: {
- ...mapMutations(["updateChapterOpen", "updateLiveLast"]),
- // 七大员是否能进入学习
- async qCheckIsCanLearn() {
- let res = await this.$api.qCheckIsCanLearn(this.orderGoodsId);
- if (res.data.code !== 200) {
- uni.showModal({
- showCancel: false,
- title: "提示",
- content: res.data.msg,
- success: (resultst) => {
- uni.navigateBack();
- },
- });
- return Promise.reject();
- }
- let res1 = await this.$api.syncSevenPublicClass({
- orderGoodsId: this.orderGoodsId,
- });
- if (res1.data.code !== 200) {
- uni.showModal({
- showCancel: false,
- title: "提示",
- content: "无法进入学习!",
- success: (resultst) => {
- uni.navigateBack();
- },
- });
- return Promise.reject();
- }
- },
- // 新增微信公众号模板消息点击数据
- clickOfficial(informId) {
- this.$http({
- url: "/data/click",
- method: "post",
- data: { informId },
- });
- },
- // 点击课程目录
- cMenu(item, index) {
- this.subIndex = index;
- this.newActiveSubjectId = item.subjectId;
- },
- courseCourseList() {
- // /course/courseList查询商品下的课程列表
- this.courseList = [];
- this.menuList = [];
- this.photoConfig = false;
- this.$api
- .courseCourseList({
- pageNum: 1,
- pageSize: 200,
- goodsId: this.goodsId,
- gradeId: this.gradeId,
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- this.courseList.push.apply(this.courseList, res.data.rows);
- // 科目
- let allItem = [{ subjectId: 0, subjectName: "所有" }];
- let ids = [];
- const newArr = [];
- this.courseList.forEach((item) => {
- if (ids.indexOf(item.subjectId) == -1) {
- ids.push(item.subjectId);
- newArr.push(item);
- }
- });
- this.subList = [...allItem, ...newArr];
- if (res.data.rows.length) {
- this.courseBusiness(res.data.rows[0].businessId);
- }
- if (res.data.total > 1) {
- this.getUserWatchLast();
- // this.$navTo.togo(`/pages2/wd/course?id=${v}&gid=${i}&orderGoodsId=${item.orderGoodsId}`);
- } else if (res.data.total == 1) {
- this.originOnShow();
- this.originMounted();
- }
- }
- });
- },
- /**
- * 获取业务层次详情
- */
- courseBusiness(businessId) {
- // '/app/common/course/business/'+data,
- this.$api.courseBusiness(businessId).then((res) => {
- this.businessData = res.data.data;
- });
- },
- // 查询用户最后一次看的录播的信息
- getUserWatchLast() {
- this.$http({
- url: "/study/record/getUserWatchLast",
- method: "get",
- data: {
- orderGoodsId: this.orderGoodsId,
- },
- }).then((res) => {
- if (res.data.code == 200) {
- this.sectionItem = res.data.data || {};
- if (res.data.data && Object.keys(res.data.data).length) {
- //有最后一次看的录播的信息
- this.courseId = res.data.data.courseId;
- // console.log('查询用户最后一次看的录播的信息', res.data, this.courseId)
- } else {
- this.courseId = this.courseList[0].courseId; // 没有观看记录默认一个课程
- // this.toggleCourseShow = true
- }
- } else {
- this.courseId = this.courseList[0].courseId; // 没有观看记录默认一个课程
- }
- this.originOnShow();
- this.originMounted();
- //获取商品双师资模板
- this.getCourseTeacher(this.courseList);
- });
- },
- getCourseTeacher(rows) {
- this.goodsTeacher = [];
- //获取商品双师资模板
- this.$api
- .courseTeacherList({
- goodsId: this.goodsId,
- })
- .then((res1) => {
- if (res1.data.data && res1.data.data.length > 0) {
- //课程老师模板
- let teacherTel = res1.data.data;
- //商品课程
- let courses = rows;
- teacherTel.forEach((tea) => {
- let dataList = [];
- let teacherList = [];
- courses.forEach((item) => {
- let data = tea.courseList.filter(
- (x) => x.courseId == item.courseId
- );
- if (data && data.length > 0) {
- dataList.push(item);
- teacherList = tea.courseList;
- }
- });
- let result = {
- teaList: teacherList,
- courseList: dataList,
- };
- this.goodsTeacher.push(result);
- });
- if (this.goodsTeacher && this.goodsTeacher.length > 0) {
- let courseIds = [];
- this.goodsTeacher.forEach((item) => {
- item.courseList.forEach((course) => {
- courseIds.push(course.courseId);
- });
- });
- if (courseIds.length > 0) {
- courses.forEach((item) => {
- if (!courseIds.includes(item.courseId)) {
- let data = {
- teaList: [],
- courseList: [],
- };
- data.courseList.push(item);
- this.goodsTeacher.push(data);
- }
- });
- }
- this.goodsTeacher.forEach((item) => {
- if (item.courseList && item.courseList.length > 0) {
- item.courseList[0].show = 1;
- }
- });
- }
- } else {
- //没有双师资模板
- rows.forEach((item) => {
- item.show = 1;
- let data = {
- teaList: [],
- courseList: [],
- };
- data.courseList.push(item);
- this.goodsTeacher.push(data);
- });
- }
- // console.log(this.goodsTeacher,'this.goodsTeacher', this.courseId);
- this.goodsTeacher.forEach((item) => {
- if (item.courseList.some((x) => x.courseId == this.courseId)) {
- this.teacherList = item.teaList;
- }
- });
- });
- },
- erJianErZaoPauseTip() {
- if (this.playSecIsLearn && this.erJianErZao) {
- if (this.pauseTimer) {
- return;
- }
- this.pauseTime = Date.now();
- console.log("开启定时器");
- this.pauseTimer = setInterval(() => {
- console.log("暂停时间", Date.now() - this.pauseTime, this.pauseTime);
- if (Date.now() - this.pauseTime > 5 * 60 * 1000) {
- // 5 * 60 * 1000
- let text = this.photoPopup ? "拍照停留" : "暂停";
- this.photoPopup = false;
- uni.showModal({
- title: "提示",
- showCancel: false,
- content: `检测${text}时间过长,刷新当前页面`,
- cancelText: "取消",
- confirmText: "确定",
- success: (res) => {
- if (res.confirm) {
- // #ifdef H5
- location.reload();
- // #endif
- // #ifdef MP-WEIXIN
- this.courseCourseList();
- // #endif
- }
- },
- });
- this.clearPauseTimer();
- }
- }, 5000);
- }
- },
- // 原来onshow里面的内容
- originOnShow() {
- this.getbaseprofiletplists().then(async (res) => {
- this.courseDetail();
- this.getGoodsDetail();
- this.getAnswerList();
- await this.studyRecordMenuAllList();
- // this.answerTimer = setInterval(() => {
- // this.getAnswerList();
- // }, 5000);
- let noteSecond = Number(this.option.noteSecond);
- // console.log('noteSecondnoteSecond:', noteSecond, this.option)
- if (noteSecond > 0) {
- //我的消息跳过来,播放节
- let item = {
- sectionId: Number(this.option.sectionId),
- recordingUrl: this.option.recordingUrl,
- noteSecond: noteSecond,
- studyDuration: noteSecond,
- };
- let playNextId = `moduleId${this.option.moduleId}chapterId${
- this.option.chapterId
- }sectionId${this.option.sectionId}${
- this.option.isRebuild ? "isRebuild" : ""
- }`;
- this.$store.commit("setPlaySectionId", {
- playSectionId: item.sectionId || item.menuId,
- });
- this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
- this.$store.commit("updatePlayNextId", playNextId);
- this.playNoteVideo(item);
- } else {
- this.studyRecordQueryLiveLast();
- }
- });
- },
- // 原来的mouted内容
- originMounted() {
- uni.$on("changeSection", (oldSectionId) => {
- console.log(
- "切换课程-originMounted->playVID:",
- this.playVID,
- oldSectionId
- );
- this.studyTimer && clearInterval(this.studyTimer); // 清除定时器
- this.clearPauseTimer();
- this.hasStart = false;
- this.photoConfig = false;
- this.photoIndex = 0;
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- if (polyvPlayerContext) {
- //解决同个节视频切换问题
- // #ifdef MP-WEIXIN
- polyvPlayerContext.seek(0);
- polyvPlayerContext.pause();
- // #endif
- // #ifdef H5
- polyvPlayerContext.j2s_seekVideo(0);
- polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
- // #endif
- }
- //清除直播
- this.$store.commit("setPlayChannelId", { playChannelId: 0 });
- this.postStudyRecord(0, oldSectionId);
- });
- uni.$on("getSection", (item) => {
- //清除直播
- this.studyTimer && clearInterval(this.studyTimer);
- this.hasStart = false;
- this.isPlayRebuild = item.rebuild;
- this.photoConfig = false;
- this.photoIndex = 0;
- this.sectionItem = item;
- this.moduleId = item.moduleId || null;
- this.chapterId = item.chapterId || null;
- this.$store.commit("setPlayChannelId", { playChannelId: 0 });
- this.$store.commit("setPlaySectionId", {
- playSectionId: item.sectionId || item.menuId,
- });
- //获取拍照历史
- this.getPhotoLastRecord();
- this.playVideo(item);
- });
- uni.$on("levelId", (item) => {
- let arr = item.split("-");
- //点击节获取的各层级ID
- this.moduleId = arr[0];
- this.chapterId = arr[1];
- });
- uni.$on("getChannel", (item) => {
- //清除录播
- this.studyTimer && clearInterval(this.studyTimer);
- this.hasStart = false;
- this.$store.commit("setPlayVID", { playVID: null });
- this.moduleId = item.moduleId;
- this.chapterId = item.chapterId;
- this.$store.commit("setPlaySectionId", {
- playSectionId: item.sectionId || item.menuId,
- });
- this.getPhotoLastRecord();
- this.playChannel(item);
- this.channelItem = item;
- });
- uni.$on("isRebuild", (item) => {
- this.isRebuild = item;
- });
- this.updateChapterOpen(true);
- },
- clearPauseTimer() {
- if (this.pauseTimer) {
- this.pauseTime = 0;
- clearInterval(this.pauseTimer);
- this.pauseTimer = null;
- }
- },
- clearBarTimer() {
- if (this.barTimer) {
- clearInterval(this.barTimer);
- this.barTimer = null;
- }
- },
- // 原来onUnload里面的内容
- originUnload() {
- if (this.playSectionId > 0 && this.hasStart) {
- //退出提交记录
- this.postStudyRecord();
- }
- //清除正在播放的节ID
- // this.$store.commit('setPlayObj',null)
- this.$store.commit("setPlaySectionId", { playSectionId: 0 });
- this.$store.commit("setPlayChannelId", { playChannelId: 0 });
- this.$store.commit("setPlayVID", { playVID: null });
- this.closePlv();
- //移除所有的事件监听器
- uni.$off();
- this.clearTimer && clearTimeout(this.clearTimer);
- this.toastTimer && clearTimeout(this.toastTimer);
- if (this.studyTimer) {
- clearInterval(this.studyTimer);
- this.hasStart = false;
- }
- this.clearPauseTimer();
- this.clearBarTimer();
- this.timer && clearInterval(this.timer);
- if (this.lockTimer) {
- clearInterval(this.lockTimer);
- this.$api
- .lockDelLock({
- action: "jxjy",
- uuid: this.$method.getUuid(),
- })
- .then((res) => {
- uni.hideLoading();
- });
- }
- },
- changeCourses() {
- this.toggleCourseShow = true;
- },
- closePop() {
- this.toggleCourseShow = false;
- },
- async activeFunc(item, index) {
- this.teacherIndex = index;
- let findResult = "";
- this.goodsTeacher.forEach((citem, index) => {
- citem.courseList.forEach((e, e_index) => {
- if (e.courseId == item.courseId) {
- findResult = e;
- }
- });
- });
- this.jump(findResult, 1);
- },
- // 进入学习
- async jump(item, index, type) {
- // console.log('item------>', index,item,this.goodsTeacher)
- if (index == 0) {
- await this.nextCourses(item, type);
- if (item.rebuild === 0) {
- //未重修
- this.$navTo.togo("/pages2/learn/details", {
- id: item.courseId,
- gradeId: item.gradeId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- return;
- }
- this.$api.courseDetail(item.courseId).then((res) => {
- if (res.data.code == 200) {
- // if (res.data.data.educationName == "继续教育") {
- this.$method.checkLock().then((res) => {
- this.courseId = item.courseId;
- this.originOnShow();
- this.originMounted();
- });
- }
- });
- } else {
- if (this.orderNum == 2) {
- //学习顺序是从头到尾学习,没学完上一课不能学习下一课
- let prevItem = this.courseList[index - 1]; //上一课
- if (prevItem.stuAllNum == prevItem.secAllNum) {
- await this.nextCourses(item, type);
- if (item.rebuild === 0) {
- //未重修
- this.$navTo.togo("/pages2/learn/details", {
- id: item.courseId,
- gradeId: item.gradeId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- return;
- }
- this.$api.courseDetail(item.courseId).then((res) => {
- if (res.data.code == 200) {
- // if (res.data.data.educationName == "继续教育") {
- this.$method.checkLock().then((res) => {
- this.courseId = item.courseId;
- this.originOnShow();
- this.originMounted();
- });
- }
- });
- } else {
- uni.showToast({
- icon: "none",
- title: "请按顺序学完上一课再学习这一课",
- });
- }
- } else {
- await this.nextCourses(item, type);
- if (item.rebuild === 0) {
- //未重修
- this.$navTo.togo("/pages2/learn/details", {
- id: item.courseId,
- gradeId: item.gradeId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- return;
- }
- this.$api.courseDetail(item.courseId).then((res) => {
- if (res.data.code == 200) {
- // if (res.data.data.educationName == "继续教育") {
- this.$method.checkLock().then((res) => {
- this.courseId = item.courseId;
- this.originOnShow();
- this.originMounted();
- });
- }
- });
- }
- }
- },
- async nextCourses(item, type) {
- this.vid = "";
- this.hasStart = true;
- await this.originUnload();
- if (type) {
- this.teacherIndex = 0;
- this.goodsTeacher.forEach((citem) => {
- if (citem.courseList.some((x) => x.courseId == item.courseId)) {
- this.teacherList = citem.teaList;
- }
- });
- }
- this.reStart = false;
- this.courseId = item.courseId;
- this.gradeId = item.gradeId;
- this.toggleCourseShow = false;
- },
- clickLeft() {
- // uni.navigateBack()
- uni.switchTab({
- url: "/pages/learn/index",
- });
- },
- markCancel() {
- uni.navigateBack({
- delta: 1,
- });
- },
- markConfirm() {
- uni.setClipboardData({
- data: this.markContent,
- success: function () {
- setTimeout(() => {
- uni.navigateBack({
- delta: 1,
- });
- }, 1000);
- },
- });
- },
- closeNotice() {
- this.$api
- .baseHandoutTip({
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {});
- },
- noticeConfirm() {
- if (this.CountTo < 0) {
- this.noticeShow = false;
- if (this.handoutTipLength == 0 && this.goodsPlayConfig.autoPlay > 0) {
- this.autoplay = true;
- // var polyvPlayerContext = this.selectComponent("#playerVideo")
- // #ifdef MP-WEIXIN
- polyvPlayerContext.play();
- // #endif
- // #ifdef H5
- polyvPlayerContext.j2s_resumeVideo();
- // #endif
- }
- }
- },
- baseHandoutTipList() {
- this.$api
- .baseHandoutTipList({
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- this.handoutTipLength = res.data.rows.length;
- if (res.data.rows.length == 0) {
- this.noticeShow = true;
- if (this.CountTo == 30) {
- var timer = setInterval(() => {
- this.CountTo--;
- if (this.CountTo < 0) {
- clearInterval(timer);
- }
- }, 1000);
- }
- } else {
- this.CountTo = -1;
- if (this.goodsPlayConfig && this.goodsPlayConfig.autoPlay > 0) {
- // #ifdef MP-WEIXIN
- this.autoplay = true;
- var polyvPlayerContext = this.selectComponent("#playerVideo");
- polyvPlayerContext.play();
- // #endif
- // #ifdef H5
- // polyvPlayerContext.j2s_resumeVideo()
- // #endif
- }
- }
- });
- },
- /**
- * 获取上次观看的直播
- */
- studyRecordGetLastLive() {
- this.$api
- .studyRecordGetLastLive({
- orderGoodsId: this.orderGoodsId,
- courseId: this.courseId,
- })
- .then((res) => {
- this.updateLiveLast(res.data.data);
- });
- },
- async initPlayVideo(sectionItem) {
- console.log(sectionItem, "this.sectionItem", this.menuList);
- this.moduleId = sectionItem.moduleId;
- this.chapterId = sectionItem.chapterId;
- this.sectionItem = sectionItem;
- if (sectionItem.sectionType == 1) {
- //录播
- this.$store.commit("setPlaySectionId", {
- playSectionId: sectionItem.sectionId,
- });
- this.$store.commit("setPlayVID", {
- playVID: sectionItem.recordingUrl,
- });
- await this.getPhotoLastRecord(); // 获取拍照历史
- this.playVideo(sectionItem);
- } else if (sectionItem.sectionType == 2) {
- //直播
- this.studyRecordGetLastLive();
- } else if (sectionItem.sectionType == 3) {
- //回放
- this.$store.commit("setPlaySectionId", {
- playSectionId: sectionItem.sectionId,
- });
- this.$store.commit("setPlayVID", {
- playVID: sectionItem.recordingUrl,
- });
- this.playVideo(sectionItem);
- } else if (sectionItem.doType == 2) {
- uni.showModal({
- title: "温馨提示",
- content: "当前节视频已学完,是否进入考试?",
- success: (res) => {
- if (res.confirm) {
- this.toQuestionBank(sectionItem);
- }
- },
- });
- return;
- }
- },
- toQuestionBank(sectionItem) {
- uni.navigateTo({
- url:
- "/pages2/class/questionBank?courseId=" +
- this.courseId +
- "&gradeId=" +
- this.gradeId +
- "&isFromVideo=1&id=" +
- sectionItem.id +
- "&goodsid=" +
- this.goodsId +
- "&moduleId=" +
- (sectionItem.moduleId || 0) +
- "&chapterId=" +
- (sectionItem.chapterId || 0) +
- "&orderGoodsId=" +
- this.orderGoodsId +
- "&type=" +
- (sectionItem.type == 4 ? 1 : 3) +
- "&learning=" +
- sectionItem.studyStatus +
- "&isBackVideo=" +
- 1,
- });
- },
- studyRecordQueryLiveLast() {
- // /study/record/queryLiveLast
- this.$api
- .studyRecordQueryLiveLast({
- gradeId: this.gradeId,
- orderGoodsId: this.orderGoodsId,
- courseId: this.courseId,
- })
- .then((res) => {
- let { data } = res.data;
- if (!data.sectionId) {
- data = this.menuAllList[0];
- }
- if (data.learning == 1 && this.orderNum == 2) {
- let next = this.menuAllList.find((e) => e.studyStatus != 1);
- next && (data = next);
- }
- this.initPlayVideo(data);
- });
- },
- /**
- * 模块大节播放完毕,刷新列表
- */
- sectionPlayEnd(isRebuild, index) {
- if (this.reMenuList.length > 0) {
- //有重修目录
- if (isRebuild.isRebuild) {
- //从重修点击
- this.$api
- .reMenuList({
- orderGoodsId: this.orderGoodsId,
- courseId: this.courseId,
- rebuild: 1,
- gradeId: this.gradeId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- if (res.data.rows.length) {
- res.data.rows[index].name = res.data.rows[index].menuName;
- this.$set(this.reMenuList, index, res.data.rows[index]);
- for (let i = 0; i < res.data.rows.length; i++) {
- let item = res.data.rows[i];
- item.down = true;
- item.id = item.menuId;
- item.name = item.menuName;
- }
- this.reMenuList = [];
- this.$nextTick(() => {
- this.reMenuList = res.data.rows;
- // console.log(this.reMenuList,'this.reMenuList1')
- });
- } else {
- this.reMenuList = [];
- }
- this.$nextTick(() => {
- if (this.reMenuList.length > 0) {
- this.list = [
- {
- name: "目录",
- },
- {
- name: "讲义",
- },
- {
- name: "笔记",
- },
- {
- name: "答疑",
- },
- { name: "重修目录" },
- ];
- } else {
- this.list = [
- {
- name: "目录",
- },
- {
- name: "讲义",
- },
- {
- name: "笔记",
- },
- {
- name: "答疑",
- },
- ];
- if (this.current == 4) {
- this.current = 0;
- }
- }
- });
- }
- });
- this.$api
- .reMenuList({
- courseId: this.courseId,
- gradeId: this.gradeId,
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- for (let i = 0; i < res.data.rows.length; i++) {
- let item = res.data.rows[i];
- item.down = true;
- item.id = item.menuId;
- item.name = item.menuName;
- item.menuType = item.type;
- }
- this.menuList = [];
- this.$nextTick(() => {
- this.menuList = res.data.rows;
- });
- }
- });
- } else {
- //从普通目录点击
- this.$api
- .reMenuList({
- courseId: this.courseId,
- gradeId: this.gradeId,
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- res.data.rows[index].name = res.data.rows[index].menuName;
- res.data.rows[index].id = res.data.rows[index].menuId;
- this.$set(this.menuList, index, res.data.rows[index]);
- }
- });
- this.$api
- .reMenuList({
- orderGoodsId: this.orderGoodsId,
- courseId: this.courseId,
- rebuild: 1,
- gradeId: this.gradeId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- if (res.data.rows.length) {
- // for (let i = 0; i < res.data.rows.length; i++) {
- // let item = res.data.rows[i];
- // item.down = true;
- // item.id = item.menuId;
- // item.name = item.menuName;
- // }
- // this.reMenuList = res.data.rows;
- } else {
- this.reMenuList = [];
- }
- this.$nextTick(() => {
- if (this.reMenuList.length > 0) {
- this.list = [
- {
- name: "目录",
- },
- {
- name: "讲义",
- },
- {
- name: "笔记",
- },
- {
- name: "答疑",
- },
- { name: "重修目录" },
- ];
- } else {
- this.list = [
- {
- name: "目录",
- },
- {
- name: "讲义",
- },
- {
- name: "笔记",
- },
- {
- name: "答疑",
- },
- ];
- if (this.current == 4) {
- this.current = 0;
- }
- }
- });
- }
- });
- }
- } else {
- console.log("--模块大节播放完毕,刷新列表-");
- //没有重修目录
- this.$api
- .reMenuList({
- courseId: this.courseId,
- gradeId: this.gradeId,
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- res.data.rows[index].name = res.data.rows[index].menuName;
- res.data.rows[index].id = res.data.rows[index].menuId;
- this.$set(this.menuList, index, res.data.rows[index]);
- }
- });
- }
- },
- goLive(item) {
- let moduleId = item.moduleId || 0;
- let chapterId = item.chapterId || 0;
- let sectionId = item.sectionId || item.menuId;
- let uuid = new Date().valueOf() + "";
- // buyCourse 是否购买课程:1是 0否
- let encode = encodeURIComponent(
- this.config.hostLive +
- "/pages/live/index?token=" +
- uni.getStorageSync("token") +
- "&userInfo=" +
- JSON.stringify(this.userInfo) +
- "&channelId=" +
- item.liveUrl +
- "&gradeId=" +
- this.gradeId +
- "&courseId=" +
- this.courseId +
- "&goodsId=" +
- this.goodsId +
- "&orderGoodsId=" +
- this.orderGoodsId +
- "§ionId=" +
- sectionId +
- "&chapterId=" +
- chapterId +
- "&moduleId=" +
- moduleId +
- "&buyCourse=1" +
- "&ident=" +
- uuid
- );
- uni.navigateTo({
- url: `../../pages/webview/index?url=` + encode,
- });
- },
- studyRecordMenuAllList() {
- // study/record/menuAllList
- return this.$api
- .studMenuAllList({
- courseId: this.courseId,
- gradeId: this.gradeId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- let nowTime = Number(new Date().getTime() / 1000).toFixed(0);
- if (res.data.data) {
- this.menuAllList = res.data.data.filter(
- (e) => e.doType != 1 || (e.doType == 2 && e.studyStatus == 1)
- );
- this.livingItem = res.data.data.find(
- (item) =>
- item.liveStartTime <= nowTime && item.liveEndTime > nowTime
- );
- }
- return Promise.resolve();
- });
- },
- async getbaseprofiletplists() {
- // #ifdef MP-WEIXIN
- this.getCameraSetting();
- // #endif
- let {
- data: { code, rows },
- } = await this.$api.getbaseprofiletplists({
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- if (code === 200 && rows.length && rows[0].keyValue) {
- let baseRes = await this.$api.getbaseprofiletpId(this.goodsId);
- if (baseRes.data.code === 200 && baseRes.data.data) {
- let {
- data: { code, data },
- } = await this.$api.getbaseprofiletpgetInfo({
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- if (
- code === 200 &&
- (!data || (data.status === 3 && data.changeStatus === 1))
- ) {
- this.needProfileModal = true;
- uni.showModal({
- content: !data
- ? "请前往填写资料"
- : "资料审核不通过,请前往重新填写",
- cancelText: "返回",
- success: (resultst) => {
- if (resultst.confirm) {
- this.$navTo.togo("/pages2/verify/input", {
- id: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- }
- if (resultst.cancel) {
- uni.navigateBack();
- }
- },
- });
- return Promise.reject();
- } else if (data.status === 1 && JSON.parse(rows[0].keyValue2)[0]) {
- let {
- data: { code, data },
- } = await this.$api.getbaseprofileStampgetInfo({
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- if (
- code === 200 &&
- (!data || (data.status === 3 && data.changeStatus === 1))
- ) {
- this.needProfileModal = true;
- uni.showModal({
- content: !data
- ? "请前往填写盖章资料"
- : "资料盖章审核不通过,请前往重新填写",
- cancelText: "返回",
- success: (resultst) => {
- if (resultst.confirm) {
- this.$navTo.togo("/pages2/verify/input2", {
- id: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- });
- }
- if (resultst.cancel) {
- uni.navigateBack();
- }
- },
- });
- return Promise.reject();
- }
- }
- }
- }
- let detail = await this.$api.goodsDetail(this.goodsId);
- if (detail.data.data.erJianErZao) {
- let info = await this.$api.userConfirmInfoDetail({
- orderGoodsId: this.orderGoodsId,
- });
- if (!info.data.data || info.data.data.pushInfo !== 1) {
- uni.showModal({
- showCancel: false,
- title: "提示",
- content: "开通信息推送不成功,无法进入学习!",
- success: (resultst) => {
- uni.navigateBack();
- },
- });
- return Promise.reject();
- }
- }
- return Promise.resolve();
- },
- getbaseprofiletplists1() {
- return new Promise((resolve) => {
- let self = this;
- // #ifdef MP-WEIXIN
- this.getCameraSetting();
- // #endif
- this.$api
- .getbaseprofiletplists({
- goodsId: self.goodsId,
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- if (res.data.code === 200 && res.data.rows.length) {
- console.log(res.data.rows[0], 987);
- if (res.data.rows[0].keyValue) {
- self.$api.getbaseprofiletpId(self.goodsId).then((baseRes) => {
- if (baseRes.data.code === 200) {
- if (baseRes.data.data) {
- // base/profile/tp/getInfo
- self.$api
- .getbaseprofiletpgetInfo({
- goodsId: self.goodsId,
- orderGoodsId: self.orderGoodsId,
- })
- .then((result) => {
- if (result.data.code === 200) {
- // status 1通过 2是待审 3是不通过
- if (
- !result.data.data ||
- (result.data.data.status === 3 &&
- result.data.data.changeStatus === 1)
- ) {
- if (!result.data.data) {
- self.needProfileModal = true;
- uni.showModal({
- content: "请前往填写资料",
- cancelText: "返回",
- success: function (resultst) {
- if (resultst.confirm) {
- self.$navTo.togo("/pages2/verify/input", {
- id: self.goodsId,
- orderGoodsId: self.orderGoodsId,
- });
- }
- if (resultst.cancel) {
- uni.navigateBack();
- }
- },
- });
- } else {
- self.needProfileModal = true;
- uni.showModal({
- content: "资料审核不通过,请前往重新填写",
- cancelText: "返回",
- success: function (resultst) {
- if (resultst.confirm) {
- self.$navTo.togo("/pages2/verify/input", {
- id: self.goodsId,
- orderGoodsId: self.orderGoodsId,
- });
- }
- if (resultst.cancel) {
- uni.navigateBack();
- }
- },
- });
- }
- } else if (
- result.data.data.status === 1 &&
- JSON.parse(res.data.rows[0].keyValue2)[0]
- ) {
- self.$api
- .getbaseprofileStampgetInfo({
- goodsId: self.goodsId,
- orderGoodsId: self.orderGoodsId,
- })
- .then((k) => {
- if (k.data.code === 200) {
- if (
- !k.data.data ||
- (k.data.data.status === 3 &&
- k.data.data.changeStatus === 1)
- ) {
- if (!k.data.data) {
- self.needProfileModal = true;
- uni.showModal({
- cancelText: "返回",
- content: "请前往填写盖章资料",
- success: function (resultst) {
- if (resultst.confirm) {
- self.$navTo.togo(
- "/pages2/verify/input2",
- {
- id: self.goodsId,
- orderGoodsId:
- self.orderGoodsId,
- }
- );
- }
- if (resultst.cancel) {
- uni.navigateBack();
- }
- },
- });
- } else {
- self.needProfileModal = true;
- uni.showModal({
- cancelText: "返回",
- content:
- "资料盖章审核不通过,请前往重新填写",
- success: function (resultst) {
- if (resultst.confirm) {
- self.$navTo.togo(
- "/pages2/verify/input2",
- {
- id: self.goodsId,
- orderGoodsId:
- self.orderGoodsId,
- }
- );
- }
- if (resultst.cancel) {
- uni.navigateBack();
- }
- },
- });
- }
- } else {
- resolve();
- }
- }
- });
- } else {
- resolve();
- }
- }
- });
- } else {
- resolve();
- }
- }
- });
- } else {
- resolve();
- }
- } else {
- // 调用推送是否成功
- resolve();
- }
- });
- if (this.gradeId > 0) {
- //提交完资料返回判断是否已开班
- this.getGradeInfo();
- }
- });
- },
- /**
- * 计算tabs宽度
- */
- itemWidth() {
- return 100 / this.list.length + "%";
- },
- findMenuNextSection(index) {
- for (let i = index + 1; i < this.reMenuList.length; i++) {
- let item = this.reMenuList[i];
- if (item.type == 3) {
- return item;
- }
- }
- return {};
- },
- loadedmetadata(event) {
- if (this.hasStart) {
- // 防止loadedmetadata事件第二次触发
- return;
- }
- // #ifdef MP-WEIXIN
- polyvPlayerContext = this.selectComponent("#playerVideo");
- // #endif
- this.hasStart = true;
- uni.$off("playPause");
- uni.$on("playPause", () => {
- // #ifdef MP-WEIXIN
- polyvPlayerContext.pause();
- // #endif
- // #ifdef H5
- polyvPlayerContext.j2s_pauseVideo(); // 暂停播放视频
- // #endif
- });
- if (!this.recordObj.videoCurrentTime) {
- //新视频直接提交一条观看记录
- this.postStudyRecord(0);
- }
- this.studyTimer && clearInterval(this.studyTimer);
- this.studyTimer = setInterval(() => {
- this.postStudyRecord(0);
- }, 15000);
- },
- getPhotoLastRecord() {
- if (this.erJianErZao) {
- return;
- }
- let self = this;
- let data = {
- sectionId: parseInt(self.playSectionId),
- goodsId: parseInt(self.goodsId),
- courseId: parseInt(self.courseId),
- gradeId: parseInt(self.gradeId),
- chapterId: parseInt(self.chapterId),
- moduleId: parseInt(self.moduleId),
- orderGoodsId: this.orderGoodsId,
- };
- // /course/photo/log/getLastInfo'
- this.$api.getPhotoLastRecord(data).then((res) => {
- if (res.data.code == 200) {
- //清空历史数据
- self.photoHistoryList = [];
- this.photoIndex = 0;
- self.photoList = [];
- for (let i = 0; i < res.data.data.length; i++) {
- //-2存储随机拍照数组
- if (res.data.data[i].photoIndex == -2) {
- self.photoList =
- res.data.data[i].timeInterval &&
- res.data.data[i].timeInterval.split(",");
- } else {
- self.photoHistoryList.push(res.data.data[i].photoIndex);
- }
- }
- }
- });
- },
- //postTime 只提交随机时间
- postCoursePhotoRecord(postTime = false) {
- return new Promise((resolve, reject) => {
- let currentTime = 0;
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- if (polyvPlayerContext) {
- // #ifdef MP-WEIXIN
- currentTime = polyvPlayerContext.getCurrentTime();
- // #endif
- // #ifdef H5
- currentTime = polyvPlayerContext.j2s_getCurrentTime();
- // #endif
- }
- let self = this;
- let photoIndex = self.photoIndex;
- let data = {
- photo: self.ossAvatarUrl,
- sectionId: parseInt(self.playSectionId),
- goodsId: parseInt(self.goodsId),
- courseId: parseInt(self.courseId),
- photoTime: parseInt(currentTime > 0 ? currentTime : 0),
- gradeId: parseInt(self.gradeId),
- photoIndex: postTime ? -2 : parseInt(photoIndex), //从0算起,-2只提交随机时间
- photoNum: parseInt(self.photoNum),
- chapterId: parseInt(self.chapterId),
- moduleId: parseInt(self.moduleId),
- timeInterval: postTime ? self.photoList.join(",") : "",
- orderGoodsId: this.orderGoodsId,
- };
- // console.log("提交接口", data);
- this.$api
- .coursePhotoRecord(data)
- .then((res) => {
- if (res.data.code == 200) {
- resolve();
- } else {
- reject();
- }
- })
- .catch((err) => {
- reject();
- });
- });
- },
- randomNum(minNum, maxNum) {
- switch (arguments.length) {
- case 1:
- return parseInt(Math.random() * minNum + 1, 10);
- break;
- case 2:
- return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
- break;
- default:
- return 0;
- break;
- }
- },
- //配置随机拍照时间
- configPhoto() {
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- let totalVideoTime = 0;
- let duration = 0;
- // #ifdef MP-WEIXIN
- totalVideoTime = polyvPlayerContext.getDuration();
- duration = polyvPlayerContext.getCurrentTime();
- // #endif
- // #ifdef H5
- totalVideoTime = polyvPlayerContext.j2s_getDuration();
- duration = polyvPlayerContext.j2s_getCurrentTime();
- // #endif
- if (!this.photoConfig) {
- this.photoConfig = true;
- if (this.erJianErZao) {
- this.photoList = this.randomConfig(totalVideoTime, duration);
- return;
- }
- //没有历史拍照间隔数据
- if (!this.photoList || this.photoList.length == 0) {
- this.photoList = this.commonConfig(
- totalVideoTime,
- this.jjShiGongYuan ? 46 * 60 : undefined
- );
- this.postCoursePhotoRecord(true); //提交随机拍照时间数组
- }
- //兼容已有观看历史
- for (let i = 0; i < this.photoList.length - 1; i++) {
- if (
- this.photoList[i] < duration &&
- this.photoList[i + 1] > duration
- ) {
- this.photoIndex = i + 1;
- break;
- }
- if (duration > this.photoList[this.photoList.length - 1]) {
- this.photoIndex = this.photoList.length - 1; //取最后一个下标
- break;
- }
- }
- }
- },
- // 二建随机拍摄时间
- randomConfig(totalVideoTime, duration) {
- this.photoHistoryList = [];
- let photoList = [duration];
- let pre = duration;
- if (totalVideoTime > 300) {
- while (pre <= totalVideoTime) {
- pre += this.randomNum(780, 900);
- pre <= totalVideoTime && photoList.push(pre);
- }
- if (totalVideoTime - 300 > photoList.slice(-1)[0]) {
- photoList.push(this.randomNum(totalVideoTime - 180, totalVideoTime));
- }
- }
- return photoList;
- },
- // 随机前后五分钟
- commonConfig(totalVideoTime, fixS) {
- console.log("🚀 ~ file: detail.vue:2407 ~ commonConfig ~ fixS:", fixS);
- let photoList = [0];
- // 固定间隔时间取
- if (fixS) {
- let num = Math.ceil(totalVideoTime / fixS);
- for (let i = 1; i < num; i++) {
- photoList.push(i * fixS);
- }
- } else {
- if (this.photoNum == 3) {
- if (totalVideoTime >= 900) {
- //大于15分钟
- let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
- let centerMinTime = centerTime - 300; //前后5分钟
- let centerMaxTime = centerTime + 300;
- let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
- photoList.push(centerTakeTime); //中间拍一张
- let endMaxTime = totalVideoTime - 60;
- let endMinTime = totalVideoTime - 300;
- let endTakeTime = this.randomNum(endMinTime, endMaxTime);
- photoList.push(endTakeTime); //最后拍一张
- } else {
- //小于15分钟
- let centerTime = this.randomNum(
- (1 / 3) * totalVideoTime,
- (2 / 3) * totalVideoTime
- );
- photoList.push(centerTime);
- let endTakeTime = this.randomNum(
- (2 / 3) * totalVideoTime,
- totalVideoTime
- );
- photoList.push(endTakeTime);
- }
- }
- }
- return photoList;
- },
- getLiveUid(channelId) {
- let self = this;
- return new Promise((resolve) => {
- let data = {
- channelId: channelId,
- orderGoodsId: this.orderGoodsId,
- };
- self.$api.polyvSign(data).then((res) => {
- resolve(res.data.data);
- });
- });
- },
- timeEventLiving() {
- if (plv != null) {
- if (this.livePlay) {
- this.liveDuration = this.liveDuration + 1; //每隔1秒
- if (this.liveDuration == 2) {
- //直播第2秒拍照
- if (
- this.goodsPhotographConfig &&
- this.goodsPhotographConfig.livephotograph == 1 &&
- this.channelItem.learning != 1 &&
- this.photoHistoryList.length == 0
- ) {
- //开启直播拍照
- this.openPhoto();
- } else {
- this.postStudyRecord(0);
- }
- }
- }
- }
- },
- playerLiveStatusChange(e) {
- const status = e.detail.status;
- if (status === "live") {
- //开始播放
- if (this.timer) {
- clearInterval(this.timer);
- }
- this.livePlay = true;
- this.timer = setInterval(this.timeEventLiving, 1000); //定时器
- }
- if (status === "end") {
- this.hasStart = false;
- if (this.livePlay) {
- //只有播放过的结束才提交,避免未开播触发结束
- this.postStudyRecord(1);
- }
- this.livePlay = false;
- // 未开始
- }
- },
- closePlv() {
- if (plv) {
- plv.destroy();
- }
- },
- playChannel(item) {
- if (this.timer) {
- clearInterval(this.timer);
- }
- this.startStatus = true;
- this.initLive();
- },
- setLiveOption(status) {
- const { userId, channelId, recordFileSimpleModel, playbackEnabled } =
- this.detail;
- const playRecordFile =
- playbackEnabled && recordFileSimpleModel && status === "end";
- this.videoOption = {
- mode: "live",
- uid: this.liveObj.uid, //this.playChannelId egsxlptzdq
- cid: this.playChannelId,
- openId: this.userInfo.userAccount,
- isAutoChange: false,
- forceVideo: false,
- };
- },
- async initLive() {
- this.liveObj = await this.getLiveUid(this.playChannelId);
- this.initLiveOk = true;
- let optionsData = {};
- optionsData.mode = "live";
- optionsData.forceVideo = false;
- optionsData.channelId = this.playChannelId; // 频道ID '2553128'
- optionsData.openId = this.userInfo.userAccount; // 用户openId this.userInfo.userAccount 'oQ5eX5BCtSjkE1ct8CzvxGWgh0hQ'
- optionsData.userId = this.liveObj.uid; // 2.0.0及以上版本的demo需要使用 userId 设置学员唯一id 'egsxlptzdq'
- let self = this;
- this.closePlv();
- plv.init(optionsData).then(({ detail, chat }) => {
- self.liveDetail = detail;
- // 设置mode为live的videoOption
- this.setLiveOption();
- if (detail.isPPT) {
- chat.on(chat.events.SLICESTART, () => {
- // 开始直播
- });
- } else {
- plv.api.getOrdinaryLiveStatus(detail.stream);
- }
- });
- },
- openSetting(res) {
- console.log(res, 98);
- },
- getCameraSetting() {
- const self = this;
- // 不支持h5
- wx.getSetting({
- success: (res) => {
- if (res.authSetting["scope.camera"]) {
- // 用户已经授权
- self.showSet = false;
- this.prendreAutoCarme = false;
- } else {
- this.prendreAutoCarme = true;
- // 用户还没有授权,向用户发起授权请求
- wx.authorize({
- scope: "scope.camera",
- success: () => {
- // 用户同意授权
- self.showSet = false;
- this.prendreAutoCarme = false;
- },
- fail: () => {
- // 用户不同意授权
- self.showSet = true;
- },
- });
- }
- },
- fail: (res) => {},
- });
- },
- studyNotice() {
- this.noticeShow = true;
- },
- //播放笔记视频
- async playNoteVideo(item) {
- if (this.timer) {
- clearInterval(this.timer);
- }
- this.vid = item.recordingUrl;
- // #ifdef MP-WEIXIN
- if (this.vid) {
- polyvPlayerContext.changeVid(this.vid);
- }
- // #endif
- this.recordObj = { videoCurrentTime: item.noteSecond };
- if (this.recordObj.videoCurrentTime) {
- this.needSeek = true; //需要跳转到播放记录
- }
- this.startStatus = true;
- //获取节笔记
- this.getNoteList();
- },
- //正常播放视频
- async playVideo(item) {
- if (this.timer) {
- clearInterval(this.timer);
- }
- // #ifdef H5
- // await this.clears();
- // #endif
- this.vid = item.recordingUrl;
- // #ifdef MP-WEIXIN
- if (this.vid) {
- polyvPlayerContext && polyvPlayerContext.changeVid(this.vid);
- }
- // #endif
- this.recordObj = null;
- this.recordObj = await this.getRecordLast();
- this.needSeek = true; //跳转到播放记录
- this.startStatus = true;
- // #ifdef H5
- await this.loadPlayerScript(this.loadPlayer);
- // #endif
- // 提交学习记录
- // #ifdef MP-WEIXIN
- this.postStudyRecord(0);
- // #endif
- //获取节笔记
- this.getNoteList();
- },
- getRecordLast() {
- return new Promise((resolve) => {
- let data = {
- gradeId:
- this.gradeId || this.gradeId == 0 ? Number(this.gradeId) : null,
- goodsId:
- this.goodsId || this.goodsId == 0 ? Number(this.goodsId) : null,
- sectionId: this.playSectionId || 0,
- courseId:
- this.courseId || this.courseId == 0 ? Number(this.courseId) : null,
- chapterId: this.chapterId || 0,
- moduleId: this.moduleId || 0,
- orderGoodsId: this.orderGoodsId,
- };
- this.$api.recordLast(data).then((res) => {
- if (res.data.data.videoCurrentTime > 3) {
- res.data.data.videoCurrentTime -= 3;
- }
- resolve(res.data.data);
- });
- });
- },
- jumpNote(item) {
- this.noteId = item.noteId;
- //没视频播放
- if (this.playSectionId == 0) {
- this.$u.toast("即将跳到笔记位置");
- this.$store.commit("setPlaySectionId", {
- playSectionId: item.sectionId || item.menuId,
- });
- this.$store.commit("setPlayVID", { playVID: item.recordingUrl });
- this.playNoteVideo(item);
- } else {
- //正在看当前笔记视频
- this.$u.toast("即将跳到笔记位置");
- //跳到笔记时刻
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- // #ifdef MP-WEIXIN
- polyvPlayerContext.seek(item.noteSecond);
- polyvPlayerContext.play();
- // #endif
- // #ifdef H5
- polyvPlayerContext.j2s_seekVideo(0);
- polyvPlayerContext.j2s_resumeVideo();
- // #endif
- }
- },
- postNote() {
- let self = this;
- if (!(this.playSectionId > 0)) {
- this.$u.toast("目前无播放视频");
- return;
- }
- if (!this.noteValue) {
- this.$u.toast("请输入内容");
- return;
- }
- if (!this.gradeId) {
- this.$u.toast("暂无班级数据");
- return;
- }
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- let noteDate = this.$method.getZeroTime();
- let noteSecond = 0;
- // #ifdef MP-WEIXIN
- noteSecond = polyvPlayerContext.getCurrentTime();
- // #endif
- // #ifdef H5
- noteSecond = polyvPlayerContext.j2s_getCurrentTime();
- // #endif
- if (!noteSecond) {
- if (noteSecond == 0) {
- //播放结束
- // #ifdef MP-WEIXIN
- noteSecond = polyvPlayerContext.getDuration();
- // #endif
- // #ifdef H5
- noteSecond = polyvPlayerContext.j2s_getCurrentTime();
- // #endif
- }
- if (!noteSecond) {
- this.$u.toast("视频暂未开始");
- return;
- }
- }
- let data = {
- gradeId: this.gradeId,
- goodsId: this.goodsId,
- sectionId: this.playSectionId,
- courseId: this.courseId,
- noteText: this.noteValue,
- noteDate: noteDate,
- noteSecond: noteSecond,
- orderGoodsId: this.orderGoodsId,
- };
- this.$api.postNote(data).then((res) => {
- if (res.data.code == 200) {
- this.$u.toast("发布成功");
- self.getNoteList();
- this.noteValue = "";
- }
- });
- },
- getGradeInfo() {
- let self = this;
- this.$store.state.allowLoading = false;
- this.$api.goodsGradeInfo(this.gradeId).then((res) => {
- if (res.data.code == 200) {
- self.gradeDetail = res.data.data;
- if (self.needProfileModal) {
- return;
- }
- if (self.gradeDetail.learningStatus == 2) {
- uni.showModal({
- showCancel: false,
- confirmText: "确定",
- content:
- "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
- success: function (resultst) {
- uni.navigateBack();
- },
- });
- }
- if (
- self.gradeDetail.learningStatus == 3 &&
- Number(self.gradeDetail.learningTimeStart) >
- Number(new Date() / 1000)
- ) {
- uni.showModal({
- showCancel: false,
- cancelText: "返回",
- content:
- "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
- success: function (resultst) {
- uni.navigateBack();
- },
- });
- }
- }
- });
- this.$store.state.allowLoading = true;
- },
- getNoteList() {
- let self = this;
- self.noteList = [];
- let data = {
- courseId: this.courseId,
- gradeId: this.gradeId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- };
- if (this.playSectionId > 0) {
- data.sectionId = this.playSectionId;
- }
- this.$api.noteList(data).then((res) => {
- if (res.data.code == 200) {
- self.noteList = res.data.rows;
- }
- });
- },
- delAnswer(answerId) {
- let self = this;
- let data = {
- answerId: answerId,
- status: -1,
- orderGoodsId: this.orderGoodsId,
- };
- this.$api.delAnswer(data).then((res) => {
- if (res.data.code == 200) {
- self.getAnswerList();
- }
- });
- },
- clearCtx() {
- this.placeholder = "您可以在这里输入答疑内容";
- this.ctxValue = "";
- this.assignUserId = 0;
- },
- focusNote(event) {
- this.bottomHeight = event.detail.height;
- },
- blurNote() {
- this.bottomHeight = 0;
- },
- blur() {
- this.bottomHeight = 0;
- this.clearTimer = setTimeout(() => {
- this.ctxValue = "";
- this.isFocus = false;
- this.assignUserId = 0;
- this.placeholder = "您可以在这里输入答疑内容";
- }, 2000);
- },
- replyContent(item) {
- this.isFocus = true;
- this.assignUserId = item.userId;
- this.placeholder = "@" + item.realname;
- },
- delContent(item) {
- this.delAnswer(item.answerId);
- },
- postAnswer() {
- let self = this;
- let data = {
- courseId: this.courseId,
- answerText: this.ctxValue,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- };
- if (this.assignUserId > 0) {
- data.assignUserId = this.assignUserId;
- }
- this.$api.postAnswer(data).then((res) => {
- if (res.data.code == 200) {
- this.$u.toast("发布成功");
- self.getAnswerList();
- this.isFocus = false;
- this.placeholder = "您可以在这里输入答疑内容";
- this.ctxValue = "";
- this.assignUserId = 0;
- }
- });
- },
- postContent() {
- if (!this.ctxValue || this.ctxValue == "") {
- this.$u.toast("请输入内容");
- return;
- }
- this.postAnswer();
- },
- postStudyRecord(status = 0, sectionId = this.playSectionId) {
- let currentTime = 0;
- let PlayDuration = 0;
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- if (polyvPlayerContext) {
- // #ifdef MP-WEIXIN
- currentTime = polyvPlayerContext.getCurrentTime(); //获取视频当前的播放时刻
- PlayDuration = polyvPlayerContext.getVideoPlayDuration(); //本次看的时长
- // #endif
- // #ifdef H5
- currentTime = polyvPlayerContext.j2s_getCurrentTime(); //当前视频播放时刻
- PlayDuration = polyvPlayerContext.j2s_realPlayVideoTime(); //本次看的时长
- // #endif
- }
- currentTime = currentTime || 0;
- if (currentTime < 10 && !this.ossAvatarUrl) {
- console.log("不提交", currentTime);
- return;
- }
- if (this.playChannelId > 0) {
- currentTime = 2; //直播无法获取,无论开始结束都传2秒
- }
- let self = this;
- let data = {
- fromPlat: 1, //来源平台 1小程序 2网站
- photo: self.ossAvatarUrl,
- sectionId: sectionId || 0,
- goodsId: parseInt(self.goodsId),
- courseId: parseInt(self.courseId),
- orderGoodsId: this.orderGoodsId,
- studyDuration: parseInt(
- PlayDuration > 0 ? PlayDuration : self.studyDuration
- ),
- gradeId: parseInt(self.gradeId),
- chapterId: this.chapterId || 0,
- moduleId: this.moduleId || 0,
- videoCurrentTime: parseInt(
- currentTime > 0 ? currentTime : self.studyDuration
- ),
- erJianErZao: this.erJianErZao,
- };
- if (this.ossAvatarUrl) {
- data.similarity = this.compareFaceData; // 相似度
- }
- if (status > 0) {
- data.status = status;
- }
- console.log(data, "记录参数");
- return new Promise((resolve, reject) => {
- this.$api
- .studyRecord(data)
- .then((res) => {
- console.log(res, "记录返回");
- let { code, msg } = res.data;
- if (code == 200) {
- if (status > 0) {
- this.studyRecordMenuAllList();
- let moduleId = this.moduleId || 0;
- let chapterId = this.chapterId || 0;
- let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
- let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
- uni.$emit("playNext" + playNextIdisRebuild, {
- fromRebuild: this.isRebuild,
- }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
- uni.$emit("playNext" + playNextId); //通知播放结束
- }
- self.ossAvatarUrl = "";
- } else if (code == 600) {
- uni.showModal({
- showCancel: false,
- title: "提示",
- content: msg,
- success: (resultst) => {
- uni.navigateBack();
- },
- });
- } else if (code == 558) {
- this.CountTo1 = msg.split(",")[1];
- this.noticeShow1 = true;
- var timer = setInterval(() => {
- this.CountTo1--;
- if (this.CountTo1 < 0) {
- this.noticeShow1 = false;
- clearInterval(timer);
- this.postStudyRecord(1);
- }
- }, 1000);
- reject("中断执行");
- } else {
- this.uploadLock = false;
- uni.showToast({
- icon: "none",
- title: res.data.msg,
- duration: 2000,
- });
- if (this.erJianErZao && code == 559) {
- this.isReach = true;
- this.openPhoto();
- }
- if (code == 559 || code == 588) {
- reject("中断执行");
- }
- }
- resolve();
- })
- .catch((err) => {
- this.studyRecordMenuAllList();
- });
- });
- },
- uploadFile(options, int) {
- var self = this;
- return new Promise((resolve, reject) => {
- var data = {
- imageStatus: int,
- gradeId: this.gradeId,
- orderGoodsId: this.orderGoodsId,
- };
- self.$api.aliyunpolicy(data).then((res) => {
- if (res.data.code != 200) {
- self.$method.showToast("签名错误" + JSON.stringify(res.data));
- return;
- }
- var ossToken = res.data.data.resultContent;
- if (ossToken.host == null || ossToken.host == undefined) {
- self.$method.showToast("上传路径报错" + JSON.stringify(res.data));
- return;
- }
- let filePath = "";
- // #ifdef H5
- var localData = options; //dataUrl为base64位
- let base = atob(localData.substring(localData.indexOf(",") + 1)); // base是将base64编码解码,去掉data:image/png;base64部分
- let length = base.length;
- let url = new Uint8Array(length);
- while (length--) {
- url[length] = base.charCodeAt(length);
- }
- filePath = new File([url], "a.jpg", {
- type: "image/jpg",
- });
- uni.uploadFile({
- url: ossToken.host,
- name: "file",
- file: filePath,
- fileType: "image",
- header: {
- AuthorizationToken: "WX " + uni.getStorageSync("token"),
- },
- formData: {
- key: ossToken.dir,
- OSSAccessKeyId: ossToken.accessid,
- policy: ossToken.policy,
- Signature: ossToken.signature,
- callback: ossToken.callback,
- success_action_status: 200,
- },
- success: (result) => {
- this.$u.toast("上传成功");
- self.ossAvatarUrl = ossToken.dir;
- resolve(ossToken.dir);
- },
- fail: (error) => {
- uni.showToast({
- title: "上传接口报错,请重新拍照上传" + error,
- icon: "none",
- });
- this.openPhoto();
- return;
- },
- });
- // #endif
- // #ifdef MP-WEIXIN
- uni.uploadFile({
- url: ossToken.host,
- name: "file",
- filePath: options,
- fileType: "image",
- header: {
- AuthorizationToken: "WX " + uni.getStorageSync("token"),
- },
- formData: {
- key: ossToken.dir,
- OSSAccessKeyId: ossToken.accessid,
- policy: ossToken.policy,
- Signature: ossToken.signature,
- callback: ossToken.callback,
- success_action_status: 200,
- },
- success: (result) => {
- // if (result.statusCode === 200) {
- this.$u.toast("上传成功");
- self.ossAvatarUrl = ossToken.dir;
- resolve(ossToken.dir);
- },
- fail: (error) => {
- uni.showToast({
- title: "上传接口报错,请重新拍照上传" + error,
- icon: "none",
- });
- this.openPhoto();
- return;
- },
- });
- // #endif
- });
- });
- },
- imageInfos() {
- var self = this;
- return new Promise(async (resolve, reject) => {
- let resPath = await myCompressImage(
- this.avatarUrl || this.faceUrl,
- 100
- );
- const waitUpload = await self.uploadFile(resPath, 0);
- resolve(waitUpload);
- });
- },
- timeEvent() {
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- if (polyvPlayerContext != null) {
- // #ifdef MP-WEIXIN
- this.playTime = polyvPlayerContext.getCurrentTime(); //播放时刻
- // #endif
- // #ifdef H5
- this.playTime = polyvPlayerContext.j2s_getCurrentTime();
- // #endif
- this.configPhoto();
- console.info(this.photoList, "photoList");
- let photoTime = 0; //获取拍照秒数
- for (let i = 0; i < this.photoList.length; i++) {
- photoTime = Number(this.photoList[i]); //获取拍照秒数
- if (
- (this.erJianErZao && !this.photoHistoryList.length) ||
- (photoTime < this.playTime && photoTime > this.playTime - 8)
- ) {
- //3秒区间内才触发拍照,避免拉动滚动条
- if (this.photoHistoryList.indexOf(i) < 0) {
- //不存在拍照历史,没有重修过,没有学过,则拍照
- //启动拍照
- //暂停
- console.log("去拍照");
- // #ifdef MP-WEIXIN
- polyvPlayerContext.exitFullScreen();
- polyvPlayerContext.pause();
- // #endif
- // #ifdef H5
- polyvPlayerContext.j2s_pauseVideo();
- polyvPlayerContext.toggleFullscreen();
- // #endif
- this.photoIndex = i;
- if (
- uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
- this.goodsId
- ) {
- return this.openPhoto();
- } else {
- this.popupPhotoShow = true;
- uni.setStorageSync(
- `tabkePhotoShow${this.goodsId}`,
- this.goodsId
- ); // 本地缓存用来判断是否已经弹出过弹窗
- }
- }
- }
- }
- }
- },
- closeToast() {
- clearTimeout(this.toastTimer);
- this.videoToastShow = false;
- },
- restart() {
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- // #ifdef MP-WEIXIN
- polyvPlayerContext.seek(0);
- // #endif
- // #ifdef H5
- polyvPlayerContext.j2s_seekVideo(0);
- // #endif
- clearTimeout(this.toastTimer);
- this.videoToastShow = false;
- },
- // 新增用户视频学习日志
- studyLog() {
- this.$http({
- url: "/user/study/log",
- method: "post",
- data: {
- goodsId: this.goodsId,
- courseId: this.courseId,
- moduleId: this.moduleId || 0,
- chapterId: this.chapterId || 0,
- sectionId: this.playSectionId || 0,
- fromPlat: 1, //来源平台 1小程序 2PC网站
- goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
- orderGoodsId: this.orderGoodsId,
- },
- }).then((res) => {});
- },
- async onStateChange(newstate, oldstate) {
- polyvPlayerContext = this.selectComponent("#playerVideo");
- if (newstate.detail.newstate == "playing") {
- console.log("播放");
- if (this.noticeShow) {
- polyvPlayerContext.pause();
- return;
- }
- if (this.needSeek) {
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- if (this.recordObj.videoCurrentTime) {
- polyvPlayerContext.seek(this.recordObj.videoCurrentTime);
- this.seekTime = this.$method.secondToDate(
- this.recordObj.videoCurrentTime
- );
- this.videoToastShow = true;
- this.toastTimer = setTimeout(() => {
- this.videoToastShow = false;
- }, 3000);
- } else {
- polyvPlayerContext.seek(1); //避免相同节继续播放
- }
- polyvPlayerContext.play();
- this.needSeek = false;
- // 新增用户视频学习日志
- this.studyLog();
- // 提交学习记录
- }
- //开始播放
- this.timer && clearInterval(this.timer);
- if (
- this.playSecIsLearn &&
- (this.erJianErZao || this.jjShiGongYuan || this.photoNum > 0)
- ) {
- this.clearPauseTimer();
- this.isReach = false;
- this.timer = setInterval(this.timeEvent, 1000); //定时器
- }
- }
- if (newstate.detail.newstate == "pause") {
- console.log("暂停");
- this.erJianErZaoPauseTip();
- clearInterval(this.timer);
- //暂停提交记录
- }
- if (newstate.detail.newstate == "ended") {
- clearInterval(this.timer);
- uni.showToast({
- icon: "none",
- title: "播放完毕",
- });
- this.hasStart = false;
- await this.postStudyRecord(1);
- this.nextSection();
- }
- },
- //播放下一节
- nextSection() {
- console.log("播放下一节");
- if (!this.menuAllList.length) {
- return;
- }
- this.curPlayIndex = this.menuAllList.findIndex((item) => {
- let i_sectionId = item.sectionId || 0;
- let i_chapterId = item.chapterId || 0;
- let i_moduleId = item.moduleId || 0;
- return (
- i_sectionId == this.playSectionId &&
- i_chapterId == this.chapterId &&
- i_moduleId == this.moduleId
- );
- });
- let data = this.menuAllList[this.curPlayIndex + 1];
- if (!data) {
- //第二个弹窗
- uni.showModal({
- title: "温馨提示",
- content:
- "恭喜您课程学习全部完成,教务会在1-3个工作日内完成学习初审,请耐心等待。",
- showCancel: !this.erJianErZao,
- success: (res) => {
- if (res.confirm) {
- uni.switchTab({
- url: "/pages/learn/index",
- });
- }
- },
- });
- } else {
- if (data.doType == 2) {
- if (data.studyStatus == 1) {
- uni.showToast({
- title: "试卷已合格!",
- duration: 2000,
- icon: "none",
- });
- return;
- }
- uni.showModal({
- title: "温馨提示",
- content: "当前节视频已学完,是否进入考试?",
- success: (res) => {
- if (res.confirm) {
- this.toQuestionBank(data);
- }
- },
- });
- return;
- }
- uni.showModal({
- title: "温馨提示",
- content: "当前节视频已学完,继续学习下一节?",
- success: async (res) => {
- if (res.confirm) {
- this.moduleId = data.moduleId;
- this.chapterId = data.chapterId;
- this.sectionId = data.sectionId;
- if (data.sectionType == 1) {
- //录播
- this.$store.commit("setPlaySectionId", {
- playSectionId: data.sectionId,
- });
- this.$store.commit("setPlayVID", {
- playVID: data.recordingUrl,
- });
- this.hasStart = false;
- this.photoConfig = false;
- this.photoIndex = 0;
- this.sectionItem = data;
- await this.getPhotoLastRecord(); // 获取拍照历史
- this.playVideo(data);
- } else if (data.sectionType == 2) {
- //直播
- this.studyRecordGetLastLive();
- } else if (data.sectionType == 3) {
- //回放
- this.$store.commit("setPlaySectionId", {
- playSectionId: data.sectionId,
- });
- this.$store.commit("setPlayVID", {
- playVID: data.recordingUrl,
- });
- this.sectionItem = data;
- this.playVideo(data);
- }
- let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
- this.$store.commit("updatePlayNextId", playNextId);
- this.updateChapterOpen(true);
- this.reStart = false;
- this.getMenuList();
- }
- },
- });
- }
- },
- //拍照
- openPhoto() {
- if (polyvPlayerContext) {
- // #ifdef MP-WEIXIN
- polyvPlayerContext.exitFullScreen();
- // #endif
- // #ifdef H5
- if (this.isFullScreen()) {
- this.exitFullscreen();
- }
- // #endif
- }
- // #ifdef MP-WEIXIN
- this.enableAutoRotation = false;
- this.photoPopup = true;
- this.isTaking = true;
- uni.setKeepScreenOn({
- keepScreenOn: true,
- });
- uni.authorize({
- scope: "scope.camera",
- success() {},
- });
- // #endif
- // #ifdef H5
- if (
- (window.navigator.mediaDevices &&
- window.navigator.mediaDevices.getUserMedia) ||
- window.navigator.getUserMedia ||
- window.navigator.webkitGetUserMedia ||
- window.navigator.mozGetUserMedia
- ) {
- console.log("getUserMedia----");
- // 调用用户媒体设备, 访问摄像头
- this.getUserMedia(
- {
- video: {
- width: 400,
- height: 300,
- facingMode: "user",
- },
- },
- this.photographSuccess,
- this.photographError
- );
- } else {
- console.log("1111没有摄像");
- this.photographError();
- }
- // #endif
- },
- /**
- * 人脸匹配
- */
- faceRecognition() {
- return new Promise((resolve) => {
- // #ifdef MP-WEIXIN
- let fileSystem = uni.getFileSystemManager();
- fileSystem.readFile({
- filePath: `${this.avatarUrl}`,
- encoding: "base64",
- position: 0,
- success: (res) => {
- let base64 = "data:image/jpg;base64," + res.data;
- // console.log('base64Data人脸识别参数:', {
- // imageA: base64,
- // orderGoodsId: this.orderGoodsId,
- // gradeId: this.gradeId,
- // })
- this.CompareFace(base64, resolve);
- },
- fail(err) {
- // this.$u.toast('人脸识别错误!')
- console.error(err, "err-----人脸识别错误");
- },
- });
- // #endif
- // #ifdef H5
- this.CompareFace(this.faceUrl, resolve);
- // #endif
- });
- },
- CompareFace(url, resolve) {
- let timer = setTimeout(() => {
- uni.showToast({
- icon: "none",
- title: "拍照超时,请重新拍照",
- duration: 2000,
- success: () => {
- setTimeout(() => {
- uni.navigateBack();
- }, 1000);
- },
- });
- }, 10 * 1000);
- this.$api
- .faceCertificationCompareFace({
- imageA: url,
- orderGoodsId: this.orderGoodsId,
- gradeId: this.gradeId,
- })
- .then((res) => {
- clearTimeout(timer);
- console.log(res, "人脸识别成功res");
- resolve(res.data.data);
- })
- .catch((err) => {
- clearTimeout(timer);
- // 当前网络延迟,
- console.log("人脸识别错误:", err);
- uni.showModal({
- content: "当前网络延迟",
- showCancel: false,
- success: (resultst) => {
- if (resultst.confirm) {
- uni.navigateBack();
- }
- },
- });
- });
- },
- // 确定拍照
- async submit() {
- if (this.uploadLock) {
- return;
- }
- this.uploadLock = true;
- let compareFaceData = await this.faceRecognition();
- this.compareFaceData = compareFaceData;
- if (compareFaceData >= 80) {
- await this.imageInfos();
- this.postCoursePhotoRecord()
- .then(async (res) => {
- this.photoHistoryList.push(this.photoIndex);
- // console.log('拍照确定提交', this.photoHistoryList);
- this.postStudyRecord(); //提交记录
- if (this.erJianErZao && this.isReach) {
- console.log("1校验");
- await this.postStudyRecord(1);
- this.photoPopup = false;
- this.uploadLock = false;
- this.enableAutoRotation = true;
- this.nextSection();
- return;
- }
- //恢复播放
- // #ifdef MP-WEIXIN
- uni.setKeepScreenOn({
- keepScreenOn: false,
- });
- // #endif
- this.photoPopup = false;
- this.uploadLock = false;
- this.enableAutoRotation = true;
- // var polyvPlayerContext = this.selectComponent("#playerVideo");
- if (polyvPlayerContext != null) {
- // #ifdef MP-WEIXIN
- polyvPlayerContext.play();
- // #endif
- // #ifdef H5
- polyvPlayerContext.j2s_resumeVideo();
- // #endif
- }
- })
- .catch((err) => {
- console.log("拍照记录接口的err", err);
- uni.showToast({
- title: "上传接口报错,请重新拍照上传" + err,
- icon: "none",
- });
- this.uploadLock = false;
- this.openPhoto();
- });
- } else {
- uni.showToast({
- title: "人脸匹配不通过,请重新拍照上传",
- icon: "none",
- duration: 2000,
- });
- setTimeout(() => {
- this.uploadLock = false;
- this.openPhoto();
- }, 2000);
- }
- },
- reTake() {
- this.isTaking = true;
- // #ifdef H5
- this.faceUrl = "";
- this.getUserMedia(
- {
- video: {
- width: 400,
- height: 300,
- facingMode: "user",
- },
- },
- this.photographSuccess,
- this.photographError
- );
- // #endif
- },
- toTakePhoto() {
- this.popupPhotoShow = false;
- this.openPhoto();
- },
- takePhTips() {
- this.popupPhotoShow = true;
- this.isTaking = false;
- this.photoPopup = false;
- this.enableAutoRotation = false;
- },
- //确认拍照
- takePhoto() {
- // #ifdef MP-WEIXIN
- const ctx = uni.createCameraContext();
- ctx.takePhoto({
- quality: "high",
- success: (res) => {
- this.avatarUrl = res.tempImagePath;
- console.log("开始拍照this.avatarUrl:", this.avatarUrl);
- this.isTaking = false;
- },
- fail: (err) => {},
- });
- // #endif
- // #ifdef H5
- const canvas = document.createElement("canvas");
- canvas.width = 400;
- canvas.height = 400;
- const context = canvas.getContext("2d");
- const box = document.querySelector(".photo_v");
- const video = box.querySelector("video");
- context.drawImage(video, 0, 0, 400, 400);
- this.faceUrl = canvas.toDataURL("image/png");
- this.isTaking = false;
- // #endif
- },
- playError(e) {
- console.log(e);
- },
- //拍照报错
- error(e) {
- console.log(e.detail);
- },
- //关闭相机
- closePhoto() {
- this.photoPopup = false;
- this.enableAutoRotation = true;
- },
- /**
- * 进入全屏
- */
- fullscreenchange(event) {
- if (event.detail.direction == "vertical") {
- this.navShow = true;
- } else if (event.detail.direction == "horizontal") {
- this.navShow = false;
- }
- },
- checkFinishRequiredCourse() {
- return this.$api
- .checkFinishRequiredCourse({
- businessId: this.goodsData.businessId,
- goodsId: this.goodsId,
- })
- .then((res) => {
- if (res.data.data > 0) {
- uni.showModal({
- showCancel: false,
- confirmText: "确定",
- content: "该业务层次下有未学完的商品,无法学习新商品!",
- success: function (resultst) {
- uni.navigateBack();
- },
- });
- return Promise.reject();
- }
- return Promise.resolve();
- });
- },
- getGoodsDetail() {
- let self = this;
- this.$api.goodsDetail(this.goodsId).then(async (res) => {
- this.goodsData = res.data.data;
- this.option.periodWaitTime && (await this.checkFinishRequiredCourse());
- if (self.goodsData.buyNote) {
- this.baseHandoutTipList();
- }
- !self.gradeId && (self.gradeId = self.goodsData.gradeId);
- self.erJianErZao = self.goodsData.erJianErZao;
- self.jjShiGongYuan = self.goodsData.jjShiGongYuan;
- this.courseBusiness(this.goodsData.businessId);
- self.getMenuList();
- self.getReMenuList(); //获取重修目录
- setTimeout(function () {
- if (!self.needProfileModal) {
- self.getGradeInfo();
- }
- }, 500);
- //获取节笔记
- this.getNoteList();
- if (self.goodsData.goodsPlayConfig) {
- self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
- if (self.goodsPlayConfig.autoPlay > 0) {
- self.autoplay = true;
- }
- if (self.goodsPlayConfig.drag > 0 && !self.erJianErZao) {
- // #ifdef MP-WEIXIN
- self.isAllowSeek = "yes";
- // #endif
- // #ifdef H5
- self.H5isAllowSeek = "off";
- // #endif
- }
- if (self.goodsPlayConfig.speed > 0) {
- self.playbackRate = [0.5, 0.8, 1.0, 1.25, 1.5, 2.0];
- }
- }
- if (self.goodsData.goodsPhotographConfig) {
- self.goodsPhotographConfig = JSON.parse(
- self.goodsData.goodsPhotographConfig
- );
- if (self.goodsPhotographConfig.photoNum > 0) {
- self.photoNum = self.goodsPhotographConfig.photoNum;
- }
- }
- });
- },
- startVideo() {
- this.startStatus = true;
- },
- getAnswerList() {
- let self = this;
- this.$api
- .answerList({
- courseId: this.courseId,
- goodsId: this.goodsId,
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- self.answerList = res.data.rows;
- }
- });
- },
- getReMenuList() {
- // console.log('重修的目录');
- let self = this;
- this.$api
- .reMenuList({
- orderGoodsId: this.orderGoodsId,
- courseId: this.courseId,
- rebuild: 1,
- gradeId: this.gradeId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- for (let i = 0; i < res.data.rows.length; i++) {
- let item = res.data.rows[i];
- item.down = true;
- item.id = item.menuId;
- item.name = item.menuName;
- }
- self.reMenuList = res.data.rows;
- if (self.reMenuList.length > 0) {
- this.showNotes = false;
- self.list = [
- {
- name: "目录",
- },
- {
- name: "讲义",
- },
- {
- name: "笔记",
- },
- {
- name: "答疑",
- },
- { name: "重修目录" },
- ];
- this.current = 0;
- if (Object.keys(this.sectionItem).length) {
- let playNextIdisRebuild = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}isRebuild`;
- this.$store.commit("updatePlayNextId", playNextIdisRebuild);
- }
- } else {
- if (Object.keys(this.sectionItem).length) {
- let playNextId = `moduleId${this.sectionItem.moduleId}chapterId${this.sectionItem.chapterId}sectionId${this.sectionItem.sectionId}`;
- this.$store.commit("updatePlayNextId", playNextId);
- }
- self.list = [
- {
- name: "目录",
- },
- {
- name: "讲义",
- },
- {
- name: "笔记",
- },
- {
- name: "答疑",
- },
- ];
- this.current = 0;
- }
- }
- });
- },
- getMenuList() {
- // console.log('menuList的目录');
- let self = this;
- // /course/menuList 查询课程目录结构列表
- this.$api
- .reMenuList({
- courseId: this.courseId,
- gradeId: this.gradeId,
- orderGoodsId: this.orderGoodsId,
- })
- .then((res) => {
- if (res.data.code == 200) {
- for (let i = 0; i < res.data.rows.length; i++) {
- let item = res.data.rows[i];
- item.down = true;
- item.id = item.menuId;
- item.name = item.menuName;
- item.menuType = item.type;
- }
- self.menuList = res.data.rows;
- this.reStart = true;
- for (let i = 0; i < res.data.rows.length; i++) {
- if (res.data.rows[i].type == 1) {
- // 模块
- if (Object.keys(this.sectionItem).length) {
- if (res.data.rows[i].menuId == this.sectionItem.moduleId) {
- this.menuIndex = [i];
- break;
- }
- } else {
- this.menuIndex = [i];
- break;
- }
- } else if (res.data.rows[i].type == 2) {
- // 章
- if (Object.keys(this.sectionItem).length) {
- if (
- res.data.rows[i].menuId == this.sectionItem.chapterId &&
- (!this.sectionItem.moduleId ||
- this.sectionItem.moduleId == 0)
- ) {
- this.menuIndex = [i];
- break;
- }
- } else {
- this.menuIndex = [i];
- break;
- }
- }
- }
- // console.log('menuList: ---', this.menuList, 'menuIndex:', this.menuIndex);
- }
- });
- },
- courseDetail() {
- let self = this;
- // '/course/'+data,
- this.$api.courseDetail(this.courseId).then((res) => {
- if (res.data.code == 200) {
- // if (res.data.data.educationName == "继续教育") {
- this.$api
- .lockLockAction({
- action: "jxjy",
- uuid: this.$method.getUuid(),
- })
- .then((res) => {});
- this.lockTimer = setInterval(() => {
- this.$api
- .lockLockAction({
- action: "jxjy",
- uuid: this.$method.getUuid(),
- })
- .then((res) => {});
- }, 10000);
- // websocket.sendMsg("doCourse");
- // }
- self.detail = res.data.data;
- }
- });
- },
- open(item) {
- item.showChildren = !item.showChildren;
- },
- change(index) {
- this.current = index;
- },
- clickMulu() {
- this.muluStyle = !this.muluStyle;
- },
- loadPlayerScript(callback) {
- if (!window.polyvPlayer) {
- const myScript = document.createElement("script");
- myScript.setAttribute("src", this.vodPlayerJs);
- myScript.onload = callback;
- document.body.appendChild(myScript);
- } else {
- callback();
- }
- },
- // 播放视频
- loadPlayer() {
- const polyvPlayer = window.polyvPlayer;
- this.$api.polyvVideoSign(this.vid).then(async (res) => {
- let option = {
- showLine: "off",
- ban_history_time: "on",
- vid: this.vid,
- forceH5: true,
- autoplay: this.autoplay, // 自动播放
- ban_seek: this.H5isAllowSeek, // 是否禁止拖拽进度条
- speed: this.playbackRate, // 倍数
- banSeekDeviation: 7, // 做兼容
- teaser_show: 1,
- tail_show: 1,
- hideSwitchPlayer: true,
- watchStartTime: this.recordObj.videoCurrentTime, // 播放开始时间,表示视频从第几秒开始播放,参数值需小于视频时长
- ts: res.data.data.ts, // 移动播放加密视频需传入的时间戳。
- sign: res.data.data.sign, // 移动端播放加密视频所需的签名
- };
- if (polyvPlayerContext) {
- polyvPlayerContext.changeVid(option);
- } else {
- option = {
- wrap: "#player",
- width: "100%",
- height: 218,
- ...option,
- };
- polyvPlayerContext = await polyvPlayer(option);
- }
- // polyvPlayerContext = await polyvPlayer({
- // wrap: "#player",
- // width: "100%",
- // showLine: "off",
- // height: 218,
- // ban_history_time: "on",
- // vid: this.vid,
- // forceH5: true,
- // autoplay: this.autoplay, // 自动播放
- // ban_seek: this.H5isAllowSeek, // 是否禁止拖拽进度条
- // speed: this.playbackRate, // 倍数
- // teaser_show: 1,
- // tail_show: 1,
- // hideSwitchPlayer: true,
- // watchStartTime: this.recordObj.videoCurrentTime, // 播放开始时间,表示视频从第几秒开始播放,参数值需小于视频时长
- // ts: res.data.data.ts, // 移动播放加密视频需传入的时间戳。
- // sign: res.data.data.sign, // 移动端播放加密视频所需的签名
- // });
- // polyvPlayerContext = this.player;
- polyvPlayerContext.on("s2j_onPlayStart", async (vid) => {
- console.log("视频初次播放时触发:");
- // #ifdef H5
- // h5禁止拖动进度条
- if (!this.$method.isWeixin()) {
- this.clearBarTimer();
- let originTime = this.recordObj.videoCurrentTime || 0;
- if (this.H5isAllowSeek == "on") {
- this.barTimer = setInterval(() => {
- const currentTime = polyvPlayerContext.j2s_getCurrentTime();
- // console.log(currentTime, originTime, 789);
- if (
- currentTime - originTime > 15 ||
- currentTime - originTime < 0
- ) {
- polyvPlayerContext.j2s_seekVideo(originTime);
- } else {
- originTime = currentTime;
- }
- }, 2000);
- }
- }
- // #endif
- this.loadedmetadata();
- this.postStudyRecord(0);
- });
- polyvPlayerContext.on("s2j_onVideoPause", () => {
- // 视频暂停时触发
- console.log("视频暂停时触发", this.vid);
- this.erJianErZaoPauseTip();
- this.clearBarTimer();
- clearInterval(this.studyTimer);
- clearInterval(this.timer);
- });
- polyvPlayerContext.on("s2j_onVideoPlay", () => {
- // 视频初次播放或由暂停恢复播放时触发
- console.log("视频初次播放或由暂停恢复播放时触发");
- if (this.noticeShow) {
- polyvPlayerContext.j2s_pauseVideo();
- return;
- }
- if (this.needSeek) {
- if (this.recordObj.videoCurrentTime) {
- this.seekTime = this.$method.secondToDate(
- this.recordObj.videoCurrentTime
- );
- this.videoToastShow = true;
- this.toastTimer = setTimeout(() => {
- this.videoToastShow = false;
- }, 3000);
- }
- this.needSeek = false;
- // 新增用户视频学习日志
- this.studyLog();
- }
- //开始播放
- this.timer && clearInterval(this.timer);
- if (
- this.playSecIsLearn &&
- (this.erJianErZao || this.jjShiGongYuan || this.photoNum > 0)
- ) {
- this.clearPauseTimer();
- this.isReach = false;
- this.timer = setInterval(this.timeEvent, 1000); //定时器
- }
- this.studyTimer && clearInterval(this.studyTimer);
- this.studyTimer = setInterval(() => {
- this.postStudyRecord(0, this.playSectionId);
- }, 15000);
- });
- polyvPlayerContext.on("s2j_onPlayOver", async () => {
- // 当前视频播放完毕时触发
- this.hasStart = false;
- this.clearBarTimer();
- clearInterval(this.studyTimer);
- clearInterval(this.timer);
- uni.showToast({
- icon: "none",
- title: "播放完毕",
- });
- await this.postStudyRecord(1);
- this.nextSection(); // 播放下一节
- });
- });
- },
- clears() {
- return new Promise((resolve, reject) => {
- this.vid = "";
- polyvPlayerContext && polyvPlayerContext.destroy();
- polyvPlayerContext = null;
- resolve();
- });
- },
- /**
- * 退出全屏
- */
- exitFullscreen() {
- try {
- var de = document;
- if (de.exitFullscreen) {
- de.exitFullscreen();
- } else if (de.mozCancelFullScreen) {
- de.mozCancelFullScreen();
- } else if (de.webkitCancelFullScreen) {
- de.webkitCancelFullScreen();
- }
- } catch (err) {}
- },
- fullele() {
- return (
- document.fullscreenElement ||
- document.webkitFullscreenElement ||
- document.msFullscreenElement ||
- document.mozFullScreenElement ||
- null
- );
- },
- //判断是否全屏
- isFullScreen() {
- return !!(document.webkitIsFullScreen || this.fullele());
- },
- getUserMedia(constraints, success, error) {
- console.log("getUserMedia===", constraints, "success:", success);
- if (window.navigator.mediaDevices.getUserMedia) {
- // 最新的标准API
- window.navigator.mediaDevices
- .getUserMedia(constraints)
- .then(success)
- .catch(error);
- } else if (window.navigator.webkitGetUserMedia) {
- // webkit核心浏览器
- window.navigator.webkitGetUserMedia(constraints, success, error);
- } else if (window.navigator.mozGetUserMedia) {
- // firfox浏览器
- window.navigator.mozGetUserMedia(constraints, success, error);
- } else if (window.navigator.getUserMedia) {
- // 旧版API
- window.navigator.getUserMedia(constraints, success, error);
- }
- },
- photographSuccess(stream) {
- console.log("有摄像头---", stream);
- this.photoPopup = true;
- this.isTaking = true;
- this.enableAutoRotation = false;
- this.$nextTick(() => {
- const box = document.querySelector(".photo_v");
- const video = box.querySelector("video");
- console.log("video:", video);
- video.srcObject = stream;
- video.play();
- });
- },
- photographError(err) {
- console.log("没有摄像头:", err);
- uni.showModal({
- title: "提示",
- content:
- "课程学习需要开启摄像头进行拍照,经检测您的设备无摄像头可使用,请检测环境是否支持。",
- cancelText: "取消",
- showCancel: false,
- confirmText: "确定",
- success: (res) => {
- if (res.confirm) {
- uni.navigateBack();
- } else if (res.cancel) {
- }
- },
- });
- },
- },
- };
- </script>
- <style lang="scss" scope>
- @import "./css/detail.scss";
- .top {
- &__header {
- position: relative;
- width: 100%;
- height: 150rpx;
- padding: 24rpx 150rpx 24rpx 24rpx;
- .img {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- }
- .note {
- position: relative;
- z-index: 10;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #efdbff;
- }
- .title {
- position: relative;
- z-index: 10;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #ffffff;
- }
- }
- }
- #top {
- position: relative;
- z-index: 99;
- }
- .polyv_detail {
- display: flex;
- flex-direction: column;
- height: 100vh;
- position: relative;
- top: 0;
- left: 0;
- .pops {
- position: absolute;
- top: 0;
- left: 0;
- background: #ccc;
- opacity: 0.5;
- width: 100%;
- height: 300rpx;
- z-index: 9999;
- }
- .box {
- flex: 1;
- overflow: hidden;
- margin: 16rpx 16rpx 100rpx 16rpx;
- .box_in {
- height: 100%;
- }
- }
- .first_ml {
- margin: 16rpx 16rpx 16rpx 16rpx;
- }
- }
- .btnSet {
- width: 440rpx;
- height: 80rpx;
- background: #007aff;
- border-radius: 40rpx;
- color: #ffffff;
- font-size: 28rpx;
- line-height: 80rpx;
- }
- .btnReply {
- width: 80rpx;
- height: 40rpx;
- background: #e3f0ff;
- border-radius: 16rpx;
- text-align: center;
- color: #007aff;
- }
- .btnDel {
- width: 80rpx;
- height: 40rpx;
- background: #ffedf0;
- border-radius: 16rpx;
- text-align: center;
- color: #ff2d55;
- }
- .btnReply {
- width: 80rpx;
- height: 40rpx;
- background: #e3f0ff;
- border-radius: 16rpx;
- font-size: 24rpx;
- }
- .lecture-content {
- background: #fff;
- margin-top: 10rpx;
- padding: 10rpx;
- border-radius: 16rpx;
- }
- .photoBox {
- width: 100%;
- // background-color: #ffffff;
- // border-radius: 24px 24px 0px 0px;
- .photoTop {
- width: 100%;
- height: 74rpx;
- border-radius: 20px 20px 0px 0px;
- background-color: #ffffff;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0rpx 38rpx;
- .sqzz {
- width: 28rpx;
- height: 28rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .centersq {
- color: #333;
- font-size: 30rpx;
- font-weight: 500;
- }
- }
- .photoCenter {
- width: 750rpx;
- height: 75vh;
- position: relative;
- .center_camera {
- width: 100%;
- height: 75vh;
- position: fixed;
- .head_take {
- width: 100%;
- height: 75vh;
- display: flex;
- flex-direction: column;
- }
- .headTake_up {
- width: 100%;
- height: 100rpx;
- }
- .headTake_minddle {
- display: flex;
- .min_img {
- width: 500rpx;
- height: 550rpx;
- }
- .min_left,
- .min_right {
- flex: 1;
- height: 550rpx;
- }
- }
- .headTake_down {
- width: 100%;
- flex: 1;
- }
- .color {
- background-color: #333;
- opacity: 0.5;
- }
- .photo_v {
- width: 100%;
- height: 100%;
- }
- .mask {
- width: 500rpx;
- height: 550rpx;
- position: absolute;
- top: 100rpx;
- left: 0;
- right: 0;
- bottom: 0;
- margin: 0 auto;
- box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
- }
- }
- .custom {
- width: 750rpx;
- height: 75vh;
- position: absolute;
- z-index: 1000;
- top: 0;
- left: 0;
- image {
- width: 100%;
- height: 100%;
- }
- }
- }
- .btns {
- display: flex;
- .takePhoto_btn {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- background: #a9a7a9;
- padding: 40rpx 26rpx;
- .middle_btn {
- width: 120rpx;
- height: 120rpx;
- border-radius: 40rpx;
- border: 4rpx solid #ffffff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .square {
- width: 96rpx;
- height: 96rpx;
- background: #ffffff;
- border-radius: 28rpx;
- }
- .rights {
- font-size: 32rpx;
- font-weight: 500;
- color: #ffffff;
- }
- }
- .btnResult {
- height: 100rpx;
- flex: 1;
- background-color: #07c160;
- text-align: center;
- line-height: 100rpx;
- color: #fff;
- font-size: 32rpx;
- font-weight: bold;
- }
- }
- }
- .chat_box {
- display: flex;
- padding: 20rpx;
- justify-content: space-between;
- }
- .chat3 {
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- margin-top: 10rpx;
- }
- .chat2 {
- font-size: 20rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- margin-top: 10rpx;
- }
- .chat1 {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #333333;
- }
- .leftPadding {
- margin-left: 8rpx;
- }
- .t2Content {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #999999;
- line-height: 48rpx;
- }
- .tBox2 {
- display: flex;
- padding-top: 10rpx;
- color: #333333;
- font-size: 30rpx;
- font-weight: 400;
- }
- .tBox {
- display: flex;
- align-items: center;
- padding-top: 10rpx;
- }
- .title {
- font-size: 24rpx;
- color: #999999;
- }
- .Answering {
- .answer_item {
- &:nth-child(2) {
- border-radius: 16rpx 16rpx 0rpx 0rpx;
- }
- &:nth-last-child(1) {
- border-radius: 0rpx 0rpx 16rpx 16rpx;
- }
- }
- }
- .inputBottom {
- position: fixed;
- left: 0;
- bottom: 0;
- background: #ffffff;
- height: 98rpx;
- display: flex;
- align-items: center;
- width: 100%;
- .flex_auto {
- flex: 1;
- margin-left: 10%;
- word-break: break-all;
- // .input {
- // height: 60rpx;
- // }
- }
- .btn {
- color: #007aff;
- font-size: 30rpx;
- font-weight: bold;
- width: 15%;
- text-align: center;
- }
- .input {
- background: rgba(244, 244, 244, 0.98);
- height: 60rpx;
- border-radius: 24rpx;
- margin-top: 12rpx;
- }
- }
- .noteBox {
- width: 100%;
- background: #ffffff;
- padding: 0rpx 10rpx 20rpx;
- border-radius: 16rpx;
- overflow: hidden;
- .left_ti {
- padding-top: 14rpx;
- }
- }
- .dateBox {
- width: 216rpx;
- height: 48rpx;
- background: #ffffff;
- border-radius: 24rpx;
- font-size: 24rpx;
- color: #666666;
- text-align: center;
- line-height: 48rpx;
- margin: 16rpx 0rpx 8rpx;
- }
- .t_content1 {
- color: #007aff;
- margin-left: 10rpx;
- }
- .tag1 {
- border: 2rpx solid #007aff;
- border-radius: 8rpx;
- font-size: 20rpx;
- color: #007aff;
- padding: 5rpx;
- }
- .b_title {
- color: #333333;
- font-size: 30rpx;
- font-weight: bold;
- }
- page {
- background: #eaeef1;
- }
- .menuBox {
- width: 100%;
- background: #ffffff;
- border-radius: 16rpx;
- padding: 0rpx 20rpx;
- margin-bottom: 20rpx;
- }
- .btnspric {
- border-top: 1rpx solid #eee;
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 108rpx;
- padding-left: 43rpx;
- padding-right: 32rpx;
- }
- .btnspric > .lefprL {
- font-size: 36rpx;
- color: #0c141f;
- font-weight: bold;
- }
- .btnspric > .lefprR {
- padding: 0rpx 24rpx;
- height: 60rpx;
- line-height: 60rpx;
- text-align: center;
- color: #fff;
- background: #32467b;
- border-radius: 24rpx;
- box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
- }
- .yhj,
- .hdyhj {
- padding: 24rpx 29rpx 24rpx 34rpx;
- }
- .yhj {
- border-bottom: 16rpx solid #f9f9f9;
- }
- .yhjtit {
- font-size: 30rpx;
- color: #0c141f;
- font-weight: 500;
- margin-bottom: 14rpx;
- }
- .yhjList {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 14rpx;
- }
- .yhjList > .yhjLefts {
- display: flex;
- align-items: center;
- }
- .yhjLefts > .yhl {
- color: #32467b;
- font-size: 30rpx;
- margin-right: 31rpx;
- }
- .yhjLefts > .yhbq {
- font-size: 24rpx;
- color: #ff9500;
- border-radius: 18rpx;
- background-color: rgba(255, 149, 0, 0.2);
- border: 2rpx solid #ff9500;
- height: 38rpx;
- line-height: 38rpx;
- padding: 0rpx 16rpx;
- }
- .ts {
- font-size: 24rpx;
- color: #999;
- margin: 14rpx 0rpx;
- padding-right: 29rpx;
- padding-left: 34rpx;
- }
- .yh {
- padding-top: 20rpx;
- }
- .yh > .yhtitle {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding-right: 29rpx;
- padding-left: 34rpx;
- }
- .priceBxs {
- display: flex;
- align-items: center;
- }
- .priceBxs > .pricleft {
- border-radius: 24rpx;
- border: 1rpx solid #e91313;
- background-color: rgba(233, 19, 19, 0.1);
- padding: 0rpx 18rpx;
- height: 49rpx;
- line-height: 49rpx;
- text-align: center;
- font-size: 30rpx;
- font-weight: 500;
- color: #e91313;
- margin-right: 13rpx;
- }
- .topBox {
- padding: 32rpx 32rpx 24rpx;
- border-bottom: 1rpx solid #eeeeee;
- }
- .topBox > .boldFonstType {
- font-weight: 500;
- font-size: 30rpx;
- margin: 16rpx 0rpx 23rpx;
- }
- .topBox > .firstTopL {
- display: flex;
- align-items: center;
- }
- .topBox > .firstTopL > .imageBs {
- width: 331rpx;
- height: 160rpx;
- border-radius: 6rpx;
- overflow: hidden;
- margin-right: 8rpx;
- box-shadow: 0rpx 6rpx 6rpx 0rpx rgba(47, 67, 121, 0.08);
- }
- .topBox > .firstTopL > .imageBs > image {
- width: 100%;
- height: 100%;
- }
- .topBox > .firstTopL > .textBs {
- font-size: 30rpx;
- font-weight: bold;
- color: #0c141f;
- }
- .content {
- padding: 24rpx;
- text-align: left;
- }
- .catalogBox {
- display: flex;
- align-items: center;
- flex-wrap: nowrap;
- overflow-x: auto;
- padding-left: 38rpx;
- max-height: 305rpx;
- overflow-y: auto;
- transition: all 0.4s;
- }
- .catalogBox > .catalogA {
- min-width: 200rpx;
- height: 48rpx;
- line-height: 48rpx;
- // text-align: center;
- border: 2rpx solid transparent;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- word-break: break-all;
- border-radius: 10rpx;
- background: rgba(22, 119, 255, 0.05);
- padding-left: 19rpx;
- box-sizing: border-box;
- padding-right: 15rpx;
- margin-right: 16rpx;
- margin-bottom: 20rpx;
- margin-top: 15rpx;
- font-size: 24rpx;
- color: #666;
- }
- .catalogBox > .activesq {
- border-color: #1677ff;
- }
- .changeCatalogBox {
- display: block;
- }
- .catalogBox::-webkit-scrollbar {
- display: none; /* Chrome Safari */
- }
- .price_t2 {
- font-size: 18rpx;
- font-family: PingFang SC;
- font-weight: 500;
- text-decoration: line-through;
- color: #999999;
- }
- .price_t1 {
- font-size: 33rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #e91313;
- }
- .sc_t {
- font-size: 22rpx;
- color: #000000;
- }
- .sc {
- width: 29rpx;
- height: 29rpx;
- }
- .buy {
- width: 138rpx;
- height: 48rpx;
- line-height: 48rpx;
- background: #32467b;
- border-radius: 10rpx;
- color: #ffffff;
- font-size: 28rpx;
- text-align: center;
- vertical-align: middle;
- position: absolute;
- right: 30rpx;
- }
- .video_body {
- padding-bottom: 96rpx;
- }
- .footer_tab {
- position: fixed;
- bottom: 0;
- height: 96rpx;
- width: 100%;
- background-color: #ffffff;
- }
- .tj_box {
- width: 50%;
- display: inline-block;
- text-align: center;
- margin: 10rpx 0;
- }
- .teacher_t {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #666666;
- line-height: 36rpx;
- margin-left: 15rpx;
- }
- .teacher_img {
- width: 87rpx;
- height: 129rpx;
- }
- .t2 {
- font-size: 24rpx;
- font-family: PingFang SC;
- color: #666666;
- line-height: 36rpx;
- margin: 15rpx;
- }
- .r_t2 {
- width: 201rpx;
- height: 49rpx;
- background: rgba(22, 119, 255, 0.05);
- border: 1rpx solid #32467b;
- border-radius: 16rpx;
- color: #666666;
- font-size: 23rpx;
- text-align: center;
- display: flex;
- align-items: center;
- padding: 5rpx;
- }
- .scroll_box {
- width: 100%;
- height: 60rpx;
- background: #ffffff;
- box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
- white-space: nowrap;
- overflow: hidden;
- margin: 15rpx 0;
- }
- .r_sliper {
- padding: 0 20rpx;
- }
- .top_line {
- width: 6rpx;
- height: 22rpx;
- background: #32467b;
- margin-right: 10rpx;
- }
- .video_t2 {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- }
- .video_play {
- position: absolute;
- width: 95rpx;
- height: 95rpx;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- margin: auto;
- }
- .video_box {
- position: relative;
- #playerVideo {
- position: relative;
- z-index: 99;
- }
- .video-toast {
- position: absolute;
- width: 686rpx;
- height: 80rpx;
- background: rgba(0, 0, 0, 0.6);
- border-radius: 24rpx;
- bottom: 100rpx;
- left: 50%;
- transform: translateX(-50%);
- color: #fff;
- display: flex;
- font-size: 26rpx;
- align-items: center;
- overflow: visible;
- z-index: 999;
- &__text {
- flex: 1;
- margin-left: 40rpx;
- }
- &__btn {
- width: 180rpx;
- text-align: center;
- border-left: 1rpx solid #fff;
- }
- }
- .video-toast__close {
- position: absolute;
- right: 32rpx;
- bottom: 184rpx;
- width: 40rpx;
- height: 40rpx;
- line-height: 40rpx;
- text-align: center;
- background: rgba(0, 0, 0, 0.6);
- border-radius: 50%;
- color: rgba(255, 255, 255, 0.3);
- }
- }
- .rotoct {
- transform: rotate(90deg);
- }
- .slot-content {
- padding: 0 20rpx;
- }
- .notice_modal {
- .content {
- width: 100%;
- height: 100%;
- padding: 56rpx 56rpx 56rpx 64rpx;
- .title {
- color: #222;
- line-height: 40rpx;
- font-size: 36rpx;
- text-align: center;
- font-weight: bold;
- margin-bottom: 24rpx;
- }
- .text {
- height: 340rpx;
- line-height: 40rpx;
- text-indent: 2em;
- font-size: 32rpx;
- color: #222;
- }
- .had_read {
- width: 100%;
- height: 88rpx;
- line-height: 88rpx;
- text-align: center;
- background: #3577e8;
- border-radius: 240rpx;
- font-size: 32rpx;
- font-weight: 500;
- color: #fff;
- margin-top: 20rpx;
- &.gray {
- background: #bbbec5;
- }
- }
- }
- }
- .full_mulu {
- position: absolute;
- top: 100rpx;
- right: 20rpx;
- width: 700rpx;
- height: 515rpx;
- color: #333;
- display: flex;
- align-items: center;
- justify-content: space-between;
- z-index: 99999;
- .mulus {
- width: 623rpx;
- // height: 515rpx;
- height: 400rpx;
- overflow-y: scroll;
- // overflow: scroll;
- }
- .mulu_box_in {
- background-color: #b7b7b7;
- border-radius: 16rpx;
- // transition: all 0.5s;
- &::after {
- content: "";
- width: 0;
- height: 0;
- position: absolute;
- top: 235rpx;
- right: 27px;
- border-top: 16rpx solid transparent;
- border-right: 16rpx solid transparent;
- border-left: 16rpx solid #b7b7b7;
- border-bottom: 16rpx solid transparent;
- }
- }
- .mulu_box_out {
- // visibility: hidden;
- display: none;
- }
- .menuBox_mulu {
- // width: 100%;
- background: #ffffff;
- border-radius: 16rpx;
- padding: 0rpx 20rpx;
- margin-bottom: 20rpx;
- }
- .ml_img {
- position: absolute;
- right: 0;
- top: 100rpx;
- }
- .items {
- width: 620rpx;
- height: 100rpx;
- border: 1rpx solid red;
- }
- }
- </style>
|