personal.vue 95 KB

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