# Conflicts:
#	wuye-manager-uniapp/pages/index/index.vue
This commit is contained in:
Zy
2026-05-20 09:20:48 +08:00
18 changed files with 455 additions and 352 deletions

View File

@@ -2,7 +2,7 @@
<view class="content-class">
<view class="nar-top">
<!-- 这里是状态栏占位 -->
<view class="status_bar"></view>
<view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
<!-- 导航栏 -->
<view class="nav-bar">
<text class="nav-title">首页</text>
@@ -45,7 +45,7 @@
<swiper class="swiper-box" :current="current" autoplay>
<swiper-item v-for="(item, index) in bannerList" :key="index">
<view class="swiper-item">
<image :src="item.img" style="width: 100%; height: 100%"></image>
<image :src="item.url" style="width: 100%; height: 100%"></image>
</view>
</swiper-item>
</swiper>
@@ -84,7 +84,7 @@
<!-- 巡检数据统计区 -->
<view class="statistics-wrap">
<view class="statistics-item" @click="goToInspectionRecord">
<text class="num">{{ totalTasks }}</text>
<text class="num">{{ allCount }}</text>
<text class="label">全部巡检</text>
</view>
<view class="statistics-item" @click="goToDaysInspection">
@@ -153,16 +153,18 @@
<script setup>
import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app'
import { getCurrentVillage, getTodayInspection, getNewNoticeData } from '../../api/api.js'
import { getCurrentVillage,getTodayInspection,getNewNoticeData,getBannarList} from '../../api/api.js'
// 列表数据状态
const current = ref(0)
const currentCommunity = ref('请选择小区')
const bannerList = ref([{ img: 'https://wuyeadmin.bugtc.com/images/imgs/banner1.png' }])
const bannerList = ref([])
const noticeText = ref('暂无公告')
const totalTasks = ref(0) // 全部巡检
const allCount = ref(0) // 全部巡检
const pendingCount = ref(0) //待巡检
const InspectedCount = ref(0) //已巡检
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// =======方法=======
// 跳转小区
@@ -240,19 +242,17 @@ const currentVillageData = () => {
.catch(() => {})
}
// 获取今日巡检数据
const getInspectionData = () => {
getTodayInspection()
.then(res => {
if (res.code === 200) {
if (res.data) {
totalTasks.value = res.data.totalTasks
pendingCount.value = res.data.unfinishedTasks
InspectedCount.value = res.data.completedTasks
} else {
totalTasks.value = 0
pendingCount.value = 0
InspectedCount.value = 0
}
const getInspectionData = () =>{
getTodayInspection().then(res =>{
if(res.code === 200){
if(res.data){
allCount.value = res.data.totalTasks
pendingCount.value = res.data.unfinishedTasks
InspectedCount.value = res.data.completedTasks
}else{
allCount.value = 0
pendingCount.value = 0
InspectedCount.value = 0
}
})
.catch(err => {
@@ -271,6 +271,16 @@ const getNoticeData = () => {
})
.catch(() => {})
}
// 获取bannar图
function getbannarData(){
getBannarList().then(res => {
if (res.code === 200 && res.data) {
bannerList.value = res.data
}else{
bannerList.value = []
}
}).catch(() => {})
}
// 接收选择小区返回的参数
const slelctHomeData = data => {
@@ -285,6 +295,7 @@ onLoad(() => {
// 优先调用接口获取当前小区,失败时再读缓存
currentVillageData()
getInspectionData()
getbannarData()
})
onUnload(() => {
@@ -311,8 +322,8 @@ const clickItem = index => {
}
.status_bar {
height: 46px;
width: 100%;
flex-shrink: 0;
}
/* 导航栏 */
@@ -323,7 +334,7 @@ const clickItem = index => {
}
.nav-title {
font-size: 14px;
font-size: 32rpx;
font-weight: 400;
}