personal.vue 101 KB

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