status.vue 51 KB

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