personal.vue 103 KB

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