personal.vue 104 KB

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