status.vue 48 KB

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