personal.vue 82 KB

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