personal.vue 109 KB

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