personal.vue 100 KB

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