修复bug

This commit is contained in:
zhouyanli
2026-08-28 17:25:55 +08:00
parent ea1acf1bbc
commit 0661687bc5
11 changed files with 93 additions and 48 deletions

View File

@@ -1,6 +1,6 @@
// 服务器地址(与 request.js 保持一致)
// const baseUrl = 'https://wuyeapi.ckdzkj.com';
const baseUrl = "http://192.168.1.6:8080"
const baseUrl = 'https://wuyeapi.ckdzkj.com';
// const baseUrl = "http://192.168.1.6:8080"
/**
* 图片上传 Hook

View File

@@ -24,7 +24,7 @@
<text class="status">{{ item.status }}</text>
</view>
<view class="tag-label">{{ item.inspectionType }}</view>
<view class="text-row">巡检时间{{ item.executeDate }}</view>
<view class="text-row">巡检时间{{ item.taskTime }}</view>
<view class="text-row">巡检人{{ item.inspectorName }}</view>
</view>
</view>

View File

@@ -33,7 +33,7 @@
</view>
<view class="info-row">
<text class="info-label">房间号</text>
<text class="info-value">{{form.houseNo}}</text>
<text class="info-value">{{form.buildingName+'栋'+form.unitNo+'单元'+form.houseNo}}</text>
</view>
<view class="info-row">
<text class="info-label">业主</text>
@@ -60,8 +60,8 @@
<text class="info-value">{{form.residentName}}</text>
</view>
<view class="info-row">
<text class="info-label">房间号</text>
<text class="info-value">{{form.houseNo}}</text>
<text class="info-label">性别</text>
<text class="info-value">{{form.gender === '0'?'男':'女'}}</text>
</view>
<view class="info-row">
<text class="info-label">证件类型</text>

View File

@@ -12,7 +12,7 @@
<view class="notice-meta">
<view class="notice-author">
<text class="author-name">{{noticeDetail.author}}</text>
<text class="separator">·</text>
<text class="separator" v-if="noticeDetail.author">·</text>
<text class="publish-time">{{noticeDetail.publishTime}}</text>
</view>
</view>

View File

@@ -94,6 +94,7 @@ const searchText = ref('')
const selectedItem = ref(null)
const scrollIntoViewId = ref('')
const currentVillageIdFromHome = ref('') // 首页传入的当前选中小区ID
const sourcePage = ref('') // 来源页面payment 为缴费页独立切换,其他走首页切换
// 分页相关
const currentPage = ref(1)
@@ -187,7 +188,8 @@ const getCommunityList = async (pageNum = 1, keyword = '') => {
// 页面加载时初始化
onLoad((options) => {
// 接收首页传来得选择的小区id
// 接收来源页面及选中小区id
sourcePage.value = options?.source || ''
currentVillageIdFromHome.value = options?.villageId || ''
getCommunityList(1)
})
@@ -248,42 +250,58 @@ const handleConfirm = async () => {
})
return
}
// 缴费页为独立切换:不调用后端切换小区接口
const isPayment = sourcePage.value === 'payment'
try {
uni.showLoading({
title: '切换小区中...',
title: isPayment ? '加载中...' : '切换小区中...',
mask: true
})
const params = {
if (!isPayment) {
const res = await getVillageSwitch({
villageId: selectedItem.value.villageId,
}
const res = await getVillageSwitch(params)
})
uni.hideLoading()
if (res.code === 200) {
if (res.code !== 200) {
uni.showToast({
title: res.msg || '切换小区失败',
icon: 'none',
duration: 2000
})
return
}
if (res.data?.villageId) {
selectedItem.value.villageId = res.data.villageId
}
} else {
uni.hideLoading()
}
uni.showToast({
title: '选择成功',
icon: 'success',
duration: 1500
})
if (isPayment) {
// 缴费页独立缓存 + 独立事件,通知缴费页刷新(按账号隔离)
const userId = uni.getStorageSync('userId') || ''
uni.setStorageSync('paymentVillageId_' + userId, selectedItem.value.villageId)
uni.setStorageSync('paymentVillageName_' + userId, selectedItem.value.villageName)
uni.$emit('confirmPayment', {
name: selectedItem.value.villageName,
villageId: selectedItem.value.villageId
})
} else {
// 更新缓存并通知首页
uni.setStorageSync('currentVillageId', selectedItem.value.villageId)
uni.$emit('confirm', {
name: selectedItem.value.villageName,
villageId: selectedItem.value.villageId
})
}
setTimeout(() => {
uni.navigateBack()
}, 1000)
} else {
uni.showToast({
title: res.msg || '切换小区失败',
icon: 'error',
duration: 2000
})
}
} catch (err) {
uni.hideLoading()
uni.showToast({

View File

@@ -146,8 +146,22 @@ const paymentList = ref([
])
// 独立的当前小区ID按账号隔离避免切换账号后残留上个账号的小区
const getPaymentVillageIdKey = () => 'paymentVillageId_' + (uni.getStorageSync('userId') || '')
const getPaymentVillageNameKey = () => 'paymentVillageName_' + (uni.getStorageSync('userId') || '')
const getPaymentVillageId = () => {
return uni.getStorageSync(getPaymentVillageIdKey()) || uni.getStorageSync('currentVillageId') || ''
}
// 获取当前小区
const getCurrentCommunityData = () => {
const paymentVillageId = uni.getStorageSync(getPaymentVillageIdKey())
const paymentVillageName = uni.getStorageSync(getPaymentVillageNameKey())
if (paymentVillageId) {
currentCommunity.value = paymentVillageName || '已选小区'
return
}
getCurrentVillage().then(res => {
if (res.code === 200 && res.data && res.data.villageId) {
currentCommunity.value = res.data.villageName || '未命名小区'
@@ -159,9 +173,12 @@ const getCurrentCommunityData = () => {
// 接收小区切换事件
const slelctHomeData = (data) => {
if (data.name) currentCommunity.value = data.name
if (data.name) {
currentCommunity.value = data.name
uni.setStorageSync(getPaymentVillageNameKey(), data.name)
}
if (data.villageId) {
uni.setStorageSync('currentVillageId', data.villageId)
uni.setStorageSync(getPaymentVillageIdKey(), data.villageId)
}
getBillDetails()
getPayList()
@@ -169,11 +186,11 @@ const slelctHomeData = (data) => {
// 跳转小区选择
const navigateToSelectHome = () => {
const cachedVillageId = uni.getStorageSync('currentVillageId')
const cachedVillageId = getPaymentVillageId()
if (!cachedVillageId || cachedVillageId === '0' || cachedVillageId === 0) {
uni.navigateTo({ url: '/pageSubPack/my/myHouseIndex' })
} else {
uni.navigateTo({ url: `/pageSubPack/notice-list/selectHome?villageId=${cachedVillageId}` })
uni.navigateTo({ url: `/pageSubPack/notice-list/selectHome?villageId=${cachedVillageId}&source=payment` })
}
}
@@ -184,12 +201,12 @@ onShow(() => {
onLoad(() => {
uni.hideTabBar({ animation: false });
uni.$on('confirm', slelctHomeData)
uni.$on('confirmPayment', slelctHomeData)
getPayList()
})
onUnload(() => {
uni.$off('confirm', slelctHomeData)
uni.$off('confirmPayment', slelctHomeData)
})
// 页面返回拦截
@@ -249,7 +266,7 @@ const getBillDetails = (isLoadMore = false) => {
}
getTopUpDetails({
userId: uni.getStorageSync('userId'),
villageId: uni.getStorageSync('currentVillageId'),
villageId: getPaymentVillageId(),
pageNum: pageNum.value,
pageSize: pageSize.value,
}).then(res => {
@@ -289,7 +306,7 @@ const getPayList = async (isLoadMore = false) => {
residentUserId: uni.getStorageSync('userId'),
pageNum: payPageNum.value,
pageSize: payPageSize.value,
villageId:uni.getStorageSync('currentVillageId')
villageId:getPaymentVillageId()
})
const data = res.rows || res.data
if (isLoadMore) {

View File

@@ -188,7 +188,6 @@ const addComplaintsSuggestions = () => {
position: sticky;
top: 0;
z-index: 10;
background: #e2efff;
display: flex;
justify-content: flex-start;
align-items: center;
@@ -238,6 +237,7 @@ const addComplaintsSuggestions = () => {
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
}

View File

@@ -82,7 +82,7 @@
</view>
<view class="value">
<uni-datetime-picker type="datetime" v-model="form.visitTime" @change="handleTimeChange" @maskClick="pickerVisible = false"
:border="false" />
:border="false" :hide-second="true"/>
</view>
</view>
<view class="form-item" @click="onPickerOpen">
@@ -91,7 +91,7 @@
</view>
<view class="value">
<uni-datetime-picker type="datetime" v-model="form.leaveTime" @change="handleTimeChange" @maskClick="pickerVisible = false"
:border="false" />
:border="false" :hide-second="true"/>
</view>
</view>
<view class="tips">预计来访时间和预计离开时间间隔不能超过24小时</view>

View File

@@ -4,8 +4,8 @@
<view class="info-card">
<view class="info-header">
<text class="title">来访者{{ visitorInfo.name }}</text>
<text class="status {{ visitorInfo.status === 'visited' ? 'visited' : 'waiting' }}">
{{ visitorInfo.status === 'visited' ? '已到访' : '等待来访' }}
<text class="status" :class="{ active: visitorInfo.status === '等待来访' }">
{{ visitorInfo.status}}
</text>
</view>
@@ -30,7 +30,7 @@
</view>
<view class="info-item">
<text class="label">有效期</text>
<text class="value">{{ visitorInfo.validTime }}</text>
<text class="value-valid">{{ visitorInfo.validTime }}</text>
</view>
<view class="info-item">
<text class="label">邀请时间</text>
@@ -65,7 +65,7 @@ import {getVisitorDetail} from '../api/api.js'
// 访客信息(实际项目中从接口获取)
const visitorInfo = ref({
name: '',
status: 'waiting', // waiting:等待来访visited:已到访
status: '', // waiting:等待来访visited:已到访
type: '',
address: '',
phone: '',
@@ -84,7 +84,7 @@ const mapDetail = (item) => {
item.unitNo ? item.unitNo + '单元' : '',
item.houseNo
].filter(Boolean)
const status = item.status === 1 || item.status === '1' ? 'visited' : 'waiting'
const status = item.status === '1' ? '已到访' : '等待来访'
return {
name: item.visitorName || '',
status,
@@ -153,6 +153,10 @@ const goToQrcode = () => {
padding: 6rpx 16rpx;
border-radius: 20rpx;
}
.status.active{
color: #2f77fd;
font-weight: 500;
}
.waiting {
color: #007aff;
@@ -181,6 +185,13 @@ const goToQrcode = () => {
.value {
color: #222;
flex: 1;
text-align: right;
}
.value-valid{
color: #222;
flex: 1;
text-align: right;
white-space: nowrap;
}
.tips-text {

View File

@@ -77,7 +77,7 @@
</text>
</view>
<!-- 底部占位防止最后一项贴底 -->
<!-- 底部占位 -->
<view class="list-bottom-space"></view>
</view>
@@ -167,7 +167,6 @@ const addInvitation = () => {
top: 0;
z-index: 10;
display: flex;
background: #e2f0ff;
}
.tab-item {

View File

@@ -112,7 +112,7 @@
<view class="activity-time">
{{formatDate(activity.startTime)}}-{{formatDate(activity.endTime)}}</view>
<view class="activity-organizer">
<text>{{activity.createName}}</text>
<text>{{activity.address}}</text>
</view>
<view class="activity-enrollment">
<text>