status.vue 48 KB

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