personal.vue 84 KB

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