personal.vue 95 KB

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