personal.vue 108 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020
  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="middle">
  12. <view class="flex justify-center align-center" style="margin-left: 160rpx; ">
  13. <view class="flex align-center "
  14. style="margin-right: 40rpx; padding: 0 18px; height: 56rpx; background-color: rgba(255, 153, 0, 1); border-radius: 13.5px;">
  15. <image class="png-more-black" style="margin-right: 16rpx;"
  16. src="/static/common/sideBar/gold_black@2x.png">
  17. </image>
  18. <view class="text-14px" style="line-height: 28rpx;">{{cGold}}</view>
  19. </view>
  20. <view class="flex align-center"
  21. style="padding: 0 18px; height: 56rpx; background-color: rgba(255, 153, 0, 1); border-radius: 13.5px;">
  22. <image class="png-more-black" style="margin-right: 16rpx; "
  23. src="/static/common/sideBar/diamond_black@2x.png">
  24. </image>
  25. <view class="text-14px" style="line-height: 28rpx;">{{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. 'getSignInList', 'onUserSignIn',
  914. 'setGuideUnlockState'
  915. ]),
  916. BasicsSteps() {
  917. this.basics = this.basics == this.basicsList.length - 1 ? 0 : this.basics + 1
  918. },
  919. onLog(value) {
  920. this.vLog = value;
  921. },
  922. onKeyDown(e) {
  923. console.log(e);
  924. },
  925. showClickEvent() {
  926. // #ifdef APP-PLUS
  927. this.showDrawer();
  928. // #endif
  929. // #ifdef H5 || MP-WEIXIN
  930. this.$refs.sideBar.showModal();
  931. this.$store.state.bCanvasShow = false;
  932. // #endif
  933. },
  934. showModal(e) {
  935. if (e.currentTarget.dataset.target == "slideUpModal" && this.bGamePlaying) {
  936. /**
  937. * 判断下游戏是否进行中,进行中不能切换
  938. */
  939. uni.showToast({
  940. title: '游戏进行中,不能选择关卡。',
  941. icon: 'none',
  942. mask: true
  943. })
  944. return;
  945. }
  946. this.modalName = e.currentTarget.dataset.target;
  947. this.$store.state.bCanvasShow = false;
  948. if (this.modalName == "slideUpModal") {
  949. this.updateTaskScroll();
  950. }
  951. },
  952. hideModal(e) {
  953. if (this.modalName == "sportCompletion") {
  954. console.log("关闭卡片");
  955. this.sportData = {
  956. calorie: 0,
  957. hit: 0,
  958. miss: 0,
  959. percent: 0,
  960. time: 0,
  961. allData: 0,
  962. }
  963. } else if (this.modalName == "slideUpModal") {
  964. this.tempSelectedLevel = this.currentJumpTask;
  965. }
  966. this.modalName = null;
  967. this.$store.state.bCanvasShow = true;
  968. },
  969. onTestAddLocalCalorie() {
  970. let _add = (10 * 1.875) / (4 * 30);
  971. console.log(_add);
  972. this.onUpdateCaloriePlane(10);
  973. },
  974. /**
  975. * 首页圆形表部分时间计时器
  976. */
  977. arcbarCountDownTimeUp() {
  978. //todo,涉及到倒计时的关卡。时间到。游戏结束
  979. if (1 === this.currentModeIndex) {
  980. if (this.currentMode == "pkMode") {
  981. this.$refs.actionJumpRef.onPKModeGameOver("timeUp");
  982. } else {
  983. uni.showToast({
  984. title: '时间到,游戏结束。',
  985. icon: 'none',
  986. duration: 2000,
  987. mask: true
  988. })
  989. this.$refs.actionJumpRef.onGameOver("timeUp");
  990. }
  991. }
  992. },
  993. arcbarCountDownTimeUpdate(data) {
  994. this.AJData.gameCountDown = data.curSeconds;
  995. this.updateArcbarDataFromActionJump();
  996. this.onActionJumpCountDownUpdate();
  997. },
  998. arcbarCountDownTimeReset() {
  999. //清除时间计时器
  1000. this.$refs.arcbarCountDownRef.timePause();
  1001. },
  1002. arcbarCountDownPlay(bResetTime) {
  1003. if (bResetTime) {
  1004. this.$refs.arcbarCountDownRef.startData();
  1005. }
  1006. this.$refs.arcbarCountDownRef.timePlay();
  1007. },
  1008. // 进度条数据
  1009. arcbarData(_planData) {
  1010. let showCal = 0,
  1011. showLCal = 0,
  1012. LCalTip = '',
  1013. showTip = '';
  1014. let series = [{
  1015. name: showTip,
  1016. data: 0,
  1017. color: '#2fc25b'
  1018. }];
  1019. //这里区分进度条数据
  1020. if (0 == this.currentModeIndex) {
  1021. showCal = _planData.calorie;
  1022. showLCal = _planData.allCalorie;
  1023. LCalTip = '大卡';
  1024. showTip = '(未达标)';
  1025. // 如果运动的卡路里大于目标卡路里,设置为目标卡路里值,即为Max
  1026. if (showLCal >= showCal) {
  1027. showTip = '(达标)';
  1028. }
  1029. series = [{
  1030. name: showTip,
  1031. data: _planData.allCalorie == 0 ? 0 : _planData.allCalorie / showCal,
  1032. color: '#2fc25b'
  1033. }];
  1034. } else if (1 == this.currentModeIndex) {
  1035. showCal = _planData.calorie;
  1036. showLCal = _planData.allCalorie;
  1037. LCalTip = '大卡';
  1038. showTip = '(未达标)';
  1039. // 如果运动的卡路里大于目标卡路里,设置为目标卡路里值,即为Max
  1040. if (showLCal >= showCal) {
  1041. showTip = '(达标)';
  1042. }
  1043. series = [{
  1044. name: showTip,
  1045. data: this.AJData.gameCountDown == 0 ? 0 : this.AJData.gameCountDown / this.AJData
  1046. .gameLimitTime,
  1047. color: '#2fc25b'
  1048. }];
  1049. // console.log(series);
  1050. }
  1051. return {
  1052. showCal,
  1053. showLCal,
  1054. LCalTip,
  1055. showTip,
  1056. series
  1057. }
  1058. },
  1059. // 圆形进度条
  1060. showArcbar() {
  1061. let {
  1062. showCal,
  1063. showLCal,
  1064. LCalTip,
  1065. series
  1066. } = this.arcbarData(_self.planData);
  1067. // console.log("series==", series[0]);
  1068. canvaArcbar1 = new uCharts({
  1069. $this: _self,
  1070. canvasId: 'canvasArcbar',
  1071. type: 'myGradualChangeArcbar',
  1072. fontSize: 11,
  1073. legend: {
  1074. show: false
  1075. },
  1076. background: '#FFFFFF',
  1077. pixelRatio: 1,
  1078. series: series,
  1079. animation: false,
  1080. width: _self.cWidthArcbar,
  1081. height: _self.cHeightArcbar,
  1082. dataLabel: true,
  1083. // Math.round(chartData.series[0].data * 100) + '%'
  1084. // title: {
  1085. // // arcbarDate: date.formatDate(_self.originalDate),
  1086. // name: showLCal,
  1087. // molecularUnit: LCalTip, //单位的分子部分
  1088. // denominatorUnit: showCal, //单位的分母部分
  1089. // unitFontSize: 11, //单位字符大小
  1090. // color: 'rgba(255, 255, 255, 1)',
  1091. // fontSize: 28,
  1092. // offsetX: -30,
  1093. // offsetY: 10
  1094. // },
  1095. // subtitle: {
  1096. // name: series[0].name,
  1097. // color: 'rgba(255, 255, 255, 1)',
  1098. // fontSize: 13,
  1099. // offsetY: -75
  1100. // },
  1101. extra: {
  1102. arcbar: {
  1103. type: 'default',
  1104. backgroundColor: 'rgba(234, 234, 255, 1)',
  1105. backgroundEndColor: 'rgba(234, 234, 255, 1)',
  1106. backgroundMiddle: '#9291FF', //'rgba(158, 158, 255, 1)',
  1107. width: _self.arcbarWidth, //圆弧的宽度
  1108. lineColor: '#51EDFE',
  1109. lineEndColor: '#F7C75D'
  1110. }
  1111. }
  1112. });
  1113. // 更新位置同步
  1114. this.syncLocalDataToServer((res) => {
  1115. this.originalDate = res.newDate;
  1116. this.currentDate = date.formatTime(res.newDate);
  1117. this.updateArcbarData();
  1118. });
  1119. },
  1120. updateArcbarData(data) {
  1121. // if (data == "plan") {
  1122. // // 加入设置的卡路里小于本地,则更新本地最小值
  1123. // _self.addlocalCalorie(0);
  1124. // console.log("**************updateArcbarData");
  1125. // // 如果是计划设置好后
  1126. // // this.$store.state.bPlanFinish = true;
  1127. // // setTimeout(() => {
  1128. // // this.$store.state.bPlanFinish = false;
  1129. // // }, 10000)
  1130. // }
  1131. // console.log("updateArcbarData:",this.planData);
  1132. let {
  1133. showCal,
  1134. showLCal,
  1135. LCalTip,
  1136. series
  1137. } = _self.arcbarData(_self.planData);
  1138. if (showCal == _self.oldArcbarProCalorie && showLCal == _self.oldArcbarAllCalorie) {
  1139. // console.log("没有改变值,不刷新表盘:", showCal, _self.oldArcbarProCalorie, showLCal, _self.oldArcbarAllCalorie);
  1140. return;
  1141. }
  1142. //这个是显示当前的总卡路里
  1143. _self.$store.state.oldArcbarAllCalorie = showLCal;
  1144. //这个是计划的卡路里
  1145. _self.$store.state.oldArcbarProCalorie = showCal;
  1146. canvaArcbar1.updateData({
  1147. series: series,
  1148. // title: {
  1149. // //这里的文案是自定义的,不写是不变的
  1150. // name: showLCal,
  1151. // molecularUnit: LCalTip, //单位的分子部分
  1152. // denominatorUnit: showCal, //单位的分母部分
  1153. // }
  1154. //,
  1155. // subtitle: {
  1156. // //这里的文案是自定义的,不写是不变的
  1157. // name: series[0].name
  1158. // }
  1159. });
  1160. },
  1161. updateArcbarDataFromActionJump(data) {
  1162. let {
  1163. showCal,
  1164. showLCal,
  1165. LCalTip,
  1166. series
  1167. } = _self.arcbarData(_self.planData);
  1168. canvaArcbar1.updateData({
  1169. series: series
  1170. });
  1171. },
  1172. //没有限制下的更新表盘
  1173. updateNoLimit() {
  1174. let {
  1175. showCal,
  1176. showLCal,
  1177. LCalTip,
  1178. series
  1179. } = _self.arcbarData(_self.planData);
  1180. //这个是显示当前的总卡路里
  1181. _self.$store.state.oldArcbarAllCalorie = showLCal;
  1182. //这个是计划的卡路里
  1183. _self.$store.state.oldArcbarProCalorie = showCal;
  1184. canvaArcbar1.updateData({
  1185. series: series,
  1186. // title: {
  1187. // //这里的文案是自定义的,不写是不变的
  1188. // name: showLCal,
  1189. // molecularUnit: LCalTip, //单位的分子部分
  1190. // denominatorUnit: showCal, //单位的分母部分
  1191. // }
  1192. // ,
  1193. // subtitle: {
  1194. // //这里的文案是自定义的,不写是不变的
  1195. // name: series[0].name
  1196. // }
  1197. });
  1198. },
  1199. // 跳转计划页面
  1200. openPlan(e) {
  1201. // console.log(e);
  1202. uni.navigateTo({
  1203. url: '../plan/plan?newsid=' + 11,
  1204. success: res => {},
  1205. fail: () => {},
  1206. complete: () => {}
  1207. });
  1208. },
  1209. // 跳转转换页面
  1210. onNavConver() {
  1211. uni.reLaunch({
  1212. url: '../../conversion-page/conversion/conversion',
  1213. success: res => {},
  1214. fail: () => {},
  1215. complete: () => {}
  1216. });
  1217. },
  1218. // 跳转我的页面
  1219. onNavMyPage() {
  1220. uni.navigateTo({
  1221. url: '../../my-page/homepage/homepage',
  1222. success: res => {},
  1223. fail: () => {},
  1224. complete: () => {}
  1225. });
  1226. },
  1227. updateBLECIndex() {
  1228. for (let i = 0; i < this.BLEDeviceShowList.length; i++) {
  1229. let eq = this.BLEDeviceShowList[i];
  1230. if ((eq.ename.indexOf("mobilePhoneBandage") > -1 && this.BLEConnectDevice.id == 0) ||
  1231. (eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) ||
  1232. (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) ||
  1233. (eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3)) {
  1234. eq.bRatio = true;
  1235. this.$store.state.cIndex = i;
  1236. }
  1237. if (eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) {
  1238. if (this.$refs.boxingPostRef) {
  1239. this.$refs.boxingPostRef.onSetMode('pkMode');
  1240. } else {
  1241. setTimeout(() => {
  1242. this.$refs.boxingPostRef.onSetMode('pkMode');
  1243. }, 500)
  1244. }
  1245. } else if (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) {
  1246. if (this.$refs.boxingPostRef) {
  1247. this.$refs.boxingPostRef.onSetMode('calorieMode');
  1248. } else {
  1249. setTimeout(() => {
  1250. this.$refs.boxingPostRef.onSetMode('calorieMode');
  1251. }, 500)
  1252. }
  1253. } else if (eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3) {
  1254. //todo 暂时设置兼容跑步模式
  1255. // if (this.$refs.boxingPostRef) {
  1256. // this.$refs.boxingPostRef.onSetMode('ropeMode');
  1257. // } else {
  1258. // setTimeout(() => {
  1259. // this.$refs.boxingPostRef.onSetMode('ropeMode');
  1260. // }, 500)
  1261. // }
  1262. }
  1263. }
  1264. },
  1265. /**
  1266. * 蓝牙断开连接时候
  1267. */
  1268. callbackCloseBLE() {
  1269. if (0 == this.currentModeIndex) {
  1270. //蓝牙断开连接后,直接关闭
  1271. this.$refs.boxingPostRef.onCloseDevices();
  1272. }
  1273. },
  1274. //蓝牙状态回调
  1275. callbackBLEState(res) {
  1276. console.log("callbackBLEState==", res);
  1277. if (this.cState != res.state) this.cState = res.state;
  1278. },
  1279. //设备回调事件
  1280. callbackUpdateBLEData(data) {
  1281. //如果在监听状态时候隐藏页面,返回
  1282. if (_self.bHide) return;
  1283. // console.log("callbackDeviceState==", data);
  1284. if (this.ConnectBindingDevice) {
  1285. this.gUpdateSandbagAlgorithm({
  1286. data: data,
  1287. callback: (res) => {
  1288. if (res.type == 'hit') {
  1289. this.$refs.boxingPostRef.onBLEHotmanUpdate(res);
  1290. }
  1291. }
  1292. });
  1293. return;
  1294. }
  1295. //连接了手柄模式
  1296. //没有开启指令不刷新
  1297. if (!this.instructionState.bOpen) return;
  1298. if (this.BLEConnectDevice.usageMode == "hotman") {
  1299. this.gUpdateFilter({
  1300. data: data,
  1301. callback: (res) => {
  1302. if (res.type == 'hit') {
  1303. this.$refs.boxingPostRef.onBLEHotmanUpdate(res);
  1304. }
  1305. }
  1306. });
  1307. } else if (this.BLEConnectDevice.usageMode == "general") {
  1308. //这个是普通打击模式
  1309. this.$refs.boxingPostRef.onBLEHandleUpdate(data);
  1310. } else if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  1311. this.onConvertDeviceData({
  1312. data: data,
  1313. callback: (outData) => {
  1314. // this.outBLEData = {
  1315. // acc: outData.convertAcc,
  1316. // gyro: outData.convertGyro
  1317. // }
  1318. // console.log(JSON.stringify(outData),JSON.stringify(data));
  1319. data.acc = outData.convertAcc;
  1320. data.gyro = outData.convertGyro;
  1321. //跳绳蓝牙反馈
  1322. this.$refs.actionJumpRef.onBLERopeUpdate(data);
  1323. }
  1324. });
  1325. }
  1326. },
  1327. //绑定设备函数
  1328. onBindingDevice(item, index) {
  1329. if (item == null) {
  1330. item = this.DeviceBindingList[0];
  1331. }
  1332. if (this.BLEConnectDevice) {
  1333. uni.showToast({
  1334. icon: "none",
  1335. title: "已连接硬件设备",
  1336. duration: 1000
  1337. })
  1338. return;
  1339. }
  1340. if (this.ConnectBindingDevice) {
  1341. this.$store.state.ConnectBindingDevice = null;
  1342. setTimeout(() => {
  1343. uni.showToast({
  1344. icon: "none",
  1345. title: "断开连接",
  1346. duration: 1000
  1347. })
  1348. }, 300)
  1349. } else {
  1350. this.$store.state.ConnectBindingDevice = item;
  1351. setTimeout(() => {
  1352. uni.showToast({
  1353. icon: "none",
  1354. title: "已连接",
  1355. duration: 1000
  1356. })
  1357. }, 300)
  1358. //连接后保存最近连接的设备
  1359. }
  1360. //刷新状态
  1361. this.$refs.boxingPostRef.onSetMode('pkMode');
  1362. },
  1363. //关闭设备函数
  1364. onCloseBindingDevice(item, e) {
  1365. if (e.currentTarget.dataset.index == this.cIndex) {
  1366. uni.showModal({
  1367. title: '设备状态',
  1368. content: '是否断开连接',
  1369. ConfirmColor: '#A488DC',
  1370. success: res => {
  1371. if (res.confirm) {
  1372. this.$store.state.cIndex = -1;
  1373. this.$store.state.ConnectBindingDevice = null;
  1374. }
  1375. }
  1376. });
  1377. }
  1378. },
  1379. onNavBindingDevice() {
  1380. this.toView = "addDeviceView";
  1381. },
  1382. onDevice(item, e) {
  1383. if (this.ConnectBindingDevice) {
  1384. uni.showToast({
  1385. title: '当前已开启数据',
  1386. icon: 'none',
  1387. mask: true
  1388. })
  1389. return;
  1390. }
  1391. if (this.cIndex !== -1) {
  1392. uni.showToast({
  1393. title: '当前已连接设备',
  1394. icon: 'none',
  1395. mask: true
  1396. })
  1397. return;
  1398. }
  1399. //连接蓝牙
  1400. this.onCreateBLEConnection({
  1401. item: item,
  1402. index: e.currentTarget.dataset.index,
  1403. initItem: true,
  1404. getinitAdapter: () => {
  1405. this.onDevice(item, e);
  1406. },
  1407. getSuccess: () => {
  1408. if (this.bHide) {
  1409. //弹出框时候,是隐藏状态
  1410. this.bGetBondTesting = true;
  1411. } else {
  1412. //没有弹出框时候,直接检测
  1413. // setTimeout(() => {
  1414. // this.onGetBondDevice();
  1415. // }, 5000)
  1416. }
  1417. //刷新状态
  1418. if (this.cIndex != -1) {
  1419. let eq = this.BLEDeviceShowList[this.cIndex];
  1420. // console.log(eq,this.BLEConnectDevice);
  1421. if (eq.ename.indexOf("hotman") > -1 && this.BLEConnectDevice.id == 1) {
  1422. this.$refs.boxingPostRef.onSetMode('pkMode');
  1423. } else if (eq.ename.indexOf("BLEHandle") > -1 && this.BLEConnectDevice.id == 2) {
  1424. this.$refs.boxingPostRef.onSetMode('calorieMode');
  1425. } else if (eq.ename.indexOf("rope") > -1 && this.BLEConnectDevice.id == 3) {
  1426. // this.$refs.boxingPostRef.onSetMode('ropeMode');
  1427. }
  1428. }
  1429. }
  1430. });
  1431. },
  1432. /**
  1433. * 检测获取匹配的设备
  1434. */
  1435. onGetBondDevice() {
  1436. /**
  1437. * 假如手机没有匹配,断开连接
  1438. */
  1439. console.log("****", this.BLEConnectDevice);
  1440. if (!this.BLEConnectDevice) return;
  1441. this.B_GetBondedDevices({
  1442. deviceId: this.BLEConnectDevice.deviceId,
  1443. success: (bondedDevice) => {
  1444. // console.error("===========", bondedDevice);
  1445. // uni.hideToast();
  1446. if (bondedDevice == null) {
  1447. // if (plus.os.name == 'Android')
  1448. {
  1449. //此问题 华为手机容易出现
  1450. //android手机已配对的设备 不存在,但是app 又直接连接成功了。提示,并且断开app连接
  1451. //1.关闭当前连接
  1452. this.onCloseBLEConnection({
  1453. getSuccess: () => {}
  1454. });
  1455. uni.hideToast();
  1456. //2.跳转蓝牙设置
  1457. uni.showModal({
  1458. title: '蓝牙配对失败',
  1459. content: '请跳转后点击配对BGBox_2020,成功后手动跳转回哔蹦重新连接。',
  1460. success: (res) => {
  1461. if (res.confirm) {
  1462. this.B_OpenBLESetting();
  1463. }
  1464. }
  1465. })
  1466. }
  1467. }
  1468. }
  1469. });
  1470. },
  1471. openDeviceList(e) {
  1472. if (this.ConnectBindingDevice) {
  1473. uni.showToast({
  1474. title: '当前已开启数据',
  1475. icon: 'none',
  1476. mask: true
  1477. })
  1478. return;
  1479. }
  1480. //先判断蓝牙是否初始化
  1481. /**
  1482. * 蓝牙部分操作,转全局变量操作
  1483. * */
  1484. // console.log("openDeviceList bOpenBluetooth", this.bOpenBluetooth);
  1485. // #ifdef APP-PLUS
  1486. if (!this.bOpenBluetooth) {
  1487. this.initAdapter(() => {
  1488. uni.navigateTo({
  1489. // url: '../devices-category/devices-category',
  1490. url: '../devices-hardware/devices-hardware',
  1491. success: res => {
  1492. this.bLimitReconnection = true;
  1493. },
  1494. fail: () => {},
  1495. complete: () => {}
  1496. });
  1497. });
  1498. return;
  1499. }
  1500. // #endif
  1501. uni.navigateTo({
  1502. url: '../devices-hardware/devices-hardware',
  1503. success: res => {
  1504. this.bLimitReconnection = true;
  1505. },
  1506. fail: () => {},
  1507. complete: () => {}
  1508. });
  1509. },
  1510. onNavToMore() {
  1511. uni.navigateTo({
  1512. url: '../more/more?index=' + this.cIndex,
  1513. success: res => {},
  1514. fail: () => {},
  1515. complete: () => {}
  1516. });
  1517. },
  1518. onAddDevice() {
  1519. let deviceItem = {
  1520. name: '蹦床',
  1521. icon: '/static/trampoline.png'
  1522. };
  1523. if (this.deviceList.length != 0) {
  1524. this.deviceList = this.deviceList.concat(deviceItem);
  1525. } else {
  1526. this.deviceList = deviceItem;
  1527. }
  1528. },
  1529. onCloseDevice(item, e) {
  1530. //如果不是连接状态,则删除
  1531. if (e.currentTarget.dataset.index != this.cIndex) {
  1532. if (this.cIndex != -1) {
  1533. uni.showToast({
  1534. icon: 'none',
  1535. title: "请先断开已连接设备",
  1536. duration: 2000,
  1537. mask: true
  1538. })
  1539. return;
  1540. }
  1541. uni.showModal({
  1542. title: '设备状态',
  1543. content: '是否删除设备?',
  1544. ConfirmColor: '#A488DC',
  1545. success: res => {
  1546. if (res.confirm) {
  1547. this.$store.commit('deleteBLEDevice', e.currentTarget.dataset.index);
  1548. }
  1549. }
  1550. });
  1551. return;
  1552. }
  1553. uni.showModal({
  1554. title: '设备状态',
  1555. content: '是否断开连接?',
  1556. /**
  1557. * 如果需要强制,不显示取消按钮
  1558. */
  1559. showCancel: true,
  1560. ConfirmColor: '#A488DC',
  1561. success: res => {
  1562. if (res.confirm) {
  1563. this.onCloseBLEConnection({
  1564. getSuccess: () => {}
  1565. });
  1566. }
  1567. }
  1568. });
  1569. },
  1570. onNavDetail(item) {
  1571. console.log(item);
  1572. let temItem = encodeURIComponent(JSON.stringify(item));
  1573. // return;
  1574. uni.navigateTo({
  1575. url: '../../game-page/game-detail/game-detail?item=' + temItem
  1576. });
  1577. },
  1578. onNavToGameMore(e) {
  1579. uni.reLaunch({
  1580. url: '../../game-page/game/game?type=' + e.currentTarget.dataset.type
  1581. });
  1582. },
  1583. //判断是否有其他限制
  1584. onStartCheck(data) {
  1585. //#ifdef H5
  1586. // 直接走测试,如果是h5 APP-PLUS
  1587. if (0 === this.currentModeIndex) {
  1588. this.onBoxingGuideFinish();
  1589. } else if (1 === this.currentModeIndex) {
  1590. if (this.currentJumpTask == null) {
  1591. uni.showToast({
  1592. title: '先选一个挑战关卡',
  1593. icon: 'none',
  1594. duration: 2000,
  1595. })
  1596. return;
  1597. }
  1598. if (this.currentMode == 'pkMode' && this.finallySelectFriendInfo == null) {
  1599. uni.showToast({
  1600. title: '选择一个pk好友',
  1601. icon: 'none',
  1602. duration: 2000,
  1603. })
  1604. return;
  1605. }
  1606. //调用开始
  1607. this.onActionJumpPlay();
  1608. }
  1609. return;
  1610. //#endif
  1611. //分类型判断
  1612. if (0 === this.currentModeIndex) {
  1613. //拳击运动类型
  1614. // 1.检测是否有对应设备,没有ConnectBindingDevice,再进行下一步
  1615. if (this.ConnectBindingDevice == null) {
  1616. uni.showToast({
  1617. title: '开启连接数据',
  1618. icon: 'none'
  1619. })
  1620. this.toView = "openAccGyroView";
  1621. return;
  1622. }
  1623. // TODO,目前去掉蓝牙设备
  1624. // //2.检测是否有设备
  1625. // if (this.BLEDeviceShowList.length == 0) {
  1626. // this.$store.state.bGuidePages = true;
  1627. // this.guideCurrent = 3;
  1628. // uni.showToast({
  1629. // title: '请添加蓝牙设备',
  1630. // icon: 'none'
  1631. // })
  1632. // this.toView = "addDeviceView";
  1633. // return;
  1634. // }
  1635. // //2.检测是否连接设备 || this.BLEConnectDevice.ename !== 'BT04'
  1636. // if (this.cIndex == -1) {
  1637. // //没有连接设备,提示去连接设备
  1638. // uni.showToast({
  1639. // title: '请连接蓝牙设备',
  1640. // icon: 'none'
  1641. // })
  1642. // this.toView = "addDeviceView";
  1643. // return;
  1644. // }
  1645. } else if (1 === this.currentModeIndex) {
  1646. //2.检测是否连接设备 || this.BLEConnectDevice.ename !== 'BT04'
  1647. if (this.cIndex == -1) {
  1648. //没有连接设备,提示去连接设备
  1649. // uni.showToast({
  1650. // title: '请连接蓝牙设备',
  1651. // icon: 'none'
  1652. // })
  1653. this.onGetBluetoothConnectView({
  1654. hiddenType: 'none'
  1655. });
  1656. // this.toView = "addDeviceView";
  1657. return;
  1658. }
  1659. }
  1660. //3.检测一下计划日期
  1661. console.log("remainingDays == >", this.planData, this.remainingDays);
  1662. if (date.formatDate(new Date()) > this.planData.endTime || this.remainingDays == 0) {
  1663. if (!this.$store.state.bPlanExpired) {
  1664. this.$store.state.bPlanExpired = true;
  1665. setTimeout(() => {
  1666. this.$store.state.bPlanExpired = false;
  1667. }, 3000)
  1668. // uni.showToast({
  1669. // title: "计划到期,请制定计划。",
  1670. // icon: 'none'
  1671. // })
  1672. uni.showModal({
  1673. title: '提醒',
  1674. content: '计划到期,请制定新计划。',
  1675. confirmText: '去制定',
  1676. success: (res) => {
  1677. if (res.confirm) {
  1678. uni.switchTab({
  1679. url: "../plan/plan"
  1680. })
  1681. }
  1682. }
  1683. })
  1684. }
  1685. // this.$store.state.bGuidePages = true;
  1686. // setTimeout(() => {
  1687. // this.$refs.codeElfGuide.setCurrent(0);
  1688. // }, 0)
  1689. // this.toView = "projectButtonView";
  1690. // // #ifdef APP-PLUS
  1691. // this.showGuide('plan', null)
  1692. // // #endif
  1693. return;
  1694. }
  1695. if (0 === this.currentModeIndex) {
  1696. //如果新手,调用新手教程
  1697. console.log("this.bNewGuide:", this.bNewGuide);
  1698. if (this.bNewGuide) {
  1699. // 拳击的新手提示
  1700. this.$store.state.bGuidePages = true;
  1701. this.guideCurrent = 5;
  1702. this.toView = "boxingHitID";
  1703. this.$store.state.bNewGuide = false;
  1704. } else {
  1705. if (this.ConnectBindingDevice) {
  1706. //假如有连接bingding设备
  1707. this.gCreateSandbagAlgorithm();
  1708. this.gStartSimulateBLEUpdate();
  1709. } else {
  1710. //todo 跳绳模式 发送开启指令
  1711. if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  1712. //打开跳绳模式
  1713. this.B_OpenRopeSkipping();
  1714. } else {
  1715. //初始化filter快速打击对象
  1716. if (this.BLEConnectDevice.usageMode == "hotman") {
  1717. this.gCreateFilterObj();
  1718. }
  1719. //打开加速计
  1720. this.onWriteBLEConnectionValue({
  1721. value: "3"
  1722. });
  1723. // setTimeout(() => {
  1724. // //设置加速计b:20ms a:10ms
  1725. // this.onWriteBLEConnectionValue({
  1726. // value: config.refreshRate
  1727. // });
  1728. // }, 1000)
  1729. }
  1730. }
  1731. //监听蓝牙回调
  1732. uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
  1733. this.onBoxingGuideFinish();
  1734. }
  1735. } else if (1 == this.currentModeIndex) {
  1736. if (data) {
  1737. let {
  1738. bStartCountDown
  1739. } = data;
  1740. this.bStartCountDown = bStartCountDown;
  1741. }
  1742. if (this.bStartCountDown) {
  1743. this.BoxingPostCountDownText = 3;
  1744. this.b_countDown = setInterval(() => {
  1745. if (this.BoxingPostCountDownText <= 1) {
  1746. if (this.b_countDown) {
  1747. clearInterval(this.b_countDown);
  1748. this.b_countDown = null;
  1749. }
  1750. setTimeout(() => {
  1751. this.personalAudioContext.stop();
  1752. this.personalAudioContext.play();
  1753. //倒计时结束后开始游戏
  1754. if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  1755. //打开跳绳模式
  1756. // this.B_OpenRopeSkipping();
  1757. this.onWriteBLEConnectionValue({
  1758. value: "3"
  1759. });
  1760. }
  1761. //监听蓝牙回调
  1762. uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
  1763. //调用开始
  1764. this.onActionJumpPlay();
  1765. this.bStartCountDown = false;
  1766. }, 800)
  1767. return;
  1768. }
  1769. this.BoxingPostCountDownText--;
  1770. }, 1000)
  1771. } else {
  1772. if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  1773. //打开跳绳模式
  1774. // this.B_OpenRopeSkipping();
  1775. this.onWriteBLEConnectionValue({
  1776. value: "3"
  1777. });
  1778. }
  1779. //监听蓝牙回调
  1780. uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
  1781. //调用开始
  1782. this.onActionJumpPlay();
  1783. }
  1784. }
  1785. },
  1786. onShowBoxingHitTip() {
  1787. this.$store.state.bGuidePages = true;
  1788. this.guideCurrent = 5;
  1789. this.toView = "boxingHitID";
  1790. this.$store.state.bNewGuide = false;
  1791. },
  1792. //检测是否符合要求,没有的话进行新手提示
  1793. onPersonalCheck(data) {
  1794. // #ifdef APP-PLUS
  1795. if (1 === this.currentModeIndex) {
  1796. if (this.currentJumpTask == null) {
  1797. console.log("**************11");
  1798. this.onTipLevel({
  1799. hiddenType: 'normal'
  1800. });
  1801. if (this.guideUnlockState.firstPromptSelectLevel) {
  1802. // this.onTipLevel();
  1803. let guideUnlockState = Object.assign(this.guideUnlockState, {
  1804. firstPromptSelectLevel: false
  1805. });
  1806. this.setGuideUnlockState(guideUnlockState);
  1807. }
  1808. // else {
  1809. // uni.showToast({
  1810. // title: '先选一个挑战关卡',
  1811. // icon: 'none',
  1812. // duration: 2000,
  1813. // })
  1814. // }
  1815. return;
  1816. }
  1817. if (this.currentMode == 'pkMode' && this.finallySelectFriendInfo == null) {
  1818. //todo 这里没处理 新手提示
  1819. uni.showToast({
  1820. title: '选择一个pk好友',
  1821. icon: 'none',
  1822. duration: 2000,
  1823. })
  1824. return;
  1825. }
  1826. let _item = this.currentJumpTask.item;
  1827. //第一次选择关卡时候判断
  1828. if (this.guideUnlockState.firstUnlockJumpUp && _item.id == 1) {
  1829. this.showGuide('level-game-tip', {
  1830. levelType: 'midJump',
  1831. hiddenType: 'firstUnlockJumpUp'
  1832. })
  1833. let guideUnlockState = Object.assign(this.guideUnlockState, {
  1834. firstUnlockJumpUp: false
  1835. });
  1836. this.setGuideUnlockState(guideUnlockState);
  1837. return;
  1838. } else if (this.guideUnlockState.firstUnlockLeftAndRightJump && _item.id == 6) {
  1839. this.showGuide('level-game-tip', {
  1840. levelType: 'directionJump',
  1841. hiddenType: 'firstUnlockLeftAndRightJump'
  1842. })
  1843. let guideUnlockState = Object.assign(this.guideUnlockState, {
  1844. firstUnlockLeftAndRightJump: false
  1845. });
  1846. this.setGuideUnlockState(guideUnlockState);
  1847. return;
  1848. } else if (this.guideUnlockState.firstUnlockLeftAndRightRotationJump && _item.id == 9) {
  1849. this.showGuide('level-game-tip', {
  1850. levelType: 'rotationJump',
  1851. hiddenType: 'firstUnlockLeftAndRightRotationJump'
  1852. })
  1853. let guideUnlockState = Object.assign(this.guideUnlockState, {
  1854. firstUnlockLeftAndRightRotationJump: false
  1855. });
  1856. this.setGuideUnlockState(guideUnlockState);
  1857. return;
  1858. }
  1859. }
  1860. // #endif
  1861. this.onStartCheck(data);
  1862. },
  1863. //
  1864. onBoxingGuideFinish() {
  1865. if (this.b_countDown) {
  1866. clearInterval(this.b_countDown);
  1867. this.b_countDown = null;
  1868. }
  1869. //|| this.currentMode == 'ropeMode'
  1870. if (this.currentMode == 'calorieMode') {
  1871. this.personalAudioContext.stop();
  1872. this.personalAudioContext.play();
  1873. setTimeout(() => {
  1874. this.$refs.boxingPostRef.onBoxingPostPlay(true);
  1875. }, 600);
  1876. } else {
  1877. this.BoxingPostCountDownText = 3;
  1878. this.$refs.boxingPostRef.onSetRingAnimation(true);
  1879. uni.showToast({
  1880. title: '匹配中...',
  1881. mask: true,
  1882. icon: 'loading',
  1883. duration: 2000
  1884. })
  1885. setTimeout(() => {
  1886. //ai信息
  1887. this.onGetAiRandom();
  1888. // this.b_countDown = setInterval(() => {
  1889. // if (this.BoxingPostCountDownText <= 1) {
  1890. // if (this.b_countDown) {
  1891. // clearInterval(this.b_countDown);
  1892. // this.b_countDown = null;
  1893. // }
  1894. // setTimeout(() => {
  1895. // this.personalAudioContext.stop();
  1896. // this.personalAudioContext.play();
  1897. // this.$refs.boxingPostRef.onBoxingPostPlay(true);
  1898. // this.$refs.boxingPostRef.onSetRingAnimation(false);
  1899. // uni.hideToast();
  1900. // }, 800)
  1901. // }
  1902. // this.BoxingPostCountDownText--;
  1903. // }, 1000)
  1904. setTimeout(() => {
  1905. this.personalAudioContext.stop();
  1906. this.personalAudioContext.play();
  1907. this.$refs.boxingPostRef.onBoxingPostPlay(true);
  1908. this.$refs.boxingPostRef.onSetRingAnimation(false);
  1909. uni.hideToast();
  1910. }, 800)
  1911. }, 2000);
  1912. }
  1913. },
  1914. //运动时间
  1915. onUpdateSportTime(res) {
  1916. // console.log("同步的运动时间",res);
  1917. this.setLocalSportTime(res);
  1918. },
  1919. //更新运动数据
  1920. onUpdateCaloriePlane(data) {
  1921. // 记录卡路里到本地
  1922. this.addlocalCalorie(data);
  1923. this.updateArcbarData();
  1924. },
  1925. onRoundTrigger(data) {
  1926. // console.log("onRoundTrigger==", data);
  1927. // return;
  1928. let url = '';
  1929. switch (data.item.type) {
  1930. case "personal":
  1931. //个人中心页面
  1932. url = '../../personal-page/personal/personal';
  1933. break;
  1934. case "game":
  1935. url = '../../game-page/game/game';
  1936. break;
  1937. default:
  1938. url = '../../personal-page/personal/personal';
  1939. break;
  1940. }
  1941. uni.reLaunch({
  1942. url: url,
  1943. success: res => {},
  1944. fail: () => {},
  1945. complete: () => {}
  1946. });
  1947. },
  1948. /**
  1949. * 同步本地数据到服务器
  1950. */
  1951. onSyncData() {
  1952. this.syncRequestEvent({
  1953. success: () => {
  1954. this.updateArcbarData();
  1955. }
  1956. });
  1957. // 更新显示日期
  1958. this.originalDate = new Date();
  1959. this.currentDate = date.formatTime(this.originalDate);
  1960. },
  1961. hidePlanTipModal() {
  1962. this.modalName = null;
  1963. if (this.planTipIndex === 1) {
  1964. // 您今天的目标还没完成 是否结束训练
  1965. this.onActionPause(false);
  1966. }
  1967. },
  1968. confirmPlanTipModal() {
  1969. this.modalName = null;
  1970. if (this.planTipIndex === 0) {
  1971. this.onStartCheck()
  1972. } else if (this.planTipIndex === 1) {
  1973. // 您今天的目标还没完成 是否结束训练
  1974. this.onActionPause(true);
  1975. }
  1976. },
  1977. //断开连接时候,关闭
  1978. onCloseBoxingHit() {
  1979. console.log('关闭训练');
  1980. if (this.currentMode == 'pkMode') {
  1981. this.$refs.hitEffectRef.onStop();
  1982. }
  1983. this.onActionPause(true);
  1984. },
  1985. //点击暂停时候,判断一下是否完成目标
  1986. onActionControlPlay(bPlay) {
  1987. if (!bPlay) {
  1988. //跳模块的情况下,暂停计时器
  1989. if (1 == this.currentModeIndex)
  1990. this.arcbarCountDownTimeReset();
  1991. if (this.planData.allCalorie < this.planData.calorie) {
  1992. this.modalName = 'showPlanTipModal';
  1993. this.planTipIndex = 1;
  1994. } else {
  1995. //假如完成了目标,更新卡路里
  1996. this.onActionPause(true);
  1997. }
  1998. }
  1999. },
  2000. /**
  2001. * 切换体验模式
  2002. * @param {Object} data
  2003. */
  2004. onModeEvent(data) {
  2005. console.log("当前模式:", data);
  2006. this.currentMode = data.mode;
  2007. this.title = data.name;
  2008. // || this.currentMode == 'ropeMode'
  2009. if (this.currentMode == 'calorieMode') {
  2010. setTimeout(() => {
  2011. this.updateNoLimit();
  2012. }, 0)
  2013. }
  2014. },
  2015. onAiHitEvent(bloodPoint) {
  2016. // this.onPlay({
  2017. // bloodPoint: num,
  2018. // createType: 'red',
  2019. // callback: (res) => {
  2020. // console.log("红色拳头击中对方:", res);
  2021. // }
  2022. // });
  2023. this.$refs.hitFistRef.onPlay({
  2024. bloodPoint: bloodPoint,
  2025. createType: 'red',
  2026. callback: () => {
  2027. if (this.bAiHitShake) return;
  2028. this.bAiHitShake = true;
  2029. this.$refs.aiHitEffectRef.onPlay();
  2030. this.$refs.aiHitEffectRef.onAIHit();
  2031. setTimeout(() => {
  2032. this.bAiHitShake = false;
  2033. }, 500)
  2034. }
  2035. });
  2036. },
  2037. //打击时候头像修改
  2038. onHitEvent(bloodPoint) {
  2039. // console.log("this.bHitShake:",this.bHitShake);
  2040. this.$refs.hitFistRef.onPlay({
  2041. bloodPoint: bloodPoint,
  2042. createType: 'blue',
  2043. callback: () => {
  2044. if (this.bHitShake) return;
  2045. this.bHitShake = true;
  2046. this.$refs.hitEffectRef.onPlay();
  2047. this.$refs.hitEffectRef.onMyHit();
  2048. setTimeout(() => {
  2049. this.bHitShake = false;
  2050. }, 500)
  2051. }
  2052. }
  2053. );
  2054. },
  2055. //弹出目标提示后,进行下一步
  2056. onActionPause(bFinish) {
  2057. if (bFinish) {
  2058. if (this.ConnectBindingDevice) {
  2059. this.gStopSimulateBLEUpdate();
  2060. uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
  2061. } else {
  2062. // if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  2063. // this.B_CloseRopeSkipping();
  2064. // } else {
  2065. // }
  2066. if (0 === this.currentModeIndex) {
  2067. this.$refs.boxingPostRef.onBoxingPostStop();
  2068. //停止时候,重置ai信息
  2069. this.aiObj.name = this.aiOldObj.name;
  2070. this.aiObj.avatar = this.aiOldObj.avatar;
  2071. } else if (1 === this.currentModeIndex) {
  2072. //todo actionJump
  2073. if (this.currentMode == "calorieMode") {
  2074. this.$refs.actionJumpRef.onGameOver("none");
  2075. } else {
  2076. this.$refs.actionJumpRef.onPKModeGameOver("none");
  2077. }
  2078. }
  2079. }
  2080. if (1 === this.currentModeIndex) {
  2081. if (this.currentMode == "calorieMode") {
  2082. this.syncRequestEvent({
  2083. success: () => {
  2084. this.updateArcbarData();
  2085. }
  2086. });
  2087. }
  2088. } else {
  2089. this.syncRequestEvent({
  2090. success: () => {
  2091. this.updateArcbarData();
  2092. }
  2093. });
  2094. }
  2095. } else {
  2096. //如果不是,继续调用播放
  2097. if (0 === this.currentModeIndex) {
  2098. this.$refs.boxingPostRef.onBoxingPostPlay(true);
  2099. } else if (1 === this.currentModeIndex) {
  2100. //actionJump
  2101. this.$refs.actionJumpRef.onContinueGame();
  2102. if (0 !== this.currentJumpTask.item.limitTime) {
  2103. //0默认不限时,所以限时的才走计时间
  2104. this.arcbarCountDownPlay(false);
  2105. }
  2106. }
  2107. }
  2108. },
  2109. /**
  2110. * 新手任务引导
  2111. */
  2112. onGuideChange(e) {
  2113. let tempCurrent = e.detail.current;
  2114. if (tempCurrent == 1) {
  2115. _self.toView = "addDeviceView";
  2116. } else if (tempCurrent == 0) {
  2117. _self.toView = "projectButtonView";
  2118. }
  2119. },
  2120. guideHide(e) {
  2121. this.$store.state.bGuidePages = false;
  2122. if (e.current == 0 && !e.onlyHide) {
  2123. //跳转计划页面
  2124. this.openPlan();
  2125. } else if (e.current == 1 && !e.onlyHide) {
  2126. console.log('guideHide:', e.current);
  2127. //跳转搜索设备页面
  2128. // this.openDeviceList();
  2129. } else if (e.current == 3 && !e.onlyHide) {
  2130. //新手引导跳转扫码页面,直接走绑定 再check
  2131. // this.openQRCode((res) => {
  2132. // setTimeout(() => {
  2133. // this.onPersonalCheck();
  2134. // }, 200);
  2135. // });
  2136. // 跳转连接蓝牙页面
  2137. this.openDeviceList();
  2138. } else if (e.current == 4 && !e.onlyHide) {
  2139. //连接绑定设备
  2140. // this.openQRCode();
  2141. console.log(e);
  2142. let _index = Number(e.device.dataset.index);
  2143. this.onBindingDevice(this.DeviceBindingList[_index], _index);
  2144. //连接设备后,再
  2145. setTimeout(() => {
  2146. this.onPersonalCheck();
  2147. }, 200);
  2148. } else if (e.current == 5 && !e.onlyHide) {
  2149. console.log("==:", e);
  2150. //todo 跳绳模式 新手引导
  2151. if (this.BLEConnectDevice.usageMode == "ropeSkipping") {
  2152. this.B_OpenRopeSkipping();
  2153. } else {
  2154. //初始化filter快速打击对象
  2155. if (this.BLEConnectDevice.usageMode == "hotman") {
  2156. this.gCreateFilterObj();
  2157. }
  2158. //打开加速计
  2159. this.onWriteBLEConnectionValue({
  2160. value: "3"
  2161. });
  2162. // setTimeout(() => {
  2163. // //设置加速计b:20ms a:10ms
  2164. // this.onWriteBLEConnectionValue({
  2165. // value: config.refreshRate
  2166. // });
  2167. // }, 1000)
  2168. }
  2169. //监听蓝牙回调
  2170. uni.$on('updateBLEDeviceData', this.callbackUpdateBLEData);
  2171. this.onBoxingGuideFinish();
  2172. }
  2173. },
  2174. mainScroll(e) {
  2175. if (_self.toView == "addDeviceView") {
  2176. _self.toView = "";
  2177. if (!_self.bGuidePages) return;
  2178. let view = uni.createSelectorQuery().select('#addDeviceView');
  2179. view.boundingClientRect(data => {
  2180. _self.$refs.codeElfGuide.setDeviceObj(data);
  2181. }).exec();
  2182. } else if (_self.toView == "projectButtonView") {
  2183. _self.toView = "";
  2184. if (!_self.bGuidePages) return;
  2185. _self.onGetProjectView();
  2186. } else if (_self.toView == "QRDeviceView") {
  2187. _self.toView = "";
  2188. if (!_self.bGuidePages) return;
  2189. let view = uni.createSelectorQuery().select('#QRDeviceView');
  2190. view.boundingClientRect(data => {
  2191. _self.$refs.codeElfGuide.setDeviceObj(data);
  2192. }).exec();
  2193. } else if (_self.toView == "bing-boxingPost") {
  2194. _self.toView = "";
  2195. if (!_self.bGuidePages) return;
  2196. let view = uni.createSelectorQuery().select('#bing-boxingPost');
  2197. view.boundingClientRect(data => {
  2198. _self.$refs.codeElfGuide.setDeviceObj(data);
  2199. console.log(data);
  2200. }).exec();
  2201. } else if (_self.toView == "boxingHitID") {
  2202. _self.toView = "";
  2203. // let view = uni.createSelectorQuery().select('#boxingHitID');
  2204. // view.boundingClientRect(data => {
  2205. // _self.$refs.codeElfGuide.setModalObj(data);
  2206. // console.log(data);
  2207. // }).exec();
  2208. } else if (_self.toView == "openAccGyroView") {
  2209. _self.toView = "";
  2210. }
  2211. },
  2212. onGetProjectView() {
  2213. let view = uni.createSelectorQuery().select('#projectButtonView');
  2214. view.boundingClientRect(data => {
  2215. _self.$refs.codeElfGuide.setProjectObj(data);
  2216. }).exec();
  2217. },
  2218. onGetActionJumpView() {
  2219. this.$nextTick(() => {
  2220. this.toView = "actionJumpID"
  2221. });
  2222. this.toView = '' //不清空再次跳到锚点位置会不起作用
  2223. setTimeout(() => {
  2224. _self.$refs.actionJumpRef.onGetActionJumpPlayView((data) => {
  2225. console.log(JSON.stringify(data));
  2226. // #ifdef APP-PLUS
  2227. _self.showGuide('actionJumpPlay', data);
  2228. // #endif
  2229. });
  2230. }, 200)
  2231. },
  2232. onGetBluetoothConnectView(initData) {
  2233. _self.$refs.roundFabRef.onGetRoundFabView((data) => {
  2234. console.log(JSON.stringify(data), initData.firstInstallation);
  2235. // #ifdef APP-PLUS
  2236. let temp = Object.assign({}, data, initData);
  2237. console.log('当前的temp:', temp);
  2238. _self.showGuide('bluetoothConnect', temp);
  2239. // #endif
  2240. });
  2241. // let view = uni.createSelectorQuery().select('#roundFabID');
  2242. // view.boundingClientRect(data => {
  2243. // console.log(JSON.stringify(data));
  2244. // // #ifdef APP-PLUS
  2245. // _self.showGuide('bluetoothConnect', data);
  2246. // // #endif
  2247. // }).exec();
  2248. },
  2249. //拳击模块的回调
  2250. boxingUpdateCalorie(calorie) {
  2251. if (this.currentMode != 'pkMode') {
  2252. //这里调用一下设置可以播放音效
  2253. this.$refs.personalFruitRef.onCanPlay();
  2254. }
  2255. this.onUpdateCaloriePlane(calorie);
  2256. },
  2257. //扫码添加设备
  2258. openQRCode(callback) {
  2259. let that = this;
  2260. // 允许从相机和相册扫码
  2261. uni.scanCode({
  2262. success: function(res) {
  2263. // console.log('条码类型:' + res.scanType);
  2264. // console.log('条码内容:' + res.result);
  2265. let obj = JSON.parse(res.result)
  2266. let data = {
  2267. type: obj.type,
  2268. uuid: obj.uuid,
  2269. }
  2270. }
  2271. });
  2272. },
  2273. //屏幕抖动
  2274. onScreenShake() {
  2275. this.bEFHitShake = true;
  2276. setTimeout(() => {
  2277. this.bEFHitShake = false;
  2278. }, 500)
  2279. },
  2280. onGetAiRandom() {
  2281. let _self = this;
  2282. let avatarlist = AvatarConfig.getAvatarList().avatarList;
  2283. let _length = avatarlist.length;
  2284. let _index = Math.floor(Math.random() * _length);
  2285. console.log(avatarlist);
  2286. _self.aiObj.name = avatarlist[_index].name;
  2287. _self.aiObj.avatar = avatarlist[_index].url;
  2288. },
  2289. onBoxingGameOver(res) {
  2290. this.$refs.hitEffectRef.onStop();
  2291. this.onActionPause(true);
  2292. //拳击柱部分
  2293. uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
  2294. let _title = res.myWin ? "胜利" : "失败";
  2295. let _context = res.myWin ? "你已经赢得PK胜利!" : "你在PK中被打败了!";
  2296. this.modalName = "showModalTip"
  2297. this.$refs.modalTipRef.setShowData({
  2298. title: _title,
  2299. context: _context,
  2300. operationItem: null
  2301. });
  2302. },
  2303. onModalTipHide() {
  2304. this.modalName = null;
  2305. },
  2306. onModalTipConfirm(data) {
  2307. let {
  2308. type,
  2309. operationItem
  2310. } = data;
  2311. this.modalName = null;
  2312. //再来一局
  2313. //提示过关奖励
  2314. console.log('onModalTipConfirm', type, operationItem);
  2315. if (type == 'PASSTHELEVEL') {
  2316. this.showPopup('levelReward', operationItem);
  2317. }
  2318. },
  2319. onTestShare() {
  2320. uni.share({
  2321. provider: "weixin",
  2322. scene: "WXSenceTimeline",
  2323. type: 2,
  2324. imageUrl: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png",
  2325. success: function(res) {
  2326. console.log("success:" + JSON.stringify(res));
  2327. },
  2328. fail: function(err) {
  2329. console.log("fail:" + JSON.stringify(err));
  2330. }
  2331. });
  2332. },
  2333. openAcc() {
  2334. if (!this.globalAcc) {
  2335. AccAndOri.bindAcc((accId) => {
  2336. this.$store.state.globalAcc = accId;
  2337. console.log("初始化:globalAcc=", this.globalAcc);
  2338. });
  2339. }
  2340. if (!this.globalOri) {
  2341. AccAndOri.bindOri((oriId) => {
  2342. this.$store.state.globalOri = oriId;
  2343. console.log("初始化:globalOri=", this.globalOri);
  2344. });
  2345. }
  2346. },
  2347. closeAcc() {
  2348. AccAndOri.unBindAcc(this.globalAcc);
  2349. this.$store.state.globalAcc = null;
  2350. AccAndOri.unBindOri(this.globalOri);
  2351. this.$store.state.globalOri = null;
  2352. },
  2353. outGyro(o) {
  2354. console.log("Orientation\nAlpha:" + o.alpha + "\nBeta:" + o.beta + "\nGamma:" + o.gamma);
  2355. },
  2356. openGyro() {
  2357. if (!this.globalOri) {
  2358. AccAndOri.bindOri((oriId) => {
  2359. this.$store.state.globalOri = oriId;
  2360. console.log("初始化:globalOri=", this.globalOri);
  2361. });
  2362. }
  2363. uni.$on('watchOrientation', this.outGyro);
  2364. },
  2365. stopGyro() {
  2366. uni.$off('watchOrientation', this.outGyro);
  2367. AccAndOri.unBindOri(this.globalOri);
  2368. this.$store.state.globalOri = null;
  2369. },
  2370. onKeyInput: function(event) {
  2371. this.$store.state.LocationGameUrl = event.target.value
  2372. },
  2373. onNavFcGame() {
  2374. // console.log(0);
  2375. uni.navigateTo({
  2376. url: "../../fc-page/fc/fc"
  2377. })
  2378. },
  2379. onNavAppInfo() {
  2380. uni.navigateTo({
  2381. url: '../../info-page/app-info/app-info'
  2382. })
  2383. },
  2384. getBLEDeviceServices() {
  2385. console.log("getBLEDeviceServices");
  2386. // uni.getBLEDeviceServices({
  2387. // deviceId: "C5:5C:19:04:00:30",
  2388. // success: res => {
  2389. // console.log("getBLEDeviceServices==", JSON.stringify(res));
  2390. // },
  2391. // fail: failRes => {
  2392. // console.log('device services:', failRes)
  2393. // }
  2394. // });
  2395. },
  2396. // testAsyncFunc() {
  2397. // // 调用异步方法
  2398. // testModule.testAsyncFunc({
  2399. // 'name': 'unimp',
  2400. // 'age': 1
  2401. // },
  2402. // (ret) => {
  2403. // modal.toast({
  2404. // message: ret,
  2405. // duration: 1.5
  2406. // });
  2407. // })
  2408. // },
  2409. // startSyncFunc() {
  2410. // // 调用同步方法
  2411. // var ret = testModule.onStartAccAndGyro({
  2412. // 'name': 'unimp',
  2413. // 'age': 1
  2414. // })
  2415. // modal.toast({
  2416. // message: ret,
  2417. // duration: 1.5
  2418. // });
  2419. // },
  2420. // stopSyncFunc() {
  2421. // // 调用同步方法
  2422. // var ret = testModule.onStopAccAndGyro({
  2423. // 'name': 'unimp',
  2424. // 'age': 1
  2425. // })
  2426. // modal.toast({
  2427. // message: ret,
  2428. // duration: 1.5
  2429. // });
  2430. // },
  2431. onNavToSelectFriend() {
  2432. uni.navigateTo({
  2433. url: '../../friend-page/select/select'
  2434. })
  2435. },
  2436. /**
  2437. * 悬停按钮
  2438. */
  2439. fabClick() {
  2440. //如果第一次点击悬停按钮
  2441. // if (this.guideUnlockState.firstDisconnectBluetooth) {
  2442. // this.onGetBluetoothConnectView({
  2443. // hiddenType: 'firstDisconnectBluetooth'
  2444. // });
  2445. // let guideUnlockState = Object.assign(this.guideUnlockState, {
  2446. // firstDisconnectBluetooth: false
  2447. // });
  2448. // this.setGuideUnlockState(guideUnlockState);
  2449. // return;
  2450. // }
  2451. if (this.cIndex != -1 && this.BLEConnectDevice != null) {
  2452. //先检测
  2453. uni.showModal({
  2454. title: '设备状态',
  2455. content: '是否断开连接?',
  2456. /**
  2457. * 如果需要强制,不显示取消按钮
  2458. */
  2459. showCancel: true,
  2460. ConfirmColor: '#A488DC',
  2461. success: res => {
  2462. if (res.confirm) {
  2463. this.onCloseBLEConnection({
  2464. getSuccess: () => {}
  2465. });
  2466. }
  2467. }
  2468. });
  2469. } else {
  2470. this.openDeviceList();
  2471. }
  2472. },
  2473. /**
  2474. * action 模块相关数据更新,实时更新
  2475. */
  2476. onActionJumpDataUpdate(obj) {
  2477. // console.log(obj);
  2478. this.AJData.allCount = obj.eliminationCount + obj.faultCount;
  2479. this.AJData.faultCount = obj.faultCount;
  2480. //如果pk模式下,区分两个人的分数
  2481. if (this.currentMode == "pkMode") {
  2482. if (this.AJData.isLeftPlayer) {
  2483. this.AJData.myScore = obj.eliminationCount - obj.faultCount;
  2484. } else {
  2485. this.AJData.otherScore = obj.eliminationCount - obj.faultCount;
  2486. }
  2487. }
  2488. // console.log(this.AJData.myUsageTime, this.AJData.otherUsageTime);
  2489. },
  2490. onActionJumpCountDownUpdate(obj) {
  2491. // this.AJData.perCountDown = obj.countDown;
  2492. if (this.currentMode == "pkMode") {
  2493. if (this.AJData.isLeftPlayer) {
  2494. this.AJData.myUsageTime = this.AJData.gameLimitTime - this.AJData.gameCountDown;
  2495. } else {
  2496. this.AJData.otherUsageTime = this.AJData.gameLimitTime - this.AJData.gameCountDown;
  2497. }
  2498. }
  2499. // console.log(this.AJData.myUsageTime, this.AJData.otherUsageTime, this.AJData.gameLimitTime);
  2500. },
  2501. //actionJump 模块跳关卡开始处理
  2502. onActionJumpPlay() {
  2503. //开始时候,设置默认参数
  2504. if (this.AJData.isFinish) {
  2505. //如果下一局,重新设置一下默认参数
  2506. this.onResetDefaultActionJumpData();
  2507. }
  2508. this.onSetActionJumpData();
  2509. this.$refs.actionJumpRef.onActionJumpPlay();
  2510. this.bGamePlaying = true;
  2511. //todo 首先判断时间处理
  2512. if (0 !== this.currentJumpTask.item.limitTime) {
  2513. //0默认不限时,所以限时的才走计时间
  2514. this.arcbarCountDownPlay(true);
  2515. }
  2516. },
  2517. //重置actionJump数据
  2518. onResetDefaultActionJumpData() {
  2519. this.AJData = Object.assign({}, this.defaultAJData);
  2520. },
  2521. onSetActionJumpData() {
  2522. let _item = this.currentJumpTask.item;
  2523. //这里set只是对应关卡的数据
  2524. this.AJData = Object.assign({}, this.AJData, {
  2525. allCount: 0,
  2526. faultCount: 0,
  2527. perCountDown: 0,
  2528. gameCountDown: 0,
  2529. gameLimitTime: _item.limitTime,
  2530. targetCount:_item.signCount,
  2531. })
  2532. // console.log('onSetActionJumpData'+JSON.stringify(this.AJData)+JSON.stringify(_item));
  2533. },
  2534. onActionJumpGameOver(data) {
  2535. let {
  2536. isOffEvent = false
  2537. } = data;
  2538. if (isOffEvent) {
  2539. //停止蓝牙加速计
  2540. this.onWriteBLEConnectionValue({
  2541. value: "4"
  2542. });
  2543. uni.$off('updateBLEDeviceData', this.callbackUpdateBLEData);
  2544. console.log('onActionJumpGameOver 任务结束');
  2545. this.bGamePlaying = false;
  2546. }
  2547. //游戏结束,重置时间
  2548. this.arcbarCountDownTimeReset();
  2549. //todo 可能区分 levelJump 关卡类型
  2550. if (this.currentMode == "pkMode") {
  2551. //pk模式下面
  2552. if (this.AJData.isLeftPlayer) {
  2553. //如果是左边的.切换下一个玩家
  2554. this.AJData.isLeftPlayer = false;
  2555. uni.showModal({
  2556. title: '切换下一个玩家',
  2557. showCancel: false,
  2558. success: (res) => {
  2559. if (res.confirm) {
  2560. //重新开始计算
  2561. this.onActionJumpPlay();
  2562. }
  2563. }
  2564. })
  2565. } else {
  2566. this.AJData.isFinish = true;
  2567. //奖励赢的人 PKLEVELREWARD
  2568. let _item = this.currentJumpTask.item;
  2569. let _curFriend = this.finallySelectFriendInfo;
  2570. console.log('this.finallySelectFriendInfo:', this.finallySelectFriendInfo);
  2571. let isMyWin = true;
  2572. //如果是右边好友,即判断结束。计算胜负关系
  2573. if (this.AJData.myScore > this.AJData.otherScore) {
  2574. //规定时间内,跳得最多
  2575. // uni.showToast({
  2576. // title: '我赢!!',
  2577. // duration: 2000
  2578. // })
  2579. isMyWin = true;
  2580. //显示一个提示框
  2581. this.showPopup('pkFinish', {
  2582. name: this.username,
  2583. url: this.avatarUrl,
  2584. score: this.AJData.myScore,
  2585. consumeTime: Math.abs(this.AJData.myUsageTime),
  2586. hit: this.AJData.allCount - this.AJData.faultCount,
  2587. miss: this.AJData.faultCount
  2588. });
  2589. console.log({
  2590. name: this.username,
  2591. url: this.avatarUrl,
  2592. score: this.AJData.myScore,
  2593. consumeTime: Math.abs(this.AJData.myUsageTime),
  2594. hit: this.AJData.allCount - this.AJData.faultCount,
  2595. miss: this.AJData.faultCount
  2596. });
  2597. } else {
  2598. // uni.showToast({
  2599. // title: '好友赢或者平局',
  2600. // duration: 2000
  2601. // })
  2602. isMyWin = false;
  2603. //显示一个提示框
  2604. this.showPopup('pkFinish', {
  2605. name: _curFriend.username,
  2606. url: _curFriend.avatarUrl,
  2607. score: this.AJData.otherScore,
  2608. consumeTime: this.AJData.otherUsageTime,
  2609. hit: this.AJData.allCount - this.AJData.faultCount,
  2610. miss: this.AJData.faultCount
  2611. });
  2612. }
  2613. reqUtil
  2614. .requestData(config.URL.PKLEVELREWARD, {
  2615. levelId: _item.id,
  2616. levelType: 1,
  2617. isMyWin: isMyWin,
  2618. friendId: _curFriend.friendId
  2619. })
  2620. .then(
  2621. res => {
  2622. if (res.code == 0) {
  2623. console.log('PKLEVELREWARD:' + JSON.stringify(res.data));
  2624. this.nextTaskCanUnlock = false;
  2625. for (let i = 0; i < this.currentTaskList.length; i++) {
  2626. if (this.currentTaskList[i].id == _item.id) {
  2627. this.currentTaskList[i].isPassed = true;
  2628. break;
  2629. }
  2630. }
  2631. if (isMyWin) {
  2632. //只有isMyWin的情况下才有这两个字段返回,更新本地金币和钻石
  2633. this.setGoldAndDiamond({
  2634. gold: res.data.gold,
  2635. diamond: res.data.diamond
  2636. });
  2637. }
  2638. }
  2639. },
  2640. e => {
  2641. console.log(e);
  2642. }
  2643. );
  2644. }
  2645. } else {
  2646. this.AJData.isFinish = true;
  2647. if (data.myWin) {
  2648. //通过关卡,处理逻辑
  2649. let _item = this.currentJumpTask.item;
  2650. reqUtil
  2651. .requestData(config.URL.PASSTHELEVEL, {
  2652. levelId: _item.id,
  2653. levelType: 1,
  2654. })
  2655. .then(
  2656. res => {
  2657. if (res.code == 0) {
  2658. console.log('PASSTHELEVEL:' + JSON.stringify(res.data));
  2659. //处理 列表数据
  2660. this.nextTaskCanUnlock = false;
  2661. for (let i = 0; i < this.currentTaskList.length; i++) {
  2662. if (this.currentTaskList[i].id == _item.id) {
  2663. this.currentTaskList[i].isPassed = true;
  2664. break;
  2665. }
  2666. }
  2667. let _title = data.myWin ? "胜利" : "失败";
  2668. let _context = data.myWin ? "通关关卡成功!" : "通关关卡失败!";
  2669. this.modalName = "showModalTip"
  2670. if (0 !== res.data.rewardHonor.type || 0 !== res.data.rewardGold || 0 !== res.data
  2671. .rewardDiamond) {
  2672. //todo
  2673. this.$refs.modalTipRef.setShowData({
  2674. title: _title,
  2675. context: _context,
  2676. operationItem: res.data,
  2677. type: 'PASSTHELEVEL'
  2678. });
  2679. //存在任何奖励的情况下直接更新一下返回的金币和钻石数据
  2680. this.setGoldAndDiamond({
  2681. gold: res.data.gold,
  2682. diamond: res.data.diamond
  2683. });
  2684. } else {
  2685. //没有奖励数据
  2686. this.$refs.modalTipRef.setShowData({
  2687. title: _title,
  2688. context: _context,
  2689. operationItem: null,
  2690. type: 'none'
  2691. });
  2692. }
  2693. }
  2694. },
  2695. e => {
  2696. console.log(e);
  2697. }
  2698. );
  2699. }
  2700. }
  2701. },
  2702. showDrawer() {
  2703. this.showDrawerById();
  2704. },
  2705. showPopup(type, item) {
  2706. this.showPopupById({
  2707. type,
  2708. item
  2709. });
  2710. },
  2711. showGuide(type, item) {
  2712. this.showGuideById({
  2713. type,
  2714. item
  2715. });
  2716. },
  2717. /**
  2718. * 任务相关
  2719. */
  2720. selectTask(_index, _item) {
  2721. // console.log(JSON.stringify(_item));
  2722. if (_item.isUnlock) {
  2723. let _data = {
  2724. modeName: this.currentMode, //记录时候记录当前的mode
  2725. index: _index,
  2726. item: _item,
  2727. }
  2728. //记录临时选择的游戏关卡
  2729. this.tempSelectedLevel = _data;
  2730. } else {
  2731. let isCanUnlock = _index == 0 || (_index >= 1 && this.currentTaskList[_index - 1].isUnlock && this
  2732. .currentTaskList[_index - 1].isPassed) ? true : false;
  2733. if (!isCanUnlock) return;
  2734. this.showPopup('unlock', _item);
  2735. }
  2736. },
  2737. updateTaskScroll() {
  2738. /**
  2739. * 获取任务对象
  2740. */
  2741. this.getActionJumpTask();
  2742. //console.error('当前的任务对象===========:' + JSON.stringify(this.currentJumpTask.modeName) + '= '+this.currentMode);
  2743. if (this.currentJumpTask != null && this.currentJumpTask.modeName == this.currentMode) {
  2744. let _index = this.currentJumpTask.index - 1 < 0 ? 0 : this.currentJumpTask.index - 1;
  2745. this.$nextTick(() => {
  2746. this.taskIntoView = "task_" + _index;
  2747. });
  2748. this.taskIntoView = '' //不清空再次跳到锚点位置会不起作用
  2749. }
  2750. },
  2751. switchTaskInfo() {
  2752. if (this.currentMode == 'calorieMode') {
  2753. this.currentTaskList = this.singlePersonList;
  2754. } else if (this.currentMode == 'pkMode') {
  2755. this.currentTaskList = this.multiPersonList;
  2756. }
  2757. },
  2758. onSwitchMode() {
  2759. if (this.currentMode == 'calorieMode') {
  2760. this.currentMode = 'pkMode';
  2761. } else if (this.currentMode == 'pkMode') {
  2762. this.currentMode = 'calorieMode';
  2763. }
  2764. this.switchTaskInfo();
  2765. },
  2766. /**
  2767. * @deprecated Test 测试通过关卡
  2768. */
  2769. onPassTheLevel() {
  2770. if (this.currentMode == "pkMode") {
  2771. this.AJData.myScore = 10;
  2772. this.AJData.isLeftPlayer = false;
  2773. }
  2774. this.onActionJumpGameOver({
  2775. myWin: true
  2776. });
  2777. },
  2778. //确认时候选择按钮
  2779. onConfirmSelectionLevel() {
  2780. if (this.tempSelectedLevel == null) {
  2781. uni.showToast({
  2782. icon: 'none',
  2783. title: '先选择一个挑战关卡',
  2784. mask: true
  2785. })
  2786. return;
  2787. }
  2788. //点击确认时候,记录关卡,并且开始游戏
  2789. this.setActionJumpTask(this.tempSelectedLevel);
  2790. this.hideModal();
  2791. setTimeout(() => {
  2792. // 自动调用开始游戏
  2793. this.onPersonalCheck({
  2794. bStartCountDown: true
  2795. });
  2796. }, 300);
  2797. },
  2798. registerPopupEvent() {
  2799. // 接收 popup 的消息
  2800. uni.$on('reward-popup-page', (data) => {
  2801. switch (data.type) {
  2802. case 'interactive':
  2803. uni.showModal({
  2804. title: '来自Popup的消息',
  2805. content: data.info
  2806. })
  2807. break;
  2808. case 'button':
  2809. if (data.messageType == 'prompt') {
  2810. if (data.confirm) {
  2811. console.log('prompt confirm!');
  2812. } else if (data.cancel) {
  2813. }
  2814. } else if (data.messageType == 'unlock') {
  2815. if (data.confirm) {
  2816. let _operationItem = data.operationItem;
  2817. console.log('unlock confirm!', _operationItem);
  2818. uni.showToast({
  2819. title: '正在解锁',
  2820. icon: 'loading',
  2821. duration: 10000
  2822. })
  2823. //todo 处理解锁流程
  2824. reqUtil
  2825. .requestData(config.URL.UNLOCKLEVEL, {
  2826. levelId: _operationItem.id,
  2827. levelType: 1, //levelJump = 1
  2828. numberType: _operationItem.numberType,
  2829. })
  2830. .then(
  2831. res => {
  2832. uni.hideToast();
  2833. console.log('UNLOCKLEVEL:' + JSON.stringify(res));
  2834. if (res.code === 404) {
  2835. uni.showToast({
  2836. title: '金币不足',
  2837. icon: 'none',
  2838. duration: 1000
  2839. })
  2840. } else if (res.code === 405) {
  2841. uni.showToast({
  2842. title: '钻石不足',
  2843. icon: 'none',
  2844. duration: 1000
  2845. })
  2846. } else if (res.code === 0) {
  2847. //解锁成功
  2848. uni.showToast({
  2849. title: '解锁成功',
  2850. icon: 'none',
  2851. duration: 1000
  2852. })
  2853. //更新本地金币和钻石
  2854. this.setGoldAndDiamond({
  2855. gold: res.data.gold,
  2856. diamond: res.data.diamond
  2857. });
  2858. for (let i = 0; i < this.currentTaskList.length; i++) {
  2859. if (this.currentTaskList[i].id == _operationItem.id) {
  2860. this.currentTaskList[i].isUnlock = true;
  2861. break;
  2862. }
  2863. }
  2864. } else if (res.code === 803) {
  2865. if (res.data.length > 0) {
  2866. uni.showToast({
  2867. title: '需要' + res.data[0].explain,
  2868. icon: 'none',
  2869. duration: 2000
  2870. })
  2871. } else {
  2872. uni.showToast({
  2873. title: '关卡条件关联未设置',
  2874. icon: 'none',
  2875. duration: 2000
  2876. })
  2877. }
  2878. } else if (res.code === 802 || res.code === 805) {
  2879. uni.showToast({
  2880. title: res.msg,
  2881. icon: 'none',
  2882. duration: 2000
  2883. })
  2884. }
  2885. },
  2886. e => {
  2887. console.log(e);
  2888. }
  2889. );
  2890. }
  2891. } else if (data.messageType == 'signIn') {
  2892. this.onUserSignIn();
  2893. }
  2894. break;
  2895. default:
  2896. uni.showToast({
  2897. title: data.title,
  2898. })
  2899. break;
  2900. }
  2901. })
  2902. // 监听 drawer 消息
  2903. uni.$on('drawer-page', (data) => {
  2904. uni.showToast({
  2905. title: '点击了第' + data + '项',
  2906. icon: "none"
  2907. });
  2908. })
  2909. uni.$on('guide-popup-page', (data) => {
  2910. console.log('guide-popup-page', JSON.stringify(data));
  2911. switch (data.type) {
  2912. case 'button':
  2913. if (data.messageType == 'plan') {
  2914. if (data.confirm) {
  2915. //首次安装
  2916. if (data.hiddenType == 'firstInstallation') {
  2917. //跳转提示连接手柄蓝牙
  2918. setTimeout(() => {
  2919. this.onGetBluetoothConnectView({
  2920. hiddenType: 'firstInstallation'
  2921. });
  2922. }, 60)
  2923. console.log('提示连接手柄')
  2924. }
  2925. }
  2926. } else if (data.messageType == 'bluetoothConnect') {
  2927. if (data.confirm) {
  2928. //跳转播放
  2929. // this.onGetActionJumpView();
  2930. //首次安装
  2931. if (data.hiddenType == 'firstInstallation') {
  2932. setTimeout(() => {
  2933. // this.showGuide('device-tip', {
  2934. // hiddenType: 'firstInstallation'
  2935. // });
  2936. this.showGuide('level-button-tip', {
  2937. hiddenType: 'firstInstallation'
  2938. });
  2939. console.log('提示连接关卡')
  2940. }, 60)
  2941. } else if (data.hiddenType == 'firstDisconnectBluetooth') {
  2942. this.fabClick();
  2943. }
  2944. }
  2945. } else if (data.messageType == 'actionJumpPlay') {
  2946. if (data.confirm) {
  2947. }
  2948. } else if (data.messageType == 'device-tip') {
  2949. if (data.confirm) {
  2950. if (data.hiddenType == 'firstInstallation') {
  2951. setTimeout(() => {
  2952. this.showGuide('level-button-tip', {
  2953. hiddenType: 'firstInstallation'
  2954. });
  2955. }, 60)
  2956. }
  2957. }
  2958. } else if (data.messageType == 'level-button-tip') {
  2959. if (data.confirm) {
  2960. }
  2961. }
  2962. break;
  2963. case 'selected':
  2964. console.log('当前操作的类型 selected:', data.messageType)
  2965. if (data.messageType == 'level-button-tip') {
  2966. if (data.isSelected) {
  2967. uni.setStorage({
  2968. key: 'levelButtonPrompt',
  2969. data: {
  2970. isSelected: true
  2971. }
  2972. })
  2973. //如果选择不提示。则隐藏按钮
  2974. this.$refs.actionJumpRef.onUpdateTipLevelValue(false);
  2975. } else {
  2976. uni.setStorage({
  2977. key: 'levelButtonPrompt',
  2978. data: {
  2979. isSelected: false
  2980. }
  2981. })
  2982. //如果选择提示。则显示按钮
  2983. this.$refs.actionJumpRef.onUpdateTipLevelValue(true);
  2984. }
  2985. } else if (data.messageType == 'device-tip') {
  2986. if (data.isSelected) {
  2987. uni.setStorage({
  2988. key: 'deviceDirectionPrompt',
  2989. data: {
  2990. isSelected: true
  2991. }
  2992. })
  2993. //todo 后续处理是否自动提示,true就不自动提示
  2994. } else {
  2995. uni.setStorage({
  2996. key: 'deviceDirectionPrompt',
  2997. data: {
  2998. isSelected: false
  2999. }
  3000. })
  3001. //todo 后续处理是否自动提示,false就自动提示
  3002. }
  3003. }
  3004. break;
  3005. default:
  3006. uni.showToast({
  3007. title: data.title,
  3008. })
  3009. break;
  3010. }
  3011. })
  3012. },
  3013. unregisterPopupEvent() {
  3014. uni.$off('reward-popup-page')
  3015. uni.$off('drawer-page')
  3016. uni.$off('guide-popup-page')
  3017. },
  3018. onNavToDirection() {
  3019. uni.navigateTo({
  3020. url: '../directionOfDetection/directionOfDetection'
  3021. })
  3022. },
  3023. moveBoxingHandle() {
  3024. return;
  3025. },
  3026. /**
  3027. * 提示打开关卡
  3028. */
  3029. onTipLevel(value) {
  3030. // #ifdef APP-PLUS
  3031. this.showGuide('level-button-tip', value);
  3032. // #endif
  3033. // #ifdef H5
  3034. console.warn("不支持nvue");
  3035. // #endif
  3036. },
  3037. onShowFirstInstallation() {
  3038. //第一次安装登录。提示 计划
  3039. this.showGuide('plan', {
  3040. hiddenType: 'firstInstallation'
  3041. });
  3042. console.log("guideUnlockState 1=============:", this.guideUnlockState);
  3043. let guideUnlockState = Object.assign(this.guideUnlockState, {
  3044. firstInstallation: false
  3045. });
  3046. this.setGuideUnlockState(guideUnlockState);
  3047. }
  3048. }
  3049. };
  3050. </script>
  3051. <style>
  3052. .bg-person {
  3053. /* background-color: #9797ff; */
  3054. background-color: #00003D;
  3055. /* #ifdef H5 */
  3056. /* background-size:750rpx 1622rpx;
  3057. background-image: url(../../../static/modal/action-jump/temp-tip.png); */
  3058. /* #endif */
  3059. }
  3060. .plan-view {
  3061. overflow: hidden;
  3062. /* background-color: #9797ff; */
  3063. }
  3064. .plan-l-tip-view {
  3065. border-radius: 80upx 0 0 80upx;
  3066. background-color: rgba(255, 255, 255, 0.05);
  3067. }
  3068. .plan-r-tip-view {
  3069. border-radius: 0 80upx 80upx 0;
  3070. background-color: rgba(255, 255, 255, 0.05);
  3071. }
  3072. .bottom-view {
  3073. background-color: rgba(246, 243, 249, 255);
  3074. padding-bottom: 20rpx;
  3075. border-radius: 80rpx 80rpx 0 0;
  3076. width: 750rpx;
  3077. overflow: hidden;
  3078. }
  3079. .time-view {
  3080. width: 100%;
  3081. margin-top: 53rpx;
  3082. /* border: 1rpx solid #DD514C; */
  3083. }
  3084. /*样式的width和height一定要与定义的cWidth和cHeight相对应*/
  3085. .qiun-charts-arcbar {
  3086. height: 376rpx;
  3087. position: relative;
  3088. width: 750rpx;
  3089. /* border: 1rpx solid #fff; */
  3090. background-color: RGBA(30, 30, 85, 1);
  3091. }
  3092. .charts-arcbar {
  3093. position: absolute;
  3094. /* margin-left: 81upx;
  3095. */
  3096. left: 0;
  3097. right: 0;
  3098. top: 0;
  3099. bottom: 0;
  3100. margin: auto;
  3101. width: 490rpx;
  3102. height: 480rpx;
  3103. /* border: 1rpx solid #FFFFFF; */
  3104. }
  3105. .charts-arcbar-img {
  3106. position: absolute;
  3107. left: 135upx;
  3108. width: 480upx;
  3109. height: 480upx;
  3110. }
  3111. .charts-pring-bottom {
  3112. position: relative;
  3113. width: 100%;
  3114. display: flex;
  3115. flex-direction: column;
  3116. justify-content: center;
  3117. align-items: center;
  3118. }
  3119. .charts-pring-button {
  3120. width: 178rpx;
  3121. height: 64rpx;
  3122. display: flex;
  3123. flex-direction: row;
  3124. justify-content: start;
  3125. align-items: center;
  3126. border-radius: 0 25px 25px 0;
  3127. }
  3128. /* 心电图 */
  3129. /* .qiun-charts-elect {
  3130. width: 500rpx;
  3131. height: 136rpx;
  3132. } */
  3133. .charts-elect {
  3134. width: 464rpx;
  3135. height: 96rpx;
  3136. border: 1rpx solid #000000;
  3137. }
  3138. .e-button {
  3139. background-color: rgba(255, 255, 255, 0.25);
  3140. border-radius: 45px;
  3141. margin: 5px 12px;
  3142. box-shadow: 1px 1px 3px #888888;
  3143. display: flex;
  3144. justify-content: center;
  3145. }
  3146. /* 曲线图 */
  3147. .qiun-charts-area {
  3148. width: calc(750rpx - 40rpx);
  3149. height: 300upx;
  3150. /* background-color: #007AFF; */
  3151. position: relative;
  3152. }
  3153. .charts-area {
  3154. position: absolute;
  3155. width: 750upx;
  3156. height: 300upx;
  3157. }
  3158. .qiun-charts-bottom-container {
  3159. height: 63px;
  3160. position: relative;
  3161. width: 100%;
  3162. justify-content: center;
  3163. align-items: center;
  3164. display: flex;
  3165. flex-direction: row;
  3166. }
  3167. .qiun-charts-bottom-right {
  3168. position: absolute;
  3169. left: calc(50% + 50rpx);
  3170. top: 15px;
  3171. margin-left: 20rpx;
  3172. }
  3173. /* picker */
  3174. .mpvue-picker-view {
  3175. width: calc(50% - 5px);
  3176. height: 300px;
  3177. /* background-color: rgba(255, 255, 255, 1); */
  3178. border-radius: 20px;
  3179. }
  3180. .item {
  3181. text-align: center;
  3182. width: calc(100% - 0px);
  3183. background-color: rgba(255, 255, 255, 1);
  3184. height: 88upx;
  3185. line-height: 88upx;
  3186. text-overflow: ellipsis;
  3187. white-space: nowrap;
  3188. font-size: 40upx;
  3189. }
  3190. .picker-unit {
  3191. position: absolute;
  3192. right: 70px;
  3193. top: 43%;
  3194. }
  3195. .left-button,
  3196. .right-button {
  3197. margin: 20px 0;
  3198. padding: 10px 30px;
  3199. background-color: #ffffff;
  3200. }
  3201. .left-button {
  3202. border-top-left-radius: 20px;
  3203. border-bottom-left-radius: 20px;
  3204. border-right: 1px solid #e6e6e6;
  3205. }
  3206. .right-button {
  3207. border-top-right-radius: 20px;
  3208. border-bottom-right-radius: 20px;
  3209. }
  3210. .png-size-28 {
  3211. width: 24px;
  3212. height: 24px;
  3213. margin-bottom: 4px;
  3214. }
  3215. .png-size-32 {
  3216. width: 32px;
  3217. height: 32px;
  3218. }
  3219. .png-size-34 {
  3220. width: 34px;
  3221. height: 34px;
  3222. }
  3223. /* 图标大小 */
  3224. .data-play {
  3225. width: 16px;
  3226. height: 16px;
  3227. margin-top: 10rpx;
  3228. }
  3229. .p-data-png {
  3230. width: 16px;
  3231. height: 16px;
  3232. margin: 5rpx 20rpx;
  3233. }
  3234. .data-png {
  3235. width: 16px;
  3236. height: 16px;
  3237. margin: 5rpx;
  3238. }
  3239. .data-png-20 {
  3240. width: 20px;
  3241. height: 20px;
  3242. margin: 0 14rpx;
  3243. }
  3244. .data-png-54 {
  3245. width: 54px;
  3246. height: 54px;
  3247. margin: 0 14rpx;
  3248. }
  3249. .data-png-add {
  3250. position: absolute;
  3251. left: 0;
  3252. top: 0;
  3253. right: 0;
  3254. bottom: 0;
  3255. margin: auto;
  3256. width: 34px;
  3257. height: 37px;
  3258. }
  3259. .time-container {
  3260. margin-top: 13px;
  3261. width: 100%;
  3262. height: 218rpx;
  3263. position: relative;
  3264. /* border: 1rpx solid #007AFF; */
  3265. }
  3266. .time-png {
  3267. width: 503rpx;
  3268. height: 222rpx;
  3269. position: absolute;
  3270. left: 0;
  3271. right: 0;
  3272. top: 0;
  3273. bottom: 0;
  3274. margin: auto;
  3275. z-index: 1;
  3276. }
  3277. .time-text {
  3278. font-size: 9px;
  3279. z-index: 10;
  3280. position: relative;
  3281. height: 100%;
  3282. display: flex;
  3283. justify-content: center;
  3284. align-items: center;
  3285. color: #FFFFFF;
  3286. }
  3287. .padding {
  3288. padding: 10rpx;
  3289. }
  3290. .logo {
  3291. height: 200rpx;
  3292. width: 200rpx;
  3293. margin-top: 200rpx;
  3294. margin-left: auto;
  3295. margin-right: auto;
  3296. margin-bottom: 50rpx;
  3297. }
  3298. .float-png {
  3299. position: absolute;
  3300. right: 15px;
  3301. bottom: 200px;
  3302. width: 56px;
  3303. height: 56px;
  3304. }
  3305. .moveCanvas {
  3306. position: fixed;
  3307. top: 9999rpx;
  3308. left: 0;
  3309. width: 188rpx;
  3310. height: 188rpx;
  3311. }
  3312. .scroll-class {
  3313. width: 100%;
  3314. overflow-x: hidden;
  3315. box-sizing: border-box;
  3316. /* border: 1rpx solid #000000; */
  3317. }
  3318. .homepage-grid-square {
  3319. width: 250rpx;
  3320. /* height: 250rpx; */
  3321. align-items: start;
  3322. }
  3323. .homepage-grid-square image {
  3324. width: 176rpx;
  3325. height: 176rpx;
  3326. }
  3327. .border {
  3328. /* width: 176rpx; */
  3329. font-size: 30rpx;
  3330. color: rgba(175, 175, 175, 1);
  3331. font-weight: 400;
  3332. text-align: center;
  3333. margin-top: 22rpx;
  3334. margin-bottom: 40rpx;
  3335. }
  3336. .item-img {
  3337. border-radius: 20rpx;
  3338. /* border: 1rpx solid #EEEEEE; */
  3339. box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23);
  3340. }
  3341. .plan-Tip-child {
  3342. height: 120rpx;
  3343. }
  3344. .plan-mode-tip {
  3345. height: 90rpx;
  3346. }
  3347. .plan-grid-square {
  3348. width: 250rpx;
  3349. /* height: 250rpx; */
  3350. align-items: start;
  3351. }
  3352. .plan-grid-square image {
  3353. width: 168rpx;
  3354. height: 58rpx;
  3355. }
  3356. .plan-mode {
  3357. /* height: 54px; */
  3358. border-radius: 10px;
  3359. padding: 3px;
  3360. margin: 0 5px 10px 5px;
  3361. border: 1rpx solid #eeeeee;
  3362. /* box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23); */
  3363. position: relative;
  3364. }
  3365. .plan-mode-selected {
  3366. /* height: 54px; */
  3367. padding: 3px;
  3368. margin: 0 5px 10px 5px;
  3369. background-size: contain;
  3370. background-clip: border-box;
  3371. background-repeat: no-repeat;
  3372. background-image: url(../../../static/plan-select-bg.png);
  3373. /* box-shadow: 0px 1px 2px 0px rgba(113, 113, 219, 0.23); */
  3374. position: relative;
  3375. }
  3376. .plan-mode-border {
  3377. /* width: 176rpx; */
  3378. font-size: 26rpx;
  3379. color: rgba(151, 151, 255, 1);
  3380. font-weight: 400;
  3381. text-align: center;
  3382. }
  3383. .button-fav {
  3384. background-color: rgba(153, 150, 252, 255);
  3385. color: #ffffff;
  3386. /* border-radius: 10px; */
  3387. /* width: 184rpx; */
  3388. height: 122rpx;
  3389. display: flex;
  3390. justify-content: center;
  3391. text-align: center;
  3392. align-items: center;
  3393. font-size: 14px;
  3394. }
  3395. .card-view-small {
  3396. /* border: 1rpx solid #000000; */
  3397. width: 80%;
  3398. border-radius: 20px;
  3399. margin-left: 50rpx;
  3400. overflow: hidden;
  3401. background-color: #ffffff;
  3402. box-shadow: 0px 2px 4px 0px rgba(113, 113, 219, 0.23);
  3403. }
  3404. .right-bg {
  3405. /* border: 1rpx solid #000000; */
  3406. border-radius: 8px;
  3407. background-color: #9797ff;
  3408. padding: 15rpx;
  3409. position: absolute;
  3410. right: 5%;
  3411. margin-top: 4%;
  3412. }
  3413. .plan-small-child {
  3414. background-color: #f5f5ff;
  3415. border-radius: 20px;
  3416. width: 480rpx;
  3417. height: 90rpx;
  3418. margin: 0 0 30rpx 30rpx;
  3419. /* margin-top: 60rpx; */
  3420. }
  3421. .cu-btn-plan {
  3422. position: relative;
  3423. border: 0upx;
  3424. display: inline-flex;
  3425. align-items: center;
  3426. justify-content: center;
  3427. box-sizing: border-box;
  3428. padding: 4upx 25upx 4upx 4upx;
  3429. margin-left: 5px;
  3430. font-size: 22upx;
  3431. height: 64upx;
  3432. line-height: 1;
  3433. text-align: center;
  3434. text-decoration: none;
  3435. overflow: visible;
  3436. margin-left: initial;
  3437. transform: translate(0upx, 0upx);
  3438. margin-right: initial;
  3439. }
  3440. .cu-btn-plan-child {
  3441. position: relative;
  3442. border: 0upx;
  3443. display: inline-flex;
  3444. align-items: center;
  3445. justify-content: center;
  3446. box-sizing: border-box;
  3447. padding: 0 4upx;
  3448. font-size: 22upx;
  3449. height: 56upx;
  3450. line-height: 1;
  3451. text-align: center;
  3452. text-decoration: none;
  3453. overflow: visible;
  3454. margin-left: initial;
  3455. transform: translate(0upx, 0upx);
  3456. margin-right: initial;
  3457. }
  3458. .cu-btn-plan-right {
  3459. position: relative;
  3460. border: 0upx;
  3461. display: inline-flex;
  3462. align-items: center;
  3463. justify-content: center;
  3464. box-sizing: border-box;
  3465. padding: 4upx 4upx 4upx 19upx;
  3466. margin-left: 5px;
  3467. font-size: 22upx;
  3468. height: 64upx;
  3469. line-height: 1;
  3470. text-align: center;
  3471. text-decoration: none;
  3472. overflow: visible;
  3473. margin-left: initial;
  3474. transform: translate(0upx, 0upx);
  3475. margin-right: initial;
  3476. }
  3477. /* 粗线条 */
  3478. .line-make {
  3479. margin-top: 11px;
  3480. margin-left: 8px;
  3481. border: 4rpx solid #FFFFFF;
  3482. width: 152rpx;
  3483. border-radius: 3px;
  3484. }
  3485. /* 头像背景处理 */
  3486. .avatar-bg-personal {
  3487. width: 34px;
  3488. height: 34px;
  3489. border-radius: 45px;
  3490. border: 2px solid #9997fc;
  3491. background-color: #9997fc;
  3492. box-sizing: border-box;
  3493. }
  3494. .avatar-bg-arrow {
  3495. position: absolute;
  3496. top: 12px;
  3497. left: calc(50% - 10px);
  3498. border-left: 10px solid transparent;
  3499. border-right: 10px solid transparent;
  3500. border-bottom: 10px solid #9997fc;
  3501. }
  3502. .elect-round-image {
  3503. width: 48px;
  3504. height: 48px;
  3505. z-index: 10;
  3506. box-shadow: 1px 1px 3px #888888;
  3507. border-radius: 45px;
  3508. }
  3509. .elect-personal {
  3510. /* width: 100%; */
  3511. height: 120rpx;
  3512. /* margin: 50rpx 0; */
  3513. margin-bottom: 50rpx;
  3514. border-radius: 45px;
  3515. padding: 10rpx;
  3516. border: 1rpx solid rgba(255, 255, 255, 0.11);
  3517. display: flex;
  3518. justify-content: center;
  3519. align-items: center;
  3520. position: relative;
  3521. }
  3522. /* 呼吸灯 */
  3523. .breathing-lamp {
  3524. animation-duration: 1s;
  3525. animation-timing-function: ease-out;
  3526. animation-fill-mode: inherit;
  3527. animation-iteration-count: infinite;
  3528. animation-name: run-lamp;
  3529. animation-play-state: running;
  3530. }
  3531. @keyframes run-lamp {
  3532. 0%,
  3533. 100% {
  3534. opacity: 1;
  3535. transform: scale(1);
  3536. }
  3537. 50% {
  3538. opacity: 0.6;
  3539. transform: scale(0.9);
  3540. }
  3541. }
  3542. .personal-fruit-container {
  3543. position: absolute;
  3544. left: 0;
  3545. top: 0;
  3546. bottom: 0;
  3547. right: 0;
  3548. margin: auto;
  3549. display: flex;
  3550. align-items: center;
  3551. justify-content: center;
  3552. /* border: 1rpx solid #F0F0F0; */
  3553. }
  3554. .screen-jitter {
  3555. animation-duration: 1s;
  3556. animation-timing-function: ease-out;
  3557. animation-fill-mode: inherit;
  3558. animation-iteration-count: infinite;
  3559. animation-name: personal-shake;
  3560. animation-play-state: running;
  3561. }
  3562. .screen-red {
  3563. border: 1rpx solid #ff0000;
  3564. }
  3565. @keyframes personal-shake {
  3566. 0%,
  3567. 100% {
  3568. transform: translateX(0)
  3569. }
  3570. 10% {
  3571. transform: translateX(-9px)
  3572. }
  3573. 20% {
  3574. transform: translateX(8px)
  3575. }
  3576. 30% {
  3577. transform: translateX(-7px)
  3578. }
  3579. 40% {
  3580. transform: translateX(6px)
  3581. }
  3582. 50% {
  3583. transform: translateX(-5px)
  3584. }
  3585. 60% {
  3586. transform: translateX(4px)
  3587. }
  3588. 70% {
  3589. transform: translateX(-3px)
  3590. }
  3591. 80% {
  3592. transform: translateX(2px)
  3593. }
  3594. 90% {
  3595. transform: translateX(-1px)
  3596. }
  3597. }
  3598. .CountDownMask {
  3599. position: absolute;
  3600. top: 0;
  3601. bottom: 0;
  3602. right: 0;
  3603. left: 0;
  3604. background-color: rgba(0, 0, 0, 0.5);
  3605. z-index: 1000;
  3606. display: flex;
  3607. justify-content: center;
  3608. align-items: center;
  3609. font-size: 100px;
  3610. font-weight: bold;
  3611. color: #FFFFFF;
  3612. }
  3613. /**
  3614. * 任务样式
  3615. */
  3616. .task-up-button {
  3617. z-index: 10;
  3618. /* #ifndef APP-PLUS */
  3619. position: absolute;
  3620. /* #endif */
  3621. /* #ifdef APP-PLUS */
  3622. position: fixed;
  3623. /* #endif */
  3624. bottom: -53rpx;
  3625. right: 0;
  3626. left: 0;
  3627. margin: auto;
  3628. width: 100%;
  3629. height: 104rpx;
  3630. /* border: 1rpx solid #000000; */
  3631. }
  3632. </style>