status.vue 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844
  1. <template>
  2. <view class="container">
  3. <!-- <view style="height: 20px;line-height:15px;padding: 2px;text-align: center;position: fixed;right: -5px;top:30px;z-index: 9999;background: rgb(243,157,116);color: white;border-radius: 5px;font-size: 10px;width: 120rpx;" @click="goBack">
  4. {{$t('charge.break')}}
  5. </view>
  6. <view v-if="locale == 'en'" style="height: 40px;line-height:15px;padding: 2px;text-align: center;position: fixed;right: -5px;top:120px;z-index: 9999;background: #1A87FF;color: white;border-radius: 5px;font-size: 10px;width: 120rpx;" @click="modifyPwd">
  7. {{$t('charge.modifypwd')}}
  8. </view>
  9. <view v-else style="height: 20px;line-height:15px;padding: 2px;text-align: center;position: fixed;right: -5px;top:120px;z-index: 9999;background: #1A87FF;color: white;border-radius: 5px;font-size: 10px;width: 120rpx;" @click="modifyPwd">
  10. {{$t('charge.modifypwd')}}
  11. </view>
  12. <view style=";position: relative;height: 250px;margin-top:2vh;">
  13. <view class="dtop">
  14. <view class="can">
  15. <view class="box">
  16. <view class="three">
  17. <view class="four"></view>
  18. <view class="five"></view>
  19. <view class="six"></view>
  20. </view>
  21. <view class="dot"></view>
  22. <view class="dot"></view>
  23. <view class="dot"></view>
  24. <view class="dot"></view>
  25. <view class="dot"></view>
  26. </view> -->
  27. <!-- <canvas id="c">-->
  28. <!-- </canvas>-->
  29. <!-- <view class="stip">
  30. <view class="p0" st="">{{i18('设备号')}}:{{uuid}}</view>
  31. <view class="p1">
  32. <view v-if="portStatus == 2">
  33. {{$t('charge.charging')}}
  34. </view>
  35. <view v-else-if="portStatus == 6">
  36. {{$t('charge.planed')}}
  37. </view>
  38. <view v-else-if="portStatus == 5">
  39. {{$t('charge.connected')}}
  40. </view>
  41. <view v-else>
  42. {{$t('charge.nocharge')}}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view style="display: flex;flex-direction: row;margin:0 33%;" v-if="curPort.length>1">
  50. <view class="port_item" :class="item.id==choosePort?'selected_item':''" v-for="item in curPort" @click="selectPort(item.id);">{{ i18(item.text )}}</view>
  51. </view>
  52. <view class="dstatus">
  53. <view class="ditem">
  54. <image class="itemimg" src="/static/images/new/tmp.png"/>
  55. <view class="item-value">{{deviceTemp}}℃</view>
  56. <span class="item-text">{{$t('charge.devtemper')}}</span>
  57. </view>
  58. <view class="ditem">
  59. <image class="itemimg" src="/static/images/new/dianya.png"/>
  60. <view class="item-value">{{ deviceV }}V</view>
  61. <span class="item-text">{{$t('charge.voltage')}}</span>
  62. </view>
  63. <view class="ditem">
  64. <image class="itemimg" src="/static/images/new/dianliu.png"/>
  65. <view class="item-value" v-if="deviceV==0">0A</view>
  66. <view class="item-value" v-else>
  67. {{currentValue}}A
  68. </view>
  69. <span class="item-text">{{$t('charge.current')}}</span>
  70. </view>
  71. <view class="ditem">
  72. <image class="itemimg" src="/static/images/new/shjian.png"/>
  73. <view class="item-value" >{{ chargeTime }}{{ i18('分钟') }}</view>
  74. <span class="item-text" v-if="portStatus == 6">{{$t('charge.lefttime')}}</span>
  75. <span class="item-text" v-else>{{$t('charge.chargetime')}}</span>
  76. </view>
  77. <view class="ditem">
  78. <image class="itemimg" src="/static/images/new/gonglv.png"/>
  79. <view class="item-value" >{{ gonglv }}W</view>
  80. <span class="item-text">{{$t('charge.power')}}</span>
  81. </view>
  82. <view class="ditem">
  83. <image class="itemimg" src="/static/images/new/dianliang.png"/>
  84. <view class="item-value" >{{ dianliang}} {{ i18('度') }}</view>
  85. <span class="item-text">{{$t('charge.elec')}}</span>
  86. </view>
  87. </view>
  88. <view class="dbtns">
  89. <view class="start" @click="toPage">
  90. <image style="width:25px;height: 25px;margin-right: 5px;" src="/static/images/new/start.png"/>
  91. <span>{{$t('charge.startcharge')}}</span>
  92. </view>
  93. <view class="get" @click="getInfo">
  94. <image style="width:25px;height: 25px;margin-right: 5px;" src="/static/images/new/get.png"/>
  95. <span>{{$t('charge.getinfo')}}</span>
  96. </view>
  97. </view>
  98. <view class="dtip">
  99. <view style="margin:10px 0px;color: #1A87FF;"><img style="width: 13px;height: 13px" src="/static/images/new/tip.png">{{i18('温馨提示')}}</view>
  100. <view>1,{{i18('桩控制最大输出电流,当功率没有达到请检查车的状态或者车的设置')}};</view>
  101. <view>2,{{i18('启动充电-&gt;设备管理->可设置设备最大输出电流')}}</view>
  102. <view>3,{{i18('为保障您远程启动正常充电,请确保枪头完全连接充电口,同时确认您的爱车处于立即充电状态下')}};</view>
  103. <view>4,{{i18('注意规范安全充电,停好车,锁好车。')}}</view>
  104. </view>
  105. <u-picker @cancel="showPort=false" @confirm="confirmPort" :show="showPort" :columns="portList" keyName="text"></u-picker>
  106. <u-picker @cancel="cancelPicker" @confirm="confirm" :show="showPlan" :columns="planCols" @change="changeHandler"></u-picker>
  107. <u-modal :show="showPwd" :confirmText="i18('确认')" :cancelText="i18('取消')" @confirm="inputPwd" @cancel="cancel" :showCancelButton="true" :title="$t('charge.modifypwd')" >
  108. <view class="slot-content">
  109. <view>
  110. <u--input
  111. type="number"
  112. :placeholder="$t('charge.oldpwd')"
  113. border="surround"
  114. v-model="oldPwd"
  115. ></u--input>
  116. </view>
  117. <view style="margin-top:5px">
  118. <u--input
  119. type="number"
  120. :placeholder="$t('charge.newpwd')"
  121. border="surround"
  122. v-model="pwd"
  123. ></u--input>
  124. </view>
  125. </view>
  126. </u-modal> -->
  127. <view style="height: 0vh;place-items: center;display: grid;">
  128. <image style="height: 3vh;width: 15vh;margin-top: 5vh;top: 3vh;"
  129. src="../../../static/images/new/starts/login/backImg2.png"></image>
  130. <text @click="clickRight()"
  131. style="font-size: 15px;margin: -5px 0 0 30vh;font-weight: bold;z-index: 9999;"><uni-icons v-show="!show" style="color: #ffffff;" size="30" type="more-filled"></uni-icons><uni-icons size="30" v-show="show" style="color: #57B03D;" type="more-filled"></uni-icons></text>
  132. <!-- <uni-drawer @change="changeDrawer" style="top:20vh;height: 100vh" ref="showRight" mode="right"
  133. :mask-click="true">
  134. </uni-drawer> -->
  135. </view>
  136. <view >
  137. <u-popup :show="show" mode="right" customStyle="top:14vh;bottom:200px" :overlayOpacity="0" :closeOnClickOverlay="true" :zIndex="100" ref="showRight" :overlay="false" >
  138. <view style="width: 100vw;height: 100vh;">
  139. <scroll-view style="background: linear-gradient(#000000, #161615);font-size: 20px;height: 100vh;" scroll-y="true">
  140. <view class="prop-item" @click="handleLogout()">
  141. <!-- <view class="prop-item-image">
  142. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  143. </view> -->
  144. <view class="prop-item-right">{{i18('退出登录')}}</view>
  145. <view class="prop-item-left">
  146. <!-- <uni-icons type="forward" color="lightgray" size="16"></uni-icons> -->
  147. </view>
  148. </view>
  149. <u-divider />
  150. <view class="prop-item" @click="skipPage(3)">
  151. <!-- <view class="prop-item-image">
  152. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  153. </view> -->
  154. <view class="prop-item-right">{{i18('关于我们')}}</view>
  155. <view class="prop-item-left">
  156. <!-- <uni-icons type="forward" color="lightgray" size="16"></uni-icons> -->
  157. </view>
  158. </view>
  159. <u-divider />
  160. <view class="prop-item" @click="skipPage(4)">
  161. <!-- <view class="prop-item-image">
  162. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  163. </view> -->
  164. <view class="prop-item-right">{{i18('帮助')}}</view>
  165. <view class="prop-item-left">
  166. <!-- <uni-icons type="forward" color="lightgray" size="16"></uni-icons> -->
  167. </view>
  168. </view>
  169. <u-divider />
  170. </scroll-view>
  171. </view>
  172. </u-popup>
  173. </view>
  174. <view style=" position: relative;top: 10vh;margin-top: 4vh;text-align: center;display: flex;flex-direction: row;justify-content: center;">
  175. <view class="progress_box" style="text-align: center">
  176. <view >
  177. <image class="progress-barup" src="../../../static/images/new/starts/kedu.png"></image>
  178. <canvas class="progress_bar" canvas-id="cpbar"></canvas>
  179. </view>
  180. <!-- <canvas class="progress_bg" canvas-id="cpbg"></canvas>
  181. <canvas class="progress_bar" canvas-id="cpbar"></canvas>
  182. <canvas class="progress_line" canvas-id="cpline"></canvas> -->
  183. <view class="progress_txt">
  184. <view class="progress_info">
  185. <view class="p0" style="color: azure;" st="">{{ deviceInfo.deviceId}}</view>
  186. <view class="p1" >
  187. <view v-if="portStatus == 2" style="position: relative;">
  188. {{$t('charge.charging')}}
  189. </view>
  190. <view v-else-if="portStatus == 6" style="position: relative;">
  191. {{$t('charge.planed')}}
  192. </view>
  193. <view v-else-if="portStatus == 5" style="position: relative">
  194. {{$t('charge.connected')}}
  195. </view>
  196. <view v-else>
  197. {{$t('charge.nocharge')}}
  198. </view>
  199. </view>
  200. <view class="p2">
  201. <view class="item-value" v-if="portDetail.voltage == 0">0 {{ i18('度') }}</view>
  202. <view class="item-value" v-else>{{ dianliang }} {{ i18('度') }}</view>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. <view style="display: flex;align-items: center;flex-direction: column;color: aliceblue;margin-top: 5vh;">
  209. <view class="port_item" :class="item.id==choosePort?'selected_item':''" v-for="item in curPort" @click="selectPort(item.id);">{{ i18(item.text )}}</view>
  210. <view
  211. style="background-color:#494E51 ;justify-content: center;display: flex;justify-items: center;flex-direction: row;text-align: center;width: 75vw;;border-radius: 27px;">
  212. <view span="4" style="width: 25vw;">
  213. <view class="item-value">{{ deviceV }}V</view>
  214. <span class="item-text">{{$t('charge.voltage')}}</span>
  215. </view>
  216. <u-line direction="col" color="#6F84AC" length="50"></u-line>
  217. <view span="4" style="width: 25vw;">
  218. <view class="item-value">{{ gonglv }}W</view>
  219. <span class="item-text">{{$t('charge.power')}}</span>
  220. </view>
  221. <u-line direction="col" color="#6F84AC" length="50"></u-line>
  222. <view span="4" style="width: 25vw;margin-top: -5px;">
  223. <view class="item-value">{{deviceTemp}}℃</view>
  224. <span class="item-text">{{$t('charge.devtemper')}}</span>
  225. </view>
  226. <!-- <u-line direction="col" color="#6F84AC" length="50"></u-line> -->
  227. <!-- <view span="3" style="width: 19vw;">
  228. <view class="item-value" v-if="portDetail.voltage == 0">0 {{ i18('度') }}</view>
  229. <view class="item-value" v-else>{{ dianliang }} {{ i18('度') }}</view>
  230. <span class="item-text">{{$t('charge.elec')}}</span>
  231. </view> -->
  232. </view>
  233. </view>
  234. <view style="display: flex;align-items: center;flex-direction: column;color: aliceblue;margin-top: 3vh;">
  235. <view
  236. style="position:relative;justify-content: center;display: flex;justify-items: center;flex-direction: row;text-align: center;width: 100%;height: 6vh;}">
  237. <view style="width: 27vw;left:5vw;position: absolute;font-size: 11px;">
  238. <view style="margin-left: 1vh;">
  239. <view style="font-weight: bold;"><span v-if="portDetail.portStatus == 6">{{i18('剩余时间')}}</span>
  240. <span v-else>{{$t('charge.chargetime')}}</span></view>
  241. <view class="demo-layout bg-purple"
  242. style="border-radius: 8px;background-color: aliceblue;color: #000;">
  243. <view >{{ chargeTime }}{{ i18('分钟') }}</view>
  244. </view>
  245. </view>
  246. </view>
  247. <view span="2" style=";left:34vw;position: absolute">
  248. <view v-if="portDetail.portStatus == 2"
  249. style="text-align: center;position: absolute;margin:-1vh 2vw;border: 0ch;height: 20vh;">
  250. <u-button @click="toPage()" shape="circle"
  251. style="background: #ec3e41;color:white;width: 28vw;border: 0ch;height: 6vh;">STOP</u-button>
  252. </view>
  253. <view v-if="portDetail.portStatus != 2"
  254. style="text-align: center;position: absolute;margin:-1vh 2vw;border: 0ch;height: 20vh;">
  255. <u-button @click="toPage()" shape="circle"
  256. style="background: #57B03D;color:white;width: 28vw;border: 0ch;height: 6vh;">Charge</u-button>
  257. </view>
  258. <!-- <view class="control-btn" @click="trigger()" v-if="portDetail.portStatus == 2">
  259. <image class="btn-image" src="/static/images/new/start/stop.png" >
  260. </image>
  261. <view>{{ i18('停止充电') }}</view>
  262. </view>
  263. <view class="control-btn" @click="trigger()" v-if="portDetail.portStatus != 2">
  264. <image class="btn-image" src="/static/images/new/start/using.png" >
  265. </image>
  266. <view>{{ i18('立即充电') }}</view>
  267. </view> -->
  268. </view>
  269. <view span="3" style="width: 26vw;left:65%;position: absolute">
  270. <view style="margin-left: 3vw;font-size: 11px;">
  271. <view style="font-weight: bold;"> Ampere</view>
  272. <view class="demo-layout bg-purple"
  273. style="border-radius: 8px;background-color: aliceblue;color: #000;">
  274. <view v-if="deviceV == 0">0A</view>
  275. <view v-else>{{currentValue}}A</view>
  276. </view>
  277. </view>
  278. </view>
  279. </view>
  280. </view>
  281. <view style="display: flex;align-items: center;justify-content: center;margin-top: 5vh;">
  282. <view @click="toPage">
  283. <image src="../../../static/images/new/starts/status/Setting.png"
  284. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  285. </view>
  286. <!-- <view class="" @click="wifi">
  287. <image src="../../../static/images/new/starts/status/WiFi.png"
  288. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  289. </view> -->
  290. <view @click="modifyPwd">
  291. <image src="../../../static/images/new/starts/status/Lock/Unlocked.png"
  292. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  293. </view
  294. >
  295. <view class="" @click="getInfo">
  296. <image src="../../../static/images/new/starts/status/Refresh.png"
  297. style="width: 60px;height: 60px;margin: 2vh 0.2vh;;"></image>
  298. </view>
  299. <view class="" @click="goBack">
  300. <image src="../../../static/images/new/starts/status/Link.png"
  301. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  302. </view>
  303. </view>
  304. <view style="display: flex;align-items: center;justify-content: center;">
  305. <view @click="skip(0)">
  306. <image src="../../../static/images/new/starts/tabbar/one_off.png"
  307. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  308. </view>
  309. <view @click="skip(1)">
  310. <image src="../../../static/images/new/starts/tabbar/two_off.png"
  311. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  312. </view>
  313. <view @click="skip(2)">
  314. <image src="../../../static/images/new/starts/tabbar/three_off.png"
  315. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  316. </view>
  317. </view>
  318. <u-modal :show="showInitPwd" :confirmText="i18('确认')" :cancelText="i18('取消')" @confirm="inputPwd" @cancel="cancelInitDlg" :showCancelButton="true" :title="i18('当前密码为初始密码,请修改')" >
  319. <view class="slot-content">
  320. <view style="margin-bottom:10px;">
  321. {{i18('请保存好设备序列号。可用于找回密码')}}
  322. </view>
  323. <view style="margin-bottom:10px;text-decoration: underline" @click="copyPwd">
  324. {{i18('设备序列号')}} :{{uuid}}
  325. </view>
  326. <view>
  327. <u--input
  328. type="number"
  329. :placeholder="$t('charge.oldpwd')"
  330. border="surround"
  331. v-model="oldPwd"
  332. ></u--input>
  333. </view>
  334. <view style="margin-top:5px">
  335. <u--input
  336. type="number"
  337. :placeholder="$t('charge.newpwd')"
  338. border="surround"
  339. v-model="pwd"
  340. ></u--input>
  341. </view>
  342. </view>
  343. </u-modal>
  344. <u-modal :show="showPwd" :confirmText="i18('确认')" :cancelText="i18('取消')" @confirm="inputPwd" @cancel="cancel" :showCancelButton="true" :title="$t('charge.modifypwd')" >
  345. <view class="slot-content">
  346. <view>
  347. <u--input
  348. type="number"
  349. :placeholder="$t('charge.oldpwd')"
  350. border="surround"
  351. v-model="oldPwd"
  352. ></u--input>
  353. </view>
  354. <view style="margin-top:5px">
  355. <u--input
  356. type="number"
  357. :placeholder="$t('charge.newpwd')"
  358. border="surround"
  359. v-model="pwd"
  360. ></u--input>
  361. </view>
  362. </view>
  363. </u-modal>
  364. </view>
  365. </template>
  366. <script>
  367. import {getDeviceInfo,getPortDetail,startCharge,stopCharge,sendPortDetailCmd,checkStatusChange,getPlanInfo,cancelPlan,parseDataObj,planCharge,getPwd,setPwd,getUUID} from "@/utils/weitiandi/device/device.js";
  368. // #ifdef APP
  369. import ecUI from '@/utils/ecUI.js'
  370. import ecBLE from '@/utils/ecBLE/ecBLE.js'
  371. // #endif
  372. // #ifdef MP
  373. const ecUI = require('@/utils/ecUI.js')
  374. const ecBLE = require('@/utils/ecBLE/ecBLE.js')
  375. // #endif
  376. import i18 from '@/utils/i18.js'
  377. let ctx
  378. let isCheckScroll = true
  379. let isCheckRevHex = false
  380. let isCheckSendHex = false
  381. let sendData = ''
  382. export default {
  383. data() {
  384. return {
  385. chargeTime:0,
  386. deviceTemp:0,
  387. deviceV:0,
  388. currentValue:0,
  389. gonglv:0,
  390. dianliang:0,
  391. portStatus:0,
  392. locale:"",
  393. oldPwd:"",
  394. pwd:"",
  395. showPwd:false,
  396. planCols:[ ],
  397. columnData:[],
  398. showPlan:false,
  399. deviceInfo:{},
  400. visitTime:"",
  401. timer:null,
  402. showPort:false,
  403. portDetail:{portStatus:0,power:0,voltage:0,time:0,dev_temper:0,elec:0,dev_temper:0},
  404. statusTimer:"",
  405. connected:false,
  406. scriptTask:null,
  407. choosePort:1,
  408. portList:[[{port:1,text:"端口一"}]],
  409. planInfo:null,
  410. days:["","周一","周二","周三","周四","周五","周六","周日"],
  411. textRevData: '',
  412. picker:null,
  413. firstInit:false,
  414. hasRight:false,
  415. startAutoCharge:true,
  416. initPwd:"123456",
  417. showInitPwd:false,
  418. uuid:"",
  419. curPort:[],
  420. firstRender:false,
  421. refreshTimer:null,
  422. clickRightTag:0,
  423. show:false,
  424. timeFlg:true
  425. }
  426. },
  427. computed: {
  428. imgUrl() {
  429. return getApp().globalData.config.imgUrl;
  430. }
  431. },
  432. onLoad() {
  433. // #ifdef MP
  434. this.firstRender = true;
  435. // #endif
  436. this.locale = uni.getLocale();
  437. console.log("status comeing")
  438. this.checkPassword();
  439. // this.messageCallback({"type":103,"real_data":{"port_first_status":1,"power":0,"elec":0,"money":0,"time":0,"port_second_status":2,"power_1":0,"elec_1":3,"money_1":50000,"time_1":367,"dev_temper":17,"voltage":228,"":249,"portStatus":1,"currentValue":"0.0"}})
  440. },
  441. onShow(){
  442. uni.setNavigationBarTitle({
  443. title: this.$t('page.detail')
  444. })
  445. this.buletooth();
  446. },
  447. onUnload (){
  448. this.closeSocket();
  449. if(this.refreshTimer != null){
  450. clearTimeout(this.refreshTimer)
  451. }
  452. },
  453. mounted: function() {
  454. this.drawCircle(25);
  455. this.drawProgressbg();
  456. //参数为1-100
  457. this.drawLine();
  458. },
  459. methods: {
  460. drawProgressbg: function() {
  461. // 自定义组件实例 this ,表示在这个自定义组件下查找拥有 canvas-id 的 <canvas/>
  462. var ctx = uni.createCanvasContext('cpbg', this);
  463. ctx.setLineWidth(20); // 设置圆环的宽度
  464. ctx.setStrokeStyle('#35383A'); // 设置圆环的颜色
  465. // ctx.setLineCap('round'); // 设置圆环端点的形状
  466. ctx.setLineCap('square'); // 设置圆环端点的形状
  467. ctx.beginPath(); //开始一个新的路径
  468. ctx.arc(100, 100, 90, 0 * Math.PI, 2 * Math.PI, false);
  469. //设置一个原点(110,110),半径为100的圆的路径到当前路径
  470. ctx.stroke(); //对当前路径进行描边
  471. ctx.draw();
  472. },
  473. drawCircle: function(step) {
  474. var ctx = uni.createCanvasContext('cpbar', this);
  475. // 进度条的渐变(中心x坐标-半径-边宽,中心Y坐标,中心x坐标+半径+边宽,中心Y坐标)
  476. var gradient = ctx.createLinearGradient(0, 0, 120, 0);
  477. let increase = 0.15;
  478. let end = (150/100 ) * 2 * Math.PI ; // 最后的角度
  479. let current = (50 / 100) * 2 * Math.PI-Math.PI/2 ; // 起始角度
  480. if(this.portDetail.portStatus == 2){
  481. if(this.timeFlg){
  482. this.timeFlg=false
  483. let timer = setInterval(() => {
  484. gradient.addColorStop('0', '#57B03D');
  485. gradient.addColorStop('1.0', '#57B03D');
  486. ctx.setLineWidth(10);
  487. ctx.setStrokeStyle(gradient);
  488. ctx.setLineCap('square');
  489. ctx.beginPath();
  490. // 参数step 为绘制的百分比
  491. if (current < end) {
  492. current = current + increase;
  493. }
  494. if (current >= end) {
  495. current = end;
  496. if(this.portDetail.portStatus != 2){
  497. clearInterval(timer);
  498. this.timeFlg=true
  499. }else{
  500. end = (150/100 ) * 2 * Math.PI ; // 最后的角度
  501. current = (50 / 100) * 2 * Math.PI-Math.PI/2 ; // 起始角度
  502. }
  503. }
  504. ctx.arc(100, 100, 90, (50 / 100) * 2 * Math.PI-Math.PI/2, current, false);
  505. ctx.stroke();
  506. ctx.draw();
  507. }, 20);
  508. }
  509. }
  510. },
  511. // 画刻度
  512. drawLine() {
  513. var context = uni.createCanvasContext("cpline", this);
  514. var r = 90;
  515. var x0 = 100;
  516. var y0 = 100;
  517. var x;
  518. var y;
  519. var lineWidth = 15;
  520. for (let i = 0; i < 60; i++) {
  521. context.beginPath();
  522. context.setLineWidth(lineWidth);
  523. context.setStrokeStyle("#35383A");
  524. x = x0 - r * Math.sin(((6 * (i + 1) - 3) * Math.PI) / 180);
  525. y = y0 - r * Math.cos(((6 * (i + 1) - 3) * Math.PI) / 180);
  526. // console.log('x0:' + x0 + ' y0:' + y0 + ' x:' + x + ' y:' + y);
  527. context.moveTo(x, y);
  528. context.arc(
  529. x0,
  530. y0,
  531. r,
  532. ((270 - 6 * (i + 1) + 3) * Math.PI) / 180,
  533. ((270 - 6 * i) * Math.PI) / 180,
  534. false
  535. );
  536. context.stroke();
  537. context.closePath();
  538. }
  539. context.stroke();
  540. context.draw();
  541. },
  542. getInfo() {
  543. let self = this;
  544. this.$modal.loading("正在获取状态,请稍等...");
  545. sendPortDetailCmd(this.deviceInfo).then(res => {
  546. this.$modal.loading("正在获取状态,请稍等...");
  547. this.visitTime = res.msg;
  548. if (!this.visitTime) {
  549. this.$modal.msg("请重新进入页面");
  550. return;
  551. }
  552. if (!this.scriptTask) {
  553. this.initSocket(this.deviceInfo.deviceId);
  554. }
  555. setTimeout(function() {
  556. getPortDetail(self.deviceInfo, self.visitTime).then(res => {
  557. let data = res.data;
  558. if (data != null) {
  559. self.parsePortCmd(data);
  560. } else {}
  561. });
  562. }, 500)
  563. })
  564. },
  565. skip(type){
  566. if(type==0){
  567. uni.navigateTo({
  568. url:'/pages/index'
  569. })
  570. }else if(type==1){
  571. uni.navigateTo({
  572. url:'/pages/weitiandi/deviceList'
  573. })
  574. }else if(type==2){
  575. uni.navigateTo({
  576. url:'/pages/mine/index'
  577. })
  578. }else{
  579. this.$modal.showToast("功能开发中..");
  580. }
  581. },
  582. handleLogout() {
  583. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  584. this.$store.dispatch('LogOut').then(() => {
  585. this.$tab.reLaunch('/pages/index')
  586. })
  587. })
  588. },
  589. changeDrawer(event) {
  590. if (event) {
  591. // 抽屉打开时的逻辑
  592. this.clickRightTag = 1
  593. } else {
  594. // 抽屉关闭时的逻辑
  595. this.clickRightTag = 0
  596. }
  597. },
  598. //自定义头右操作函数
  599. clickRight() {
  600. //打开抽屉
  601. this.show=!this.show
  602. // if (this.clickRightTag == 0) {
  603. // this.$refs.showRight.open();
  604. // this.clickRightTag = 1
  605. // } else {
  606. // this.$refs.showRight.close()
  607. // this.clickRightTag = 0
  608. // }
  609. },
  610. cancelInitDlg(){
  611. this.showInitPwd = false;
  612. },
  613. selectPort(id){
  614. this.choosePort = id;
  615. console.log(this.choosePort)
  616. this.getInfo();
  617. },
  618. copyPwd(){
  619. uni.setClipboardData({
  620. data: this.uuid,
  621. success: function () {
  622. this.$modal.showToast("复制成功");
  623. }
  624. });
  625. },
  626. i18(text){
  627. return i18(text)
  628. },
  629. toPage(){
  630. uni.navigateTo({
  631. url: '/pages/weitiandi/bluetooth/index'
  632. });
  633. },
  634. toSetting(){
  635. let imei = this.deviceInfo.deviceId;
  636. let ccid = this.deviceInfo.ccid;
  637. uni.navigateTo({
  638. url: '/pages/weitiandi/bluetooth/setting'
  639. });
  640. },
  641. cancel(){
  642. this.showPwd = false;
  643. },
  644. modifyPwd(){
  645. this.showPwd = true;
  646. },
  647. inputPwd(){
  648. let rightPwd = uni.getStorageSync("pwd");
  649. if(!this.oldPwd){
  650. this.$modal.showToast("原密码不能为空");
  651. return;
  652. }
  653. if(rightPwd != this.oldPwd){
  654. this.$modal.showToast("原密码不对");
  655. return;
  656. }
  657. if(this.pwd == "000000"){
  658. this.$modal.showToast("密码不能设置为000000");
  659. return;
  660. }
  661. if(this.pwd == "123456"){
  662. this.$modal.showToast("密码不能设置为123456");
  663. return;
  664. }
  665. if(!this.pwd){
  666. this.$modal.showToast("密码不能为空");
  667. }else {
  668. setPwd(this.pwd);
  669. this.oldPwd = this.pwd;
  670. uni.removeStorageSync("pwd");
  671. this.$modal.showToast("密码修改成功");
  672. this.showPwd = false;
  673. this.showInitPwd = false;
  674. // this.goBack();
  675. }
  676. },
  677. confirm(e) {
  678. let value = e.value;
  679. console.log('confirm', value)
  680. let day = value[0];
  681. let date = new Date();
  682. let nowDay = date.getDate();
  683. let hour = value[1]+"";
  684. hour = parseInt(hour.substr(0,hour.length-1),10);
  685. let min = value[2]+"";
  686. min = parseInt(min.substr(0,min.length-1),10);
  687. let todayTotalMin = 0;
  688. let planDate = {min:min,hour:hour};
  689. let nowHour = date.getHours();
  690. let nowMin = date.getMinutes();
  691. let nowDate ={min:nowMin,hour:nowHour};
  692. if("今日" == day){
  693. todayTotalMin = this.getGapMin(planDate,nowDate)
  694. }else {
  695. let nowHour = date.getHours();
  696. let min = date.getMinutes();
  697. let maxDate ={min:59,hour:23};
  698. todayTotalMin = this.getGapMin(maxDate,nowDate);
  699. let minDate = {min:0,hour:0};
  700. todayTotalMin +=this.getGapMin(planDate,minDate);
  701. }
  702. console.log(todayTotalMin);
  703. this.cancelPicker();
  704. if(todayTotalMin<=0 || todayTotalMin>1440){
  705. this.$modal.showToast("最大预约时间为24小时");
  706. }else{
  707. planCharge(this.choosePort,todayTotalMin).then(res=>{
  708. this.getInfo(true);
  709. });
  710. }
  711. },
  712. getGapMin(date1,date2){
  713. let min1 = date1.min;
  714. let hour1 = date1.hour;
  715. let min2 = date2.min;
  716. let hour2 = date2.hour;
  717. let total1 = min1+hour1*60;
  718. let total2 = min2+hour2*60;
  719. return total1-total2;
  720. },
  721. cancelPicker(e) {
  722. this.showPlan = false
  723. },
  724. changeHandler(e){
  725. const {
  726. columnIndex,
  727. value,
  728. values, // values为当前变化列的数组内容
  729. index,
  730. // 微信小程序无法将picker实例传出来,只能通过ref操作
  731. picker = this.$refs.uPicker
  732. } = e
  733. let day = e.value[0];
  734. // 当第一列值发生变化时,变化第二列(后一列)对应的选项
  735. this.picker = picker;
  736. if (columnIndex === 0) {
  737. // picker为选择器this实例,变化第二列对应的选项
  738. if(day == "今日"){
  739. picker.setColumnValues(1, this.columnData[1])
  740. }else{
  741. picker.setColumnValues(1, this.columnData[0])
  742. }
  743. }
  744. },
  745. checkPassword(){
  746. setTimeout(function (){
  747. getUUID();
  748. },500);
  749. let rightPwd = uni.getStorageSync("pwd");
  750. if(rightPwd === this.initPwd){
  751. this.showInitPwd = true;
  752. this.oldPwd = rightPwd;
  753. }
  754. },
  755. recon(){
  756. let self = this;
  757. ecUI.showLoading('设备连接中')
  758. let blueid = uni.getStorageSync('blueid');
  759. ecBLE.onBLEConnectionStateChange(res => {
  760. ecUI.hideLoading()
  761. if (res.ok) {
  762. self.buletooth();
  763. } else {
  764. uni.removeStorageSync('blueid');
  765. ecUI.showModal(
  766. '提示',
  767. '连接失败,errCode=' + res.errCode + ',errMsg=' + res.errMsg
  768. )
  769. }
  770. })
  771. ecBLE.createBLEConnection(blueid);
  772. },
  773. buletooth(){
  774. let self = this;
  775. ctx = this
  776. isCheckScroll = true
  777. isCheckRevHex = false
  778. isCheckSendHex = false
  779. sendData = ''
  780. //on disconnect
  781. ecBLE.onBLEConnectionStateChange(() => {
  782. uni.showModal({
  783. title: '提示',
  784. content: '蓝牙断开连接',
  785. confirmText:"点击重连",
  786. showCancel:false,
  787. success: function (res) {
  788. if (res.confirm) {
  789. uni.reLaunch({
  790. url: '/pages/bluetooth/index/index'
  791. });
  792. // self.recon()
  793. } else if (res.cancel) {
  794. console.log('用户点击取消');
  795. }
  796. }
  797. });
  798. })
  799. //receive data
  800. ecBLE.onBLECharacteristicValueChange((str, strHex) => {
  801. isCheckRevHex = true;
  802. let data =
  803. (isCheckRevHex ? strHex.replace(/[0-9a-fA-F]{2}/g, ' $&') : str)
  804. // console.log(data)
  805. self.$modal.closeLoading();
  806. console.log("收到消息:"+data);
  807. //AA 67 0D 05 00 00 00 00 00 00 00 00 00 25 E2 00 80
  808. data = parseDataObj(data);
  809. self.messageCallback(data);
  810. })
  811. self.getInfo();
  812. self.startTimer();
  813. },
  814. startTimer(){
  815. let self = this;
  816. if(this.refreshTimer != null){
  817. clearTimeout(this.refreshTimer);
  818. }
  819. self.refreshTimer = setTimeout(function(){
  820. self.getInfo();
  821. self.startTimer();
  822. },30000);
  823. },
  824. messageCallback(data,flag){
  825. let self = this;
  826. let type = data.type;
  827. let real_data = data.real_data;
  828. if(type == 103){
  829. self.portDetail = real_data;
  830. self.portList = [[]];
  831. self.curPort = [];
  832. let port_first_status = self.portDetail["port_first_status"];
  833. let port_second_status = self.portDetail["port_second_status"]
  834. if(port_first_status){
  835. self.portList[0].push({port:1,text:"端口一"});
  836. self.curPort.push({
  837. text:"端口一",
  838. status:port_first_status,
  839. id:1,
  840. })
  841. let power = self.portDetail.power;
  842. let voltage = parseInt(self.portDetail.voltage);
  843. if(voltage >0){
  844. let current = power/voltage;
  845. current = current.toFixed(1);
  846. self.portDetail.currentValue = current;
  847. }
  848. }
  849. if(port_second_status){
  850. self.portList[0].push({port:2,text:"端口二"});
  851. self.curPort.push({
  852. text:"端口二",
  853. status:port_second_status,
  854. id:2
  855. })
  856. let power = self.portDetail.power_1;
  857. let voltage = parseInt(self.portDetail.voltage);
  858. if(voltage >0){
  859. let current = power/voltage;
  860. current = current.toFixed(1);
  861. self.portDetail.currentValue_1 = current;
  862. }
  863. }
  864. let choosePort = self.choosePort
  865. /**
  866. * chargeTime:0,
  867. * deviceTemp:0,
  868. * deviceV:0,
  869. * currentValue:0,
  870. * gonglv:0,
  871. * dianliang:0,
  872. * portStatus:0,
  873. */
  874. if(choosePort == 1){
  875. self.portDetail.portStatus = port_first_status;
  876. self.chargeTime = self.portDetail.time;
  877. self.gonglv = self.portDetail.power;
  878. self.dianliang = self.portDetail.elec/100;
  879. self.currentValue = self.portDetail.currentValue;
  880. if(port_first_status != 2){
  881. self.chargeTime = 0;
  882. if(port_first_status == 6){
  883. self.chargeTime = self.portDetail.time;
  884. }
  885. self.gonglv = 0;
  886. self.dianliang = 0;
  887. self.currentValue = 0;
  888. }
  889. }else if(choosePort == 2){
  890. self.portDetail.portStatus = port_second_status;
  891. self.chargeTime = self.portDetail.time_1;
  892. self.gonglv = self.portDetail.power_1;
  893. self.dianliang = self.portDetail.elec_1/100;
  894. self.currentValue = self.portDetail.currentValue_1;
  895. if(port_second_status != 2){
  896. self.chargeTime = 0;
  897. if(port_first_status == 6){
  898. self.chargeTime = self.portDetail.time_1;
  899. }
  900. self.gonglv = 0;
  901. self.dianliang = 0;
  902. self.currentValue = 0;
  903. }
  904. }
  905. self.portStatus = self.portDetail.portStatus;
  906. self.deviceTemp = self.portDetail.dev_temper;
  907. self.deviceV = self.portDetail.voltage;
  908. self.$modal.closeLoading();
  909. if(self.portDetail.portStatus==2){
  910. this.drawCircle(100);
  911. }
  912. }
  913. if(type == 116){
  914. self.$modal.closeLoading();
  915. self.getInfo();
  916. }
  917. if(type == 113){
  918. self.$modal.closeLoading();
  919. self.getInfo();
  920. }
  921. if(type == 96){
  922. }
  923. if(type == 253){
  924. self.$modal.closeLoading();
  925. self.uuid = real_data.substr(0,6);
  926. }
  927. self.$forceUpdate();
  928. if(!flag){
  929. console.log('收到服务器内容:' + JSON.stringify(data));
  930. }
  931. console.log("当前对象内容")
  932. console.log(self.portDetail)
  933. if(!this.firstInit){
  934. this.firstInit = true;
  935. let autoCharge = self.getAutoChargeValue()
  936. if(self.portDetail.portStatus == 5 && autoCharge == 1){
  937. self.startCharge();
  938. }
  939. }
  940. },
  941. getAutoChargeValue(){
  942. let autoCharge = uni.getStorageSync("autoCharge");
  943. if(!autoCharge ){
  944. autoCharge = 1;
  945. }
  946. return autoCharge;
  947. },
  948. planCharge(){
  949. if(this.portDetail.portStatus == 6){
  950. this.$modal.confirm("确认取消预约?").then(res=>{
  951. this.cancelPlan();
  952. })
  953. }else{
  954. this.toPlan()
  955. }
  956. },
  957. sendBlueData(){
  958. ecBLE.writeBLECharacteristicValue(tempSendData, false)
  959. },
  960. cancelPlan(){
  961. cancelPlan(this.choosePort).then(res=>{
  962. this.$modal.msg("取消成功");
  963. this.getInfo(true);
  964. })
  965. },
  966. // getPlanInfo(){
  967. // getPlanInfo(this.deviceInfo.deviceId,this.choosePort).then(res=>{
  968. // let data = res.data;
  969. // if(data != null){
  970. // let planType = data.planType;
  971. // if(planType == 1){//单次预约
  972. // let planInfo = {};
  973. // planInfo.runTime = data.runTime;
  974. // this.planInfo = planInfo;
  975. // this.planInfo.id = data.id;
  976. // }else{
  977. // let planInfo = {};
  978. // planInfo.runTime = data.runTime;
  979. // let repeatDays = data.repeatDays;
  980. // let days = repeatDays.split(",")
  981. // let strs = "";
  982. // for (let i = 0; i < days.length; i++) {
  983. // if(strs.length>0){
  984. // strs+=",";
  985. // }
  986. // strs +=this.days[days[i]];
  987. // }
  988. // this.planInfo = planInfo;
  989. // this.planInfo.runTime = strs+" "+data.repeatTime;
  990. // this.planInfo.id = data.id;
  991. // }
  992. // }
  993. // })
  994. // },
  995. confirmPort(e){
  996. let value = e.value[0]
  997. this.choosePort = value.port;
  998. this.showPort = false;
  999. this.getInfo()
  1000. },
  1001. initSocket(key){
  1002. let self = this;
  1003. },
  1004. toSet(){
  1005. // this.closeSocket();
  1006. uni.navigateTo({
  1007. url: '/pages/weitiandi/bluetooth/setting'
  1008. });
  1009. },
  1010. toPlan(){
  1011. let arr = [];
  1012. let date = new Date();
  1013. let min = date.getMinutes();
  1014. let hour = date.getHours();
  1015. let arr1 = ["今日", "明日"];
  1016. let arr2 = []
  1017. let arr3 = [];
  1018. let arr4 = [];
  1019. for (let i = 0; i < hour; i++) {
  1020. arr2.push(i+"时")
  1021. }
  1022. this.columnData[0] = arr2;
  1023. for (let i = hour+1; i < 24; i++) {
  1024. arr3.push(i+"时")
  1025. }
  1026. this.columnData[1] = arr3;
  1027. for (let i = 0; i <= 59; i++) {
  1028. arr4.push(i+"分")
  1029. }
  1030. this.planCols = [arr1, arr3, arr4]
  1031. this.showPlan = true;
  1032. },
  1033. trigger(){
  1034. let portStatus = this.portDetail.portStatus;
  1035. if(portStatus == 2){//需要停止充电
  1036. this.$modal.confirm("需要停止充电么?").then(res=>{
  1037. this.stopCharge();
  1038. this.drawCircle(0); //参数为1-100
  1039. })
  1040. }else{
  1041. if(portStatus == 1){
  1042. this.$modal.msg("请先将充电枪插入后再点击充电");
  1043. }
  1044. if(portStatus == 5){
  1045. this.$modal.confirm("确认开始充电么?").then(res=>{
  1046. this.startCharge();
  1047. this.drawCircle(100); //参数为1-100
  1048. })
  1049. }else {
  1050. this.$modal.msg("端口无法开始充电");
  1051. }
  1052. }
  1053. },
  1054. getInfo(flag) {
  1055. let self = this;
  1056. // setTimeout(function (){
  1057. // self.messageCallback({"type":103,"real_data":{"port_first_status":1,"power":0,"elec":0,"money":0,"time":0,"port_second_status":2,"power_1":0,"elec_1":3,"money_1":50000,"time_1":367,"dev_temper":17,"voltage":228,"":249,"portStatus":1,"currentValue":"0.0"}})
  1058. //
  1059. // },50);
  1060. //
  1061. // setTimeout(function (){
  1062. // self.messageCallback({"type":103,"real_data":{"port_first_status":1,"power":0,"elec":0,"money":0,"time":0,"port_second_status":2,"power_1":0,"elec_1":3,"money_1":50000,"time_1":367,"dev_temper":17,"voltage":228,"":249,"portStatus":1,"currentValue":"0.0"}})
  1063. //
  1064. // },150);
  1065. //
  1066. // setTimeout(function (){
  1067. // self.messageCallback({"type":103,"real_data":{"port_first_status":1,"power":0,"elec":0,"money":0,"time":0,"port_second_status":2,"power_1":0,"elec_1":3,"money_1":50000,"time_1":367,"dev_temper":17,"voltage":228,"":249,"portStatus":1,"currentValue":"0.0"}})
  1068. //
  1069. // },250);
  1070. this.$modal.loading("正在获取状态,请稍等...");
  1071. if(flag){
  1072. setTimeout(function (){
  1073. sendPortDetailCmd().then(res => {
  1074. })
  1075. },500)
  1076. }else{
  1077. sendPortDetailCmd().then(res => {
  1078. })
  1079. }
  1080. },
  1081. stopCharge(){
  1082. let self = this;
  1083. this.deviceInfo.port = this.choosePort;
  1084. stopCharge(this.deviceInfo).then(()=>{
  1085. self.$modal.loading("停止成功");
  1086. setTimeout((()=>{
  1087. self.getInfo();
  1088. }),1000);
  1089. })
  1090. },
  1091. startCharge(){
  1092. let self = this;
  1093. this.deviceInfo.port = this.choosePort;
  1094. startCharge(this.deviceInfo).then(res=>{
  1095. self.$modal.loading("启动成功");
  1096. setTimeout((()=>{
  1097. self.getInfo();
  1098. }),1000);
  1099. })
  1100. },
  1101. getPortInfo(){
  1102. this.startPortDetailTimer();
  1103. },
  1104. startPortDetailTimer(){
  1105. let self = this;
  1106. this.timer = setTimeout(function (){
  1107. getPortDetail(self.deviceInfo,self.visitTime).then(res=>{
  1108. let data = res.data;
  1109. if(data != null){
  1110. self.portDetail = data;
  1111. self.checkStatusCheck();
  1112. self.$modal.closeLoading();
  1113. }else{
  1114. self.startPortDetailTimer();
  1115. }
  1116. });
  1117. },1000);
  1118. },
  1119. checkStatusCheck(){
  1120. this.statusChangeTimer();
  1121. },
  1122. checkOnPage(){
  1123. var pages = getCurrentPages() // 获取栈实例
  1124. let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
  1125. if("pages/weitiandi/device/index" != currentRoute){
  1126. return false;
  1127. }
  1128. return true;
  1129. },
  1130. goBack(){
  1131. this.closeSocket();
  1132. uni.navigateBack({
  1133. });
  1134. },
  1135. closeSocket(){
  1136. ecBLE.onBLEConnectionStateChange(() => {})
  1137. ecBLE.onBLECharacteristicValueChange(() => {})
  1138. ecBLE.closeBLEConnection()
  1139. uni.removeStorageSync('blueid');
  1140. },
  1141. statusChangeTimer(){
  1142. let self = this;
  1143. this.statusTimer = setTimeout(function(){
  1144. if(!this.checkOnPage()){
  1145. return;
  1146. }
  1147. checkStatusChange(self.deviceInfo,self.visitTime).then(res=>{
  1148. let data = res.data;
  1149. if(data != null){
  1150. self.getInfo();
  1151. }else{
  1152. self.statusChangeTimer();
  1153. }
  1154. });
  1155. },3000);
  1156. }
  1157. }
  1158. }
  1159. </script>
  1160. <style>
  1161. .container {
  1162. /* background: rgb(249, 252, 255); */
  1163. background-image: url('../../../static/images/new/starts/bg1.jpg');
  1164. background-size: cover;
  1165. background-repeat: no-repeat;
  1166. inset: 0;
  1167. position: absolute;
  1168. }
  1169. .header {
  1170. position: relative;
  1171. margin-top:4vw;
  1172. }
  1173. .prop-item {
  1174. position: relative;
  1175. display: flex;
  1176. flex-direction: row;
  1177. height: 40px;
  1178. line-height: 40px;
  1179. margin: 0 20rpx;
  1180. }
  1181. .prop-item-left {
  1182. color: #BCBCBF;
  1183. ;
  1184. width: 30%;
  1185. font-size: 14px;
  1186. //margin-left: 36px;
  1187. }
  1188. .prop-item-image {
  1189. width: 15px;
  1190. height: 15px;
  1191. position: absolute;
  1192. left: 2vw;
  1193. top: 0.5vh;
  1194. }
  1195. .prop-item-right {
  1196. position: absolute;
  1197. right: 10rpx;
  1198. top: 5rpx;
  1199. color: #BCBCBF;
  1200. }
  1201. .progress_box {
  1202. /* position: relative; */
  1203. /* position: relative; */
  1204. width: 52vw;
  1205. height: 35vh;
  1206. /* background-color: red; */
  1207. display: flex;
  1208. text-align: center;
  1209. flex-direction: row;
  1210. }
  1211. .pcds {
  1212. margin-top: 90rpx;
  1213. color: black;
  1214. }
  1215. .progress_bg {
  1216. position: absolute;
  1217. width: 30vh;
  1218. height: 30vh;
  1219. }
  1220. .progress_txt {
  1221. position: absolute;
  1222. z-index: 99;
  1223. width: 55vw;
  1224. /* text-align: center;
  1225. font-size: 28upx;
  1226. margin: 16vw;
  1227. /* margin-top: 54px;
  1228. margin-left: 74px;
  1229. color: #999999; */
  1230. }
  1231. .progress_bar {
  1232. position: absolute;
  1233. width: 60vw;
  1234. margin: 2px;
  1235. height: 50vh;
  1236. }
  1237. .progress-barup{
  1238. position: absolute;
  1239. width: 200px;
  1240. margin: 2px;
  1241. height: 196px;
  1242. z-index: 1;
  1243. }
  1244. .progress_line {
  1245. position: absolute;
  1246. width: 30vh;
  1247. height: 30vh;
  1248. }
  1249. .progress_info {
  1250. display: flex;
  1251. font-size: 10px;
  1252. margin: 70px 30px;
  1253. align-items: center;
  1254. flex-direction: column;
  1255. height: 14vh;
  1256. width: 35vw;
  1257. }
  1258. .header-status-desc {
  1259. position: absolute;
  1260. text-align: center;
  1261. width: 100%;
  1262. bottom:1vh;
  1263. font-size: 5vw;
  1264. font-weight: bold;
  1265. color: #0E9F9B;
  1266. margin-bottom: 5vw;
  1267. }
  1268. .header-status {
  1269. font-weight: bold;
  1270. text-align: center;
  1271. }
  1272. .chong-active {
  1273. color: #0E9F9B
  1274. }
  1275. .header-img {
  1276. width: 100%;
  1277. padding: 5% 10%;
  1278. text-align: center;
  1279. }
  1280. .header-img image {
  1281. width: 100%;
  1282. height: 23vh;
  1283. }
  1284. .info-body{
  1285. background: #0E9F9B;
  1286. height: 20vh;
  1287. margin: 0 2%;
  1288. border-radius: 1vw;
  1289. margin-top:2vh;
  1290. color: #F8FCFF;
  1291. line-height: 3vh;
  1292. }
  1293. .info-content{
  1294. display: inline-block;
  1295. width: 23%;
  1296. text-align: center;
  1297. margin: 1%;
  1298. margin-top:2.5vh;
  1299. }
  1300. .info-content-value{
  1301. font-weight: bold;
  1302. }
  1303. .info-content-text{
  1304. }
  1305. .info-summary{
  1306. display: flex;
  1307. flex-direction: row;
  1308. text-align: center;
  1309. margin:3vh 0;
  1310. }
  1311. .summary{
  1312. width: 33%;
  1313. line-height: 2.5vh;
  1314. }
  1315. .charge-num{
  1316. color: #0E9F9B;
  1317. font-weight: bold;
  1318. font-size: 4.5vw;
  1319. }
  1320. .charge-title{
  1321. color: #B2B2B2;
  1322. font-weight: 400;
  1323. }
  1324. .btn-image{
  1325. width: 90%;
  1326. height: 100%;
  1327. }
  1328. .info-bottom-btn{
  1329. display: flex;
  1330. flex-direction: row;
  1331. text-align: center;
  1332. position: relative;
  1333. margin-top: 10vh
  1334. ;
  1335. }
  1336. .btn-area{
  1337. width: 50%;
  1338. height: 50px;
  1339. }
  1340. .left{
  1341. position: relative;
  1342. left: 10px;
  1343. text-align: right;
  1344. }
  1345. .right{
  1346. text-align: left;
  1347. position: relative;
  1348. right: 10px;
  1349. }
  1350. .info-plan{
  1351. text-align: center;
  1352. color: #0E9F9B;
  1353. margin-top:1vh;
  1354. font-weight: 400;
  1355. }
  1356. .setting{
  1357. position: fixed;
  1358. right: -1px;
  1359. top: 10vh;
  1360. z-index: 999;
  1361. background: rgb(227,243,245);
  1362. color: #0E9F9B;
  1363. font-size: 10px;
  1364. border-radius: 5px;
  1365. padding: 3px;
  1366. }
  1367. .port{
  1368. height: 70px;
  1369. background: #F8FCFF;
  1370. border: 0px solid #F8FCFF;
  1371. box-shadow: 0px 0px 6px 1px rgba(101,101,101,0.29);
  1372. border-radius: 4px;
  1373. margin:0 10px;
  1374. position: relative;
  1375. margin-top:10px;
  1376. }
  1377. .plan{
  1378. height: 70px;
  1379. background: #F8FCFF;
  1380. border: 0px solid #F8FCFF;
  1381. box-shadow: 0px 0px 6px 1px rgba(101,101,101,0.29);
  1382. border-radius: 4px;
  1383. margin:0 10px;
  1384. position: relative;
  1385. margin-top:15px;
  1386. }
  1387. .port-image{
  1388. height: 40px;
  1389. width: 40px;
  1390. position: absolute;
  1391. top:15px;
  1392. left:20px;
  1393. }
  1394. .port-text{
  1395. position: absolute;
  1396. top:13px;
  1397. left:75px;
  1398. font-weight: bold;
  1399. }
  1400. .port-num{
  1401. position: absolute;
  1402. top:38px;
  1403. left:75px;
  1404. color: #B2B2B2;
  1405. }
  1406. .port-icon{
  1407. position: absolute;
  1408. top:30px;
  1409. right:5px;
  1410. width: 10px;
  1411. height: 16px;
  1412. }
  1413. .port-icon image{
  1414. width: 90%;
  1415. }
  1416. .body-bottom{
  1417. padding:0 22px;
  1418. }
  1419. .body-bottom .info-content{
  1420. width: 30%;
  1421. }
  1422. .bottom-control{
  1423. height: 22vh;
  1424. margin: 0 2%;
  1425. margin-top:2vh;
  1426. line-height: 3vh;
  1427. background: #F8FCFF;
  1428. border: 0px solid #F8FCFF;
  1429. box-shadow: 0px 0px 6px 1px rgba(101,101,101,0.29);
  1430. border-radius: 4px;
  1431. padding:3%;
  1432. }
  1433. .control-btn{
  1434. display: inline-block;;
  1435. height: 60px;
  1436. width: 25%;
  1437. padding:10px 20px;
  1438. text-align: center;
  1439. font-size: 12px;
  1440. color: black;
  1441. }
  1442. .control-btn .btn-image{
  1443. }
  1444. #box {
  1445. /* width: 300px; */
  1446. height: 280px;
  1447. position: relative;
  1448. /* 背景色 */
  1449. /* background: #f7f6f6; */
  1450. overflow: hidden;
  1451. /* padding: 50px 0; */
  1452. box-sizing: border-box;
  1453. ;
  1454. }
  1455. .box {
  1456. width: 100%;
  1457. height: 100%;
  1458. position: absolute;
  1459. display: flex;
  1460. justify-content: center;
  1461. /* 此处尽量不要设置背景色,可以选择在父标签上设置背景色,否则没有黏黏的效果 */
  1462. filter: url("#goo");
  1463. }
  1464. /* 电量文字 */
  1465. .text {
  1466. font-weight: 200;
  1467. font-size: 20px;
  1468. margin-top: 5px;
  1469. text-align: center;
  1470. color: #ff6600;
  1471. }
  1472. /* 电量文字 */
  1473. .text span {
  1474. font-size: 15px;
  1475. }
  1476. .three {
  1477. width: 170px;
  1478. height: 170px;
  1479. border-radius: 300px;
  1480. opacity: 1;
  1481. position: absolute;
  1482. top: 20px;
  1483. z-index: 10;
  1484. /* 从中心向外剪切圆,相当于掏空 */
  1485. /* -webkit-mask: radial-gradient(transparent 95px, white 0px); */
  1486. background: #ffffff;
  1487. /* animation: ballZhuan 9s linear infinite; */
  1488. overflow: hidden;
  1489. box-shadow: 0px 0px 19px 1px #2196f3;
  1490. }
  1491. .four {
  1492. width: 200px;
  1493. height: 200px;
  1494. border-radius: 80px;
  1495. opacity: 0.3;
  1496. position: absolute;
  1497. top: 10px;
  1498. z-index: 10;
  1499. /* 从中心向外剪切圆,相当于掏空 */
  1500. /* -webkit-mask: radial-gradient(transparent 95px, white 0px); */
  1501. background: #2196f3;
  1502. animation: ballZhuan1 linear infinite;
  1503. animation-duration: 11s;
  1504. }
  1505. .five {
  1506. width: 270px;
  1507. height: 270px;
  1508. border-radius: 99px;
  1509. opacity: 0.6;
  1510. position: absolute;
  1511. top: 30px;
  1512. z-index: 10;
  1513. /* 从中心向外剪切圆,相当于掏空 */
  1514. /* -webkit-mask: radial-gradient(transparent 95px, white 0px); */
  1515. background: #2196f3;
  1516. animation: ballZhuan1 linear infinite;
  1517. /* transform: rotate(120deg); */
  1518. animation-duration: 9s;
  1519. left: -67px;
  1520. }
  1521. .six {
  1522. width: 270px;
  1523. height: 270px;
  1524. border-radius: 99px;
  1525. opacity: 0.6;
  1526. position: absolute;
  1527. top:30px;
  1528. z-index: 10;
  1529. /* 从中心向外剪切圆,相当于掏空 */
  1530. /* -webkit-mask: radial-gradient(transparent 95px, white 0px); */
  1531. background: #2196f3;
  1532. animation: ballZhuan1 7s linear infinite;
  1533. /* transform: rotate(120deg); */
  1534. right: -67px;
  1535. }
  1536. @keyframes ballZhuan {
  1537. 100% {
  1538. transform: rotate(360deg);
  1539. }
  1540. }
  1541. @keyframes ballZhuan1 {
  1542. 100% {
  1543. transform: rotate(360deg);
  1544. }
  1545. }
  1546. /* 底部的小球 */
  1547. .dot {
  1548. display: block;
  1549. width: 20px;
  1550. height: 20px;
  1551. border-radius: 50%;
  1552. background: rgba(101,192,255,0.28);
  1553. position: absolute;
  1554. z-index: 1000;
  1555. bottom: -50px;
  1556. }
  1557. .dot:nth-of-type(1) {
  1558. width: 40px;
  1559. height: 40px;
  1560. right: 116px;
  1561. animation: dotMove 5s linear infinite;
  1562. }
  1563. .dot:nth-of-type(2) {
  1564. width: 50px;
  1565. height: 50px;
  1566. left: 120px;
  1567. animation: dotMove 4s linear infinite;
  1568. }
  1569. .dot:nth-of-type(3) {
  1570. animation: dotMove 2s linear infinite;
  1571. }
  1572. .dot:nth-of-type(4) {
  1573. width: 15px;
  1574. height: 15px;
  1575. left: 130px;
  1576. animation: dotMove 2s linear infinite;
  1577. }
  1578. .dot:nth-of-type(5) {
  1579. width: 30px;
  1580. height: 30px;
  1581. animation: dotMove 3s linear infinite;
  1582. }
  1583. @keyframes dotMove {
  1584. 0% {
  1585. transform: translateY(0px);
  1586. opacity: 1;
  1587. }
  1588. 98% {
  1589. opacity: 1;
  1590. }
  1591. 100% {
  1592. transform: translateY(-260px);
  1593. opacity: 0;
  1594. }
  1595. }
  1596. .w-flex {
  1597. display: -webkit-box;
  1598. display: -webkit-flex;
  1599. display: flex;
  1600. padding: 0px 25px;
  1601. }
  1602. .w-flex__item {
  1603. -webkit-box-flex: 1;
  1604. -webkit-flex: 1;
  1605. flex: 1;
  1606. }
  1607. .w-item{
  1608. text-align: center;
  1609. padding: 5px;
  1610. }
  1611. .w-item-tit{
  1612. font-size: 14px;
  1613. color: #888;
  1614. }
  1615. .w-item-num{
  1616. font-size: 18px;
  1617. color: #111;
  1618. }
  1619. .can{
  1620. position: relative;
  1621. z-index: 0;
  1622. width: 211px;
  1623. height: 211px;
  1624. background-image: url(/static/images/new/quan.png);
  1625. background-size: cover;
  1626. display: flex;
  1627. justify-content: center;
  1628. align-items: center;
  1629. }
  1630. .dtop{
  1631. background: url(/static/images/new/box1.png);
  1632. background-size: cover;
  1633. width: 260px;
  1634. height: 236px;
  1635. display: flex;
  1636. justify-content: center;
  1637. align-items: center;
  1638. left: 15%;
  1639. position: relative;
  1640. }
  1641. .dstatus{
  1642. margin-top: 0.1rem;
  1643. display: flex;
  1644. flex-wrap: wrap;
  1645. justify-content: space-evenly;
  1646. align-content: center;
  1647. }
  1648. .ditem{
  1649. width: 30%;
  1650. display: flex;
  1651. flex-direction: column;
  1652. align-items: center;
  1653. margin-bottom: 0.3rem;
  1654. margin-top: 10px;
  1655. }
  1656. .itemimg{
  1657. width: 50px;
  1658. height: 50px;
  1659. }
  1660. .item-value{
  1661. font-weight: bold;
  1662. font-size: 15px;
  1663. margin:8px 0 0 0;
  1664. }
  1665. .item-text{
  1666. font-size: 11px;
  1667. margin:1px 0;
  1668. color: #eeeeee;
  1669. }
  1670. .start{
  1671. background: #1A87FF;
  1672. color: #fff;
  1673. width: 45%;
  1674. height: 50px;
  1675. min-height: 40px;
  1676. border-radius: 50px;
  1677. display: flex;
  1678. justify-content: center;
  1679. align-items: center;
  1680. font-size: 20px;
  1681. font-weight: bold;
  1682. }
  1683. .dbtns{
  1684. display: flex;
  1685. margin-top:10px;
  1686. justify-content: space-between;
  1687. padding: 0 30px;
  1688. }
  1689. .get{
  1690. background: #fff;
  1691. border: 1px solid #1A87FF;
  1692. color: #1A87FF;
  1693. width: 45%;
  1694. height: 50px;
  1695. min-height: 40px;
  1696. border-radius: 50px;
  1697. display: flex;
  1698. justify-content: center;
  1699. align-items: center;
  1700. font-size: 20px;
  1701. font-weight: bold;
  1702. }
  1703. .dtip{
  1704. margin: 20px 20px;
  1705. padding: 10px;
  1706. background: rgba(127,200,251,0.1);
  1707. border: 1px solid #7FC8FB;
  1708. box-shadow: 0 2px 8px 0 rgba(0,0,0,0.19);
  1709. border-radius: 5px;
  1710. font-size: 17px;
  1711. font-weight: 400;
  1712. color: #B8B9BA;
  1713. margin-bottom: 10px;
  1714. }
  1715. /* .p1{
  1716. font-size: 20px;
  1717. color: white;
  1718. font-weight: bold;
  1719. margin-top:10px;
  1720. } */
  1721. .p1 {
  1722. font-size: 20px;
  1723. color: white;
  1724. font-weight: bold;
  1725. margin-top: 10px;
  1726. /* margin-left: -1vh;; */
  1727. }
  1728. .p2{
  1729. font-size: 20px;
  1730. color: #888;
  1731. font-weight: bold;
  1732. }
  1733. .stip{
  1734. text-align: center;
  1735. z-index: 9999;
  1736. }
  1737. .port_item{
  1738. color: #1A87FF;
  1739. padding: 5px;
  1740. border: 1px solid #1A87FF;
  1741. }
  1742. .selected_item{
  1743. color: white !important;
  1744. padding: 5px;
  1745. background: #1A87FF !important;
  1746. }
  1747. </style>