From ea689dd91eaa72425dc01759042c3b4eb2186512 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期三, 17 六月 2026 10:14:44 +0800
Subject: [PATCH] 新增智能电表、空调管理
---
h5/pages/index.vue | 96 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 73 insertions(+), 23 deletions(-)
diff --git a/h5/pages/index.vue b/h5/pages/index.vue
index 9d3409d..ba479e2 100644
--- a/h5/pages/index.vue
+++ b/h5/pages/index.vue
@@ -1,6 +1,6 @@
<template>
<view class="main_app">
- <view class="hone_name title">{{ userInfo.realname }}锛屾杩庣櫥褰�</view>
+ <view class="hone_name title">{{ userInfo.realname }}锛屾杩庣櫥褰曪綖</view>
<view class="home_con">
<image class="bg" src="@/static/home/home_bg.jpg" mode=""></image>
<view class="h1">闃滃畞鏂囦綋涓績</view>
@@ -18,20 +18,27 @@
<view v-for="item in list2" class="item" @click="itemClick(item)">
<image :src="item.img"></image>
<view class="name">{{item.name}}</view>
+ <view v-if="item.name == '寰呭姙涓績' && taskNum" class="superscript">{{taskNum}}</view>
</view>
</view>
- <view class="loginout" @click="loginOut">閫�鍑虹櫥闄�</view>
+ <view class="footer-actions">
+ <view class="switch-role" @click="switchRole">鍒囨崲瑙掕壊</view>
+ <view class="loginout" @click="loginOut">閫�鍑虹櫥褰�</view>
+ </view>
</view>
</template>
-<script>
- import { logoutPost } from '@/api'
+<script>
+ import {
+ logoutPost,
+ myNoticesH5
+ } from '@/api'
+ import { switchRole as doSwitchRole, goRoleSelect } from '@/utils/roleSwitch.js'
export default {
data() {
return {
userInfo: uni.getStorageSync('userInfo') || {},
- list1: [
- {
+ list1: [{
name: '鏂板宸ュ崟',
url: '/pages/workOrder/edit',
img: require('@/static/home/ic_xinzenggongdan@2x.png'),
@@ -49,6 +56,12 @@
img: require('@/static/home/ic_fangkebaobe@2x.png'),
auth: 'weixin:menu:visitcar'
},
+ {
+ name: '搴撳瓨鐩樼偣',
+ url: '/pages/inventory/index',
+ img: require('@/static/home/ic_pandian@2x.png'),
+ auth: 'weixin:menu:visitcar'
+ },
],
list2: [{
name: '宸℃浠诲姟',
@@ -62,11 +75,20 @@
img: require('@/static/home/ic_wodehuiyi@2x.png'),
auth: 'weixin:menu:visitcar'
},
- ]
+ {
+ name: '寰呭姙涓績',
+ url: '/pages/workOrder/wait',
+ img: require('@/static/home/ic_daiban@2x.png'),
+ auth: 'weixin:menu:visitcar'
+ },
+ ],
+ taskNum: 0
}
},
- onLoad() {
-
+ onShow() {
+ myNoticesH5({ page: 1, capacity: 1,model: {status: 0}}).then(res => {
+ this.taskNum = res.data.total
+ })
},
methods: {
itemClick(item) {
@@ -74,13 +96,11 @@
url: item.url
})
},
- loginOut() {
- logoutPost()
- this.$store.commit('empty')
- uni.redirectTo({
- url: '/pages/login'
- })
- // window.location.href= 'https://zhcg.fnwtzx.com/fn_h5'
+ switchRole () {
+ doSwitchRole(logoutPost)
+ },
+ loginOut() {
+ logoutPost().catch(() => {}).finally(() => goRoleSelect())
},
}
@@ -129,7 +149,7 @@
flex-direction: column;
align-items: center;
width: 25%;
-
+ position: relative;
image {
width: 88rpx;
height: 88rpx;
@@ -139,23 +159,53 @@
.name {
font-size: 26rpx;
}
+ .superscript{
+ height: 40rpx;
+ width: 40rpx;
+ position: absolute;
+ top: -16rpx;
+ right: 24rpx;
+ background-color: red;
+ color: #fff;
+ font-size: 24rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 50%;
+ }
}
}
- .loginout {
+ .footer-actions {
position: fixed;
bottom: 88rpx;
- left: 50%;
- transform: translate(-50%, 0);
- width: 152rpx;
+ left: 0;
+ right: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: 24rpx;
+ }
+
+ .switch-role,
+ .loginout {
height: 60rpx;
+ padding: 0 32rpx;
border-radius: 30rpx;
- border: 1rpx solid $primaryColor;
- color: $primaryColor;
font-size: 26rpx;
display: flex;
justify-content: center;
align-items: center;
}
+
+ .switch-role {
+ border: 1rpx solid $primaryColor;
+ color: $primaryColor;
+ }
+
+ .loginout {
+ border: 1rpx solid #ccc;
+ color: #666;
+ }
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3