personal.vue 96 KB

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