status.vue 54 KB

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