personal.vue 83 KB

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