# 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

@@ -100,14 +100,14 @@ onLoad((options) => {
repairId.value = options.projectId
}
// ✅ 监听返回选择的项目
// 监听返回选择的项目
uni.$on('selectRepairProject', (data) => {
repairProject.value = `${data.category}-${data.project}`
repairId.value = data.projectId
})
})
// ✅ 页面卸载时移除监听(必须加)
// 页面卸载时移除监听
onUnload(() => {
uni.$off('selectRepairProject')
})
@@ -155,8 +155,8 @@ const uploadImages = async () => {
uploadedUrls.push(res.url || '')
} catch (err) {
uni.showToast({
title:e.msg || '图片上传失败',
icon:'error'
title:err.msg || '图片上传失败',
icon:'error'
})
}
}

View File

@@ -42,18 +42,10 @@ import { onLoad } from '@dcloudio/uni-app'
import {getRepairOrder} from '../../api/api.js'
// 分类列表
const categoryList = ref([
// { id: 1, name: '基础设施' },
// { id: 2, name: '电子设施' }
])
const categoryList = ref([])
// 所有项目数据
const projectList = ref([
// { id: 101, categoryId: 1, name: '路灯' },
// { id: 102, categoryId: 1, name: '楼层指示灯' },
// { id: 103, categoryId: 2, name: '应急出口灯' },
// { id: 104, categoryId: 1, name: '草坪灯' }
])
const projectList = ref([])
// 选中的分类
const activeCategory = ref(1)
@@ -91,7 +83,7 @@ const fetchProjectList = async () => {
activeCategory.value = categoryList.value[0]?.id || 1
}
} catch (e) {
uni.showToast({ title: '获取项目列表失败', icon: 'none' })
uni.showToast({ title: e.msg ||'获取项目列表失败', icon: 'none' })
}
}

View File

