personal-copy.vue 110 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067
  1. <!-- 旧版本跳首页文件修改版本 -->
  2. <template>
  3. <view class="bg-person " :class="bEFHitShake?' screen-jitter ':''">
  4. <!-- :title="title" @clickRight="onNavAppInfo() title="PK模式"" -->
  5. <!-- 自定义导航栏 backgroundColor="rgba(164, 136, 220, 1)" @clickRight="onSyncData" @clickRight="onTestShare"-->
  6. <uni-nav-bar id="nav-bar" status-bar="true" backgroundColor="rgba(153, 150, 252, 255)"
  7. @clickLeft="showClickEvent()" color="#FFFFFF" fixed="true" :border="false">
  8. <view slot="left">
  9. <view class=" flex align-center margin-left">
  10. <image class="png-more" src="/static/more.png"></image>
  11. </view>
  12. </view>
  13. <!-- @clickRight="onNavFcGame()" -->
  14. <view slot="middle">
  15. <!-- <view style="position: relative; border: 1rpx solid #FFFFFF;">
  16. <view
  17. style="position: absolute;top: 0;left: -155rpx;right: 0;bottom: 0;margin: auto; width: 194rpx;height: 52rpx; border-radius: 26rpx 0 0 26rpx; background-color: rgba(255,255,255,0.12);"
  18. class="flex align-center justify-center">
  19. <image style="width: 26rpx;height: 24rpx; margin-right: 12rpx;"
  20. src="/static/personal/linkWhite.png"></image>
  21. <view class="text-14px ">连接设备</view>
  22. </view>
  23. </view> -->
  24. <view class="flex justify-center align-center" style="margin-left: 160rpx; ">
  25. <view class="flex align-center"
  26. style="margin-right: 40rpx; padding: 0 18px; height: 56rpx; background-color: rgba(255,255,255,0.11); border-radius: 13.5px;">
  27. <image class="png-more" style="margin-right: 16rpx;" src="/static/common/sideBar/sGold.png">
  28. </image>
  29. <view class="text-14px" style="line-height: 28rpx;">{{cGold}}</view>
  30. </view>
  31. <view class="flex align-center"
  32. style="padding: 0 18px; height: 56rpx; background-color: rgba(255,255,255,0.11); border-radius: 13.5px;">
  33. <image class="png-more" style="margin-right: 16rpx; " src="/static/common/sideBar/sDiamond.png">
  34. </image>
  35. <view class="text-14px" style="line-height: 28rpx;">{{cDiamond}}</view>
  36. </view>
  37. </view>
  38. </view>
  39. </uni-nav-bar>
  40. <!-- 导航栏下面滚动区域 -->
  41. <scroll-view class="scroll-class" @scroll="mainScroll" :scroll-top="scrollTop" :scroll-into-view="toView"
  42. scroll-y="true" :style="{ height: scrollviewHight + 'px' }">
  43. <view class="flex align-center">
  44. <view class="justify-center">
  45. <!-- 计划显示 区域 topScrollHight :style="{ height: + '100%' }"-->
  46. <scroll-view scroll-y="true" style="height: 100%; width: 100%;">
  47. <view class="plan-view">
  48. <!-- 拳击模块 -->
  49. <view v-if="currentMode == 'pkMode' && 0 === currentModeIndex"
  50. style="display: flex; flex-direction: row; height: 200rpx; margin-top: 140rpx; justify-content: space-around;align-items: center;">
  51. <view>
  52. <view class="cu-avatar-group" style="position: relative;">
  53. <view class="cu-avatar round xl" :class="bAiHitShake?' screen-jitter':''"
  54. :style="[{ backgroundImage:'url('+avatarUrl+')' }]"></view>
  55. <HitEffect ref="aiHitEffectRef"></HitEffect>
  56. </view>
  57. <view style="margin-top: 20rpx; width: 165rpx;" class="text-cut text-white">
  58. {{userName}}{{AJData.isLeftPlayer?'':'当前玩家'}}
  59. </view>
  60. </view>
  61. <view>
  62. <image style="width: 104rpx; height: 42rpx ;margin-bottom: 60rpx;"
  63. src="/static/personal/pk@2x.png"></image>
  64. </view>
  65. <view>
  66. <view class="cu-avatar-group" style="position: relative;">
  67. <view class="cu-avatar round xl" :class="bHitShake?' screen-jitter':''"
  68. :style="[{ backgroundImage:'url('+aiObj.avatar+')' }]"></view>
  69. <HitEffect ref="hitEffectRef"></HitEffect>
  70. </view>
  71. <view style="margin-top: 20rpx; width: 165rpx;" class="text-cut text-white">
  72. {{aiObj.name}}{{AJData.isLeftPlayer?'':'当前玩家'}}
  73. </view>
  74. </view>
  75. <view
  76. style="position: absolute;left: 0;right: 0;top: 0;bottom: 0; height: 200rpx; margin-top: 120rpx;">
  77. <HitFistEffect ref="hitFistRef"></HitFistEffect>
  78. </view>
  79. </view>
  80. <!-- pk模式下的跳绳 -->
  81. <block v-if="1 === currentModeIndex">
  82. <view v-if="currentMode == 'pkMode'" class="flex justify-center "
  83. style="height: 180rpx; margin-top: 20rpx;">
  84. <view class="flex flex-direction justify-center align-center">
  85. <view class="cu-avatar-group" style="position: relative;">
  86. <view class="cu-avatar round xl" :class="bAiHitShake?' screen-jitter':''"
  87. :style="[{ backgroundImage:'url('+avatarUrl+')' }]"></view>
  88. </view>
  89. <view style="margin-top: 20rpx; width: 165rpx; "
  90. class="text-cut text-white text-center">
  91. {{userName}}
  92. </view>
  93. </view>
  94. <view class="flex justify-center align-center " style=" width: 300rpx;">
  95. <LEDFont style="" :showValue='AJData.myScore' :size="30" color='#FFFFFF'>
  96. </LEDFont>
  97. <view class="text-white text-bold">:</view>
  98. <LEDFont style="" :showValue='AJData.otherScore' :size="30" color='#FFFFFF'>
  99. </LEDFont>
  100. </view>
  101. <view v-if="finallySelectFriendInfo"
  102. class="flex flex-direction justify-center align-center"
  103. @click="onNavToSelectFriend()">
  104. <view class="cu-avatar-group" style="position: relative;">
  105. <view class="cu-avatar round xl" :class="bHitShake?' screen-jitter':''"
  106. :style="[{ backgroundImage:'url('+finallySelectFriendInfo.avatarUrl+')' }]">
  107. </view>
  108. </view>
  109. <view style="margin-top: 20rpx; width: 165rpx;"
  110. class="text-cut text-white text-center">
  111. {{finallySelectFriendInfo.username}}
  112. </view>
  113. </view>
  114. <view v-else class="flex flex-direction justify-center align-center"
  115. @click="onNavToSelectFriend()">
  116. <image style="width: 100rpx ;height: 100rpx;"
  117. src="/static/friend/friend-add.png">
  118. </image>
  119. <view style="margin-top: 20rpx; width: 165rpx;"
  120. class="text-cut text-white text-center">
  121. 选择好友
  122. </view>
  123. </view>
  124. </view>
  125. <view v-else style="height:80rpx;"> </view>
  126. </block>
  127. <!-- 圆形进度条 -->
  128. <view
  129. v-if="(currentMode == 'pkMode' && 1 === currentModeIndex)||currentMode== 'calorieMode'"
  130. class="qiun-charts-arcbar">
  131. <!-- 进度条 -->
  132. <canvas canvas-id="canvasArcbar" id="canvasArcbar" class="charts-arcbar "></canvas>
  133. <!-- 图标 -->
  134. <view class="personal-fruit-container">
  135. <image style="width: 36rpx;height: 56rpx; margin-top: -120px;"
  136. src="../../../static/modal/action-jump/arcbarJumpIcon.png"></image>
  137. </view>
  138. <!-- 图标 -->
  139. <view class="personal-fruit-container">
  140. <view class="text-13px text-white" style="margin-top: -50px;">
  141. 失误:{{AJData.faultCount}}</view>
  142. </view>
  143. <!-- 水果卡路里-->
  144. <!-- <view class="personal-fruit-container">
  145. <fruit ref="personalFruitRef" :calorie="planData.allCalorie"></fruit>
  146. </view> -->
  147. <!-- 跳动次数 -->
  148. <view class="personal-fruit-container">
  149. <LEDFont style="margin-top: 40px;" :showValue='AJData.allCount' :size="60"
  150. color='#FFFFFF'>
  151. </LEDFont>
  152. <!-- <view style="margin-top: 130px;font-size:12px;color: #FFFFFF;">计划时间{{planData.sportTime}}分钟</view> -->
  153. </view>
  154. <!-- 计划按钮 -->
  155. <!-- <view id="projectButtonView" style="position: absolute;left: 0;top: 18px;">
  156. <view class="flex justify-center" style="width: 100%;">
  157. <view class="charts-pring-button make-line-bPurple " :class="bPlanExpired?'breathing-lamp':''" style="background-color: #FFFFFF;"
  158. @tap="openPlan">
  159. <image src="/static/reform.png" class="p-data-png" mode="aspectFit"></image>
  160. <view class="text-11px">改计划</view>
  161. </view>
  162. </view>
  163. </view> -->
  164. <!-- 计时器 -->
  165. <view class="personal-fruit-container">
  166. <arcbarCountDown
  167. style="margin-top: 150px; border: 1rpx solid rgba(255,255,255,0.33); padding: 0 10px; border-radius: 40rpx;"
  168. ref="arcbarCountDownRef" :show-day="false" :second="AJData.gameLimitTime"
  169. color="#FFFFFF" background-color="rgba(255,255,255,0);" border-color="#007AFF"
  170. :size="18" splitorColor="#FFFFFF" @timeUp="arcbarCountDownTimeUp"
  171. @timeUpdate="arcbarCountDownTimeUpdate" />
  172. </view>
  173. <!-- 卡路里提示 -->
  174. <!-- <view class="personal-fruit-container">
  175. <prompt-box :calorie="planData.allCalorie"></prompt-box>
  176. </view> -->
  177. </view>
  178. <!-- 钻石和金币部分 -->
  179. <!-- <view class="charts-pring-bottom" style="margin-top: 34rpx;">
  180. <view class="flex justify-center align-center"
  181. style="height: 52rpx; width: 412rpx; background-color: rgba(255,255,255,0.11); border-radius: 12rpx;">
  182. <view class=" flex align-center justify-center" style="color: #fff;">
  183. <view class="flex align-center">
  184. <image class="png-more" style="margin-right: 18rpx;"
  185. src="/static/personal/cDiamond.png"></image>
  186. <view>{{cDiamond}}</view>
  187. </view>
  188. <view class="flex align-center" style="margin-left: 60rpx;">
  189. <image class="png-more" style="margin-right: 18rpx;"
  190. src="/static/personal/cGold.png"></image>
  191. <view>{{cGold}}</view>
  192. </view>
  193. </view>
  194. </view>
  195. </view> -->
  196. <!-- 用于定位 -->
  197. <!-- <view id="boxingHitID" style="position: absolute;top: 180rpx; pointer-events: none;" ></view> -->
  198. <view id="boxingHitID" v-if="0 === currentModeIndex" class="charts-pring-bottom">
  199. <!-- 添加一个 ConnectBindingDevice 测试 -->
  200. <boxing-hit ref="boxingPostRef"
  201. :bUpdate="!bHide&&(ConnectBindingDevice!=null)||(cIndex!=-1 && BLEConnectDevice!=null &&
  202. (BLEConnectDevice.deviceType == 'mySelf'||BLEConnectDevice.deviceType == 'BLEHandle' || BLEConnectDevice.deviceType == 'BLERope' ))"
  203. :showTime="localSportTime"
  204. :bRebound="BLEConnectDevice&&BLEConnectDevice.limitType == 'rebound'"
  205. @updateCalorie="boxingUpdateCalorie" @boxingPostCheck="onPersonalCheck"
  206. @shake="onScreenShake" @updateSportTime="onUpdateSportTime"
  207. @boxingGuideFinish="onBoxingGuideFinish"
  208. @boxingPostControlPlay="onActionControlPlay" @modeEvent="onModeEvent"
  209. @hitEvent="onHitEvent" @aiHitEvent="onAiHitEvent" @gameOver="onBoxingGameOver"
  210. @closeBoxingControl="onCloseBoxingHit"></boxing-hit>
  211. </view>
  212. <view id='actionJumpID' v-if="1 === currentModeIndex" class="charts-pring-bottom">
  213. <action-jump ref="actionJumpRef"
  214. :levelData="currentJumpTask!=null?currentJumpTask.item:null"
  215. :currentMode="currentMode" @actionJumpCheck="onPersonalCheck"
  216. @actionJumpControllerPlay="onActionControlPlay"
  217. @actionJumpDataUpdate="onActionJumpDataUpdate" @gameOver="onActionJumpGameOver"
  218. @tipLevel="onTipLevel">
  219. </action-jump>
  220. </view>
  221. <!-- <button @tap="onTestAddLocalCalorie">11</button> -->
  222. </view>
  223. </scroll-view>
  224. <!-- <view class="margin flex flex-direction">
  225. <view class="title">当前游戏链接:{{LocationGameUrl}}</view>
  226. <input style="border: 1rpx solid #000000;margin: 10rpx;" @input="onKeyInput" placeholder="输入同步到view中" />
  227. </view> -->
  228. <!-- <button @tap="onShowBoxingHitTip">11</button> -->
  229. </view>
  230. </view>
  231. <!-- <modal-mask></modal-mask> -->
  232. <!-- <view class="example">
  233. <view class="example-title">从左侧滑出</view>
  234. <button @click="showDrawer">显示抽屉</button>
  235. </view> -->
  236. <!-- <view class="example">
  237. <button @click="showPopup('pkFinish',null)">显示 pk奖励</button>
  238. </view> -->
  239. <!-- guide -->
  240. <!-- <view class="example">
  241. <button @click="showGuide('device-tip',null)">显示 device-tip</button>
  242. </view>
  243. <view class="example">
  244. <button @click="onGetActionJumpView()">显示 onGetActionJumpView</button>
  245. </view>
  246. -->
  247. <!-- <view class="example">
  248. <button @click="showGuide('level-game-tip',{levelType:'rotationJump'})">显示 level-game-tip</button>
  249. </view> -->
  250. <!-- <view class="example">
  251. <button @click="onTipLevel">显示 ontipLevel</button>
  252. </view> -->
  253. <!-- <view class="example" style="margin-top: 10rpx;">
  254. <button @click="onNavToDirection">跳转校准页面</button>
  255. </view> -->
  256. <!-- <view class="example">
  257. <button @click="onGetBluetoothConnectView({
  258. hiddenType: 'firstInstallation'
  259. })">显示 bluetoothConnect</button>
  260. </view> -->
  261. <!-- <view class="example">
  262. <button @click="onUserSignIn()">签到</button>
  263. </view> -->
  264. <view style="height: 100rpx;"></view>
  265. </scroll-view>
  266. <!-- 底部中间上滑按钮 -->
  267. <view class="flex flex-direction justify-end align-center task-up-button" @tap="showModal"
  268. data-target="slideUpModal">
  269. <!-- <image style="width: 156rpx; height: 32rpx;" src="../../../static/personal/slideUp.png" @tap="showModal"
  270. data-target="slideUpModal"></image> -->
  271. <image style="width: 147px;height: 31px; top: -6px;" class="position-absolute-center"
  272. src="../../../static/modal/level-tip/level-tip-bg@2x.png"></image>
  273. <image style="width: 30px;height: 23px; " src="../../../static/modal/level-tip/level-tip-logo@2x.png">
  274. </image>
  275. <view style="width: 100%;height: 16rpx; background-color: #FFFFFF; color: #FFFFFF;"></view>
  276. </view>
  277. <!-- 右下角导航栏 -->
  278. <round-fab ref="roundFabRef" :connect="cIndex!=-1 && BLEConnectDevice!=null" @fabClick="fabClick"></round-fab>
  279. <!-- 侧边栏 如果app使用 nvue 侧边栏 -->
  280. <!-- #ifdef H5 || MP-WEIXIN -->
  281. <sideBar ref="sideBar"></sideBar>
  282. <!-- #endif -->
  283. <!-- 训练卡 -->
  284. <view class="cu-modal " :class="modalName == 'sportCompletion' ? '' : ''">
  285. <view style="
  286. position: relative;
  287. width: 586rpx;
  288. height: 766rpx;
  289. background-color: #FFFFFF;
  290. border-radius: 25px;
  291. display: inline-block;
  292. vertical-align: middle;
  293. margin-left: auto;
  294. margin-right: auto;
  295. overflow: hidden;">
  296. <view style="position: relative; width: 100%; height: 328rpx;">
  297. <image style="position: absolute;top: 0;left: 0; width: 100%;height: 100%;"
  298. src="../../../static/sidebar_top_bg.png"></image>
  299. <view class="flex flex-direction justify-around align-center"
  300. style="position: relative; height: 100%;">
  301. <view class="text-white">已在哔嘣健身训练了</view>
  302. <view class="text-white"><span style="font-size: 43px;">{{sportData.time}}</span> 分钟</view>
  303. <view class="text-white">本次达标率{{sportData.percent}}%</view>
  304. </view>
  305. </view>
  306. <view class="flex justify-around">
  307. <view class="flex flex-direction justify-around align-center"
  308. style="position: relative; height: 162rpx;">
  309. <view class="text-grey">消耗</view>
  310. <view class="text-grey"><span
  311. style="font-size: 18px; color: #000000;">{{sportData.calorie}}</span> 卡</view>
  312. </view>
  313. <view class="flex flex-direction justify-around align-center"
  314. style="position: relative; height: 162rpx;">
  315. <view class="text-grey">踩中</view>
  316. <view class="text-grey"><span style="font-size: 18px; color: #000000;">{{sportData.hit}}</span>
  317. 次</view>
  318. </view>
  319. <view class="flex flex-direction justify-around align-center"
  320. style="position: relative; height: 162rpx;">
  321. <view class="text-grey">失误</view>
  322. <view class="text-grey"><span style="font-size: 18px; color: #000000;">{{sportData.miss}}</span>
  323. 次</view>
  324. </view>
  325. </view>
  326. <view class="flex flex-direction justify-around align-center margin-top-sm">
  327. <view style="position: relative; width: 500rpx; border:1rpx solid #EEEEEE ;"></view>
  328. </view>
  329. <view class="flex flex-direction justify-around align-center" style="height: 230rpx;">
  330. <view class="text-black text-16px">非常优秀,继续加油!</view>
  331. <view class="flex justify-center align-center text-white make-bg-bPurple round text-16px"
  332. style="width: 300rpx;height: 80rpx;" @tap="hideModal">确定</view>
  333. </view>
  334. </view>
  335. </view>
  336. <!-- :class="modalName == 'jumpAnimation' ? 'show' : ''" -->
  337. <view class="cu-modal " :class="modalName == 'jumpAnimation' ? '' : ''">
  338. <view style="
  339. position: relative;
  340. width: 586rpx;
  341. height: 400rpx;
  342. background-color: #FFFFFF;
  343. border-radius: 4px;
  344. display: inline-block;
  345. vertical-align: middle;
  346. margin-left: auto;
  347. margin-right: auto;
  348. overflow: hidden;">
  349. <view style="height: 100%;display: flex;justify-content: center;align-items: center;">
  350. <character></character>
  351. </view>
  352. </view>
  353. </view>
  354. <!-- 引导蒙层 bGuidePages guideCurrent-->
  355. <code-elf-guide ref="codeElfGuide" v-if="bGuidePages" @hide="guideHide" @change="onGuideChange"
  356. :current="guideCurrent" :currentMode="currentMode"></code-elf-guide>
  357. <view v-if="bStartCountDown" class="CountDownMask">
  358. {{BoxingPostCountDownText}}
  359. </view>
  360. <view class="cu-modal " :class="modalName=='showPlanTipModal'?'show':''"
  361. @touchmove.stop.prevent="moveBoxingHandle">
  362. <view class="cu-bind-modal">
  363. <view style="position: absolute; top: 0; left: 0; width: 100%; height:100%;">
  364. <image style="position: absolute;top: 0;left: 0; width: 100%;height: 100%;"
  365. src="/static/modelBg.png"></image>
  366. </view>
  367. <view class="flex flex-direction justify-between " style="position: relative; height: 100%;">
  368. <view class="flex justify-around justify-center align-center" style="margin: 170rpx 30rpx 0 30rpx;">
  369. <view style="width: 80rpx;height: 2rpx;border-radius: 2px; background-color: #cbcdcf;"></view>
  370. <view class="make-text-bPurple" style=" font-size: 20px;">提示</view>
  371. <view style="width: 80rpx;height: 2rpx;border-radius: 2px;background-color: #cbcdcf;"></view>
  372. </view>
  373. <view class="text-16px" style="align-self: center; max-width: 200px; word-break: break-all;">
  374. {{planTip[planTipIndex]}}
  375. </view>
  376. <view class="flex justify-around align-center"
  377. style=" border-top: 1rpx solid #EEEEEE; margin-bottom: 2px;">
  378. <view class="flex justify-center align-center text-16px" style="width: 100%;height: 123rpx;"
  379. @tap="hidePlanTipModal">取消</view>
  380. <view style="height: 123rpx;width: 1px;background-color: #EEEEEE;"></view>
  381. <view class="flex justify-center align-center text-16px" style="width: 100%;height: 123rpx;"
  382. @tap="confirmPlanTipModal">确定</view>
  383. </view>
  384. </view>
  385. </view>
  386. </view>
  387. <ModalTip ref='modalTipRef' :class="modalName=='showModalTip'?' show':''" @hide="onModalTipHide"
  388. @confirm="onModalTipConfirm"></ModalTip>
  389. <!-- 任务栏 -->
  390. <view class="cu-modal bottom-modal" :class="modalName=='slideUpModal'?'show':''" @tap="hideModal">
  391. <view class="cu-dialog bg-white" style="border-radius: 15px 15px 0 0 ;" @tap.stop="">
  392. <view class="flex justify-center align-center position-relative" style="width: 750rpx; height: 64rpx;"
  393. @tap="hideModal">
  394. <view class="text-blue make-bg-bPurple radius" style="width: 80rpx; height: 4px;"></view>
  395. <view class="position-absolute-right-top">
  396. <image style="width: 64rpx;height: 64rpx;" src="../../../static/common/modal/task-close@2x.png">
  397. </image>
  398. </view>
  399. </view>
  400. <view class="flex justify-between" style="width: 100%; padding: 34rpx 60rpx 46rpx 81rpx;">
  401. <view class="flex align-center justify-center">
  402. <view class="text-16px text-bold make-text-bPurple"
  403. style="line-height: 32rpx; margin-right: 18rpx;">{{currentMode == 'pkMode'?'PK模式':'健身模式'}}
  404. </view>
  405. <image style="width: 42rpx;height: 24rpx;" src="/static/common/modal/right-arrow.png"></image>
  406. </view>
  407. <view>
  408. <button class="make-bg-bPurple flex justify-center align-center" @click="onSwitchMode">
  409. <view class="flex align-center justify-center" style="width: 190rpx;height: 60rpx;">
  410. <image style="width: 24rpx;height: 22rpx; margin-right: 18rpx;"
  411. src="/static/personal/switchWhite.png"></image>
  412. <view class="text-14px text-white" style="line-height: 28rpx;">
  413. {{currentMode !== 'pkMode'?'PK模式':'健身模式'}}
  414. </view>
  415. </view>
  416. </button>
  417. </view>
  418. </view>
  419. <scroll-view scroll-y="true" style="height: 800rpx; max-height: 800rpx;min-height: 460rpx;"
  420. :style="{ height: modalHeight + 'px' }" :scroll-into-view="taskIntoView"
  421. :scroll-top="taskScrollTop">
  422. <!-- :class="!item.isUnlock?'':'make-text-bPurple'" -->
  423. <view class="my-column-cu-steps">
  424. <view class="cu-item"
  425. :class="(tempSelectedLevel!=null&&item.id==tempSelectedLevel.item.id)?'make-bg-bPurple-01':''"
  426. v-for="(item,index) in currentTaskList" :key="index" :id='"task_"+index'
  427. @click="selectTask(index,item)">
  428. <image v-if="item.isUnlock" class="my-column-cu-image"
  429. src="../../../static/common/modal/unLock.png"></image>
  430. <image
  431. v-else-if="index>=1&&currentTaskList[index-1].isUnlock&&currentTaskList[index-1].isPassed"
  432. class="my-column-cu-image" src="../../../static/common/modal/canUnlock.png">
  433. </image>
  434. <image v-else class="my-column-cu-image" src="../../../static/common/modal/lock.png">
  435. </image>
  436. <view class="content">
  437. <view class="text-15px text-bold text-cut text-left text-black text-medium"
  438. style="margin-left: 48rpx; width: 360rpx;margin-top: 30rpx;">
  439. {{index+1}}. {{item.name}}
  440. </view>
  441. <view class="flex justify-start align-center" style="margin:20rpx 0 20rpx 86rpx;">
  442. <!-- 居中绘制星星样式 -->
  443. <view class="flex align-center justify-center"
  444. style="margin-right: 36rpx;margin-top: 4rpx;">
  445. <image style="width: 36rpx;height: 36rpx; margin-right: 18rpx;"
  446. src="/static/common/sideBar/sGold.png"></image>
  447. <view class="text-13px text-black text-medium" style="line-height: 26rpx;">
  448. {{item.consumeGold}}
  449. </view>
  450. </view>
  451. <view class="flex align-center justify-center"
  452. style="margin-right: 36rpx;margin-top: 4rpx;">
  453. <image style="width: 38rpx;height: 34rpx; margin-right: 18rpx;"
  454. src="/static/common/sideBar/sDiamond.png"></image>
  455. <view class="text-13px text-black text-medium" style="line-height: 26rpx;">
  456. {{item.consumeDiamond}}
  457. </view>
  458. </view>
  459. </view>
  460. <!-- <view class="text-13px text-grey text-left" style="margin: 20rpx 20rpx 0 86rpx;">
  461. {{item.conditionPassed.explain}}
  462. </view> -->
  463. <view class="flex justify-start align-center" style="margin-left: 86rpx;">
  464. <view class="flex flex-direction align-center" v-for="(item, index) in 5"
  465. :key="index">
  466. <image style="width: 34rpx;height: 32rpx;"
  467. src="../../../static/modal/action-jump/stars.png">
  468. </image>
  469. </view>
  470. </view>
  471. </view>
  472. <image class="my-column-cu-right-image" style="pointer-events:auto;"
  473. src="../../../static/common/modal/medal.png" @click="showPopup('prompt',item)">
  474. </image>
  475. <view v-if="currentJumpTask!=null&&item.id==currentJumpTask.item.id"
  476. class="position-absolute-right-bottom make-text-bPurple text-13px text-medium "
  477. style="right: 70rpx;bottom: 24rpx;">游戏中...</view>
  478. <!-- /static/devicesOther/radio-g -->
  479. <image class="my-column-cu-image"
  480. style="left: 140rpx;top: 70rpx; width: 30rpx;height: 30rpx;"
  481. :src="(tempSelectedLevel!=null&&item.id==tempSelectedLevel.item.id)?'/static/devicesOther/radio-b.png':'.png'"
  482. mode="aspectFit"></image>
  483. </view>
  484. </view>
  485. </scroll-view>
  486. <button class="cu-btn make-bg-bPurple text-white margin-top margin-bottom"
  487. style="width: 604rpx;height: 88rpx;" @tap="onConfirmSelectionLevel">确认</button>
  488. <!-- <button class="cu-btn make-bg-bPurple text-white margin-top margin-bottom"
  489. style="width: 604rpx;height: 88rpx;" @tap="onPassTheLevel">点击直接通过所选关卡</button>
  490. -->
  491. </view>
  492. </view>
  493. <!-- 这里vConsole 是为了解决再页面内显示vconsole -->
  494. <view id="vconsole" :prop="vLog" :change:prop="vconsole.updateData"></view>
  495. </view>
  496. </template>
  497. <!-- 这里vConsole 是为了解决再页面内显示vconsole -->
  498. <script module="vconsole" lang="renderjs">
  499. import VConsole from '../../../util/util-js/vconsole.min.js'
  500. new VConsole();
  501. export default {
  502. mounted() {
  503. // ...
  504. },
  505. data: {
  506. return () {}
  507. },
  508. methods: {
  509. updateData(newValue, oldValue, ownerInstance, instance) {
  510. // newValue: 新数据
  511. // oldValue: 老数据
  512. var log = console.log.bind(console);
  513. log(newValue)
  514. }
  515. }
  516. }
  517. </script>
  518. <script>
  519. // import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue';
  520. import uCharts from '@/components/u-charts/u-charts.js';
  521. import myPicker from '@/components/slambb-picker/slambb-picker.vue';
  522. import pickerData from '@/components/slambb-picker/picker.js';
  523. import date from '@/util/util-js/date.js';
  524. import sideBar from '@/components/side-bar/side-bar.vue';
  525. import reqUtil from '@/util/util-js/requstUtil.js';
  526. import config from '@/common/config.js';
  527. import uniCountDown from '@/components/uni-count-down/uni-count-down.vue'
  528. import character from "@/components/electAni/character.vue"
  529. import fruit from "@/components/fruitMachine/fruitMachine.vue"
  530. import promptBox from "@/components/prompt-box/prompt-box.vue"
  531. import roundFab from "@/components/round-fab/round-fab.vue"
  532. import codeElfGuide from '@/components/code-elf-guide/code-elf-guide.vue'
  533. import boxingPost from "@/components/modal/boxing-post/boxing-post.vue"
  534. import boxingHit from "@/components/modal/boxing-hit/boxing-hit.vue"
  535. import actionJump from "@/components/modal/action-jump/action-jump.vue"
  536. import AccAndOri from "@/util/util-js/AccAndOri.js"
  537. import AvatarConfig from "@/util/util-js/avatar.js"
  538. import HitEffect from "@/components/effectHit/hitEffect.vue"
  539. import HitFistEffect from "@/components/effectHit/hitFistEffect.vue"
  540. import ModalTip from "@/components/modal-tip/modalTip.vue"
  541. import keyboardListener from '@/components/keyboard-listener/keyboard-listener.vue'
  542. import LEDFont from '@/components/LEDFont/LEDFont.vue'
  543. import arcbarCountDown from '@/components/uni-count-down/uni-count-down.vue'
  544. import modalMask from '@/components/modal-mask/modal-mask.vue'
  545. // 获取 module
  546. // var testModule = uni.requireNativePlugin("MyAttitude")
  547. // const modal = uni.requireNativePlugin('modal');
  548. import {
  549. mapState,
  550. mapMutations
  551. } from 'vuex';
  552. var _self;
  553. var canvaArcbar1;
  554. export default {
  555. computed: mapState(['bCanvasShow', 'forcedLogin', 'hasLogin', 'userName', 'avatarUrl', 'days', 'remainingDays',
  556. 'signature', 'weight', 'height', 'planData', 'BLEDeviceShowList', 'BLEConnectDevice', 'bPlanExpired',
  557. 'bPlanFinish',
  558. 'bGuidePages',
  559. 'globalAcc', 'globalOri', 'DeviceBindingList', 'ConnectBindingDevice', 'cIndex', 'bNewGuide',
  560. 'localSportTime',
  561. 'currentModeIndex', 'oldArcbarProCalorie', 'oldArcbarAllCalorie', 'bOpenBluetooth', 'bOpenSuccess',
  562. 'bListenAdapterStateChange', 'bConnection', 'bVerifiedConnection', 'currentInstruction',
  563. 'instructionState',
  564. 'LocationGameUrl',
  565. 'bPhoneMatched',
  566. 'versionCodeState',
  567. 'platform',
  568. 'systemInfo', 'navHeight', 'tabbarHeight',
  569. 'cDiamond', 'cGold',
  570. 'finallySelectFriendInfo',
  571. 'currentJumpTask', 'singlePersonList', 'multiPersonList',
  572. 'guideUnlockState'
  573. ]),
  574. components: {
  575. // uniNavBar,
  576. myPicker,
  577. sideBar,
  578. uniCountDown,
  579. character,
  580. fruit,
  581. roundFab,
  582. codeElfGuide,
  583. boxingPost,
  584. boxingHit,
  585. promptBox,
  586. HitEffect,
  587. HitFistEffect,
  588. ModalTip,
  589. keyboardListener,
  590. actionJump,
  591. LEDFont,
  592. arcbarCountDown,
  593. modalMask
  594. },
  595. data() {
  596. return {
  597. title: 'pk模式', //pk模式 健身模式
  598. modalName: null,
  599. originalDate: '', //记录new date
  600. currentDate: '', //当前日期
  601. cWidthArcbar: '', //圆弧进度图
  602. cHeightArcbar: '', //圆弧进度图
  603. arcbarWidth: '', //圆弧进度图,进度条宽度,此设置可使各端宽度一致
  604. pixelRatio: 1,
  605. // textarea: '',
  606. // arcbarImagePath: '/static/logo.png',
  607. // cWidth: '',
  608. // cHeight: '',
  609. scrollviewHight: '',
  610. // 顶部区域部分
  611. topScrollHight: '',
  612. // 选择器
  613. pickerObj: {},
  614. // lineAImagePath: '/static/logo.png',
  615. // visible: true,
  616. // indicatorStyle: `height: ${Math.round(uni.getSystemInfoSync().screenWidth / (750 / 100))}px;`,
  617. //设备列表
  618. deviceList: [{
  619. name: '蹦床',
  620. icon: '/static/trampoline.png'
  621. }],
  622. cState: 1,
  623. //游戏列表
  624. gameList: [],
  625. //视频列表,现在视频是和游戏一起管理
  626. videoList: [],
  627. //运动数据
  628. sportData: {
  629. calorie: 0,
  630. hit: 0,
  631. miss: 0,
  632. percent: 0,
  633. time: 0,
  634. allData: 0
  635. },
  636. //设置滚动栏高度
  637. scrollTop: 0,
  638. //scroll view 跳转到对应的组件上
  639. toView: '',
  640. guideCurrent: 0,
  641. bHide: false,
  642. //屏幕抖动
  643. bEFHitShake: false,
  644. bStartBoxingPost: false,
  645. bStartCountDown: false,
  646. BoxingPostCountDownText: 3,
  647. b_countDown: null,
  648. countDownUrl: [
  649. "/static/personal/audio/GO.mp3",
  650. "/static/personal/audio/1.mp3",
  651. "/static/personal/audio/2.mp3",
  652. "/static/personal/audio/3.mp3"
  653. ],
  654. threeUrl: "/static/personal/audio/3.mp3",
  655. twoUrl: "/static/personal/audio/2.mp3",
  656. oneUrl: "/static/personal/audio/1.mp3",
  657. goUrl: "/static/personal/audio/GO.mp3",
  658. dangdang: "/static/personal/audio/dangdang.mp3",
  659. personalAudioContext: null,
  660. planTip: [
  661. '您今天的目标已经达成,是否进行自由训练.',
  662. '您今天的目标还没完成,是否结束训练.'
  663. ],
  664. planTipIndex: 0,
  665. //匹配的ai信息
  666. aiObj: {
  667. name: '匿名',
  668. avatar: '/static/defaultAvatar.png'
  669. },
  670. aiOldObj: {
  671. name: '匿名',
  672. avatar: '/static/defaultAvatar.png'
  673. },
  674. currentMode: 'calorieMode', //pkMode calorieMode
  675. bHitShake: false,
  676. bAiHitShake: false,
  677. //限制重连,比如去了对应硬件连接页面,限制这个页面的重连操作
  678. bLimitReconnection: false,
  679. /**
  680. * 首页这里连接了蓝牙,然后选择框回来后show会触发,触发时候检测一下是否有对应的
  681. * 匹配蓝牙
  682. */
  683. bGetBondTesting: false,
  684. basicsList: [{
  685. cuIcon: 'usefullfill',
  686. name: '开始',
  687. bLock: false,
  688. }, {
  689. cuIcon: 'radioboxfill',
  690. name: '等待',
  691. bLock: true,
  692. },
  693. {
  694. cuIcon: 'roundclosefill',
  695. name: '错误'
  696. }, {
  697. cuIcon: 'roundcheckfill',
  698. name: '完成'
  699. },
  700. {
  701. cuIcon: 'roundcheckfill',
  702. name: '完成'
  703. },
  704. {
  705. cuIcon: 'roundcheckfill',
  706. name: '完成'
  707. },
  708. ],
  709. basics: 3,
  710. currentTask: null, //当前选择的任务
  711. taskIntoView: '',
  712. taskScrollTop: 0,
  713. currentTaskList: [],
  714. nextTaskCanUnlock: false, //下一个关卡是否可解锁
  715. /**
  716. * actionJump 模块对应的交互参数
  717. */
  718. AJData: {
  719. allCount: 0,
  720. faultCount: 0,
  721. perCountDown: 0,
  722. gameCountDown: 0,
  723. //pk部分参数
  724. myScore: 0, //左边自己的分数
  725. otherScore: 0, //右边好友的分数
  726. myUsageTime: 0,
  727. otherUsageTime: 0,
  728. isLeftPlayer: true,
  729. isFinish: false,
  730. gameLimitTime: 0,
  731. describe: '', //关卡说明
  732. },
  733. defaultAJData: null,
  734. bGamePlaying:false,
  735. /**
  736. * 任务参数
  737. */
  738. modalHeight: 300,
  739. vLog: '',
  740. /**
  741. * 任务关卡相关
  742. */
  743. tempSelectedLevel: null
  744. };
  745. },
  746. onLoad() {
  747. //设置self
  748. _self = this;
  749. // 圆形进度条样式
  750. this.cWidthArcbar = uni.upx2px(415); //这里要与样式的宽高对应
  751. this.cHeightArcbar = uni.upx2px(440); //这里要与样式的宽高对应
  752. this.arcbarWidth = uni.upx2px(14);
  753. // 体重数据样式
  754. // this.cWidth = uni.upx2px(750);
  755. // this.cHeight = uni.upx2px(300);
  756. // #ifdef APP-PLUS || H5
  757. //监听
  758. uni.$on('updateArcbarData', this.updateArcbarData);
  759. // #endif
  760. //监听
  761. uni.$on('callbackCloseBLE', this.callbackCloseBLE);
  762. // uni.$on('callbackBLEState', this.callbackBLEState);
  763. //获得游戏列表
  764. // reqUtil
  765. // .requestData(config.URL.GAMERECOMMENDBYPLATFORM, {
  766. // recommendType: 2,
  767. // endTime: config.endTime
  768. // })
  769. // .then(
  770. // res => {
  771. // // console.log('GAMERECOMMEND =====', res);
  772. // if (res.code == 0) {
  773. // if (res.data.gameList.length > 3) {
  774. // this.gameList = this.gameList.concat(res.data.gameList.slice(0, 3));
  775. // } else {
  776. // this.gameList = this.gameList.concat(res.data.gameList);
  777. // }
  778. // }
  779. // },
  780. // e => {
  781. // console.log(e);
  782. // }
  783. // );
  784. //获得视频列表
  785. // reqUtil
  786. // .requestData(config.URL.GAMERECOMMENDBYPLATFORM, {
  787. // recommendType: 1,
  788. // endTime: config.endTime
  789. // })
  790. // .then(
  791. // res => {
  792. // if (res.code == 0) {
  793. // if (res.data.gameList.length > 3) {
  794. // this.videoList = this.videoList.concat(res.data.gameList.slice(0, 3));
  795. // } else {
  796. // this.videoList = this.videoList.concat(res.data.gameList);
  797. // }
  798. // }
  799. // },
  800. // e => {
  801. // console.log(e);
  802. // }
  803. // );
  804. //初始化后设置一下pickerObj
  805. this.pickerObj = {
  806. pickerLeftList: pickerData.getWeightList().leftList,
  807. pickerRightList: pickerData.getWeightList().rightList,
  808. pickerType: 'doubleItem',
  809. pickerUnit: '公斤',
  810. pickerTitle: '记体重',
  811. defaultValue: this.weight,
  812. showInput: true,
  813. };
  814. this.getPlanData(function() {
  815. // 如果个人页面直接获取数据
  816. _self.showArcbar();
  817. });
  818. this.personalAudioContext = uni.createInnerAudioContext();
  819. this.personalAudioContext.autoplay = false;
  820. this.personalAudioContext.src = this.dangdang;
  821. this.personalAudioContext.volume = 1;
  822. //获取本地记录的运动时间
  823. uni.getStorage({
  824. key: 'localSportTime',
  825. success: function(res) {
  826. // console.log("本地的时间:",res.data);
  827. _self.$store.state.localSportTime = res.data;
  828. }
  829. });
  830. //获取设备信息,上报服务器
  831. this.gOnAddClientInfo();
  832. this.registerPopupEvent();
  833. //获取任务数据
  834. this.getLevelList(() => {
  835. this.switchTaskInfo();
  836. });
  837. //钱包信息
  838. this.getUserWallets();
  839. //测试socket
  840. // console.log('test*******************************');
  841. // this.$testWS.connectSocket(()=>{
  842. // this.$testWS.sendSocketMessage('unity');
  843. // });
  844. //复制一个默认参数
  845. this.defaultAJData = Object.assign({}, this.AJData);
  846. //用户签到列表
  847. this.getSignInList();
  848. uni.$on("onLog", this.onLog);
  849. },
  850. onShow() {
  851. _self.bHide = false;
  852. if (canvaArcbar1)
  853. _self.updateArcbarData();
  854. //this.bConnection &&
  855. if (this.bVerifiedConnection && this.BLEConnectDevice) {
  856. this.updateBLECIndex();
  857. // setTimeout(() => {
  858. // /**
  859. // * 如果是首页连接,则检测
  860. // */
  861. // if (this.bGetBondTesting) {
  862. // this.onGetBondDevice();
  863. // this.bGetBondTesting = false;
  864. // }
  865. // }, 5000)
  866. }
  867. //如果是测试数据
  868. if (this.ConnectBindingDevice) {
  869. if (this.$refs.boxingPostRef) {
  870. this.$refs.boxingPostRef.onSetMode('pkMode');
  871. } else {
  872. setTimeout(() => {
  873. this.$refs.boxingPostRef.onSetMode('pkMode');
  874. }, 500)
  875. }
  876. }
  877. console.log('personal show');
  878. this.bLimitReconnection = false;
  879. //测试环境检测,给个modal提示 active
  880. // if (config.active == 'dev') {
  881. // function thanDate(date2) {
  882. // var oDate1 = new Date();
  883. // console.log("检测日期", oDate1);
  884. // var oDate2 = new Date(date2);
  885. // if (oDate1.getTime() > oDate2.getTime()) {
  886. // return true;
  887. // } else {
  888. // return false;
  889. // }
  890. // }
  891. // if (thanDate('2021-05-31 13:10:36')) {
  892. // uni.showModal({
  893. // title: "提示",
  894. // content: "此版本为测试版本,有需要请和开发者联系。微信 sweetdontcry"
  895. // })
  896. // }
  897. // }
  898. // #ifdef APP-PLUS
  899. if (this.guideUnlockState.firstInstallation) {
  900. // 根据onshow 去调用first显示。 由于 onShow生命周期比 onReady 快。所以此时没有 注册 onShowFirstInstallation
  901. // 即 onShowFirstInstallation 是调用不到的
  902. uni.$emit("onShowFirstInstallation");
  903. }
  904. // #endif
  905. },
  906. onReady() {
  907. // 计算屏幕剩余高度 填补剩余高度
  908. // 计算组件的高度
  909. _self.scrollviewHight = this.systemInfo.windowHeight - this.navHeight - this.tabbarHeight - 16 - this
  910. .systemInfo
  911. .statusBarHeight;
  912. console.log("personal onReady");
  913. // #ifdef APP-PLUS
  914. //第一步提示设置计划,之后在回调registerPopupEvent 中处理
  915. //第一次安装登录。提示 计划,这里注册一次信息
  916. uni.$on("onShowFirstInstallation", this.onShowFirstInstallation);
  917. if (this.guideUnlockState.firstInstallation) {
  918. // 如果新安装便触发一次,新手调用
  919. uni.$emit("onShowFirstInstallation");
  920. }
  921. // #endif
  922. },
  923. onUnload() {
  924. console.log("personal ********* onUnload *********");
  925. uni.$off("onLog", this.onLog);
  926. // #ifndef APP-PLUS||H5
  927. //监听
  928. console.log('移除监听');
  929. uni.$off('updateArcbarData', this.updateArcbarData);
  930. // #endif
  931. //*****注释蓝牙操作******
  932. uni.$off('callbackCloseBLE', this.callbackCloseBLE);
  933. // uni.$off('callbackBLEState', this.callbackBLEState);
  934. uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
  935. //unload 时候清除timeout
  936. this.onUnloadCreateBLEConnectionTimeout();
  937. this.unregisterPopupEvent();
  938. uni.$off("onShowFirstInstallation", this.onShowFirstInstallation);
  939. },
  940. onHide() {
  941. _self.bHide = true;
  942. console.log("personal ******* onHide *******");
  943. //时间暂停 ,隐藏了 需要判断是否为空
  944. if (_self.$refs.countDownObj)
  945. _self.$refs.countDownObj.timePause('pause');
  946. //心电图暂停
  947. if (_self.$refs.electRef)
  948. _self.$refs.electRef.pausedElect(true);
  949. },
  950. methods: {
  951. ...mapMutations(['accountLogin', 'getPlanData', 'addlocalCalorie', 'setLocalCalorie', 'setShowCalorie',
  952. 'syncLocalDataToServer', 'syncRequestEvent', 'setLocalSportTime',
  953. 'initAdapter', 'onCreateBLEConnection', 'onUnloadCreateBLEConnectionTimeout', 'onCloseBLEConnection',
  954. 'gOnAddClientInfo', 'onWriteBLEConnectionValue',
  955. 'gCreateFilterObj', 'gUpdateFilter', 'B_GetBondedDevices', 'B_OpenBLESetting', 'B_OpenRopeSkipping',
  956. 'B_CloseRopeSkipping',
  957. 'gCreateSandbagAlgorithm', 'gUpdateSandbagAlgorithm', 'gStartSimulateBLEUpdate',
  958. 'gStopSimulateBLEUpdate',
  959. 'getActionJumpTask',
  960. 'setActionJumpTask', 'getLevelList',
  961. 'getUserWallets', 'setGoldAndDiamond',
  962. 'onConvertDeviceData',
  963. 'showDrawerById', 'showPopupById', 'showGuideById',
  964. 'getSignInList', 'onUserSignIn',
  965. 'setGuideUnlockState'
  966. ]),
  967. BasicsSteps() {
  968. this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1
  969. },
  970. onLog(value) {
  971. this.vLog = value;
  972. },
  973. onKeyDown(e) {
  974. console.log(e);
  975. },
  976. showClickEvent() {
  977. // #ifdef APP-PLUS
  978. this.showDrawer();
  979. // #endif
  980. // #ifdef H5 || MP-WEIXIN
  981. this.$refs.sideBar.showModal();
  982. this.$store.state.bCanvasShow = false;
  983. // #endif
  984. },
  985. showModal(e) {
  986. if (e.currentTarget.dataset.target == "slideUpModal" && this.bGamePlaying) {
  987. /**
  988. * 判断下游戏是否进行中,进行中不能切换
  989. */
  990. uni.showToast({
  991. title:'游戏进行中,不能选择关卡。',
  992. icon:'none',
  993. mask:true
  994. })
  995. return;
  996. }
  997. this.modalName = e.currentTarget.dataset.target;
  998. this.$store.state.bCanvasShow = false;
  999. if (this.modalName == "slideUpModal") {
  1000. this.updateTaskScroll();
  1001. }
  1002. },
  1003. hideModal(e) {
  1004. if (this.modalName == "sportCompletion") {
  1005. console.log("关闭卡片");
  1006. this.sportData = {
  1007. calorie: 0,
  1008. hit: 0,
  1009. miss: 0,
  1010. percent: 0,
  1011. time: 0,
  1012. allData: 0,
  1013. }
  1014. } else if (this.modalName == "slideUpModal") {
  1015. this.tempSelectedLevel = this.currentJumpTask;
  1016. }
  1017. this.modalName = null;
  1018. this.$store.state.bCanvasShow = true;
  1019. },
  1020. onTestAddLocalCalorie() {
  1021. let _add = (10 * 1.875) / (4 * 30);
  1022. console.log(_add);
  1023. this.onUpdateCaloriePlane(10);
  1024. },
  1025. /**
  1026. * 首页圆形表部分时间计时器
  1027. */
  1028. arcbarCountDownTimeUp() {
  1029. //todo,涉及到倒计时的关卡。时间到。游戏结束
  1030. if (1 === this.currentModeIndex) {
  1031. if (this.currentMode == "pkMode") {
  1032. this.$refs.actionJumpRef.onPKModeGameOver("timeUp");
  1033. } else {
  1034. uni.showToast({
  1035. title: '时间到,游戏结束。',
  1036. icon: 'none',
  1037. duration: 2000,
  1038. mask: true
  1039. })
  1040. this.$refs.actionJumpRef.onGameOver("timeUp");
  1041. }
  1042. }
  1043. },
  1044. arcbarCountDownTimeUpdate(data) {
  1045. this.AJData.gameCountDown = data.curSeconds;
  1046. this.updateArcbarDataFromActionJump();
  1047. this.onActionJumpCountDownUpdate();
  1048. },
  1049. arcbarCountDownTimeReset() {
  1050. //清除时间计时器
  1051. this.$refs.arcbarCountDownRef.timePause();
  1052. },
  1053. arcbarCountDownPlay(bResetTime) {
  1054. if (bResetTime) {
  1055. this.$refs.arcbarCountDownRef.startData();
  1056. }
  1057. this.$refs.arcbarCountDownRef.timePlay();
  1058. },
  1059. // 进度条数据
  1060. arcbarData(_planData) {
  1061. let showCal = 0,
  1062. showLCal = 0,
  1063. LCalTip = '',
  1064. showTip = '';
  1065. let series = [{
  1066. name: showTip,
  1067. data: 0,
  1068. color: '#2fc25b'
  1069. }];
  1070. //这里区分进度条数据
  1071. if (0 == this.currentModeIndex) {
  1072. showCal = _planData.calorie;
  1073. showLCal = _planData.allCalorie;
  1074. LCalTip = '大卡';
  1075. showTip = '(未达标)';
  1076. // 如果运动的卡路里大于目标卡路里,设置为目标卡路里值,即为Max
  1077. if (showLCal >= showCal) {
  1078. showTip = '(达标)';
  1079. }
  1080. series = [{
  1081. name: showTip,
  1082. data: _planData.allCalorie == 0 ? 0 : _planData.allCalorie / showCal,
  1083. color: '#2fc25b'
  1084. }];
  1085. } else if (1 == this.currentModeIndex) {
  1086. showCal = _planData.calorie;
  1087. showLCal = _planData.allCalorie;
  1088. LCalTip = '大卡';
  1089. showTip = '(未达标)';
  1090. // 如果运动的卡路里大于目标卡路里,设置为目标卡路里值,即为Max
  1091. if (showLCal >= showCal) {
  1092. showTip = '(达标)';
  1093. }
  1094. series = [{
  1095. name: showTip,
  1096. data: this.AJData.gameCountDown == 0 ? 0 : this.AJData.gameCountDown / this.AJData
  1097. .gameLimitTime,
  1098. color: '#2fc25b'
  1099. }];
  1100. // console.log(series);
  1101. }
  1102. return {
  1103. showCal,
  1104. showLCal,
  1105. LCalTip,
  1106. showTip,
  1107. series
  1108. }
  1109. },
  1110. // 圆形进度条
  1111. showArcbar() {
  1112. let {
  1113. showCal,
  1114. showLCal,
  1115. LCalTip,
  1116. series
  1117. } = this.arcbarData(_self.planData);
  1118. // console.log("series==", series[0]);
  1119. canvaArcbar1 = new uCharts({
  1120. $this: _self,
  1121. canvasId: 'canvasArcbar',
  1122. type: 'myGradualChangeArcbar',
  1123. fontSize: 11,
  1124. legend: {
  1125. show: false
  1126. },
  1127. background: '#FFFFFF',
  1128. pixelRatio: 1,
  1129. series: series,
  1130. animation: false,
  1131. width: _self.cWidthArcbar,
  1132. height: _self.cHeightArcbar,
  1133. dataLabel: true,
  1134. // Math.round(chartData.series[0].data * 100) + '%'
  1135. // title: {
  1136. // // arcbarDate: date.formatDate(_self.originalDate),
  1137. // name: showLCal,
  1138. // molecularUnit: LCalTip, //单位的分子部分
  1139. // denominatorUnit: showCal, //单位的分母部分
  1140. // unitFontSize: 11, //单位字符大小
  1141. // color: 'rgba(255, 255, 255, 1)',
  1142. // fontSize: 28,
  1143. // offsetX: -30,
  1144. // offsetY: 10
  1145. // },
  1146. // subtitle: {
  1147. // name: series[0].name,
  1148. // color: 'rgba(255, 255, 255, 1)',
  1149. // fontSize: 13,
  1150. // offsetY: -75
  1151. // },
  1152. extra: {
  1153. arcbar: {
  1154. type: 'default',
  1155. backgroundColor: 'rgba(234, 234, 255, 1)',
  1156. backgroundEndColor: 'rgba(234, 234, 255, 1)',
  1157. backgroundMiddle: '#9291FF', //'rgba(158, 158, 255, 1)',
  1158. width: _self.arcbarWidth, //圆弧的宽度
  1159. lineColor: '#51EDFE',
  1160. lineEndColor: '#F7C75D'
  1161. }
  1162. }
  1163. });
  1164. // 更新位置同步
  1165. this.syncLocalDataToServer((res) => {
  1166. this.originalDate = res.newDate;
  1167. this.currentDate = date.formatTime(res.newDate);
  1168. this.updateArcbarData();
  1169. });
  1170. },
  1171. updateArcbarData(data) {
  1172. // if (data == "plan") {
  1173. // // 加入设置的卡路里小于本地,则更新本地最小值
  1174. // _self.addlocalCalorie(0);
  1175. // console.log("**************updateArcbarData");
  1176. // // 如果是计划设置好后
  1177. // // this.$store.state.bPlanFinish = true;
  1178. // // setTimeout(() => {
  1179. // // this.$store.state.bPlanFinish = false;
  1180. // // }, 10000)
  1181. // }
  1182. // console.log("updateArcbarData:",this.planData);
  1183. let {
  1184. showCal,
  1185. showLCal,
  1186. LCalTip,
  1187. series
  1188. } = _self.arcbarData(_self.planData);
  1189. if (showCal == _self.oldArcbarProCalorie && showLCal == _self.oldArcbarAllCalorie) {
  1190. // console.log("没有改变值,不刷新表盘:", showCal, _self.oldArcbarProCalorie, showLCal, _self.oldArcbarAllCalorie);
  1191. return;
  1192. }
  1193. //这个是显示当前的总卡路里
  1194. _self.$store.state.oldArcbarAllCalorie = showLCal;
  1195. //这个是计划的卡路里
  1196. _self.$store.state.oldArcbarProCalorie = showCal;
  1197. canvaArcbar1.updateData({
  1198. series: series,
  1199. // title: {
  1200. // //这里的文案是自定义的,不写是不变的
  1201. // name: showLCal,
  1202. // molecularUnit: LCalTip, //单位的分子部分
  1203. // denominatorUnit: showCal, //单位的分母部分
  1204. // }
  1205. //,
  1206. // subtitle: {
  1207. // //这里的文案是自定义的,不写是不变的
  1208. // name: series[0].name
  1209. // }
  1210. });
  1211. },
  1212. updateArcbarDataFromActionJump(data) {
  1213. let {
  1214. showCal,
  1215. showLCal,
  1216. LCalTip,
  1217. series
  1218. } = _self.arcbarData(_self.planData);
  1219. canvaArcbar1.updateData({
  1220. series: series
  1221. });
  1222. },
  1223. //没有限制下的更新表盘
  1224. updateNoLimit() {
  1225. let {
  1226. showCal,
  1227. showLCal,
  1228. LCalTip,
  1229. series
  1230. } = _self.arcbarData(_self.planData);
  1231. //这个是显示当前的总卡路里
  1232. _self.$store.state.oldArcbarAllCalorie = showLCal;
  1233. //这个是计划的卡路里
  1234. _self.$store.state.oldArcbarProCalorie = showCal;
  1235. canvaArcbar1.updateData({
  1236. series: series,
  1237. // title: {
  1238. // //这里的文案是自定义的,不写是不变的
  1239. // name: showLCal,
  1240. // molecularUnit: LCalTip, //单位的分子部分
  1241. // denominatorUnit: showCal, //单位的分母部分
  1242. // }
  1243. // ,
  1244. // subtitle: {
  1245. // //这里的文案是自定义的,不写是不变的
  1246. // name: series[0].name
  1247. // }
  1248. });
  1249. },
  1250. // 跳转计划页面
  1251. openPlan(e) {
  1252. // console.log(e);
  1253. uni.navigateTo({
  1254. url: '../plan/plan?newsid=' + 11,
  1255. success: res => {},
  1256. fail: () => {},
  1257. complete: () => {}
  1258. });
  1259. },
  1260. // 跳转转换页面
  1261. onNavConver() {
  1262. uni.reLaunch({
  1263. url: '../../conversion-page/conversion/conversion',
  1264. success: res => {},
  1265. fail: () => {},
  1266. complete: () => {}
  1267. });
  1268. },
  1269. // 跳转我的页面
  1270. onNavMyPage() {
  1271. uni.navigateTo({
  1272. url: '../../my-page/homepage/homepage',
  1273. success: res => {},
  1274. fail: () => {},
  1275. complete: () => {}
  1276. });
  1277. },
  1278. updateBLECIndex() {
  1279. for (let i = 0; i < this.BLEDeviceShowList.length; i++) {
  1280. let eq = this.BLEDeviceShowList[i];
  1281. if ((eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
  1282. (eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
  1283. (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) ||
  1284. (eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3)) {
  1285. eq.bRatio = true;
  1286. this.$store.state.cIndex = i;
  1287. }
  1288. if (eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) {
  1289. if (this.$refs.boxingPostRef) {
  1290. this.$refs.boxingPostRef.onSetMode('pkMode');
  1291. } else {
  1292. setTimeout(() => {
  1293. this.$refs.boxingPostRef.onSetMode('pkMode');
  1294. }, 500)
  1295. }
  1296. } else if (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) {
  1297. if (this.$refs.boxingPostRef) {
  1298. this.$refs.boxingPostRef.onSetMode('calorieMode');
  1299. } else {
  1300. setTimeout(() => {
  1301. this.$refs.boxingPostRef.onSetMode('calorieMode');
  1302. }, 500)
  1303. }
  1304. } else if (eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3) {
  1305. //todo 暂时设置兼容跑步模式
  1306. // if (this.$refs.boxingPostRef) {
  1307. // this.$refs.boxingPostRef.onSetMode('ropeMode');
  1308. // } else {
  1309. // setTimeout(() => {
  1310. // this.$refs.boxingPostRef.onSetMode('ropeMode');
  1311. // }, 500)
  1312. // }
  1313. }
  1314. }
  1315. },
  1316. /**
  1317. * 蓝牙断开连接时候
  1318. */
  1319. callbackCloseBLE() {
  1320. if (0 == this.currentModeIndex) {
  1321. //蓝牙断开连接后,直接关闭
  1322. this.$refs.boxingPostRef.onCloseDevices();
  1323. }
  1324. },
  1325. //蓝牙状态回调
  1326. callbackBLEState(res) {
  1327. console.log("callbackBLEState==", res);
  1328. if (this.cState != res.state) this.cState = res.state;
  1329. },
  1330. //设备回调事件
  1331. callbackUpdateBLEData(data) {
  1332. //如果在监听状态时候隐藏页面,返回
  1333. if (_self.bHide) return;
  1334. // console.log("callbackDeviceState==", data);
  1335. if (this.ConnectBindingDevice) {
  1336. this.gUpdateSandbagAlgorithm({
  1337. data: data,
  1338. callback: (res) => {
  1339. if (res.type == 'hit') {
  1340. this.$refs.boxingPostRef.onBLEHotmanUpdate(res);
  1341. }
  1342. }
  1343. });
  1344. return;
  1345. }
  1346. //连接了手柄模式
  1347. //没有开启指令不刷新
  1348. if (!this.instructionState.bOpen) return;
  1349. if (this.BLEConnectDevice.usageMode == "hotman") {
  1350. this.gUpdateFilter({
  1351. data: data,
  1352. callback: (res) => {
  1353. if (res.type == 'hit') {
  1354. this.$refs.boxingPostRef.onBLEHotmanUpdate(res);
  1355. }
  1356. }
  1357. });
  1358. } else if (this.BLEConnectDevice.usageMode == "general") {
  1359. //这个是普通打击模式
  1360. this.$refs.boxingPostRef.onBLEHandleUpdate(data);
  1361. } else if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  1362. this.onConvertDeviceData({
  1363. data: data,
  1364. callback: (outData) => {
  1365. // this.outBLEData = {
  1366. // acc: outData.convertAcc,
  1367. // gyro: outData.convertGyro
  1368. // }
  1369. // console.log(JSON.stringify(outData),JSON.stringify(data));
  1370. data.acc = outData.convertAcc;
  1371. data.gyro = outData.convertGyro;
  1372. //跳绳蓝牙反馈
  1373. this.$refs.actionJumpRef.onBLERopeUpdate(data);
  1374. }
  1375. });
  1376. }
  1377. },
  1378. //绑定设备函数
  1379. onBindingDevice(item, index) {
  1380. if (item == null) {
  1381. item = this.DeviceBindingList[0];
  1382. }
  1383. if (this.BLEConnectDevice) {
  1384. uni.showToast({
  1385. icon: "none",
  1386. title: "已连接硬件设备",
  1387. duration: 1000
  1388. })
  1389. return;
  1390. }
  1391. if (this.ConnectBindingDevice) {
  1392. this.$store.state.ConnectBindingDevice = null;
  1393. setTimeout(() => {
  1394. uni.showToast({
  1395. icon: "none",
  1396. title: "断开连接",
  1397. duration: 1000
  1398. })
  1399. }, 300)
  1400. } else {
  1401. this.$store.state.ConnectBindingDevice = item;
  1402. setTimeout(() => {
  1403. uni.showToast({
  1404. icon: "none",
  1405. title: "已连接",
  1406. duration: 1000
  1407. })
  1408. }, 300)
  1409. //连接后保存最近连接的设备
  1410. }
  1411. //刷新状态
  1412. this.$refs.boxingPostRef.onSetMode('pkMode');
  1413. },
  1414. //关闭设备函数
  1415. onCloseBindingDevice(item, e) {
  1416. if (e.currentTarget.dataset.index == this.cIndex) {
  1417. uni.showModal({
  1418. title: '设备状态',
  1419. content: '是否断开连接',
  1420. ConfirmColor: '#A488DC',
  1421. success: res => {
  1422. if (res.confirm) {
  1423. this.$store.state.cIndex = -1;
  1424. this.$store.state.ConnectBindingDevice = null;
  1425. }
  1426. }
  1427. });
  1428. }
  1429. },
  1430. onNavBindingDevice() {
  1431. this.toView = "addDeviceView";
  1432. },
  1433. onDevice(item, e) {
  1434. if (this.ConnectBindingDevice) {
  1435. uni.showToast({
  1436. title: '当前已开启数据',
  1437. icon: 'none',
  1438. mask: true
  1439. })
  1440. return;
  1441. }
  1442. if (this.cIndex !== -1) {
  1443. uni.showToast({
  1444. title: '当前已连接设备',
  1445. icon: 'none',
  1446. mask: true
  1447. })
  1448. return;
  1449. }
  1450. //连接蓝牙
  1451. this.onCreateBLEConnection({
  1452. item: item,
  1453. index: e.currentTarget.dataset.index,
  1454. initItem: true,
  1455. getinitAdapter: () => {
  1456. this.onDevice(item, e);
  1457. },
  1458. getSuccess: () => {
  1459. if (this.bHide) {
  1460. //弹出框时候,是隐藏状态
  1461. this.bGetBondTesting = true;
  1462. } else {
  1463. //没有弹出框时候,直接检测
  1464. // setTimeout(() => {
  1465. // this.onGetBondDevice();
  1466. // }, 5000)
  1467. }
  1468. //刷新状态
  1469. if (this.cIndex != -1) {
  1470. let eq = this.BLEDeviceShowList[this.cIndex];
  1471. // console.log(eq,this.BLEConnectDevice);
  1472. if (eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) {
  1473. this.$refs.boxingPostRef.onSetMode('pkMode');
  1474. } else if (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) {
  1475. this.$refs.boxingPostRef.onSetMode('calorieMode');
  1476. } else if (eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3) {
  1477. // this.$refs.boxingPostRef.onSetMode('ropeMode');
  1478. }
  1479. }
  1480. }
  1481. });
  1482. },
  1483. /**
  1484. * 检测获取匹配的设备
  1485. */
  1486. onGetBondDevice() {
  1487. /**
  1488. * 假如手机没有匹配,断开连接
  1489. */
  1490. console.log("****", this.BLEConnectDevice);
  1491. if (!this.BLEConnectDevice) return;
  1492. this.B_GetBondedDevices({
  1493. deviceId: this.BLEConnectDevice.deviceId,
  1494. success: (bondedDevice) => {
  1495. // console.error("===========", bondedDevice);
  1496. // uni.hideToast();
  1497. if (bondedDevice == null) {
  1498. // if (plus.os.name == 'Android')
  1499. {
  1500. //此问题 华为手机容易出现
  1501. //android手机已配对的设备 不存在,但是app 又直接连接成功了。提示,并且断开app连接
  1502. //1.关闭当前连接
  1503. this.onCloseBLEConnection({
  1504. getSuccess: () => {}
  1505. });
  1506. uni.hideToast();
  1507. //2.跳转蓝牙设置
  1508. uni.showModal({
  1509. title: '蓝牙配对失败',
  1510. content: '请跳转后点击配对BGBox_2020,成功后手动跳转回哔蹦重新连接。',
  1511. success: (res) => {
  1512. if (res.confirm) {
  1513. this.B_OpenBLESetting();
  1514. }
  1515. }
  1516. })
  1517. }
  1518. }
  1519. }
  1520. });
  1521. },
  1522. openDeviceList(e) {
  1523. if (this.ConnectBindingDevice) {
  1524. uni.showToast({
  1525. title: '当前已开启数据',
  1526. icon: 'none',
  1527. mask: true
  1528. })
  1529. return;
  1530. }
  1531. //先判断蓝牙是否初始化
  1532. /**
  1533. * 蓝牙部分操作,转全局变量操作
  1534. * */
  1535. console.log("openDeviceList bOpenBluetooth", this.bOpenBluetooth);
  1536. // #ifdef APP-PLUS
  1537. if (!this.bOpenBluetooth) {
  1538. this.initAdapter(() => {
  1539. uni.navigateTo({
  1540. // url: '../devices-category/devices-category',
  1541. url: '../devices-hardware/devices-hardware',
  1542. success: res => {
  1543. this.bLimitReconnection = true;
  1544. },
  1545. fail: () => {},
  1546. complete: () => {}
  1547. });
  1548. });
  1549. return;
  1550. }
  1551. // #endif
  1552. uni.navigateTo({
  1553. url: '../devices-hardware/devices-hardware',
  1554. success: res => {
  1555. this.bLimitReconnection = true;
  1556. },
  1557. fail: () => {},
  1558. complete: () => {}
  1559. });
  1560. },
  1561. onNavToMore() {
  1562. uni.navigateTo({
  1563. url: '../more/more?index=' + this.cIndex,
  1564. success: res => {},
  1565. fail: () => {},
  1566. complete: () => {}
  1567. });
  1568. },
  1569. onAddDevice() {
  1570. let deviceItem = {
  1571. name: '蹦床',
  1572. icon: '/static/trampoline.png'
  1573. };
  1574. if (this.deviceList.length != 0) {
  1575. this.deviceList = this.deviceList.concat(deviceItem);
  1576. } else {
  1577. this.deviceList = deviceItem;
  1578. }
  1579. },
  1580. onCloseDevice(item, e) {
  1581. //如果不是连接状态,则删除
  1582. if (e.currentTarget.dataset.index != this.cIndex) {
  1583. if (this.cIndex != -1) {
  1584. uni.showToast({
  1585. icon: 'none',
  1586. title: "请先断开已连接设备",
  1587. duration: 2000,
  1588. mask: true
  1589. })
  1590. return;
  1591. }
  1592. uni.showModal({
  1593. title: '设备状态',
  1594. content: '是否删除设备?',
  1595. ConfirmColor: '#A488DC',
  1596. success: res => {
  1597. if (res.confirm) {
  1598. this.$store.commit('deleteBLEDevice', e.currentTarget.dataset.index);
  1599. }
  1600. }
  1601. });
  1602. return;
  1603. }
  1604. uni.showModal({
  1605. title: '设备状态',
  1606. content: '是否断开连接?',
  1607. /**
  1608. * 如果需要强制,不显示取消按钮
  1609. */
  1610. showCancel: true,
  1611. ConfirmColor: '#A488DC',
  1612. success: res => {
  1613. if (res.confirm) {
  1614. this.onCloseBLEConnection({
  1615. getSuccess: () => {}
  1616. });
  1617. }
  1618. }
  1619. });
  1620. },
  1621. onNavDetail(item) {
  1622. console.log(item);
  1623. let temItem = encodeURIComponent(JSON.stringify(item));
  1624. // return;
  1625. uni.navigateTo({
  1626. url: '../../game-page/game-detail/game-detail?item=' + temItem
  1627. });
  1628. },
  1629. onNavToGameMore(e) {
  1630. uni.reLaunch({
  1631. url: '../../game-page/game/game?type=' + e.currentTarget.dataset.type
  1632. });
  1633. },
  1634. //判断是否有其他限制
  1635. onStartCheck(data) {
  1636. //#ifdef H5
  1637. // 直接走测试,如果是h5 APP-PLUS
  1638. if (0 === this.currentModeIndex) {
  1639. this.onBoxingGuideFinish();
  1640. } else if (1 === this.currentModeIndex) {
  1641. if (this.currentJumpTask == null) {
  1642. uni.showToast({
  1643. title: '先选一个挑战关卡',
  1644. icon: 'none',
  1645. duration: 2000,
  1646. })
  1647. return;
  1648. }
  1649. if (this.currentMode == 'pkMode' && this.finallySelectFriendInfo == null) {
  1650. uni.showToast({
  1651. title: '选择一个pk好友',
  1652. icon: 'none',
  1653. duration: 2000,
  1654. })
  1655. return;
  1656. }
  1657. //调用开始
  1658. this.onActionJumpPlay();
  1659. }
  1660. return;
  1661. //#endif
  1662. //分类型判断
  1663. if (0 === this.currentModeIndex) {
  1664. //拳击运动类型
  1665. // 1.检测是否有对应设备,没有ConnectBindingDevice,再进行下一步
  1666. if (this.ConnectBindingDevice == null) {
  1667. uni.showToast({
  1668. title: '开启连接数据',
  1669. icon: 'none'
  1670. })
  1671. this.toView = "openAccGyroView";
  1672. return;
  1673. }
  1674. // TODO,目前去掉蓝牙设备
  1675. // //2.检测是否有设备
  1676. // if (this.BLEDeviceShowList.length == 0) {
  1677. // this.$store.state.bGuidePages = true;
  1678. // this.guideCurrent = 3;
  1679. // uni.showToast({
  1680. // title: '请添加蓝牙设备',
  1681. // icon: 'none'
  1682. // })
  1683. // this.toView = "addDeviceView";
  1684. // return;
  1685. // }
  1686. // //2.检测是否连接设备 || this.BLEConnectDevice.ename !== 'BT04'
  1687. // if (this.cIndex == -1) {
  1688. // //没有连接设备,提示去连接设备
  1689. // uni.showToast({
  1690. // title: '请连接蓝牙设备',
  1691. // icon: 'none'
  1692. // })
  1693. // this.toView = "addDeviceView";
  1694. // return;
  1695. // }
  1696. } else if (1 === this.currentModeIndex) {
  1697. //2.检测是否连接设备 || this.BLEConnectDevice.ename !== 'BT04'
  1698. if (this.cIndex == -1) {
  1699. //没有连接设备,提示去连接设备
  1700. // uni.showToast({
  1701. // title: '请连接蓝牙设备',
  1702. // icon: 'none'
  1703. // })
  1704. this.onGetBluetoothConnectView({
  1705. hiddenType: 'none'
  1706. });
  1707. // this.toView = "addDeviceView";
  1708. return;
  1709. }
  1710. }
  1711. //3.检测一下计划日期
  1712. console.log("remainingDays == >", this.planData, this.remainingDays);
  1713. if (date.formatDate(new Date()) > this.planData.endTime || this.remainingDays == 0) {
  1714. if (!this.$store.state.bPlanExpired) {
  1715. this.$store.state.bPlanExpired = true;
  1716. setTimeout(() => {
  1717. this.$store.state.bPlanExpired = false;
  1718. }, 3000)
  1719. // uni.showToast({
  1720. // title: "计划到期,请制定计划。",
  1721. // icon: 'none'
  1722. // })
  1723. uni.showModal({
  1724. title: '提醒',
  1725. content: '计划到期,请制定新计划。',
  1726. confirmText: '去制定',
  1727. success: (res) => {
  1728. if (res.confirm) {
  1729. uni.switchTab({
  1730. url: "../plan/plan"
  1731. })
  1732. }
  1733. }
  1734. })
  1735. }
  1736. // this.$store.state.bGuidePages = true;
  1737. // setTimeout(() => {
  1738. // this.$refs.codeElfGuide.setCurrent(0);
  1739. // }, 0)
  1740. // this.toView = "projectButtonView";
  1741. // // #ifdef APP-PLUS
  1742. // this.showGuide('plan', null)
  1743. // // #endif
  1744. return;
  1745. }
  1746. if (0 === this.currentModeIndex) {
  1747. //如果新手,调用新手教程
  1748. console.log("this.bNewGuide:", this.bNewGuide);
  1749. if (this.bNewGuide) {
  1750. // 拳击的新手提示
  1751. this.$store.state.bGuidePages = true;
  1752. this.guideCurrent = 5;
  1753. this.toView = "boxingHitID";
  1754. this.$store.state.bNewGuide = false;
  1755. } else {
  1756. if (this.ConnectBindingDevice) {
  1757. //假如有连接bingding设备
  1758. this.gCreateSandbagAlgorithm();
  1759. this.gStartSimulateBLEUpdate();
  1760. } else {
  1761. //todo 跳绳模式 发送开启指令
  1762. if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  1763. //打开跳绳模式
  1764. this.B_OpenRopeSkipping();
  1765. } else {
  1766. //初始化filter快速打击对象
  1767. if (this.BLEConnectDevice.usageMode == "hotman") {
  1768. this.gCreateFilterObj();
  1769. }
  1770. //打开加速计
  1771. this.onWriteBLEConnectionValue({
  1772. value: "3"
  1773. });
  1774. // setTimeout(() => {
  1775. // //设置加速计b:20ms a:10ms
  1776. // this.onWriteBLEConnectionValue({
  1777. // value: config.refreshRate
  1778. // });
  1779. // }, 1000)
  1780. }
  1781. }
  1782. //监听蓝牙回调
  1783. uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
  1784. this.onBoxingGuideFinish();
  1785. }
  1786. } else if (1 == this.currentModeIndex) {
  1787. if (data) {
  1788. let {
  1789. bStartCountDown
  1790. } = data;
  1791. this.bStartCountDown = bStartCountDown;
  1792. }
  1793. if (this.bStartCountDown) {
  1794. this.BoxingPostCountDownText = 3;
  1795. this.b_countDown = setInterval(() => {
  1796. if (this.BoxingPostCountDownText <= 1) {
  1797. if (this.b_countDown) {
  1798. clearInterval(this.b_countDown);
  1799. this.b_countDown = null;
  1800. }
  1801. setTimeout(() => {
  1802. this.personalAudioContext.stop();
  1803. this.personalAudioContext.play();
  1804. //倒计时结束后开始游戏
  1805. if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  1806. //打开跳绳模式
  1807. // this.B_OpenRopeSkipping();
  1808. this.onWriteBLEConnectionValue({
  1809. value: "3"
  1810. });
  1811. }
  1812. //监听蓝牙回调
  1813. uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
  1814. //调用开始
  1815. this.onActionJumpPlay();
  1816. this.bStartCountDown = false;
  1817. }, 800)
  1818. return;
  1819. }
  1820. this.BoxingPostCountDownText--;
  1821. }, 1000)
  1822. } else {
  1823. if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  1824. //打开跳绳模式
  1825. // this.B_OpenRopeSkipping();
  1826. this.onWriteBLEConnectionValue({
  1827. value: "3"
  1828. });
  1829. }
  1830. //监听蓝牙回调
  1831. uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
  1832. //调用开始
  1833. this.onActionJumpPlay();
  1834. }
  1835. }
  1836. },
  1837. onShowBoxingHitTip() {
  1838. this.$store.state.bGuidePages = true;
  1839. this.guideCurrent = 5;
  1840. this.toView = "boxingHitID";
  1841. this.$store.state.bNewGuide = false;
  1842. },
  1843. //检测是否符合要求,没有的话进行新手提示
  1844. onPersonalCheck(data) {
  1845. // #ifdef APP-PLUS
  1846. if (1 === this.currentModeIndex) {
  1847. if (this.currentJumpTask == null) {
  1848. console.log("**************11");
  1849. this.onTipLevel({hiddenType: 'normal'});
  1850. if (this.guideUnlockState.firstPromptSelectLevel) {
  1851. // this.onTipLevel();
  1852. let guideUnlockState = Object.assign(this.guideUnlockState, {
  1853. firstPromptSelectLevel: false
  1854. });
  1855. this.setGuideUnlockState(guideUnlockState);
  1856. }
  1857. // else {
  1858. // uni.showToast({
  1859. // title: '先选一个挑战关卡',
  1860. // icon: 'none',
  1861. // duration: 2000,
  1862. // })
  1863. // }
  1864. return;
  1865. }
  1866. if (this.currentMode == 'pkMode' && this.finallySelectFriendInfo == null) {
  1867. //todo 这里没处理 新手提示
  1868. uni.showToast({
  1869. title: '选择一个pk好友',
  1870. icon: 'none',
  1871. duration: 2000,
  1872. })
  1873. return;
  1874. }
  1875. let _item = this.currentJumpTask.item;
  1876. //第一次选择关卡时候判断
  1877. if (this.guideUnlockState.firstUnlockJumpUp && _item.id == 1) {
  1878. this.showGuide('level-game-tip', {
  1879. levelType: 'midJump',
  1880. hiddenType: 'firstUnlockJumpUp'
  1881. })
  1882. let guideUnlockState = Object.assign(this.guideUnlockState, {
  1883. firstUnlockJumpUp: false
  1884. });
  1885. this.setGuideUnlockState(guideUnlockState);
  1886. return;
  1887. } else if (this.guideUnlockState.firstUnlockLeftAndRightJump && _item.id == 6) {
  1888. this.showGuide('level-game-tip', {
  1889. levelType: 'directionJump',
  1890. hiddenType: 'firstUnlockLeftAndRightJump'
  1891. })
  1892. let guideUnlockState = Object.assign(this.guideUnlockState, {
  1893. firstUnlockLeftAndRightJump: false
  1894. });
  1895. this.setGuideUnlockState(guideUnlockState);
  1896. return;
  1897. } else if (this.guideUnlockState.firstUnlockLeftAndRightRotationJump && _item.id == 9) {
  1898. this.showGuide('level-game-tip', {
  1899. levelType: 'rotationJump',
  1900. hiddenType: 'firstUnlockLeftAndRightRotationJump'
  1901. })
  1902. let guideUnlockState = Object.assign(this.guideUnlockState, {
  1903. firstUnlockLeftAndRightRotationJump: false
  1904. });
  1905. this.setGuideUnlockState(guideUnlockState);
  1906. return;
  1907. }
  1908. }
  1909. // #endif
  1910. this.onStartCheck(data);
  1911. },
  1912. //
  1913. onBoxingGuideFinish() {
  1914. if (this.b_countDown) {
  1915. clearInterval(this.b_countDown);
  1916. this.b_countDown = null;
  1917. }
  1918. //|| this.currentMode == 'ropeMode'
  1919. if (this.currentMode == 'calorieMode') {
  1920. this.personalAudioContext.stop();
  1921. this.personalAudioContext.play();
  1922. setTimeout(() => {
  1923. this.$refs.boxingPostRef.onBoxingPostPlay(true);
  1924. }, 600);
  1925. } else {
  1926. this.BoxingPostCountDownText = 3;
  1927. this.$refs.boxingPostRef.onSetRingAnimation(true);
  1928. uni.showToast({
  1929. title: '匹配中...',
  1930. mask: true,
  1931. icon: 'loading',
  1932. duration: 2000
  1933. })
  1934. setTimeout(() => {
  1935. //ai信息
  1936. this.onGetAiRandom();
  1937. // this.b_countDown = setInterval(() => {
  1938. // if (this.BoxingPostCountDownText <= 1) {
  1939. // if (this.b_countDown) {
  1940. // clearInterval(this.b_countDown);
  1941. // this.b_countDown = null;
  1942. // }
  1943. // setTimeout(() => {
  1944. // this.personalAudioContext.stop();
  1945. // this.personalAudioContext.play();
  1946. // this.$refs.boxingPostRef.onBoxingPostPlay(true);
  1947. // this.$refs.boxingPostRef.onSetRingAnimation(false);
  1948. // uni.hideToast();
  1949. // }, 800)
  1950. // }
  1951. // this.BoxingPostCountDownText--;
  1952. // }, 1000)
  1953. setTimeout(() => {
  1954. this.personalAudioContext.stop();
  1955. this.personalAudioContext.play();
  1956. this.$refs.boxingPostRef.onBoxingPostPlay(true);
  1957. this.$refs.boxingPostRef.onSetRingAnimation(false);
  1958. uni.hideToast();
  1959. }, 800)
  1960. }, 2000);
  1961. }
  1962. },
  1963. //运动时间
  1964. onUpdateSportTime(res) {
  1965. // console.log("同步的运动时间",res);
  1966. this.setLocalSportTime(res);
  1967. },
  1968. //更新运动数据
  1969. onUpdateCaloriePlane(data) {
  1970. // 记录卡路里到本地
  1971. this.addlocalCalorie(data);
  1972. this.updateArcbarData();
  1973. },
  1974. onRoundTrigger(data) {
  1975. // console.log("onRoundTrigger==", data);
  1976. // return;
  1977. let url = '';
  1978. switch (data.item.type) {
  1979. case "personal":
  1980. //个人中心页面
  1981. url = '../../personal-page/personal/personal';
  1982. break;
  1983. case "game":
  1984. url = '../../game-page/game/game';
  1985. break;
  1986. default:
  1987. url = '../../personal-page/personal/personal';
  1988. break;
  1989. }
  1990. uni.reLaunch({
  1991. url: url,
  1992. success: res => {},
  1993. fail: () => {},
  1994. complete: () => {}
  1995. });
  1996. },
  1997. /**
  1998. * 同步本地数据到服务器
  1999. */
  2000. onSyncData() {
  2001. this.syncRequestEvent({
  2002. success: () => {
  2003. this.updateArcbarData();
  2004. }
  2005. });
  2006. // 更新显示日期
  2007. this.originalDate = new Date();
  2008. this.currentDate = date.formatTime(this.originalDate);
  2009. },
  2010. hidePlanTipModal() {
  2011. this.modalName = null;
  2012. if (this.planTipIndex === 1) {
  2013. // 您今天的目标还没完成 是否结束训练
  2014. this.onActionPause(false);
  2015. }
  2016. },
  2017. confirmPlanTipModal() {
  2018. this.modalName = null;
  2019. if (this.planTipIndex === 0) {
  2020. this.onStartCheck()
  2021. } else if (this.planTipIndex === 1) {
  2022. // 您今天的目标还没完成 是否结束训练
  2023. this.onActionPause(true);
  2024. }
  2025. },
  2026. //断开连接时候,关闭
  2027. onCloseBoxingHit() {
  2028. console.log('关闭训练');
  2029. if (this.currentMode == 'pkMode') {
  2030. this.$refs.hitEffectRef.onStop();
  2031. }
  2032. this.onActionPause(true);
  2033. },
  2034. //点击暂停时候,判断一下是否完成目标
  2035. onActionControlPlay(bPlay) {
  2036. if (!bPlay) {
  2037. //跳模块的情况下,暂停计时器
  2038. if (1 == this.currentModeIndex)
  2039. this.arcbarCountDownTimeReset();
  2040. if (this.planData.allCalorie < this.planData.calorie) {
  2041. this.modalName = 'showPlanTipModal';
  2042. this.planTipIndex = 1;
  2043. } else {
  2044. //假如完成了目标,更新卡路里
  2045. this.onActionPause(true);
  2046. }
  2047. }
  2048. },
  2049. /**
  2050. * 切换体验模式
  2051. * @param {Object} data
  2052. */
  2053. onModeEvent(data) {
  2054. console.log("当前模式:", data);
  2055. this.currentMode = data.mode;
  2056. this.title = data.name;
  2057. // || this.currentMode == 'ropeMode'
  2058. if (this.currentMode == 'calorieMode') {
  2059. setTimeout(() => {
  2060. this.updateNoLimit();
  2061. }, 0)
  2062. }
  2063. },
  2064. onAiHitEvent(bloodPoint) {
  2065. // this.onPlay({
  2066. // bloodPoint: num,
  2067. // createType: 'red',
  2068. // callback: (res) => {
  2069. // console.log("红色拳头击中对方:", res);
  2070. // }
  2071. // });
  2072. this.$refs.hitFistRef.onPlay({
  2073. bloodPoint: bloodPoint,
  2074. createType: 'red',
  2075. callback: () => {
  2076. if (this.bAiHitShake) return;
  2077. this.bAiHitShake = true;
  2078. this.$refs.aiHitEffectRef.onPlay();
  2079. this.$refs.aiHitEffectRef.onAIHit();
  2080. setTimeout(() => {
  2081. this.bAiHitShake = false;
  2082. }, 500)
  2083. }
  2084. });
  2085. },
  2086. //打击时候头像修改
  2087. onHitEvent(bloodPoint) {
  2088. // console.log("this.bHitShake:",this.bHitShake);
  2089. this.$refs.hitFistRef.onPlay({
  2090. bloodPoint: bloodPoint,
  2091. createType: 'blue',
  2092. callback: () => {
  2093. if (this.bHitShake) return;
  2094. this.bHitShake = true;
  2095. this.$refs.hitEffectRef.onPlay();
  2096. this.$refs.hitEffectRef.onMyHit();
  2097. setTimeout(() => {
  2098. this.bHitShake = false;
  2099. }, 500)
  2100. }
  2101. }
  2102. );
  2103. },
  2104. //弹出目标提示后,进行下一步
  2105. onActionPause(bFinish) {
  2106. if (bFinish) {
  2107. if (this.ConnectBindingDevice) {
  2108. this.gStopSimulateBLEUpdate();
  2109. uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
  2110. } else {
  2111. // if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  2112. // this.B_CloseRopeSkipping();
  2113. // } else {
  2114. // }
  2115. if (0 === this.currentModeIndex) {
  2116. this.$refs.boxingPostRef.onBoxingPostStop();
  2117. //停止时候,重置ai信息
  2118. this.aiObj.name = this.aiOldObj.name;
  2119. this.aiObj.avatar = this.aiOldObj.avatar;
  2120. } else if (1 === this.currentModeIndex) {
  2121. //todo actionJump
  2122. if (this.currentMode == "calorieMode") {
  2123. this.$refs.actionJumpRef.onGameOver("none");
  2124. } else {
  2125. this.$refs.actionJumpRef.onPKModeGameOver("none");
  2126. }
  2127. }
  2128. }
  2129. if (1 === this.currentModeIndex) {
  2130. if (this.currentMode == "calorieMode") {
  2131. this.syncRequestEvent({
  2132. success: () => {
  2133. this.updateArcbarData();
  2134. }
  2135. });
  2136. }
  2137. } else {
  2138. this.syncRequestEvent({
  2139. success: () => {
  2140. this.updateArcbarData();
  2141. }
  2142. });
  2143. }
  2144. } else {
  2145. //如果不是,继续调用播放
  2146. if (0 === this.currentModeIndex) {
  2147. this.$refs.boxingPostRef.onBoxingPostPlay(true);
  2148. } else if (1 === this.currentModeIndex) {
  2149. //actionJump
  2150. this.$refs.actionJumpRef.onContinueGame();
  2151. if (0 !== this.currentJumpTask.item.limitTime) {
  2152. //0默认不限时,所以限时的才走计时间
  2153. this.arcbarCountDownPlay(false);
  2154. }
  2155. }
  2156. }
  2157. },
  2158. /**
  2159. * 新手任务引导
  2160. */
  2161. onGuideChange(e) {
  2162. let tempCurrent = e.detail.current;
  2163. if (tempCurrent == 1) {
  2164. _self.toView = "addDeviceView";
  2165. } else if (tempCurrent == 0) {
  2166. _self.toView = "projectButtonView";
  2167. }
  2168. },
  2169. guideHide(e) {
  2170. this.$store.state.bGuidePages = false;
  2171. if (e.current == 0 && !e.onlyHide) {
  2172. //跳转计划页面
  2173. this.openPlan();
  2174. } else if (e.current == 1 && !e.onlyHide) {
  2175. console.log('guideHide:', e.current);
  2176. //跳转搜索设备页面
  2177. // this.openDeviceList();
  2178. } else if (e.current == 3 && !e.onlyHide) {
  2179. //新手引导跳转扫码页面,直接走绑定 再check
  2180. // this.openQRCode((res) => {
  2181. // setTimeout(() => {
  2182. // this.onPersonalCheck();
  2183. // }, 200);
  2184. // });
  2185. // 跳转连接蓝牙页面
  2186. this.openDeviceList();
  2187. } else if (e.current == 4 && !e.onlyHide) {
  2188. //连接绑定设备
  2189. // this.openQRCode();
  2190. console.log(e);
  2191. let _index = Number(e.device.dataset.index);
  2192. this.onBindingDevice(this.DeviceBindingList[_index], _index);
  2193. //连接设备后,再
  2194. setTimeout(() => {
  2195. this.onPersonalCheck();
  2196. }, 200);
  2197. } else if (e.current == 5 && !e.onlyHide) {
  2198. console.log("==:", e);
  2199. //todo 跳绳模式 新手引导
  2200. if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  2201. this.B_OpenRopeSkipping();
  2202. } else {
  2203. //初始化filter快速打击对象
  2204. if (this.BLEConnectDevice.usageMode == "hotman") {
  2205. this.gCreateFilterObj();
  2206. }
  2207. //打开加速计
  2208. this.onWriteBLEConnectionValue({
  2209. value: "3"
  2210. });
  2211. // setTimeout(() => {
  2212. // //设置加速计b:20ms a:10ms
  2213. // this.onWriteBLEConnectionValue({
  2214. // value: config.refreshRate
  2215. // });
  2216. // }, 1000)
  2217. }
  2218. //监听蓝牙回调
  2219. uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
  2220. this.onBoxingGuideFinish();
  2221. }
  2222. },
  2223. mainScroll(e) {
  2224. if (_self.toView == "addDeviceView") {
  2225. _self.toView = "";
  2226. if (!_self.bGuidePages) return;
  2227. let view = uni.createSelectorQuery().select('#addDeviceView');
  2228. view.boundingClientRect(data => {
  2229. _self.$refs.codeElfGuide.setDeviceObj(data);
  2230. }).exec();
  2231. } else if (_self.toView == "projectButtonView") {
  2232. _self.toView = "";
  2233. if (!_self.bGuidePages) return;
  2234. _self.onGetProjectView();
  2235. } else if (_self.toView == "QRDeviceView") {
  2236. _self.toView = "";
  2237. if (!_self.bGuidePages) return;
  2238. let view = uni.createSelectorQuery().select('#QRDeviceView');
  2239. view.boundingClientRect(data => {
  2240. _self.$refs.codeElfGuide.setDeviceObj(data);
  2241. }).exec();
  2242. } else if (_self.toView == "bing-boxingPost") {
  2243. _self.toView = "";
  2244. if (!_self.bGuidePages) return;
  2245. let view = uni.createSelectorQuery().select('#bing-boxingPost');
  2246. view.boundingClientRect(data => {
  2247. _self.$refs.codeElfGuide.setDeviceObj(data);
  2248. console.log(data);
  2249. }).exec();
  2250. } else if (_self.toView == "boxingHitID") {
  2251. _self.toView = "";
  2252. // let view = uni.createSelectorQuery().select('#boxingHitID');
  2253. // view.boundingClientRect(data => {
  2254. // _self.$refs.codeElfGuide.setModalObj(data);
  2255. // console.log(data);
  2256. // }).exec();
  2257. } else if (_self.toView == "openAccGyroView") {
  2258. _self.toView = "";
  2259. }
  2260. },
  2261. onGetProjectView() {
  2262. let view = uni.createSelectorQuery().select('#projectButtonView');
  2263. view.boundingClientRect(data => {
  2264. _self.$refs.codeElfGuide.setProjectObj(data);
  2265. }).exec();
  2266. },
  2267. onGetActionJumpView() {
  2268. this.$nextTick(() => {
  2269. this.toView = "actionJumpID"
  2270. });
  2271. this.toView = '' //不清空再次跳到锚点位置会不起作用
  2272. setTimeout(() => {
  2273. _self.$refs.actionJumpRef.onGetActionJumpPlayView((data) => {
  2274. console.log(JSON.stringify(data));
  2275. // #ifdef APP-PLUS
  2276. _self.showGuide('actionJumpPlay', data);
  2277. // #endif
  2278. });
  2279. }, 200)
  2280. },
  2281. onGetBluetoothConnectView(initData) {
  2282. _self.$refs.roundFabRef.onGetRoundFabView((data) => {
  2283. console.log(JSON.stringify(data), initData.firstInstallation);
  2284. // #ifdef APP-PLUS
  2285. let temp = Object.assign({}, data, initData);
  2286. console.log('当前的temp:', temp);
  2287. _self.showGuide('bluetoothConnect', temp);
  2288. // #endif
  2289. });
  2290. // let view = uni.createSelectorQuery().select('#roundFabID');
  2291. // view.boundingClientRect(data => {
  2292. // console.log(JSON.stringify(data));
  2293. // // #ifdef APP-PLUS
  2294. // _self.showGuide('bluetoothConnect', data);
  2295. // // #endif
  2296. // }).exec();
  2297. },
  2298. //拳击模块的回调
  2299. boxingUpdateCalorie(calorie) {
  2300. if (this.currentMode != 'pkMode') {
  2301. //这里调用一下设置可以播放音效
  2302. this.$refs.personalFruitRef.onCanPlay();
  2303. }
  2304. this.onUpdateCaloriePlane(calorie);
  2305. },
  2306. //扫码添加设备
  2307. openQRCode(callback) {
  2308. let that = this;
  2309. // 允许从相机和相册扫码
  2310. uni.scanCode({
  2311. success: function(res) {
  2312. // console.log('条码类型:' + res.scanType);
  2313. // console.log('条码内容:' + res.result);
  2314. let obj = JSON.parse(res.result)
  2315. let data = {
  2316. type: obj.type,
  2317. uuid: obj.uuid,
  2318. }
  2319. }
  2320. });
  2321. },
  2322. //屏幕抖动
  2323. onScreenShake() {
  2324. this.bEFHitShake = true;
  2325. setTimeout(() => {
  2326. this.bEFHitShake = false;
  2327. }, 500)
  2328. },
  2329. onGetAiRandom() {
  2330. let _self = this;
  2331. let avatarlist = AvatarConfig.getAvatarList().avatarList;
  2332. let _length = avatarlist.length;
  2333. let _index = Math.floor(Math.random() * _length);
  2334. console.log(avatarlist);
  2335. _self.aiObj.name = avatarlist[_index].name;
  2336. _self.aiObj.avatar = avatarlist[_index].url;
  2337. },
  2338. onBoxingGameOver(res) {
  2339. this.$refs.hitEffectRef.onStop();
  2340. this.onActionPause(true);
  2341. //拳击柱部分
  2342. uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
  2343. let _title = res.myWin ? "胜利" : "失败";
  2344. let _context = res.myWin ? "你已经赢得PK胜利!" : "你在PK中被打败了!";
  2345. this.modalName = "showModalTip"
  2346. this.$refs.modalTipRef.setShowData({
  2347. title: _title,
  2348. context: _context,
  2349. operationItem: null
  2350. });
  2351. },
  2352. onModalTipHide() {
  2353. this.modalName = null;
  2354. },
  2355. onModalTipConfirm(data) {
  2356. let {
  2357. type,
  2358. operationItem
  2359. } = data;
  2360. this.modalName = null;
  2361. //再来一局
  2362. //提示过关奖励
  2363. console.log('onModalTipConfirm', type, operationItem);
  2364. if (type == 'PASSTHELEVEL') {
  2365. this.showPopup('levelReward', operationItem);
  2366. }
  2367. },
  2368. onTestShare() {
  2369. uni.share({
  2370. provider: "weixin",
  2371. scene: "WXSenceTimeline",
  2372. type: 2,
  2373. imageUrl: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png",
  2374. success: function(res) {
  2375. console.log("success:" + JSON.stringify(res));
  2376. },
  2377. fail: function(err) {
  2378. console.log("fail:" + JSON.stringify(err));
  2379. }
  2380. });
  2381. },
  2382. openAcc() {
  2383. if (!this.globalAcc) {
  2384. AccAndOri.bindAcc((accId) => {
  2385. this.$store.state.globalAcc = accId;
  2386. console.log("初始化:globalAcc=", this.globalAcc);
  2387. });
  2388. }
  2389. if (!this.globalOri) {
  2390. AccAndOri.bindOri((oriId) => {
  2391. this.$store.state.globalOri = oriId;
  2392. console.log("初始化:globalOri=", this.globalOri);
  2393. });
  2394. }
  2395. },
  2396. closeAcc() {
  2397. AccAndOri.unBindAcc(this.globalAcc);
  2398. this.$store.state.globalAcc = null;
  2399. AccAndOri.unBindOri(this.globalOri);
  2400. this.$store.state.globalOri = null;
  2401. },
  2402. outGyro(o) {
  2403. console.log("Orientation\nAlpha:" + o.alpha + "\nBeta:" + o.beta + "\nGamma:" + o.gamma);
  2404. },
  2405. openGyro() {
  2406. if (!this.globalOri) {
  2407. AccAndOri.bindOri((oriId) => {
  2408. this.$store.state.globalOri = oriId;
  2409. console.log("初始化:globalOri=", this.globalOri);
  2410. });
  2411. }
  2412. uni.$on('watchOrientation', this.outGyro);
  2413. },
  2414. stopGyro() {
  2415. uni.$off('watchOrientation', this.outGyro);
  2416. AccAndOri.unBindOri(this.globalOri);
  2417. this.$store.state.globalOri = null;
  2418. },
  2419. onKeyInput: function(event) {
  2420. this.$store.state.LocationGameUrl = event.target.value
  2421. },
  2422. onNavFcGame() {
  2423. // console.log(0);
  2424. uni.navigateTo({
  2425. url: "../../fc-page/fc/fc"
  2426. })
  2427. },
  2428. onNavAppInfo() {
  2429. uni.navigateTo({
  2430. url: '../../info-page/app-info/app-info'
  2431. })
  2432. },
  2433. getBLEDeviceServices() {
  2434. console.log("getBLEDeviceServices");
  2435. // uni.getBLEDeviceServices({
  2436. // deviceId: "C5:5C:19:04:00:30",
  2437. // success: res => {
  2438. // console.log("getBLEDeviceServices==", JSON.stringify(res));
  2439. // },
  2440. // fail: failRes => {
  2441. // console.log('device services:', failRes)
  2442. // }
  2443. // });
  2444. },
  2445. // testAsyncFunc() {
  2446. // // 调用异步方法
  2447. // testModule.testAsyncFunc({
  2448. // 'name': 'unimp',
  2449. // 'age': 1
  2450. // },
  2451. // (ret) => {
  2452. // modal.toast({
  2453. // message: ret,
  2454. // duration: 1.5
  2455. // });
  2456. // })
  2457. // },
  2458. // startSyncFunc() {
  2459. // // 调用同步方法
  2460. // var ret = testModule.onStartAccAndGyro({
  2461. // 'name': 'unimp',
  2462. // 'age': 1
  2463. // })
  2464. // modal.toast({
  2465. // message: ret,
  2466. // duration: 1.5
  2467. // });
  2468. // },
  2469. // stopSyncFunc() {
  2470. // // 调用同步方法
  2471. // var ret = testModule.onStopAccAndGyro({
  2472. // 'name': 'unimp',
  2473. // 'age': 1
  2474. // })
  2475. // modal.toast({
  2476. // message: ret,
  2477. // duration: 1.5
  2478. // });
  2479. // },
  2480. onNavToSelectFriend() {
  2481. uni.navigateTo({
  2482. url: '../../friend-page/select/select'
  2483. })
  2484. },
  2485. /**
  2486. * 悬停按钮
  2487. */
  2488. fabClick() {
  2489. //如果第一次点击悬停按钮
  2490. // if (this.guideUnlockState.firstDisconnectBluetooth) {
  2491. // this.onGetBluetoothConnectView({
  2492. // hiddenType: 'firstDisconnectBluetooth'
  2493. // });
  2494. // let guideUnlockState = Object.assign(this.guideUnlockState, {
  2495. // firstDisconnectBluetooth: false
  2496. // });
  2497. // this.setGuideUnlockState(guideUnlockState);
  2498. // return;
  2499. // }
  2500. if (this.cIndex != -1 && this.BLEConnectDevice != null) {
  2501. //先检测
  2502. uni.showModal({
  2503. title: '设备状态',
  2504. content: '是否断开连接?',
  2505. /**
  2506. * 如果需要强制,不显示取消按钮
  2507. */
  2508. showCancel: true,
  2509. ConfirmColor: '#A488DC',
  2510. success: res => {
  2511. if (res.confirm) {
  2512. this.onCloseBLEConnection({
  2513. getSuccess: () => {}
  2514. });
  2515. }
  2516. }
  2517. });
  2518. } else {
  2519. this.openDeviceList();
  2520. }
  2521. },
  2522. /**
  2523. * action 模块相关数据更新,实时更新
  2524. */
  2525. onActionJumpDataUpdate(obj) {
  2526. // console.log(obj);
  2527. this.AJData.allCount = obj.eliminationCount + obj.faultCount;
  2528. this.AJData.faultCount = obj.faultCount;
  2529. //如果pk模式下,区分两个人的分数
  2530. if (this.currentMode == "pkMode") {
  2531. if (this.AJData.isLeftPlayer) {
  2532. this.AJData.myScore = obj.eliminationCount - obj.faultCount;
  2533. } else {
  2534. this.AJData.otherScore = obj.eliminationCount - obj.faultCount;
  2535. }
  2536. }
  2537. // console.log(this.AJData.myUsageTime, this.AJData.otherUsageTime);
  2538. },
  2539. onActionJumpCountDownUpdate(obj) {
  2540. // this.AJData.perCountDown = obj.countDown;
  2541. if (this.currentMode == "pkMode") {
  2542. if (this.AJData.isLeftPlayer) {
  2543. this.AJData.myUsageTime = this.AJData.gameLimitTime - this.AJData.gameCountDown;
  2544. } else {
  2545. this.AJData.otherUsageTime = this.AJData.gameLimitTime - this.AJData.gameCountDown;
  2546. }
  2547. }
  2548. // console.log(this.AJData.myUsageTime, this.AJData.otherUsageTime, this.AJData.gameLimitTime);
  2549. },
  2550. //actionJump 模块跳关卡开始处理
  2551. onActionJumpPlay() {
  2552. //开始时候,设置默认参数
  2553. if (this.AJData.isFinish) {
  2554. //如果下一局,重新设置一下默认参数
  2555. this.onResetDefaultActionJumpData();
  2556. }
  2557. this.onSetActionJumpData();
  2558. this.$refs.actionJumpRef.onActionJumpPlay();
  2559. this.bGamePlaying = true;
  2560. //todo 首先判断时间处理
  2561. if (0 !== this.currentJumpTask.item.limitTime) {
  2562. //0默认不限时,所以限时的才走计时间
  2563. this.arcbarCountDownPlay(true);
  2564. }
  2565. },
  2566. //重置actionJump数据
  2567. onResetDefaultActionJumpData() {
  2568. this.AJData = Object.assign({}, this.defaultAJData);
  2569. },
  2570. onSetActionJumpData() {
  2571. let _item = this.currentJumpTask.item;
  2572. //这里set只是对应关卡的数据
  2573. this.AJData = Object.assign({}, this.AJData, {
  2574. allCount: 0,
  2575. faultCount: 0,
  2576. perCountDown: 0,
  2577. gameCountDown: 0,
  2578. gameLimitTime: _item.limitTime
  2579. })
  2580. console.log('onSetActionJumpData', JSON.stringify(this.AJData), JSON.stringify(_item));
  2581. },
  2582. onActionJumpGameOver(data) {
  2583. let {
  2584. isOffEvent = false
  2585. } = data;
  2586. if (isOffEvent) {
  2587. //停止蓝牙加速计
  2588. this.onWriteBLEConnectionValue({
  2589. value: "4"
  2590. });
  2591. uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
  2592. console.log('onActionJumpGameOver 任务结束');
  2593. this.bGamePlaying = false;
  2594. }
  2595. //游戏结束,重置时间
  2596. this.arcbarCountDownTimeReset();
  2597. //todo 可能区分 levelJump 关卡类型
  2598. if (this.currentMode == "pkMode") {
  2599. //pk模式下面
  2600. if (this.AJData.isLeftPlayer) {
  2601. //如果是左边的.切换下一个玩家
  2602. this.AJData.isLeftPlayer = false;
  2603. uni.showModal({
  2604. title: '切换下一个玩家',
  2605. showCancel: false,
  2606. success: (res) => {
  2607. if (res.confirm) {
  2608. //重新开始计算
  2609. this.onActionJumpPlay();
  2610. }
  2611. }
  2612. })
  2613. } else {
  2614. this.AJData.isFinish = true;
  2615. //奖励赢的人 PKLEVELREWARD
  2616. let _item = this.currentJumpTask.item;
  2617. let _curFriend = this.finallySelectFriendInfo;
  2618. console.log('this.finallySelectFriendInfo:', this.finallySelectFriendInfo);
  2619. let isMyWin = true;
  2620. //如果是右边好友,即判断结束。计算胜负关系
  2621. if (this.AJData.myScore > this.AJData.otherScore) {
  2622. //规定时间内,跳得最多
  2623. // uni.showToast({
  2624. // title: '我赢!!',
  2625. // duration: 2000
  2626. // })
  2627. isMyWin = true;
  2628. //显示一个提示框
  2629. this.showPopup('pkFinish', {
  2630. name: this.username,
  2631. url: this.avatarUrl,
  2632. score: this.AJData.myScore,
  2633. consumeTime: Math.abs(this.AJData.myUsageTime),
  2634. hit: this.AJData.allCount - this.AJData.faultCount,
  2635. miss: this.AJData.faultCount
  2636. });
  2637. console.log({
  2638. name: this.username,
  2639. url: this.avatarUrl,
  2640. score: this.AJData.myScore,
  2641. consumeTime: Math.abs(this.AJData.myUsageTime),
  2642. hit: this.AJData.allCount - this.AJData.faultCount,
  2643. miss: this.AJData.faultCount
  2644. });
  2645. } else {
  2646. // uni.showToast({
  2647. // title: '好友赢或者平局',
  2648. // duration: 2000
  2649. // })
  2650. isMyWin = false;
  2651. //显示一个提示框
  2652. this.showPopup('pkFinish', {
  2653. name: _curFriend.username,
  2654. url: _curFriend.avatarUrl,
  2655. score: this.AJData.otherScore,
  2656. consumeTime: this.AJData.otherUsageTime,
  2657. hit: this.AJData.allCount - this.AJData.faultCount,
  2658. miss: this.AJData.faultCount
  2659. });
  2660. }
  2661. reqUtil
  2662. .requestData(config.URL.PKLEVELREWARD, {
  2663. levelId: _item.id,
  2664. levelType: 1,
  2665. isMyWin: isMyWin,
  2666. friendId: _curFriend.friendId
  2667. })
  2668. .then(
  2669. res => {
  2670. if (res.code == 0) {
  2671. console.log('PKLEVELREWARD:' + JSON.stringify(res.data));
  2672. this.nextTaskCanUnlock = false;
  2673. for (let i = 0; i < this.currentTaskList.length; i++) {
  2674. if (this.currentTaskList[i].id == _item.id) {
  2675. this.currentTaskList[i].isPassed = true;
  2676. break;
  2677. }
  2678. }
  2679. if (isMyWin) {
  2680. //只有isMyWin的情况下才有这两个字段返回,更新本地金币和钻石
  2681. this.setGoldAndDiamond({
  2682. gold: res.data.gold,
  2683. diamond: res.data.diamond
  2684. });
  2685. }
  2686. }
  2687. },
  2688. e => {
  2689. console.log(e);
  2690. }
  2691. );
  2692. }
  2693. } else {
  2694. this.AJData.isFinish = true;
  2695. if (data.myWin) {
  2696. //通过关卡,处理逻辑
  2697. let _item = this.currentJumpTask.item;
  2698. reqUtil
  2699. .requestData(config.URL.PASSTHELEVEL, {
  2700. levelId: _item.id,
  2701. levelType: 1,
  2702. })
  2703. .then(
  2704. res => {
  2705. if (res.code == 0) {
  2706. console.log('PASSTHELEVEL:' + JSON.stringify(res.data));
  2707. //处理 列表数据
  2708. this.nextTaskCanUnlock = false;
  2709. for (let i = 0; i < this.currentTaskList.length; i++) {
  2710. if (this.currentTaskList[i].id == _item.id) {
  2711. this.currentTaskList[i].isPassed = true;
  2712. break;
  2713. }
  2714. }
  2715. let _title = data.myWin ? "胜利" : "失败";
  2716. let _context = data.myWin ? "通关关卡成功!" : "通关关卡失败!";
  2717. this.modalName = "showModalTip"
  2718. if (0 !== res.data.rewardHonor.type || 0 !== res.data.rewardGold || 0 !== res.data
  2719. .rewardDiamond) {
  2720. //todo
  2721. this.$refs.modalTipRef.setShowData({
  2722. title: _title,
  2723. context: _context,
  2724. operationItem: res.data,
  2725. type: 'PASSTHELEVEL'
  2726. });
  2727. //存在任何奖励的情况下直接更新一下返回的金币和钻石数据
  2728. this.setGoldAndDiamond({
  2729. gold: res.data.gold,
  2730. diamond: res.data.diamond
  2731. });
  2732. } else {
  2733. //没有奖励数据
  2734. this.$refs.modalTipRef.setShowData({
  2735. title: _title,
  2736. context: _context,
  2737. operationItem: null,
  2738. type: 'none'
  2739. });
  2740. }
  2741. }
  2742. },
  2743. e => {
  2744. console.log(e);
  2745. }
  2746. );
  2747. }
  2748. }
  2749. },
  2750. showDrawer() {
  2751. this.showDrawerById();
  2752. },
  2753. showPopup(type, item) {
  2754. this.showPopupById({
  2755. type,
  2756. item
  2757. });
  2758. },
  2759. showGuide(type, item) {
  2760. this.showGuideById({
  2761. type,
  2762. item
  2763. });
  2764. },
  2765. /**
  2766. * 任务相关
  2767. */
  2768. selectTask(_index, _item) {
  2769. // console.log(JSON.stringify(_item));
  2770. if (_item.isUnlock) {
  2771. let _data = {
  2772. modeName: this.currentMode, //记录时候记录当前的mode
  2773. index: _index,
  2774. item: _item,
  2775. }
  2776. //记录临时选择的游戏关卡
  2777. this.tempSelectedLevel = _data;
  2778. } else {
  2779. let isCanUnlock = _index == 0 || (_index >= 1 && this.currentTaskList[_index - 1].isUnlock && this
  2780. .currentTaskList[_index - 1].isPassed) ? true : false;
  2781. if (!isCanUnlock) return;
  2782. this.showPopup('unlock', _item);
  2783. }
  2784. },
  2785. updateTaskScroll() {
  2786. /**
  2787. * 获取任务对象
  2788. */
  2789. this.getActionJumpTask();
  2790. //console.error('当前的任务对象===========:' + JSON.stringify(this.currentJumpTask.modeName) + '= '+this.currentMode);
  2791. if (this.currentJumpTask != null && this.currentJumpTask.modeName == this.currentMode) {
  2792. let _index = this.currentJumpTask.index - 1 < 0 ? 0 : this.currentJumpTask.index - 1;
  2793. this.$nextTick(() => {
  2794. this.taskIntoView = "task_" + _index;
  2795. });
  2796. this.taskIntoView = '' //不清空再次跳到锚点位置会不起作用
  2797. }
  2798. },
  2799. switchTaskInfo() {
  2800. if (this.currentMode == 'calorieMode') {
  2801. this.currentTaskList = this.singlePersonList;
  2802. } else if (this.currentMode == 'pkMode') {
  2803. this.currentTaskList = this.multiPersonList;
  2804. }
  2805. },
  2806. onSwitchMode() {
  2807. if (this.currentMode == 'calorieMode') {
  2808. this.currentMode = 'pkMode';
  2809. } else if (this.currentMode == 'pkMode') {
  2810. this.currentMode = 'calorieMode';
  2811. }
  2812. this.switchTaskInfo();
  2813. },
  2814. /**
  2815. * @deprecated Test 测试通过关卡
  2816. */
  2817. onPassTheLevel() {
  2818. if (this.currentMode == "pkMode") {
  2819. this.AJData.myScore = 10;
  2820. this.AJData.isLeftPlayer = false;
  2821. }
  2822. this.onActionJumpGameOver({
  2823. myWin: true
  2824. });
  2825. },
  2826. //确认时候选择按钮
  2827. onConfirmSelectionLevel() {
  2828. if (this.tempSelectedLevel == null) {
  2829. uni.showToast({
  2830. icon: 'none',
  2831. title: '先选择一个挑战关卡',
  2832. mask: true
  2833. })
  2834. return;
  2835. }
  2836. //点击确认时候,记录关卡,并且开始游戏
  2837. this.setActionJumpTask(this.tempSelectedLevel);
  2838. this.hideModal();
  2839. setTimeout(() => {
  2840. // 自动调用开始游戏
  2841. this.onPersonalCheck({
  2842. bStartCountDown: true
  2843. });
  2844. }, 300);
  2845. },
  2846. registerPopupEvent() {
  2847. // 接收 popup 的消息
  2848. uni.$on('reward-popup-page', (data) => {
  2849. switch (data.type) {
  2850. case 'interactive':
  2851. uni.showModal({
  2852. title: '来自Popup的消息',
  2853. content: data.info
  2854. })
  2855. break;
  2856. case 'button':
  2857. if (data.messageType == 'prompt') {
  2858. if (data.confirm) {
  2859. console.log('prompt confirm!');
  2860. } else if (data.cancel) {
  2861. }
  2862. } else if (data.messageType == 'unlock') {
  2863. if (data.confirm) {
  2864. let _operationItem = data.operationItem;
  2865. console.log('unlock confirm!', _operationItem);
  2866. uni.showToast({
  2867. title: '正在解锁',
  2868. icon: 'loading',
  2869. duration: 10000
  2870. })
  2871. //todo 处理解锁流程
  2872. reqUtil
  2873. .requestData(config.URL.UNLOCKLEVEL, {
  2874. levelId: _operationItem.id,
  2875. levelType: 1, //levelJump = 1
  2876. numberType: _operationItem.numberType,
  2877. })
  2878. .then(
  2879. res => {
  2880. uni.hideToast();
  2881. console.log('UNLOCKLEVEL:' + JSON.stringify(res));
  2882. if (res.code === 404) {
  2883. uni.showToast({
  2884. title: '金币不足',
  2885. icon: 'none',
  2886. duration: 1000
  2887. })
  2888. } else if (res.code === 405) {
  2889. uni.showToast({
  2890. title: '钻石不足',
  2891. icon: 'none',
  2892. duration: 1000
  2893. })
  2894. } else if (res.code === 0) {
  2895. //解锁成功
  2896. uni.showToast({
  2897. title: '解锁成功',
  2898. icon: 'none',
  2899. duration: 1000
  2900. })
  2901. //更新本地金币和钻石
  2902. this.setGoldAndDiamond({
  2903. gold: res.data.gold,
  2904. diamond: res.data.diamond
  2905. });
  2906. for (let i = 0; i < this.currentTaskList.length; i++) {
  2907. if (this.currentTaskList[i].id == _operationItem.id) {
  2908. this.currentTaskList[i].isUnlock = true;
  2909. break;
  2910. }
  2911. }
  2912. } else if (res.code === 803) {
  2913. if (res.data.length > 0) {
  2914. uni.showToast({
  2915. title: '需要' + res.data[0].explain,
  2916. icon: 'none',
  2917. duration: 2000
  2918. })
  2919. } else {
  2920. uni.showToast({
  2921. title: '关卡条件关联未设置',
  2922. icon: 'none',
  2923. duration: 2000
  2924. })
  2925. }
  2926. } else if (res.code === 802 || res.code === 805) {
  2927. uni.showToast({
  2928. title: res.msg,
  2929. icon: 'none',
  2930. duration: 2000
  2931. })
  2932. }
  2933. },
  2934. e => {
  2935. console.log(e);
  2936. }
  2937. );
  2938. }
  2939. } else if (data.messageType == 'signIn') {
  2940. this.onUserSignIn();
  2941. }
  2942. break;
  2943. default:
  2944. uni.showToast({
  2945. title: data.title,
  2946. })
  2947. break;
  2948. }
  2949. })
  2950. // 监听 drawer 消息
  2951. uni.$on('drawer-page', (data) => {
  2952. uni.showToast({
  2953. title: '点击了第' + data + '项',
  2954. icon: "none"
  2955. });
  2956. })
  2957. uni.$on('guide-popup-page', (data) => {
  2958. console.log('guide-popup-page', JSON.stringify(data));
  2959. switch (data.type) {
  2960. case 'button':
  2961. if (data.messageType == 'plan') {
  2962. if (data.confirm) {
  2963. //首次安装
  2964. if (data.hiddenType == 'firstInstallation') {
  2965. //跳转提示连接手柄蓝牙
  2966. setTimeout(() => {
  2967. this.onGetBluetoothConnectView({
  2968. hiddenType: 'firstInstallation'
  2969. });
  2970. }, 60)
  2971. console.log('提示连接手柄')
  2972. }
  2973. }
  2974. } else if (data.messageType == 'bluetoothConnect') {
  2975. if (data.confirm) {
  2976. //跳转播放
  2977. // this.onGetActionJumpView();
  2978. //首次安装
  2979. if (data.hiddenType == 'firstInstallation') {
  2980. setTimeout(() => {
  2981. // this.showGuide('device-tip', {
  2982. // hiddenType: 'firstInstallation'
  2983. // });
  2984. this.showGuide('level-button-tip', {
  2985. hiddenType: 'firstInstallation'
  2986. });
  2987. console.log('提示连接关卡')
  2988. }, 60)
  2989. } else if (data.hiddenType == 'firstDisconnectBluetooth') {
  2990. this.fabClick();
  2991. }
  2992. }
  2993. } else if (data.messageType == 'actionJumpPlay') {
  2994. if (data.confirm) {
  2995. }
  2996. } else if (data.messageType == 'device-tip') {
  2997. if (data.confirm) {
  2998. if (data.hiddenType == 'firstInstallation') {
  2999. setTimeout(() => {
  3000. this.showGuide('level-button-tip', {
  3001. hiddenType: 'firstInstallation'
  3002. });
  3003. }, 60)
  3004. }
  3005. }
  3006. } else if (data.messageType == 'level-button-tip') {
  3007. if (data.confirm) {
  3008. }
  3009. }
  3010. break;
  3011. case 'selected':
  3012. console.log('当前操作的类型 selected:', data.messageType)
  3013. if (data.messageType == 'level-button-tip') {
  3014. if (data.isSelected) {
  3015. uni.setStorage({
  3016. key: 'levelButtonPrompt',
  3017. data: {
  3018. isSelected: true
  3019. }
  3020. })
  3021. //如果选择不提示。则隐藏按钮
  3022. this.$refs.actionJumpRef.onUpdateTipLevelValue(false);
  3023. } else {
  3024. uni.setStorage({
  3025. key: 'levelButtonPrompt',
  3026. data: {
  3027. isSelected: false
  3028. }
  3029. })
  3030. //如果选择提示。则显示按钮
  3031. this.$refs.actionJumpRef.onUpdateTipLevelValue(true);
  3032. }
  3033. } else if (data.messageType == 'device-tip') {
  3034. if (data.isSelected) {
  3035. uni.setStorage({
  3036. key: 'deviceDirectionPrompt',
  3037. data: {
  3038. isSelected: true
  3039. }
  3040. })
  3041. //todo 后续处理是否自动提示,true就不自动提示
  3042. } else {
  3043. uni.setStorage({
  3044. key: 'deviceDirectionPrompt',
  3045. data: {
  3046. isSelected: false
  3047. }
  3048. })
  3049. //todo 后续处理是否自动提示,false就自动提示
  3050. }
  3051. }
  3052. break;
  3053. default:
  3054. uni.showToast({
  3055. title: data.title,
  3056. })
  3057. break;
  3058. }
  3059. })
  3060. },
  3061. unregisterPopupEvent() {
  3062. uni.$off('reward-popup-page')
  3063. uni.$off('drawer-page')
  3064. uni.$off('guide-popup-page')
  3065. },
  3066. onNavToDirection() {
  3067. uni.navigateTo({
  3068. url: '../directionOfDetection/directionOfDetection'
  3069. })
  3070. },
  3071. moveBoxingHandle() {
  3072. return;
  3073. },
  3074. /**
  3075. * 提示打开关卡
  3076. */
  3077. onTipLevel(value) {
  3078. // #ifdef APP-PLUS
  3079. this.showGuide('level-button-tip', value);
  3080. // #endif
  3081. // #ifdef H5
  3082. console.warn("不支持nvue");
  3083. // #endif
  3084. },
  3085. onShowFirstInstallation() {
  3086. //第一次安装登录。提示 计划
  3087. this.showGuide('plan', {
  3088. hiddenType: 'firstInstallation'
  3089. });
  3090. console.log("guideUnlockState 1=============:", this.guideUnlockState);
  3091. let guideUnlockState = Object.assign(this.guideUnlockState, {
  3092. firstInstallation: false
  3093. });
  3094. this.setGuideUnlockState(guideUnlockState);
  3095. }
  3096. }
  3097. };
  3098. </script>
  3099. <style>
  3100. .bg-person {
  3101. background-color: #9797ff;
  3102. }
  3103. .plan-view {
  3104. overflow: hidden;
  3105. background-color: #9797ff;
  3106. }
  3107. .plan-l-tip-view {
  3108. border-radius: 80upx 0 0 80upx;
  3109. background-color: rgba(255, 255, 255, 0.05);
  3110. }
  3111. .plan-r-tip-view {
  3112. border-radius: 0 80upx 80upx 0;
  3113. background-color: rgba(255, 255, 255, 0.05);
  3114. }
  3115. .bottom-view {
  3116. background-color: rgba(246, 243, 249, 255);
  3117. padding-bottom: 20rpx;
  3118. border-radius: 80rpx 80rpx 0 0;
  3119. width: 750rpx;
  3120. overflow: hidden;
  3121. }
  3122. .time-view {
  3123. width: 100%;
  3124. margin-top: 53rpx;
  3125. /* border: 1rpx solid #DD514C; */
  3126. }
  3127. /*样式的width和height一定要与定义的cWidth和cHeight相对应*/
  3128. .qiun-charts-arcbar {
  3129. /* padding: 20rpx 15rpx; */
  3130. /* margin-top: 60rpx; */
  3131. height: 480rpx;
  3132. position: relative;
  3133. width: 750rpx;
  3134. /* border: 1rpx solid #fff; */
  3135. }
  3136. .charts-arcbar {
  3137. position: absolute;
  3138. /* margin-left: 81upx;
  3139. */
  3140. left: 0;
  3141. right: 0;
  3142. top: 0;
  3143. bottom: 0;
  3144. margin: auto;
  3145. width: 490rpx;
  3146. height: 480rpx;
  3147. /* border: 1rpx solid #FFFFFF; */
  3148. }
  3149. .charts-arcbar-img {
  3150. position: absolute;
  3151. left: 135upx;
  3152. width: 480upx;
  3153. height: 480upx;
  3154. }
  3155. .charts-pring-bottom {
  3156. position: relative;
  3157. width: 100%;
  3158. display: flex;
  3159. flex-direction: column;
  3160. justify-content: center;
  3161. align-items: center;
  3162. }
  3163. .charts-pring-button {
  3164. width: 178rpx;
  3165. height: 64rpx;
  3166. display: flex;
  3167. flex-direction: row;
  3168. justify-content: start;
  3169. align-items: center;
  3170. border-radius: 0 25px 25px 0;
  3171. }
  3172. /* 心电图 */
  3173. /* .qiun-charts-elect {
  3174. width: 500rpx;
  3175. height: 136rpx;
  3176. } */
  3177. .charts-elect {
  3178. width: 464rpx;
  3179. height: 96rpx;
  3180. border: 1rpx solid #000000;
  3181. }
  3182. .e-button {
  3183. background-color: rgba(255, 255, 255, 0.25);
  3184. border-radius: 45px;
  3185. margin: 5px 12px;
  3186. box-shadow: 1px 1px 3px #888888;
  3187. display: flex;
  3188. justify-content: center;
  3189. }
  3190. /* 曲线图 */
  3191. .qiun-charts-area {
  3192. width: calc(750rpx - 40rpx);
  3193. height: 300upx;
  3194. /* background-color: #007AFF; */
  3195. position: relative;
  3196. }
  3197. .charts-area {
  3198. position: absolute;
  3199. width: 750upx;
  3200. height: 300upx;
  3201. }
  3202. .qiun-charts-bottom-container {
  3203. height: 63px;
  3204. position: relative;
  3205. width: 100%;
  3206. justify-content: center;
  3207. align-items: center;
  3208. display: flex;
  3209. flex-direction: row;
  3210. }
  3211. .qiun-charts-bottom-right {
  3212. position: absolute;
  3213. left: calc(50% + 50rpx);
  3214. top: 15px;
  3215. margin-left: 20rpx;
  3216. }
  3217. /* picker */
  3218. .mpvue-picker-view {
  3219. width: calc(50% - 5px);
  3220. height: 300px;
  3221. /* background-color: rgba(255, 255, 255, 1); */
  3222. border-radius: 20px;
  3223. }
  3224. .item {
  3225. text-align: center;
  3226. width: calc(100% - 0px);
  3227. background-color: rgba(255, 255, 255, 1);
  3228. height: 88upx;
  3229. line-height: 88upx;
  3230. text-overflow: ellipsis;
  3231. white-space: nowrap;
  3232. font-size: 40upx;
  3233. }
  3234. .picker-unit {
  3235. position: absolute;
  3236. right: 70px;
  3237. top: 43%;
  3238. }
  3239. .left-button,
  3240. .right-button {
  3241. margin: 20px 0;
  3242. padding: 10px 30px;
  3243. background-color: #ffffff;
  3244. }
  3245. .left-button {
  3246. border-top-left-radius: 20px;
  3247. border-bottom-left-radius: 20px;
  3248. border-right: 1px solid #e6e6e6;
  3249. }
  3250. .right-button {
  3251. border-top-right-radius: 20px;
  3252. border-bottom-right-radius: 20px;
  3253. }
  3254. .png-size-28 {
  3255. width: 24px;
  3256. height: 24px;
  3257. margin-bottom: 4px;
  3258. }
  3259. .png-size-32 {
  3260. width: 32px;
  3261. height: 32px;
  3262. }
  3263. .png-size-34 {
  3264. width: 34px;
  3265. height: 34px;
  3266. }
  3267. /* 图标大小 */
  3268. .data-play {
  3269. width: 16px;
  3270. height: 16px;
  3271. margin-top: 10rpx;
  3272. }
  3273. .p-data-png {
  3274. width: 16px;
  3275. height: 16px;
  3276. margin: 5rpx 20rpx;
  3277. }
  3278. .data-png {
  3279. width: 16px;
  3280. height: 16px;
  3281. margin: 5rpx;
  3282. }
  3283. .data-png-20 {
  3284. width: 20px;
  3285. height: 20px;
  3286. margin: 0 14rpx;
  3287. }
  3288. .data-png-54 {
  3289. width: 54px;
  3290. height: 54px;
  3291. margin: 0 14rpx;
  3292. }
  3293. .data-png-add {
  3294. position: absolute;
  3295. left: 0;
  3296. top: 0;
  3297. right: 0;
  3298. bottom: 0;
  3299. margin: auto;
  3300. width: 34px;
  3301. height: 37px;
  3302. }
  3303. .time-container {
  3304. margin-top: 13px;
  3305. width: 100%;
  3306. height: 218rpx;
  3307. position: relative;
  3308. /* border: 1rpx solid #007AFF; */
  3309. }
  3310. .time-png {
  3311. width: 503rpx;
  3312. height: 222rpx;
  3313. position: absolute;
  3314. left: 0;
  3315. right: 0;
  3316. top: 0;
  3317. bottom: 0;
  3318. margin: auto;
  3319. z-index: 1;
  3320. }
  3321. .time-text {
  3322. font-size: 9px;
  3323. z-index: 10;
  3324. position: relative;
  3325. height: 100%;
  3326. display: flex;
  3327. justify-content: center;
  3328. align-items: center;
  3329. color: #FFFFFF;
  3330. }
  3331. .padding {
  3332. padding: 10rpx;
  3333. }
  3334. .logo {
  3335. height: 200rpx;
  3336. width: 200rpx;
  3337. margin-top: 200rpx;
  3338. margin-left: auto;
  3339. margin-right: auto;
  3340. margin-bottom: 50rpx;
  3341. }
  3342. .float-png {
  3343. position: absolute;
  3344. right: 15px;
  3345. bottom: 200px;
  3346. width: 56px;
  3347. height: 56px;
  3348. }
  3349. .moveCanvas {
  3350. position: fixed;
  3351. top: 9999rpx;
  3352. left: 0;
  3353. width: 188rpx;
  3354. height: 188rpx;
  3355. }
  3356. .scroll-class {
  3357. width: 100%;
  3358. overflow-x: hidden;
  3359. box-sizing: border-box;
  3360. /* border: 1rpx solid #000000; */
  3361. }
  3362. .homepage-grid-square {
  3363. width: 250rpx;
  3364. /* height: 250rpx; */
  3365. align-items: start;
  3366. }
  3367. .homepage-grid-square image {
  3368. width: 176rpx;
  3369. height: 176rpx;
  3370. }
  3371. .border {
  3372. /* width: 176rpx; */
  3373. font-size: 30rpx;
  3374. color: rgba(175, 175, 175, 1);
  3375. font-weight: 400;
  3376. text-align: center;
  3377. margin-top: 22rpx;
  3378. margin-bottom: 40rpx;
  3379. }
  3380. .item-img {
  3381. border-radius: 20rpx;
  3382. /* border: 1rpx solid #EEEEEE; */
  3383. box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23);
  3384. }
  3385. .plan-Tip-child {
  3386. height: 120rpx;
  3387. }
  3388. .plan-mode-tip {
  3389. height: 90rpx;
  3390. }
  3391. .plan-grid-square {
  3392. width: 250rpx;
  3393. /* height: 250rpx; */
  3394. align-items: start;
  3395. }
  3396. .plan-grid-square image {
  3397. width: 168rpx;
  3398. height: 58rpx;
  3399. }
  3400. .plan-mode {
  3401. /* height: 54px; */
  3402. border-radius: 10px;
  3403. padding: 3px;
  3404. margin: 0 5px 10px 5px;
  3405. border: 1rpx solid #eeeeee;
  3406. /* box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23); */
  3407. position: relative;
  3408. }
  3409. .plan-mode-selected {
  3410. /* height: 54px; */
  3411. padding: 3px;
  3412. margin: 0 5px 10px 5px;
  3413. background-size: contain;
  3414. background-clip: border-box;
  3415. background-repeat: no-repeat;
  3416. background-image: url(../../../static/plan-select-bg.png);
  3417. /* box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23); */
  3418. position: relative;
  3419. }
  3420. .plan-mode-border {
  3421. /* width: 176rpx; */
  3422. font-size: 26rpx;
  3423. color: rgba(151, 151, 255, 1);
  3424. font-weight: 400;
  3425. text-align: center;
  3426. }
  3427. .button-fav {
  3428. background-color: rgba(153, 150, 252, 255);
  3429. color: #ffffff;
  3430. /* border-radius: 10px; */
  3431. /* width: 184rpx; */
  3432. height: 122rpx;
  3433. display: flex;
  3434. justify-content: center;
  3435. text-align: center;
  3436. align-items: center;
  3437. font-size: 14px;
  3438. }
  3439. .card-view-small {
  3440. /* border: 1rpx solid #000000; */
  3441. width: 80%;
  3442. border-radius: 20px;
  3443. margin-left: 50rpx;
  3444. overflow: hidden;
  3445. background-color: #ffffff;
  3446. box-shadow: 0px 2px 4px 0px rgba(113, 113, 219, 0.23);
  3447. }
  3448. .right-bg {
  3449. /* border: 1rpx solid #000000; */
  3450. border-radius: 8px;
  3451. background-color: #9797ff;
  3452. padding: 15rpx;
  3453. position: absolute;
  3454. right: 5%;
  3455. margin-top: 4%;
  3456. }
  3457. .plan-small-child {
  3458. background-color: #f5f5ff;
  3459. border-radius: 20px;
  3460. width: 480rpx;
  3461. height: 90rpx;
  3462. margin: 0 0 30rpx 30rpx;
  3463. /* margin-top: 60rpx; */
  3464. }
  3465. .cu-btn-plan {
  3466. position: relative;
  3467. border: 0upx;
  3468. display: inline-flex;
  3469. align-items: center;
  3470. justify-content: center;
  3471. box-sizing: border-box;
  3472. padding: 4upx 25upx 4upx 4upx;
  3473. margin-left: 5px;
  3474. font-size: 22upx;
  3475. height: 64upx;
  3476. line-height: 1;
  3477. text-align: center;
  3478. text-decoration: none;
  3479. overflow: visible;
  3480. margin-left: initial;
  3481. transform: translate(0upx, 0upx);
  3482. margin-right: initial;
  3483. }
  3484. .cu-btn-plan-child {
  3485. position: relative;
  3486. border: 0upx;
  3487. display: inline-flex;
  3488. align-items: center;
  3489. justify-content: center;
  3490. box-sizing: border-box;
  3491. padding: 0 4upx;
  3492. font-size: 22upx;
  3493. height: 56upx;
  3494. line-height: 1;
  3495. text-align: center;
  3496. text-decoration: none;
  3497. overflow: visible;
  3498. margin-left: initial;
  3499. transform: translate(0upx, 0upx);
  3500. margin-right: initial;
  3501. }
  3502. .cu-btn-plan-right {
  3503. position: relative;
  3504. border: 0upx;
  3505. display: inline-flex;
  3506. align-items: center;
  3507. justify-content: center;
  3508. box-sizing: border-box;
  3509. padding: 4upx 4upx 4upx 19upx;
  3510. margin-left: 5px;
  3511. font-size: 22upx;
  3512. height: 64upx;
  3513. line-height: 1;
  3514. text-align: center;
  3515. text-decoration: none;
  3516. overflow: visible;
  3517. margin-left: initial;
  3518. transform: translate(0upx, 0upx);
  3519. margin-right: initial;
  3520. }
  3521. /* 粗线条 */
  3522. .line-make {
  3523. margin-top: 11px;
  3524. margin-left: 8px;
  3525. border: 4rpx solid #FFFFFF;
  3526. width: 152rpx;
  3527. border-radius: 3px;
  3528. }
  3529. /* 头像背景处理 */
  3530. .avatar-bg-personal {
  3531. width: 34px;
  3532. height: 34px;
  3533. border-radius: 45px;
  3534. border: 2px solid #9997fc;
  3535. background-color: #9997fc;
  3536. box-sizing: border-box;
  3537. }
  3538. .avatar-bg-arrow {
  3539. position: absolute;
  3540. top: 12px;
  3541. left: calc(50% - 10px);
  3542. border-left: 10px solid transparent;
  3543. border-right: 10px solid transparent;
  3544. border-bottom: 10px solid #9997fc;
  3545. }
  3546. .elect-round-image {
  3547. width: 48px;
  3548. height: 48px;
  3549. z-index: 10;
  3550. box-shadow: 1px 1px 3px #888888;
  3551. border-radius: 45px;
  3552. }
  3553. .elect-personal {
  3554. /* width: 100%; */
  3555. height: 120rpx;
  3556. /* margin: 50rpx 0; */
  3557. margin-bottom: 50rpx;
  3558. border-radius: 45px;
  3559. padding: 10rpx;
  3560. border: 1rpx solid rgba(255, 255, 255, 0.11);
  3561. display: flex;
  3562. justify-content: center;
  3563. align-items: center;
  3564. position: relative;
  3565. }
  3566. /* 呼吸灯 */
  3567. .breathing-lamp {
  3568. animation-duration: 1s;
  3569. animation-timing-function: ease-out;
  3570. animation-fill-mode: inherit;
  3571. animation-iteration-count: infinite;
  3572. animation-name: run-lamp;
  3573. animation-play-state: running;
  3574. }
  3575. @keyframes run-lamp {
  3576. 0%,
  3577. 100% {
  3578. opacity: 1;
  3579. transform: scale(1);
  3580. }
  3581. 50% {
  3582. opacity: 0.6;
  3583. transform: scale(0.9);
  3584. }
  3585. }
  3586. .personal-fruit-container {
  3587. position: absolute;
  3588. left: 0;
  3589. top: 0;
  3590. bottom: 0;
  3591. right: 0;
  3592. margin: auto;
  3593. display: flex;
  3594. align-items: center;
  3595. justify-content: center;
  3596. /* border: 1rpx solid #F0F0F0; */
  3597. }
  3598. .screen-jitter {
  3599. animation-duration: 1s;
  3600. animation-timing-function: ease-out;
  3601. animation-fill-mode: inherit;
  3602. animation-iteration-count: infinite;
  3603. animation-name: personal-shake;
  3604. animation-play-state: running;
  3605. }
  3606. .screen-red {
  3607. border: 1rpx solid #ff0000;
  3608. }
  3609. @keyframes personal-shake {
  3610. 0%,
  3611. 100% {
  3612. transform: translateX(0)
  3613. }
  3614. 10% {
  3615. transform: translateX(-9px)
  3616. }
  3617. 20% {
  3618. transform: translateX(8px)
  3619. }
  3620. 30% {
  3621. transform: translateX(-7px)
  3622. }
  3623. 40% {
  3624. transform: translateX(6px)
  3625. }
  3626. 50% {
  3627. transform: translateX(-5px)
  3628. }
  3629. 60% {
  3630. transform: translateX(4px)
  3631. }
  3632. 70% {
  3633. transform: translateX(-3px)
  3634. }
  3635. 80% {
  3636. transform: translateX(2px)
  3637. }
  3638. 90% {
  3639. transform: translateX(-1px)
  3640. }
  3641. }
  3642. .CountDownMask {
  3643. position: absolute;
  3644. top: 0;
  3645. bottom: 0;
  3646. right: 0;
  3647. left: 0;
  3648. background-color: rgba(0, 0, 0, 0.5);
  3649. z-index: 1000;
  3650. display: flex;
  3651. justify-content: center;
  3652. align-items: center;
  3653. font-size: 100px;
  3654. font-weight: bold;
  3655. color: #FFFFFF;
  3656. }
  3657. /**
  3658. * 任务样式
  3659. */
  3660. .task-up-button {
  3661. z-index: 10;
  3662. /* #ifndef APP-PLUS */
  3663. position: absolute;
  3664. /* #endif */
  3665. /* #ifdef APP-PLUS */
  3666. position: fixed;
  3667. /* #endif */
  3668. bottom: 0;
  3669. right: 0;
  3670. left: 0;
  3671. margin: auto;
  3672. width: 100%;
  3673. height: 82rpx;
  3674. }
  3675. </style>