status.vue 49 KB

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