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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <image class="top_logo" :src="logo" mode="aspectFit"></image>
  5. <!-- <view class="tite">
  6. {{ $t('MainTitle') }}
  7. </view> -->
  8. <view class="time">
  9. <view class="time_top">
  10. {{ formattedTime}}
  11. </view>
  12. <view class="time_bottom">
  13. <view>
  14. </view>
  15. <view class="time_bottom1">
  16. {{ $t('status') }}
  17. <view class="time_state" v-if="status=='ok'">
  18. {{$t('online')}}
  19. </view>
  20. <view class="time_state1" v-else>
  21. {{$t('offline')}}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="tap">
  28. <view class="tap_1">
  29. AC
  30. </view>
  31. <view class="tap_2">
  32. DC
  33. </view>
  34. <view class="tap_3">
  35. SYS
  36. </view>
  37. </view>
  38. <view class="power" v-if="status=='ok'">
  39. <!-- <view class="power_1">
  40. <image v-if="selectorid!=3&&selectorindex==1" src="../../static/choice1.png" mode=""></image>
  41. <image v-else src="../../static/electricity.png" mode="" @click="onclick(3)"></image>
  42. </view>
  43. <view class="power_1">
  44. <image v-if="selectorid!=2&&selectorindex==1" src="../../static/choice2.png" mode=""></image>
  45. <image v-else src="../../static/power1.png" mode="" @click="onclick(2)"></image>
  46. </view>
  47. <view class="power_1">
  48. <image v-if="selectorid!=4&&selectorindex==1" src="../../static/choice3.png" mode=""></image>
  49. <image v-else src="../../static/direct1.png" mode="" @click="onclick(4)"></image>
  50. </view>
  51. <view class="power_1">
  52. <image v-if="selectorid!=1&&selectorindex==1" src="../../static/choice4.png" mode=""></image>
  53. <image v-else src="../../static/DCpower1.png" mode="" @click="onclick(1)"></image>
  54. </view> -->
  55. <view v-if="selectorid!=3&&selectorindex==1">
  56. <view class="power_1">
  57. <view class="power_bj">
  58. <image src="../../static/img/choice1.png" mode=""></image>
  59. </view>
  60. <view class="power_title">{{$t('CommunicationRecharge')}}</view>
  61. </view>
  62. </view>
  63. <view v-else @click="onclick(3)">
  64. <view class="power_1">
  65. <view class="power_bright">
  66. <image src="../../static/img/choice1.png" mode=""></image>
  67. </view>
  68. <view class="power_title_bright">{{$t('CommunicationRecharge')}}</view>
  69. </view>
  70. </view>
  71. <view v-if="selectorid!=2&&selectorindex==1">
  72. <view class="power_1">
  73. <view class="power_bj">
  74. <image src="../../static/img/choice2.png" mode=""></image>
  75. </view>
  76. <view class="power_title">{{$t('CommunicationSupply')}}</view>
  77. </view>
  78. </view>
  79. <view v-else @click="onclick(2)">
  80. <view class="power_1">
  81. <view class="power_bright">
  82. <image src="../../static/img/choice2.png" mode=""></image>
  83. </view>
  84. <view class="power_title_bright">{{$t('CommunicationSupply')}}</view>
  85. </view>
  86. </view>
  87. <view v-if="selectorid!=4&&selectorindex==1">
  88. <view class="power_1">
  89. <view class="power_bj">
  90. <image src="../../static/img/direct.png" mode=""></image>
  91. </view>
  92. <view class="power_title">{{$t('DirectRecharge')}}</view>
  93. </view>
  94. </view>
  95. <view v-else @click="onclick(4)">
  96. <view class="power_1">
  97. <view class="power_bright">
  98. <image src="../../static/img/direct.png" mode=""></image>
  99. </view>
  100. <view class="power_title_bright">{{$t('DirectRecharge')}}</view>
  101. </view>
  102. </view>
  103. <view v-if="selectorid!=1&&selectorindex==1">
  104. <view class="power_1">
  105. <view class="power_bj">
  106. <image src="../../static/img/choice4.png" mode=""></image>
  107. </view>
  108. <view class="power_title">{{$t('DirectSupply')}}</view>
  109. </view>
  110. </view>
  111. <view v-else @click="onclick(1)">
  112. <view class="power_1">
  113. <view class="power_bright">
  114. <image src="../../static/img/choice4.png" mode=""></image>
  115. </view>
  116. <view class="power_title_bright">{{$t('DirectSupply')}}</view>
  117. </view>
  118. </view>
  119. <view class="power_5" @click="system">
  120. <view class="power_bj">
  121. <image src="../../static/img/system.png" mode=""></image>
  122. </view>
  123. <view class="power_title">{{$t('SystemInformation')}}</view>
  124. </view>
  125. </view>
  126. <view class="power" v-else>
  127. <view>
  128. <view class="power_1">
  129. <!-- <view class="power_bj" @click="onget(3)"> -->
  130. <view class="power_bj">
  131. <image src="../../static/img/choice1.png" mode=""></image>
  132. </view>
  133. <view class="power_title">{{$t('CommunicationRecharge')}}</view>
  134. </view>
  135. </view>
  136. <view>
  137. <view class="power_1">
  138. <!-- <view class="power_bj" @click="onget(2)"> -->
  139. <view class="power_bj">
  140. <image src="../../static/img/choice2.png" mode=""></image>
  141. </view>
  142. <view class="power_title">{{$t('CommunicationSupply')}}</view>
  143. </view>
  144. </view>
  145. <view>
  146. <view class="power_1">
  147. <!-- <view class="power_bj" @click="onget(4)"> -->
  148. <view class="power_bj">
  149. <image src="../../static/img/direct.png" mode=""></image>
  150. </view>
  151. <view class="power_title">{{$t('DirectRecharge')}}</view>
  152. </view>
  153. </view>
  154. <view>
  155. <!-- <view class="power_1" @click="onget(1)"> -->
  156. <view class="power_1">
  157. <view class="power_bj">
  158. <image src="../../static/img/choice4.png" mode=""></image>
  159. </view>
  160. <view class="power_title">{{$t('DirectSupply')}}</view>
  161. </view>
  162. </view>
  163. <view class="power_5" @click="system">
  164. <view class="power_bj">
  165. <image src="../../static/img/system.png" mode=""></image>
  166. </view>
  167. <view class="power_title">{{$t('SystemInformation')}}</view>
  168. </view>
  169. </view>
  170. <view class="power_6" v-if="selectorindex==1">
  171. <image src="../../static/!.png" mode=""></image>{{$t('Tipswarning')}}
  172. </view>
  173. <uni-popup ref="message" type="message">
  174. <uni-popup-message type="error" :message="messageText" :duration="2500"></uni-popup-message>
  175. </uni-popup>
  176. <view class="switch-container">
  177. <uni-data-select
  178. v-model="appLanguage"
  179. :localdata="range"
  180. :clear="false"
  181. @change="changeLanguage"
  182. ></uni-data-select>
  183. </view>
  184. <view class="appVersioncss">
  185. {{$t('version')}}{{appVersion}}
  186. </view>
  187. </view>
  188. </template>
  189. <script>
  190. import {getuidatas,control} from "../../api/api.js"
  191. import {getTime} from "../../utils/index.js"
  192. import { mapState } from 'vuex';
  193. export default {
  194. data() {
  195. return {
  196. logo:'../../static/logo/logo31.png',
  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: "4d86b3fc-f5be-448c-bdc8-2cd8db4d4e29",
  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. <!-- -->
  315. <style lang="scss" scoped>
  316. .content{
  317. width: 100%;
  318. height: 100vh;
  319. opacity: 1;
  320. // background: linear-gradient(180deg, rgba(225, 238, 222, 0) 0%,rgba(196, 219, 193, 1) 20%, rgba(196, 219, 193, 1) 100%);
  321. // background-color: #C4DBC1;
  322. background: radial-gradient(40.46% 50% at 50.01912045889101% 50%, rgba(225, 238, 222, 1) 0%, rgba(196, 219, 193, 1) 100%);
  323. box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);
  324. box-sizing: border-box;
  325. }
  326. .top {
  327. width: 100%;
  328. height: 100px;
  329. display: flex;
  330. align-items: center;
  331. justify-content: space-between;
  332. background-size: 100% 100%;
  333. background-repeat: no-repeat;
  334. // background-color: rgba(196, 219, 193, 0.1);
  335. // background-color: #E1EEDE;
  336. background: rgba(225, 238, 222, 1);
  337. padding-right:46px;
  338. padding:0px 46px;
  339. box-sizing: border-box;
  340. }
  341. .body_box{
  342. padding-top: 1rpx;
  343. // margin-top: 0rpx;
  344. height: 100%;
  345. // background-color: rgba(208, 227, 205, 1);
  346. }
  347. .top_logo{
  348. // width:325px;
  349. width:260px;
  350. // width:100px;
  351. // width:88px;
  352. // // height: 88px;
  353. // height: 56px;
  354. }
  355. .tite{
  356. width:240px;
  357. height: 50px;
  358. font-size: 80rpx;
  359. font-weight: 600;
  360. // margin-left:90px;
  361. margin-left:90px;
  362. }
  363. .time{
  364. width:277px;
  365. text-align: right;
  366. }
  367. .time_top{
  368. font-size: 17px;
  369. }
  370. .time_bottom{
  371. display: flex;
  372. font-size: 17px;
  373. justify-content: space-between;
  374. }
  375. .time_bottom1{
  376. display: flex;
  377. }
  378. .time_state{
  379. font-size: 17px;
  380. font-weight: 600;
  381. color: rgba(22, 68, 144, 1);
  382. }
  383. .time_state1 {
  384. font-size: 17px;
  385. font-weight: 600;
  386. color: rgba(217, 22, 22, 1);
  387. }
  388. .tap{
  389. width: 100%;
  390. height: 46.01px;
  391. display: flex;
  392. justify-content: space-between;
  393. margin-top: 118px;
  394. margin-bottom: 50px;
  395. padding: 0px 40px;
  396. box-sizing: border-box;
  397. }
  398. .tap_1{
  399. width: 485.57px;
  400. height: 46.5px;
  401. border-radius: 50px;
  402. // background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  403. background-color:#32CB32;
  404. display: flex;
  405. align-items: center;
  406. justify-content: center;
  407. font-size: 35.24px;
  408. font-weight: 700;
  409. color: #fff;
  410. }
  411. .tap_2{
  412. width: 485px;
  413. height: 46.5px;
  414. border-radius: 50px;
  415. // background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  416. background-color:#32CB32;
  417. display: flex;
  418. align-items: center;
  419. justify-content: center;
  420. font-size: 35.24px;
  421. font-weight: 700;
  422. color: #fff;
  423. }
  424. .tap_3{
  425. width: 155.17px;
  426. height: 46.01px;
  427. opacity: 1;
  428. border-radius: 24.47px;
  429. // background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
  430. background-color:#32CB32;
  431. display: flex;
  432. align-items: center;
  433. justify-content: center;
  434. font-size: 30px;
  435. font-weight: 700;
  436. color: #fff;
  437. }
  438. .power{
  439. width: 100%;
  440. display: flex;
  441. justify-content: space-between;
  442. padding: 0px 40px;
  443. box-sizing: border-box;
  444. }
  445. .power_1{
  446. width: 237.55px;
  447. height: 299px;
  448. display: flex;
  449. flex-direction: column;
  450. align-items: center;
  451. justify-content: space-between;
  452. // justify-content: space-around;
  453. box-sizing: border-box;
  454. .power_bright{
  455. width: 100%;
  456. height: 250px;
  457. // background-image: url("../../static/img/bj.png");
  458. background-color: rgba(225, 238, 222, 1);
  459. border: 6px solid rgba(149, 196, 142, 1);
  460. border-radius: 50rpx;
  461. background-size: 100% 100%;
  462. display: flex;
  463. align-items: center;
  464. justify-content: center;
  465. opacity: 1;
  466. }
  467. .power_bj{
  468. width: 100%;
  469. height: 250px;
  470. // background-image: url("../../static/img/bj.png");
  471. background-color: rgba(225, 238, 222, 1);
  472. border: 6px solid rgba(149, 196, 142, 1);
  473. border-radius: 50rpx;
  474. background-size: 100% 100%;
  475. display: flex;
  476. align-items: center;
  477. justify-content: center;
  478. opacity: 0.3;
  479. }
  480. .power_title{
  481. font-size: 20px;
  482. font-weight: 600;
  483. letter-spacing: 0px;
  484. color: rgba(0, 0, 0, 1);
  485. opacity: 0.4;
  486. box-sizing: border-box;
  487. }
  488. .power_title_bright{
  489. font-size: 20px;
  490. font-weight: 600;
  491. letter-spacing: 0px;
  492. color: rgba(0, 0, 0, 1);
  493. opacity: 1;
  494. box-sizing: border-box;
  495. }
  496. image {
  497. width: 200px;
  498. height: 150px;
  499. }
  500. }
  501. .power_11{
  502. width: 237.55px;
  503. height: 298.98px;
  504. opacity: 1;
  505. box-sizing: border-box;
  506. font-size: 23px;
  507. font-family: 400;
  508. display: flex;
  509. flex-direction: column;
  510. align-items: center;
  511. .power_image{
  512. width: 100%;
  513. height: 248px;
  514. margin-bottom: 20px;
  515. background-image: url("../../static/electricity1.png");
  516. background-size: 100% 100%;
  517. display: flex;
  518. align-items: center;
  519. justify-content: center;
  520. padding: 0px 16px;
  521. box-sizing: border-box;
  522. image{
  523. width: 100%;
  524. height: 160.06px;
  525. }
  526. }
  527. }
  528. .power_5{
  529. width: 158px;
  530. height: 297.61px;
  531. opacity: 1;
  532. // margin-left: 20px;
  533. display: flex;
  534. flex-direction: column;
  535. align-items: center;
  536. justify-content: space-between;
  537. .power_bj{
  538. width: 100%;
  539. height: 250px;
  540. // background-image: url("../../static/img/setup_bj.png");
  541. background-color: rgba(225, 238, 222, 1);
  542. border: 6px solid rgba(149, 196, 142, 1);
  543. border-radius: 50rpx;
  544. background-size: 100% 100%;
  545. display: flex;
  546. align-items: center;
  547. justify-content: center;
  548. }
  549. .power_title{
  550. font-size: 20px;
  551. font-weight: 600;
  552. letter-spacing: 0px;
  553. color: rgba(0, 0, 0, 1);
  554. box-sizing: border-box;
  555. }
  556. image{
  557. width: 92px;
  558. height: 92px;
  559. }
  560. }
  561. .power_6{
  562. width: 100%;
  563. height: 50px;
  564. font-size: 17.62px;
  565. margin-top: 80px;
  566. display: flex;
  567. align-items: center;
  568. padding: 0px 20px;
  569. box-sizing: border-box;
  570. position: fixed;
  571. left: 0px;
  572. bottom: 64px;
  573. image{
  574. margin-right: 10px;
  575. width: 27.41px;
  576. height: 27.41px;
  577. };
  578. }
  579. .appVersioncss{
  580. position: fixed;
  581. bottom: 10px;
  582. right: 20px;
  583. color: #ccc;
  584. }
  585. .switch-container {
  586. width: 120px;
  587. display: flex;
  588. align-items: center;
  589. position: fixed;
  590. top: 110px;
  591. right: 40px;
  592. }
  593. .switch-label {
  594. margin-right: 10px;
  595. font-size: 16px;
  596. color: #333;
  597. }
  598. </style>