@@ -10,7 +10,7 @@
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
<image
src="https://wuyeadmin.bugtc.com/images/login/phone.png"
mode=""
mode="aspectFit"
style="height: 100%; width: 100%"
></image>
</view>
@@ -31,7 +31,7 @@
<view class="input-icon">
<image
src="https://wuyeadmin.bugtc.com/images/login/code.png"
mode=""
mode="aspectFit"
style="height: 100%; width: 100%"
>
</image>
@@ -269,7 +269,6 @@ onUnmounted(() => {
/* 页面容器 */
.login-page {
padding: 80rpx 40rpx 40rpx;
/* background-color: #f8f9fa; */
min-height: 100vh;
background: repeating-linear-gradient(to bottom, #e2f0ff, #f6faff);
}

View File

@@ -4,7 +4,7 @@
<view class="news-card" v-for="item in noticeList" :key="item.id">
<view class="news-header">
<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 class="news-meta">
@@ -45,7 +45,7 @@ const noticeList = ref([])
// 分页相关
const pageNum = ref(1) // 当前页
const pageSize = ref(5) // 每页条数
const pageSize = ref(10) // 每页条数
const total = ref(0) // 总条数
const loading = ref(false) // 加载状态
const noMore = ref(false) // 是否没有更多

View File

@@ -1,7 +1,7 @@
<template>
<!-- 页面主容器 -->
<view class="door-open-page">
<view class="status_bar"></view>
<view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
<!-- 顶部标题栏 -->
<view class="top-bar">
<uni-nav-bar left-icon="left" title="远程开门" backgroundColor ="none" :border="false" @clickLeft="narBack" />
@@ -47,7 +47,7 @@
</view>
<!-- 确认开门按钮 -->
<button class="confirm-btn" @click="openDoor" :disabled="selectedDoor === -1">确认开门</button>
<button class="confirm-btn" @click="openDoor" :disabled="selectedDoor === -1">确认开门 </button>
</view>
</template>
@@ -59,6 +59,7 @@ import { getOpenDoorList, switchOpenDoor } from '../../api/api.js'
// 响应式数据:选中的门索引、开门成功提示
const selectedDoor = ref(-1) // -1表示未选中
const showSuccess = ref(false)
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// 门列表数据
const doorList = ref([])
@@ -130,8 +131,10 @@ const openDoor = () => {
box-sizing: border-box;
}
.status_bar {
height: 32px;
/* height: 32px; */
width: 100%;
/* height: var(--status-bar-height); */
flex-shrink: 0;
}
/* 顶部标题 */
.top-bar {

View File

@@ -41,56 +41,68 @@
scroll-y
: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
v-for="record in filteredRecords"
v-for="record in reportRecords"
:key="record.id"
class="record-card"
>
<!-- 标题 + 状态标签 -->
<view class="card-header">
<text class="card-title">{{ record.title }}</text>
<view class="status-tag" :class="record.status">
{{ getStatusText(record.status) }}
<text class="card-title">{{ record.item }}</text>
<view class="status-tag" :class="getStatusClass(record.problemStatus)">
{{ getStatusText(record.problemStatus) }}
</view>
</view>
<!-- 类型标签 -->
<view class="tag-group">
<view class="tag-item">{{ record.reportType }}</view>
<view class="tag-item">{{ record.category }}</view>
<view class="tag-item">{{ record.projectTypeStr || '无 ' }}</view>
<view class="tag-item">{{ record.maintenanceItemName || '无'}}</view>
</view>
<!-- 内容 -->
<view class="card-content">
{{ record.content }}
{{ record.problem }}
</view>
<!-- 底部信息 -->
<view class="card-footer">
<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 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>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import {onReady} from "@dcloudio/uni-app"
import { ref } from 'vue'
import {onReady, onReachBottom, onPullDownRefresh,onShow} from "@dcloudio/uni-app"
import {getMyOrderList} from '../../api/api.js'
// 导航栏/标签高度(适配不同设备)
const navHeight = ref(44)
const statusTabHeight = 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 activeType = ref('all') // 全部/公共报修/个人报修
@@ -98,71 +110,95 @@ const activeType = ref('all') // 全部/公共报修/个人报修
// 状态筛选选项
const statusTabs = ref([
{ label: '全部', value: 'all' },
{ label: '待分配', value: 'pending' },
{ label: '待解决', value: 'processing' },
{ label: '已完成', value: 'completed' }
// { label: '待分配', value: 'pending' },
{ label: '待解决', value: '1' },
{ label: '已完成', value: '2' }
])
// 类型筛选选项
const typeTabs = ref([
{ label: '全部', value: 'all' },
{ label: '公共报修', value: 'public' },
{ label: '个人报修', value: 'private' }
{ label: '公共报修', value: '0' },
{ label: '个人报修', value: '1' }
])
// 模拟上报记录数据(实际项目替换为接口请求)
const reportRecords = ref([
{
id: 1,
title: '标题巴拉巴拉巴拉',
status: 'pending', // pending/processing/completed
reportType: '公共报修',
category: '路灯',
content: '1栋楼下道路路灯不亮,并且有的亮度不够,请物业公司及时更换,防止发生意外事故。',
createTime: '2026-08-01 10:05:46',
repairman: ''
},
{
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: '张三'
// 上报记录数据
const reportRecords = ref([])
// 获取列表数据
const getReportList = (isRefresh = false) => {
// 防止重复请求
if (loading.value || noMore.value) return
loading.value = true
const params = {
pageSize: pageSize.value,
pageNum: pageNum.value
}
])
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(() => {
return reportRecords.value.filter(record => {
// 状态筛选
const statusMatch = activeStatus.value === 'all' || record.status === activeStatus.value
// 类型筛选
const typeMatch = activeType.value === 'all' || record.reportType === typeTabs.value.find(item => item.value === activeType.value)?.label
return statusMatch && typeMatch
// 第一页:覆盖,分页:追加
if (pageNum.value === 1) {
reportRecords.value = data
} else {
reportRecords.value = [...reportRecords.value, ...data]
}
// 判断是否还有更多
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) => {
if (activeStatus.value === value) return
activeStatus.value = value
reloadList()
}
// 切换类型(公共/个人)筛选
const switchType = (value) => {
if (activeType.value === value) return
activeType.value = value
reloadList()
}
// 返回上一页
@@ -175,12 +211,25 @@ const navBack = () => {
// 获取状态文本
const getStatusText = (status) => {
const statusMap = {
pending: '待分配',
processing: '待解决',
completed: '已完成'
// "pending": '已分配',
"1": '待解决',
'2': '已完成'
}
return statusMap[status] || ''
}
// 获取状态标签样式类名
const getStatusClass = (status) => {
const classMap = {
'1': 'processing',
'2': 'completed'
}
return classMap[status] || ''
}
onShow(() => {
pageNum.value = 1
noMore.value = false
getReportList()
})
// 页面渲染完成后适配高度
onReady(() => {
@@ -278,22 +327,6 @@ onReady(() => {
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 {
background-color: #fff;
@@ -373,4 +406,17 @@ onReady(() => {
.repairman {
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>

View File

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