status.vue 51 KB

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