status.vue 50 KB

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