personal.vue 108 KB

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