personal.vue 109 KB

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