personal.vue 104 KB

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