| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581 |
- <template>
- <view class="content">
- <view class="top">
- <image class="top_logo" src="../../static/logo.png" mode=""></image>
- <image class="tite" :src="$t('MainTitle')" mode=""></image>
- <!-- <view class="tite">
- {{ $t('MainTitle') }}
- </view> -->
- <view class="time">
- <view class="time_top">
- {{ formattedTime}}
- </view>
- <view class="time_bottom">
- <view>
-
- </view>
- <view class="time_bottom1">
- {{ $t('status') }}
- <view class="time_state" v-if="status=='ok'">
- {{$t('online')}}
- </view>
- <view class="time_state1" v-else>
- {{$t('offline')}}
- </view>
- </view>
-
- </view>
- </view>
- </view>
- <view class="tap">
- <view class="tap_1">
- AC
- </view>
- <view class="tap_2">
- DC
- </view>
- <view class="tap_3">
- SYS
- </view>
- </view>
- <view class="power" v-if="status=='ok'">
- <!-- <view class="power_1">
- <image v-if="selectorid!=3&&selectorindex==1" src="../../static/choice1.png" mode=""></image>
- <image v-else src="../../static/electricity.png" mode="" @click="onclick(3)"></image>
- </view>
- <view class="power_1">
- <image v-if="selectorid!=2&&selectorindex==1" src="../../static/choice2.png" mode=""></image>
- <image v-else src="../../static/power1.png" mode="" @click="onclick(2)"></image>
- </view>
- <view class="power_1">
- <image v-if="selectorid!=4&&selectorindex==1" src="../../static/choice3.png" mode=""></image>
- <image v-else src="../../static/direct1.png" mode="" @click="onclick(4)"></image>
- </view>
- <view class="power_1">
- <image v-if="selectorid!=1&&selectorindex==1" src="../../static/choice4.png" mode=""></image>
- <image v-else src="../../static/DCpower1.png" mode="" @click="onclick(1)"></image>
- </view> -->
- <view v-if="selectorid!=3&&selectorindex==1">
- <view class="power_1">
- <view class="power_bj">
- <image src="../../static/img/energy1.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('CommunicationRecharge')}}</view>
- </view>
- </view>
- <view v-else @click="onclick(3)">
- <view class="power_1">
- <view class="power_bright">
- <image src="../../static/img/Energybrightness1.png" mode=""></image>
- </view>
- <view class="power_title_bright">{{$t('CommunicationRecharge')}}</view>
- </view>
- </view>
- <view v-if="selectorid!=2&&selectorindex==1">
- <view class="power_1">
- <view class="power_bj">
- <image src="../../static/img/energy2.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('CommunicationSupply')}}</view>
- </view>
- </view>
- <view v-else @click="onclick(2)">
- <view class="power_1">
- <view class="power_bright">
- <image src="../../static/img/Energybrightness2.png" mode=""></image>
- </view>
- <view class="power_title_bright">{{$t('CommunicationSupply')}}</view>
- </view>
- </view>
- <view v-if="selectorid!=4&&selectorindex==1">
- <view class="power_1">
- <view class="power_bj">
- <image src="../../static/img/energy3.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('DirectRecharge')}}</view>
- </view>
- </view>
- <view v-else @click="onclick(4)">
- <view class="power_1">
- <view class="power_bright">
- <image src="../../static/img/Energybrightness3.png" mode=""></image>
- </view>
- <view class="power_title_bright">{{$t('DirectRecharge')}}</view>
- </view>
- </view>
- <view v-if="selectorid!=1&&selectorindex==1">
- <view class="power_1">
- <view class="power_bj">
- <image src="../../static/img/energy4.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('DirectSupply')}}</view>
- </view>
- </view>
- <view v-else @click="onclick(1)">
- <view class="power_1">
- <view class="power_bright">
- <image src="../../static/img/Energybrightness4.png" mode=""></image>
- </view>
- <view class="power_title_bright">{{$t('DirectSupply')}}</view>
- </view>
- </view>
- <view class="power_5" @click="system">
- <view class="power_bj">
- <image src="../../static/img/setup.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('SystemInformation')}}</view>
- </view>
- </view>
- <view class="power" v-else>
- <view>
- <view class="power_1">
- <!-- <view class="power_bj" @click="onget(3)"> -->
- <view class="power_bj">
- <image src="../../static/img/energy1.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('CommunicationRecharge')}}</view>
- </view>
- </view>
-
- <view>
- <view class="power_1">
- <!-- <view class="power_bj" @click="onget(2)"> -->
- <view class="power_bj">
- <image src="../../static/img/energy2.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('CommunicationSupply')}}</view>
- </view>
- </view>
- <view>
- <view class="power_1">
- <!-- <view class="power_bj" @click="onget(4)"> -->
- <view class="power_bj">
- <image src="../../static/img/energy3.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('DirectRecharge')}}</view>
- </view>
- </view>
-
- <view>
- <!-- <view class="power_1" @click="onget(1)"> -->
- <view class="power_1">
- <view class="power_bj">
- <image src="../../static/img/energy4.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('DirectSupply')}}</view>
- </view>
- </view>
-
- <view class="power_5" @click="system">
- <view class="power_bj">
- <image src="../../static/img/setup.png" mode=""></image>
- </view>
- <view class="power_title">{{$t('SystemInformation')}}</view>
- </view>
- </view>
- <view class="power_6" v-if="selectorindex==1">
- <image src="../../static/!.png" mode=""></image>{{$t('Tipswarning')}}
- </view>
- <uni-popup ref="message" type="message">
- <uni-popup-message type="error" :message="messageText" :duration="2500"></uni-popup-message>
- </uni-popup>
-
- <view class="switch-container">
- <uni-data-select
- v-model="appLanguage"
- :localdata="range"
- :clear="false"
- @change="changeLanguage"
- ></uni-data-select>
- </view>
-
- <view class="appVersioncss">
- {{$t('version')}}{{appVersion}}
- </view>
- </view>
- </template>
-
- <script>
- import {getuidatas,control} from "../../api/api.js"
- import {getTime} from "../../utils/index.js"
- import { mapState } from 'vuex';
- export default {
- data() {
-
- return {
- title: '',
- uidatas:'',
- formatTimeid:'',
- messageText:'',
- appVersion: '', // 用于存储应用版本号
- appLanguage:'zh-Hans',
- range: [
- { value: 'zh-Hans', text: "中文" },
- { value: 'en', text: "English" },
- ],
- }
- },
- created() {
- // 从本地存储读取用户选择的语言
-
- },
- mounted(){
- this.appLanguage = uni.getStorageSync('userLanguage') || 'zh-Hans';
- },
-
- computed: {
-
- // 使用 mapState 映射多个状态到组件的计算属性
- ...mapState(['formattedTime','status','selectorid','selectorindex']),
- ...mapState({
- uidatasdata: state => state.uidatasdata
- })
- },
- onLoad() {
- // this.onfaultsList();
- // 获取系统信息
- uni.getSystemInfo({
- success: (res) => {
- console.log(res);
- this.appVersion = res.appWgtVersion // 获取版本号并赋值
- },
- fail: (err) => {
- console.error('获取系统信息失败:', err);
- }
- });
- },
- beforeUnmount() {
- clearInterval(this.uidatas);
- // clearInterval(this.formatTimeid);
- },
- methods: {
- changeLanguage(locale){
- console.log(locale);
- this.$i18n.locale = locale
- uni.setStorageSync('userLanguage', locale);
- },
- onclick(e){
- this.pattern(e)
- },
- pattern(unm){
- let data = {
- id: "c32e6a80-9159-4f6e-9acc-8525cf177808",
- issaveinitvalue:true,
- value:unm+'' // 直流供电=1,直流补电=4,交流供电=2,交流补电=3
- }
- control(data).then(data => {
- console.log(data);
- if (data.status == 'ok') {
- if (unm==3) {
- uni.redirectTo({
- url: '/pages/home/index'
- });
- } else if(unm==2){
- uni.redirectTo({
- url: '/pages/electricity/index'
- });
- }else if(unm==4){
- uni.redirectTo({
- url: '/pages/supply/supply'
- });
- }else if(unm==1){
- uni.redirectTo({
- url: '/pages/supplyss/supplyss'
- });
- }
- } else {
- // uni.hideLoading()
- // uni.showToast({
- // title:'选择模式失败请重新选择',
- // icon: 'warning',
- // duration: 2500, // 显示时长,单位为毫秒
- // });
- this.messageText = '选择模式失败请重新选择'
- this.$refs.message.open()
- return
- }
- });
- },
- onget(unm){
- if (unm==3) {
- uni.redirectTo({
- url: '/pages/home/index'
- });
- } else if(unm==2){
- uni.redirectTo({
- url: '/pages/electricity/index'
- });
- }else if(unm==4){
- uni.redirectTo({
- url: '/pages/supply/supply'
- });
- }else if(unm==1){
- uni.redirectTo({
- url: '/pages/supplyss/supplyss'
- });
- }
- },
- system(){
- uni.redirectTo({
- url: '/pages/faultlist/index'
- });
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .content{
- width: 100%;
- height: 100vh;
- opacity: 1;
- background: linear-gradient(180deg, rgba(215, 230, 245, 0) 0%, rgba(196, 229, 255, 1) 100%);
- box-sizing: border-box;
- }
- .top {
- width: 100%;
- height: 100px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- background-size: 100% 100%;
- background-repeat: no-repeat;
- box-sizing: border-box;
- background-color: #fff;
- padding: 0px 46px;
- }
- .top_logo{
- width:327px;
- height: 56px;
- }
- .tite{
- width: 325px;
- height: 50px;
- }
- .time{
- width:277px;
- text-align: right;
- }
- .time_top{
- font-size: 17px;
- }
- .time_bottom{
- display: flex;
- font-size: 17px;
- justify-content: space-between;
- }
- .time_bottom1{
- display: flex;
- }
- .time_state{
- font-size: 17px;
- font-weight: 600;
- color: rgba(22, 68, 144, 1);
- }
- .time_state1 {
- font-size: 17px;
- font-weight: 600;
- color: rgba(217, 22, 22, 1);
- }
- .tap{
- width: 100%;
- height: 46.01px;
- display: flex;
- justify-content: space-between;
- margin-top: 118px;
- margin-bottom: 50px;
- padding: 0px 40px;
- box-sizing: border-box;
- }
- .tap_1{
- width: 485.57px;
- height: 46.5px;
- border-radius: 50px;
- background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 35.24px;
- font-weight: 700;
- color: #fff;
- }
- .tap_2{
- width: 485px;
- height: 46.5px;
- border-radius: 50px;
- background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 35.24px;
- font-weight: 700;
- color: #fff;
- }
- .tap_3{
- width: 155.17px;
- height: 46.01px;
- opacity: 1;
- border-radius: 24.47px;
- background: linear-gradient(180deg, rgba(43, 158, 218, 1) 0%, rgba(39, 114, 186, 1) 100%);
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 30px;
- font-weight: 700;
- color: #fff;
- }
- .power{
- width: 100%;
- display: flex;
- justify-content: space-between;
- padding: 0px 40px;
- box-sizing: border-box;
- }
- .power_1{
- width: 237.55px;
- height: 299px;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- // justify-content: space-around;
- box-sizing: border-box;
- .power_bright{
- width: 100%;
- height: 250px;
- background-image: url("../../static/img/bj.png");
- background-size: 100% 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- opacity: 1;
- }
- .power_bj{
- width: 100%;
- height: 250px;
- background-image: url("../../static/img/bj.png");
- background-size: 100% 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- opacity: 0.4;
- }
- .power_title{
- font-size: 20px;
- font-weight: 600;
- letter-spacing: 0px;
- color: rgba(0, 0, 0, 1);
- opacity: 0.4;
- box-sizing: border-box;
- }
- .power_title_bright{
- font-size: 20px;
- font-weight: 600;
- letter-spacing: 0px;
- color: rgba(0, 0, 0, 1);
- opacity: 1;
- box-sizing: border-box;
- }
- image {
- width: 200px;
- height: 150px;
- }
- }
-
- .power_11{
- width: 237.55px;
- height: 298.98px;
- opacity: 1;
- box-sizing: border-box;
- font-size: 23px;
- font-family: 400;
- display: flex;
- flex-direction: column;
- align-items: center;
- .power_image{
- width: 100%;
- height: 248px;
- margin-bottom: 20px;
- background-image: url("../../static/electricity1.png");
- background-size: 100% 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0px 16px;
- box-sizing: border-box;
- image{
- width: 100%;
- height: 160.06px;
- }
- }
- }
- .power_5{
- width: 158px;
- height: 297.61px;
- opacity: 1;
- // margin-left: 20px;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: space-between;
- .power_bj{
- width: 100%;
- height: 250px;
- background-image: url("../../static/img/setup_bj.png");
- background-size: 100% 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .power_title{
- font-size: 20px;
- font-weight: 600;
- letter-spacing: 0px;
- color: rgba(0, 0, 0, 1);
- box-sizing: border-box;
- }
- image{
- width: 92px;
- height: 92px;
- }
- }
- .power_6{
- width: 100%;
- height: 50px;
- font-size: 17.62px;
- margin-top: 80px;
- display: flex;
- align-items: center;
- padding: 0px 20px;
- box-sizing: border-box;
- position: fixed;
- left: 0px;
- bottom: 64px;
- image{
- margin-right: 10px;
- width: 27.41px;
- height: 27.41px;
- };
- }
- .appVersioncss{
- position: fixed;
- bottom: 10px;
- right: 20px;
- color: #ccc;
- }
- .switch-container {
- width: 120px;
- display: flex;
- align-items: center;
- position: fixed;
- top: 110px;
- right: 40px;
- }
-
- .switch-label {
- margin-right: 10px;
- font-size: 16px;
- color: #333;
- }
-
- </style>
|