personal.vue 109 KB

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