personal.vue 99 KB

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