personal.vue 107 KB

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