移动储能车V1版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <image class="top_logo" src="../../static/logo.png" mode=""></image>
  5. <image class="tite" :src="$t('MainTitle')" mode=""></image>
  6. <!-- <view class="tite">
  7. {{ $t('MainTitle') }}
  8. </view> -->
  9. <view class="time">
  10. <view class="time_top">
  11. {{ formattedTime}}
  12. </view>
  13. <view class="time_bottom">
  14. <view>
  15. </view>
  16. <view class="time_bottom1">
  17. {{ $t('status') }}
  18. <view class="time_state" v-if="status=='ok'">
  19. {{$t('online')}}
  20. </view>
  21. <view class="time_state1" v-else>
  22. {{$t('offline')}}
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="tap">
  29. <view class="tap_1">
  30. AC
  31. </view>
  32. <view class="tap_2">
  33. DC
  34. </view>
  35. <view class="tap_3">
  36. SYS
  37. </view>
  38. </view>
  39. <view class="power" v-if="status=='ok'">
  40. <!-- <view class="power_1">
  41. <image v-if="selectorid!=3&&selectorindex==1" src="../../static/choice1.png" mode=""></image>
  42. <image v-else src="../../static/electricity.png" mode="" @click="onclick(3)"></image>
  43. </view>
  44. <view class="power_1">
  45. <image v-if="selectorid!=2&&selectorindex==1" src="../../static/choice2.png" mode=""></image>
  46. <image v-else src="../../static/power1.png" mode="" @click="onclick(2)"></image>
  47. </view>
  48. <view class="power_1">
  49. <image v-if="selectorid!=4&&selectorindex==1" src="../../static/choice3.png" mode=""></image>
  50. <image v-else src="../../static/direct1.png" mode="" @click="onclick(4)"></image>
  51. </view>
  52. <view class="power_1">
  53. <image v-if="selectorid!=1&&selectorindex==1" src="../../static/choice4.png" mode=""></image>
  54. <image v-else src="../../static/DCpower1.png" mode="" @click="onclick(1)"></image>
  55. </view> -->
  56. <view v-if="selectorid!=3&&selectorindex==1">
  57. <view class="power_1">
  58. <view class="power_bj">
  59. <image src="../../static/img/energy1.png" mode=""></image>
  60. </view>
  61. <view class="power_title">{{$t('CommunicationRecharge')}}</view>
  62. </view>
  63. </view>
  64. <view v-else @click="onclick(3)">
  65. <view class="power_1">
  66. <view class="power_bright">
  67. <image src="../../static/img/Energybrightness1.png" mode=""></image>
  68. </view>
  69. <view class="power_title_bright">{{$t('CommunicationRecharge')}}</view>
  70. </view>
  71. </view>
  72. <view v-if="selectorid!=2&&selectorindex==1">
  73. <view class="power_1">
  74. <view class="power_bj">
  75. <image src="../../static/img/energy2.png" mode=""></image>
  76. </view>
  77. <view class="power_title">{{$t('CommunicationSupply')}}</view>
  78. </view>
  79. </view>
  80. <view v-else @click="onclick(2)">
  81. <view class="power_1">
  82. <view class="power_bright">
  83. <image src="../../static/img/Energybrightness2.png" mode=""></image>
  84. </view>
  85. <view class="power_title_bright">{{$t('CommunicationSupply')}}</view>
  86. </view>
  87. </view>
  88. <view v-if="selectorid!=4&&selectorindex==1">
  89. <view class="power_1">
  90. <view class="power_bj">
  91. <image src="../../static/img/energy3.png" mode=""></image>
  92. </view>
  93. <view class="power_title">{{$t('DirectRecharge')}}</view>
  94. </view>
  95. </view>
  96. <view v-else @click="onclick(4)">
  97. <view class="power_1">
  98. <view class="power_bright">
  99. <image src="../../static/img/Energybrightness3.png" mode=""></image>
  100. </view>
  101. <view class="power_title_bright">{{$t('DirectRecharge')}}</view>
  102. </view>
  103. </view>
  104. <view v-if="selectorid!=1&&selectorindex==1">
  105. <view class="power_1">
  106. <view class="power_bj">
  107. <image src="../../static/img/energy4.png" mode=""></image>
  108. </view>
  109. <view class="power_title">{{$t('DirectSupply')}}</view>
  110. </view>
  111. </view>
  112. <view v-else @click="onclick(1)">
  113. <view class="power_1">
  114. <view class="power_bright">
  115. <image src="../../static/img/Energybrightness4.png" mode=""></image>
  116. </view>
  117. <view class="power_title_bright">{{$t('DirectSupply')}}</view>
  118. </view>
  119. </view>
  120. <view class="power_5" @click="system">
  121. <view class="power_bj">
  122. <image src="../../static/img/setup.png" mode=""></image>
  123. </view>
  124. <view class="power_title">{{$t('SystemInformation')}}</view>
  125. </view>
  126. </view>
  127. <view class="power" v-else>
  128. <view>
  129. <view class="power_1">
  130. <!-- <view class="power_bj" @click="onget(3)"> -->
  131. <view class="power_bj">
  132. <image src="../../static/img/energy1.png" mode=""></image>
  133. </view>
  134. <view class="power_title">{{$t('CommunicationRecharge')}}</view>
  135. </view>
  136. </view>
  137. <view>
  138. <view class="power_1">
  139. <!-- <view class="power_bj" @click="onget(2)"> -->
  140. <view class="power_bj">
  141. <image src="../../static/img/energy2.png" mode=""></image>
  142. </view>
  143. <view class="power_title">{{$t('CommunicationSupply')}}</view>
  144. </view>
  145. </view>
  146. <view>
  147. <view class="power_1">
  148. <!-- <view class="power_bj" @click="onget(4)"> -->
  149. <view class="power_bj">
  150. <image src="../../static/img/energy3.png" mode=""></image>
  151. </view>
  152. <view class="power_title">{{$t('DirectRecharge')}}</view>
  153. </view>
  154. </view>
  155. <view>
  156. <!-- <view class="power_1" @click="onget(1)"> -->
  157. <view class="power_1">
  158. <view class="power_bj">
  159. <image src="../../static/img/energy4.png" mode=""></image>
  160. </view>
  161. <view class="power_title">{{$t('DirectSupply')}}</view>
  162. </view>
  163. </view>
  164. <view class="power_5" @click="system">
  165. <view class="power_bj">
  166. <image src="../../static/img/setup.png" mode=""></image>
  167. </view>
  168. <view class="power_title">{{$t('SystemInformation')}}</view>
  169. </view>
  170. </view>
  171. <view class="power_6" v-if="selectorindex==1">
  172. <image src="../../static/!.png" mode=""></image>{{$t('Tipswarning')}}
  173. </view>
  174. <uni-popup ref="message" type="message">
  175. <uni-popup-message type="error" :message="messageText" :duration="2500"></uni-popup-message>
  176. </uni-popup>
  177. <view class="switch-container">
  178. <uni-data-select
  179. v-model="appLanguage"
  180. :localdata="range"
  181. :clear="false"
  182. @change="changeLanguage"
  183. ></uni-data-select>
  184. </view>
  185. <view class="appVersioncss">
  186. {{$t('version')}}{{appVersion}}
  187. </view>
  188. </view>
  189. </template>
  190. <script>
  191. import {getuidatas,control} from "../../api/api.js"
  192. import {getTime} from "../../utils/index.js"
  193. import { mapState } from 'vuex';
  194. export default {
  195. data() {
  196. return {
  197. title: '',
  198. uidatas:'',
  199. formatTimeid:'',
  200. messageText:'',
  201. appVersion: '', // 用于存储应用版本号
  202. appLanguage:'zh-Hans',
  203. range: [
  204. { value: 'zh-Hans', text: "中文" },
  205. { value: 'en', text: "English" },
  206. ],
  207. }
  208. },
  209. created() {
  210. // 从本地存储读取用户选择的语言
  211. },
  212. mounted(){
  213. this.appLanguage = uni.getStorageSync('userLanguage') || 'zh-Hans';
  214. },
  215. computed: {
  216. // 使用 mapState 映射多个状态到组件的计算属性
  217. ...mapState(['formattedTime','status','selectorid','selectorindex']),
  218. ...mapState({
  219. uidatasdata: state => state.uidatasdata
  220. })
  221. },
  222. onLoad() {
  223. // this.onfaultsList();
  224. // 获取系统信息
  225. uni.getSystemInfo({
  226. success: (res) => {
  227. console.log(res);
  228. this.appVersion = res.appWgtVersion // 获取版本号并赋值
  229. },
  230. fail: (err) => {
  231. console.error('获取系统信息失败:', err);
  232. }
  233. });
  234. },
  235. beforeUnmount() {
  236. clearInterval(this.uidatas);
  237. // clearInterval(this.formatTimeid);
  238. },
  239. methods: {
  240. changeLanguage(locale){
  241. console.log(locale);
  242. this.$i18n.locale = locale
  243. uni.setStorageSync('userLanguage', locale);
  244. },
  245. onclick(e){
  246. this.pattern(e)
  247. },
  248. pattern(unm){
  249. let data = {
  250. id: "c32e6a80-9159-4f6e-9acc-8525cf177808",
  251. issaveinitvalue:true,
  252. value:unm+'' // 直流供电=1,直流补电=4,交流供电=2,交流补电=3
  253. }
  254. control(data).then(data => {
  255. console.log(data);
  256. if (data.status == 'ok') {
  257. if (unm==3) {
  258. uni.redirectTo({
  259. url: '/pages/home/index'
  260. });
  261. } else if(unm==2){
  262. uni.redirectTo({
  263. url: '/pages/electricity/index'
  264. });
  265. }else if(unm==4){
  266. uni.redirectTo({
  267. url: '/pages/supply/supply'
  268. });
  269. }else if(unm==1){
  270. uni.redirectTo({
  271. url: '/pages/supplyss/supplyss'
  272. });
  273. }
  274. } else {
  275. // uni.hideLoading()
  276. // uni.showToast({
  277. // title:'选择模式失败请重新选择',
  278. // icon: 'warning',
  279. // duration: 2500, // 显示时长,单位为毫秒
  280. // });
  281. this.messageText = '选择模式失败请重新选择'
  282. this.$refs.message.open()
  283. return
  284. }
  285. });
  286. },
  287. onget(unm){
  288. if (unm==3) {
  289. uni.redirectTo({
  290. url: '/pages/home/index'
  291. });
  292. } else if(unm==2){
  293. uni.redirectTo({
  294. url: '/pages/electricity/index'
  295. });
  296. }else if(unm==4){
  297. uni.redirectTo({
  298. url: '/pages/supply/supply'
  299. });
  300. }else if(unm==1){
  301. uni.redirectTo({
  302. url: '/pages/supplyss/supplyss'
  303. });
  304. }
  305. },
  306. system(){
  307. uni.redirectTo({
  308. url: '/pages/faultlist/index'
  309. });
  310. }
  311. }
  312. }
  313. </script>
  314. <style lang="scss" scoped>
  315. .content{
  316. width: 100%;
  317. height: 100vh;
  318. opacity: 1;
  319. background: linear-gradient(180deg, rgba(215, 230, 245, 0) 0%, rgba(196, 229, 255, 1) 100%);
  320. box-sizing: border-box;
  321. }
  322. .top {
  323. width: 100%;
  324. height: 100px;
  325. display: flex;
  326. align-items: center;
  327. justify-content: space-between;
  328. background-size: 100% 100%;
  329. background-repeat: no-repeat;
  330. box-sizing: border-box;
  331. background-color: #fff;
  332. padding: 0px 46px;
  333. }
  334. .top_logo{
  335. width:327px;
  336. height: 56px;
  337. }
  338. .tite{
  339. width: 325px;
  340. height: 50px;
  341. }
  342. .time{
  343. width:277px;
  344. text-align: right;
  345. }
  346. .time_top{
  347. font-size: 17px;
  348. }
  349. .time_bottom{
  350. display: flex;
  351. font-size: 17px;
  352. justify-content: space-between;
  353. }
  354. .time_bottom1{
  355. display: flex;
  356. }
  357. .time_state{
  358. font-size: 17px;
  359. font-weight: 600;
  360. color: rgba(22, 68, 144, 1);
  361. }
  362. .time_state1 {
  363. font-size: 17px;
  364. font-weight: 600;
  365. color: rgba(217, 22, 22, 1);
  366. }
  367. .tap{
  368. width: 100%;
  369. height: 46.01px;
  370. display: flex;
  371. justify-content: space-between;
  372. margin-top: 118px;
  373. margin-bottom: 50px;
  374. padding: 0px 40px;
  375. box-sizing: border-box;
  376. }
  377. .tap_1{
  378. width: 485.57px;
  379. height: 46.5px;
  380. border-radius: 50px;
  381. background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  382. display: flex;
  383. align-items: center;
  384. justify-content: center;
  385. font-size: 35.24px;
  386. font-weight: 700;
  387. color: #fff;
  388. }
  389. .tap_2{
  390. width: 485px;
  391. height: 46.5px;
  392. border-radius: 50px;
  393. background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  394. display: flex;
  395. align-items: center;
  396. justify-content: center;
  397. font-size: 35.24px;
  398. font-weight: 700;
  399. color: #fff;
  400. }
  401. .tap_3{
  402. width: 155.17px;
  403. height: 46.01px;
  404. opacity: 1;
  405. border-radius: 24.47px;
  406. background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  407. display: flex;
  408. align-items: center;
  409. justify-content: center;
  410. font-size: 30px;
  411. font-weight: 700;
  412. color: #fff;
  413. }
  414. .power{
  415. width: 100%;
  416. display: flex;
  417. justify-content: space-between;
  418. padding: 0px 40px;
  419. box-sizing: border-box;
  420. }
  421. .power_1{
  422. width: 237.55px;
  423. height: 299px;
  424. display: flex;
  425. flex-direction: column;
  426. align-items: center;
  427. justify-content: space-between;
  428. // justify-content: space-around;
  429. box-sizing: border-box;
  430. .power_bright{
  431. width: 100%;
  432. height: 250px;
  433. background-image: url("../../static/img/bj.png");
  434. background-size: 100% 100%;
  435. display: flex;
  436. align-items: center;
  437. justify-content: center;
  438. opacity: 1;
  439. }
  440. .power_bj{
  441. width: 100%;
  442. height: 250px;
  443. background-image: url("../../static/img/bj.png");
  444. background-size: 100% 100%;
  445. display: flex;
  446. align-items: center;
  447. justify-content: center;
  448. opacity: 0.4;
  449. }
  450. .power_title{
  451. font-size: 20px;
  452. font-weight: 600;
  453. letter-spacing: 0px;
  454. color: rgba(0, 0, 0, 1);
  455. opacity: 0.4;
  456. box-sizing: border-box;
  457. }
  458. .power_title_bright{
  459. font-size: 20px;
  460. font-weight: 600;
  461. letter-spacing: 0px;
  462. color: rgba(0, 0, 0, 1);
  463. opacity: 1;
  464. box-sizing: border-box;
  465. }
  466. image {
  467. width: 200px;
  468. height: 150px;
  469. }
  470. }
  471. .power_11{
  472. width: 237.55px;
  473. height: 298.98px;
  474. opacity: 1;
  475. box-sizing: border-box;
  476. font-size: 23px;
  477. font-family: 400;
  478. display: flex;
  479. flex-direction: column;
  480. align-items: center;
  481. .power_image{
  482. width: 100%;
  483. height: 248px;
  484. margin-bottom: 20px;
  485. background-image: url("../../static/electricity1.png");
  486. background-size: 100% 100%;
  487. display: flex;
  488. align-items: center;
  489. justify-content: center;
  490. padding: 0px 16px;
  491. box-sizing: border-box;
  492. image{
  493. width: 100%;
  494. height: 160.06px;
  495. }
  496. }
  497. }
  498. .power_5{
  499. width: 158px;
  500. height: 297.61px;
  501. opacity: 1;
  502. // margin-left: 20px;
  503. display: flex;
  504. flex-direction: column;
  505. align-items: center;
  506. justify-content: space-between;
  507. .power_bj{
  508. width: 100%;
  509. height: 250px;
  510. background-image: url("../../static/img/setup_bj.png");
  511. background-size: 100% 100%;
  512. display: flex;
  513. align-items: center;
  514. justify-content: center;
  515. }
  516. .power_title{
  517. font-size: 20px;
  518. font-weight: 600;
  519. letter-spacing: 0px;
  520. color: rgba(0, 0, 0, 1);
  521. box-sizing: border-box;
  522. }
  523. image{
  524. width: 92px;
  525. height: 92px;
  526. }
  527. }
  528. .power_6{
  529. width: 100%;
  530. height: 50px;
  531. font-size: 17.62px;
  532. margin-top: 80px;
  533. display: flex;
  534. align-items: center;
  535. padding: 0px 20px;
  536. box-sizing: border-box;
  537. position: fixed;
  538. left: 0px;
  539. bottom: 64px;
  540. image{
  541. margin-right: 10px;
  542. width: 27.41px;
  543. height: 27.41px;
  544. };
  545. }
  546. .appVersioncss{
  547. position: fixed;
  548. bottom: 10px;
  549. right: 20px;
  550. color: #ccc;
  551. }
  552. .switch-container {
  553. width: 120px;
  554. display: flex;
  555. align-items: center;
  556. position: fixed;
  557. top: 110px;
  558. right: 40px;
  559. }
  560. .switch-label {
  561. margin-right: 10px;
  562. font-size: 16px;
  563. color: #333;
  564. }
  565. </style>