对接上报记录、bannar

This commit is contained in:
zhouyanli
2026-05-18 17:20:14 +08:00
parent eb7d4da5e3
commit 616bfdfd90
13 changed files with 172 additions and 90 deletions

View File

@@ -17,6 +17,8 @@ export const getLoginBySms = (data) =>{
export const getResetPassword = (data) =>{ export const getResetPassword = (data) =>{
return post('/api/butler/auth/forgetPassword',data) return post('/api/butler/auth/forgetPassword',data)
} }
// ======首页===== // ======首页=====
// 获取小区列表 // 获取小区列表
export const getVillageList = (data) =>{ export const getVillageList = (data) =>{
@@ -38,6 +40,12 @@ export const getTodayInspection = () =>{
export const getNewNoticeData = () =>{ export const getNewNoticeData = () =>{
return get('/manage/notice/new') return get('/manage/notice/new')
} }
// 获取bannar图
export const getBannarList = () =>{
return get('/api/manage/banner/list')
}
// ============通知列表=========== // ============通知列表===========
export const getNoticeList = (data) =>{ export const getNoticeList = (data) =>{
@@ -75,6 +83,10 @@ export const switchOpenDoor = (data) =>{
export const getSettingInfo = () =>{ export const getSettingInfo = () =>{
return get('/api/setting/info') return get('/api/setting/info')
} }
// 上报记录
export const getMyOrderList = (data) =>{
return get('/manage/repair/order/myorderlist',data)
}
// =====设置======= // =====设置=======
// 修改密码 // 修改密码
export const changePassword = (data) =>{ export const changePassword = (data) =>{

View File

@@ -4,7 +4,7 @@
<view class="news-card" v-for="item in noticeList" :key="item.id"> <view class="news-card" v-for="item in noticeList" :key="item.id">
<view class="news-header"> <view class="news-header">
<text class="news-title">{{ item.item || '暂无标题' }}</text> <text class="news-title">{{ item.item || '暂无标题' }}</text>
<view class="unread-dot" v-if="item.isCheck === '0' "></view> <view class="unread-dot" v-if="item.isCheckStr === '未读' "></view>
</view> </view>
<view class="news-meta"> <view class="news-meta">

View File

@@ -47,7 +47,7 @@
</view> </view>
<!-- 确认开门按钮 --> <!-- 确认开门按钮 -->
<button class="confirm-btn" @click="openDoor" :disabled="selectedDoor === -1">确认开门</button> <button class="confirm-btn" @click="openDoor" :disabled="selectedDoor === -1">确认开门 </button>
</view> </view>
</template> </template>

View File

@@ -41,56 +41,68 @@
scroll-y scroll-y
:style="{ height: `calc(100vh - ${navHeight + statusTabHeight + typeTabHeight}px)` }" :style="{ height: `calc(100vh - ${navHeight + statusTabHeight + typeTabHeight}px)` }"
> >
<!-- 空状态 -->
<view v-if="filteredRecords.length === 0" class="empty-state">
<uni-icons type="empty" size="60" color="#ccc"></uni-icons>
<text class="empty-text">暂无上报记录</text>
</view>
<!-- 记录卡片 --> <!-- 记录卡片 -->
<view <view
v-for="record in filteredRecords" v-for="record in reportRecords"
:key="record.id" :key="record.id"
class="record-card" class="record-card"
> >
<!-- 标题 + 状态标签 --> <!-- 标题 + 状态标签 -->
<view class="card-header"> <view class="card-header">
<text class="card-title">{{ record.title }}</text> <text class="card-title">{{ record.item }}</text>
<view class="status-tag" :class="record.status"> <view class="status-tag" :class="getStatusClass(record.problemStatus)">
{{ getStatusText(record.status) }} {{ getStatusText(record.problemStatus) }}
</view> </view>
</view> </view>
<!-- 类型标签 --> <!-- 类型标签 -->
<view class="tag-group"> <view class="tag-group">
<view class="tag-item">{{ record.reportType }}</view> <view class="tag-item">{{ record.projectTypeStr || '无 ' }}</view>
<view class="tag-item">{{ record.category }}</view> <view class="tag-item">{{ record.maintenanceItemName || '无'}}</view>
</view> </view>
<!-- 内容 --> <!-- 内容 -->
<view class="card-content"> <view class="card-content">
{{ record.content }} {{ record.problem }}
</view> </view>
<!-- 底部信息 --> <!-- 底部信息 -->
<view class="card-footer"> <view class="card-footer">
<text class="create-time">{{ record.createTime }}</text> <text class="create-time">{{ record.createTime }}</text>
<text v-if="record.repairman" class="repairman">维修师傅:{{ record.repairman }}</text> <text v-if="record.repairName" class="repairman">维修师傅:{{ record.repairName }}</text>
</view> </view>
</view> </view>
<!-- 加载提示 + 没有更多数据 -->
<view class="load-more" v-if="reportRecords.length > 0">
<text v-if="loading">加载中...</text>
<text v-else-if="noMore">没有更多数据了</text>
</view>
<!-- 空数据 -->
<view class="empty" v-if="reportRecords.length === 0 && !loading">
暂无上报记录
</view>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, computed } from 'vue' import { ref } from 'vue'
import {onReady} from "@dcloudio/uni-app" import {onReady, onReachBottom, onPullDownRefresh,onShow} from "@dcloudio/uni-app"
import {getMyOrderList} from '../../api/api.js'
// 导航栏/标签高度(适配不同设备) // 导航栏/标签高度(适配不同设备)
const navHeight = ref(44) const navHeight = ref(44)
const statusTabHeight = ref(88) const statusTabHeight = ref(88)
const typeTabHeight = ref(88) const typeTabHeight = ref(88)
// 分页
const pageNum = ref(1) // 当前页
const pageSize = ref(5) // 每页条数
const total = ref(0) // 总条数
const loading = ref(false) // 加载状态
const noMore = ref(false) // 是否没有更多
// 筛选状态 // 筛选状态
const activeStatus = ref('all') // 全部/待分配/待解决/已完成 const activeStatus = ref('all') // 全部/待分配/待解决/已完成
const activeType = ref('all') // 全部/公共报修/个人报修 const activeType = ref('all') // 全部/公共报修/个人报修
@@ -98,71 +110,95 @@ const activeType = ref('all') // 全部/公共报修/个人报修
// 状态筛选选项 // 状态筛选选项
const statusTabs = ref([ const statusTabs = ref([
{ label: '全部', value: 'all' }, { label: '全部', value: 'all' },
{ label: '待分配', value: 'pending' }, // { label: '待分配', value: 'pending' },
{ label: '待解决', value: 'processing' }, { label: '待解决', value: '1' },
{ label: '已完成', value: 'completed' } { label: '已完成', value: '2' }
]) ])
// 类型筛选选项 // 类型筛选选项
const typeTabs = ref([ const typeTabs = ref([
{ label: '全部', value: 'all' }, { label: '全部', value: 'all' },
{ label: '公共报修', value: 'public' }, { label: '公共报修', value: '0' },
{ label: '个人报修', value: 'private' } { label: '个人报修', value: '1' }
]) ])
// 模拟上报记录数据(实际项目替换为接口请求) // 上报记录数据
const reportRecords = ref([ const reportRecords = ref([])
{
id: 1, // 获取列表数据
title: '标题巴拉巴拉巴拉', const getReportList = (isRefresh = false) => {
status: 'pending', // pending/processing/completed // 防止重复请求
reportType: '公共报修', if (loading.value || noMore.value) return
category: '路灯',
content: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。', loading.value = true
createTime: '2026-08-01 10:05:46', const params = {
repairman: '' pageSize: pageSize.value,
}, pageNum: pageNum.value
{
id: 2,
title: '标题巴拉巴拉巴拉',
status: 'processing',
reportType: '公共报修',
category: '路灯',
content: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
createTime: '2026-08-01 10:05:46',
repairman: '张三'
},
{
id: 3,
title: '标题巴拉巴拉巴拉',
status: 'completed',
reportType: '公共报修',
category: '路灯',
content: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
createTime: '2026-08-01 10:05:46',
repairman: '张三'
} }
]) if (activeType.value !== 'all') {
params.itemType = activeType.value
}
if (activeStatus.value !== 'all') {
params.problemStatus = activeStatus.value
}
getMyOrderList(params).then(res => {
if (res.code === 200) {
total.value = res.total || 0
const data = res.rows || []
// 筛选后的记录 // 第一页:覆盖,分页:追加
const filteredRecords = computed(() => { if (pageNum.value === 1) {
return reportRecords.value.filter(record => { reportRecords.value = data
// 状态筛选 } else {
const statusMatch = activeStatus.value === 'all' || record.status === activeStatus.value reportRecords.value = [...reportRecords.value, ...data]
// 类型筛选 }
const typeMatch = activeType.value === 'all' || record.reportType === typeTabs.value.find(item => item.value === activeType.value)?.label
return statusMatch && typeMatch // 判断是否还有更多
noMore.value = reportRecords.value.length >= total.value
}
}).catch(() => {
uni.showToast({ title: '加载失败', icon: 'none' })
}).finally(() => {
loading.value = false
if (isRefresh) {
uni.stopPullDownRefresh()
}
}) })
}
// 上拉加载更多
onReachBottom(() => {
if (noMore.value || loading.value) return
pageNum.value++
getReportList()
}) })
// 切换状态(全部/待分配/待解决/已完成)筛选 // 下拉刷新
onPullDownRefresh(() => {
pageNum.value = 1
noMore.value = false
getReportList(true)
})
// 筛选/分页重置后重新拉数据
const reloadList = () => {
pageNum.value = 1
noMore.value = false
reportRecords.value = []
getReportList()
}
// 切换状态(全部/待解决/已完成)筛选
const switchStatus = (value) => { const switchStatus = (value) => {
if (activeStatus.value === value) return
activeStatus.value = value activeStatus.value = value
reloadList()
} }
// 切换类型(公共/个人)筛选 // 切换类型(公共/个人)筛选
const switchType = (value) => { const switchType = (value) => {
if (activeType.value === value) return
activeType.value = value activeType.value = value
reloadList()
} }
// 返回上一页 // 返回上一页
@@ -175,12 +211,25 @@ const navBack = () => {
// 获取状态文本 // 获取状态文本
const getStatusText = (status) => { const getStatusText = (status) => {
const statusMap = { const statusMap = {
pending: '待分配', // "pending": '已分配',
processing: '待解决', "1": '待解决',
completed: '已完成' '2': '已完成'
} }
return statusMap[status] || '' return statusMap[status] || ''
} }
// 获取状态标签样式类名
const getStatusClass = (status) => {
const classMap = {
'1': 'processing',
'2': 'completed'
}
return classMap[status] || ''
}
onShow(() => {
pageNum.value = 1
noMore.value = false
getReportList()
})
// 页面渲染完成后适配高度 // 页面渲染完成后适配高度
onReady(() => { onReady(() => {
@@ -278,22 +327,6 @@ onReady(() => {
box-sizing: border-box; box-sizing: border-box;
} }
/* 空状态 */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
color: #ccc;
}
.empty-text {
font-size: 32rpx;
color: #999;
margin-top: 20rpx;
}
/* 记录卡片 */ /* 记录卡片 */
.record-card { .record-card {
background-color: #fff; background-color: #fff;
@@ -373,4 +406,17 @@ onReady(() => {
.repairman { .repairman {
color: #999; color: #999;
} }
.load-more {
text-align: center;
padding: 30rpx;
color: #999;
font-size: 26rpx;
}
.empty {
text-align: center;
padding: 100rpx 0;
color: #999;
font-size: 28rpx;
}
</style> </style>

View File

@@ -39,17 +39,28 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
import { logout } from '../../api/api.js' import { logout, getSettingInfo } from '../../api/api.js'
// 响应式数据 // 响应式数据
const phoneNumber = ref('') // 绑定手机号 const phoneNumber = ref('') // 绑定手机号
const passwordNumber = ref('') const passwordNumber = ref('')
// 获取用户信息中的手机号
const fetchUserInfo = () => {
getSettingInfo().then(res => {
if (res.code === 200 && res.data) {
phoneNumber.value = res.data.phonenumber || ''
}
})
}
// 页面显示时读取最新数据(从修改页返回也会触发) // 页面显示时读取最新数据(从修改页返回也会触发)
onShow(() => { onShow(() => {
const userInfo = uni.getStorageSync('tempChangePwdParams') const userInfo = uni.getStorageSync('tempChangePwdParams')
if (userInfo.phoneNumber) { if (userInfo && userInfo.phoneNumber) {
phoneNumber.value = userInfo.phoneNumber phoneNumber.value = userInfo.phoneNumber
} else {
fetchUserInfo()
} }
}) })

View File

@@ -74,7 +74,7 @@
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"onReachBottomDistance": 100 "onReachBottomDistance": 100
} }
}, }
] ]
}, },
{ {
@@ -196,7 +196,9 @@
"path": "reportingRecord", "path": "reportingRecord",
"style": { "style": {
"navigationBarTitleText": "上报记录", "navigationBarTitleText": "上报记录",
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true,
"onReachBottomDistance": 100
} }
} }
] ]

View File

@@ -39,7 +39,7 @@
<swiper class="swiper-box" :current="current" autoplay> <swiper class="swiper-box" :current="current" autoplay>
<swiper-item v-for="(item, index) in bannerList" :key="index"> <swiper-item v-for="(item, index) in bannerList" :key="index">
<view class="swiper-item"> <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> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
@@ -124,12 +124,12 @@
<script setup> <script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { onLoad, onUnload } from '@dcloudio/uni-app' 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 current = ref(0)
const currentCommunity = ref('请选择小区') const currentCommunity = ref('请选择小区')
const bannerList = ref([{ img: 'https://wuyeadmin.bugtc.com/images/imgs/banner1.png' }]) const bannerList = ref([])
const noticeText = ref('暂无公告') const noticeText = ref('暂无公告')
const allCount = ref(0) // 全部巡检 const allCount = ref(0) // 全部巡检
const pendingCount = ref(0) //待巡检 const pendingCount = ref(0) //待巡检
@@ -237,6 +237,16 @@ const getNoticeData = () => {
} }
}).catch(() => {}) }).catch(() => {})
} }
// 获取bannar图
function getbannarData(){
getBannarList().then(res => {
if (res.code === 200 && res.data) {
bannerList.value = res.data
}else{
bannerList.value = []
}
}).catch(() => {})
}
// 接收选择小区返回的参数 // 接收选择小区返回的参数
const slelctHomeData = data => { const slelctHomeData = data => {
@@ -251,6 +261,7 @@ onLoad(() => {
// 优先调用接口获取当前小区,失败时再读缓存 // 优先调用接口获取当前小区,失败时再读缓存
currentVillageData() currentVillageData()
getInspectionData() getInspectionData()
getbannarData()
}) })
onUnload(() => { onUnload(() => {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B