personal.vue 110 KB

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