修改首页轮播报错、活动显示、公共页样式显示、我的车位等bug

This commit is contained in:
zhouyanli
2026-06-13 17:49:19 +08:00
parent b395631400
commit 5040564655
13 changed files with 190 additions and 76 deletions

View File

@@ -25,7 +25,8 @@
"Gallery" : {},
"Push" : {},
"Barcode" : {},
"Payment" : {}
"Payment" : {},
"Bluetooth" : {}
},
/* */
"distribute" : {
@@ -83,7 +84,7 @@
"offline" : true,
"icons" : {
"small" : {
"mdpi" : "D:/图片文档/logo-app.png"
"mdpi" : "unpackage/res/icons/logo-app.png"
}
}
}

View File

@@ -83,7 +83,10 @@
</view>
<view class="activity-detail">
<text class="detail-text-num">活动名额{{ activity.quota }}已报名{{ activity.appliedCount }}</text>
<text class="detail-text-num">
<text v-if="activity.quota !== 0">活动名额{{ activity.quota }},</text>
已报名{{ activity.appliedCount }}
</text>
</view>
</view>
</up-col>
@@ -91,7 +94,7 @@
</view>
<view class="action-buttons">
<button v-if="activeTab === 'list' && activity.applied === false" class="action-btn signup-btn"
<button v-if="activeTab === 'list' && activity.applied === false && activity.statusText !== '已结束'" class="action-btn signup-btn"
@tap.stop="signupActivity(activity)">
立即报名
</button>

View File

@@ -344,7 +344,7 @@ const confirmRegist = async () =>{
}
}catch(err){
uni.showToast({
title: "网络异常",
title: err.msg ||"网络异常",
icon:"none"
})
// console.error('报名失败:', err)
@@ -393,7 +393,7 @@ const cancelActivityData = async () =>{
}
}catch(err){
uni.showToast({
title: "网络异常",
title: err.msg ||"网络异常",
icon:"none"
})
}
@@ -415,7 +415,7 @@ const getLiveActivityList = async () =>{
}
}catch(err){
uni.showToast({
title: "网络异常",
title: err.msg ||"网络异常",
icon:"none"
})
}

View File

@@ -233,10 +233,10 @@ const submitStatus = async () => {
uni.showToast({ title: '请输入实况描述', icon: 'none' });
return;
}
// if (!activityId.value) {
// uni.showToast({ title: '活动ID缺失', icon: 'none' });
// return;
// }
if (!location.value) {
uni.showToast({ title: '请先签到', icon: 'none' });
return;
}
uni.showLoading({ title: '提交中...', mask: true });

View File

@@ -134,6 +134,18 @@ export const getTopUpSelectByResident = (data) => {
console.log(data);
return get(`/api/topUp/selectByResident/${data.residentUserId}`, data)
}
// Zy -------------
// 账单明细列表
export const getTopUpDetails = (data) => {
return post(`/api/topUp/billDetails/list`, data)
}
// Zy --------------
// 绑定设备
export const getTopUpBindDevice = (data) => {
return post(`/api/topUp/bindDevice/${data.deviceCode}/${data.residentUserId}/${data.deviceType}`, data)

View File

@@ -221,7 +221,7 @@
} catch (err) {
uni.hideLoading()
uni.showToast({
title: err.msg || '上传失败',
title: err.msg || '网络异常',
icon: 'none'
})
}
@@ -237,7 +237,8 @@
carModel: formData.value.carModel,
carColor: formData.value.carColor,
carImageUrl: imageUrl,
residentId: uni.getStorageSync('userId')
villageId:uni.getStorageSync('currentVillageId')
// residentId: uni.getStorageSync('userId')
}

View File

@@ -5,7 +5,7 @@
</uni-nav-bar>
<!-- -->
<scroll-view class="page" scroll-y="true" @scrolltolower="getList" refresher-enabled="true" :refresher-triggered="isRefreshing" @refresherrefresh="onRefresh">
<scroll-view class="page" scroll-y="true">
<view v-if="houseList.length === 0" class="empty-state">
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
<text class="empty-text">
@@ -52,6 +52,10 @@
</view>
</view>
<view v-if="houseList.length > 0" class="load-more-wrap">
<view v-if="noMoreData" class="no-more">没有更多了</view>
<button v-else class="load-more-btn" :loading="loading" @click="loadMore">加载更多</button>
</view>
</scroll-view>
<!-- 底部添加按钮 -->
<view class="bottom-btn">
@@ -75,40 +79,28 @@
const houseList = ref([])
const loadingMore = ref(false)
const noMoreData = ref(false)
const isRefreshing = ref(false)
const loading = ref(false)
const pageNum = ref(1)
const pageSize = ref(10)
const noMoreData = ref(false)
// ==================== 获取列表数据 ====================
const getList = async () => {
// 防重复请求
if (loadingMore.value || noMoreData.value) return
loadingMore.value = true
if (loading.value) return
loading.value = true
try {
const res = await getMyHouseList({
pageNum: pageNum.value,
pageSize: pageSize.value
})
const data = res
const newList = data.rows || []
// 第一页 → 覆盖数据
const newList = res.rows || []
if (pageNum.value === 1) {
houseList.value = newList
} else {
// 后续页 → 追加数据
houseList.value = [...houseList.value, ...newList]
}
// 判断是否没有更多数据
// 不足一页说明没有更多数据
if (newList.length < pageSize.value) {
noMoreData.value = true
} else {
pageNum.value++
}
} catch (err) {
uni.showToast({
@@ -117,26 +109,21 @@
})
console.error('列表接口报错:', err)
} finally {
loadingMore.value = false
// 关闭 refresher 下拉刷新状态
if (isRefreshing.value) {
isRefreshing.value = false
}
loading.value = false
}
}
// ==================== 下拉刷新 ====================
const onRefresh = () => {
isRefreshing.value = true
pageNum.value = 1
noMoreData.value = false
houseList.value = []
loadingMore.value = false
// ==================== 加载更多 ====================
const loadMore = () => {
if (loading.value || noMoreData.value) return
pageNum.value++
getList()
}
// 页面加载时请求第一页
onMounted(() => {
pageNum.value = 1
noMoreData.value = false
getList()
})
@@ -155,7 +142,7 @@
const data = res
if (data.code === 200) {
// uni.hideLoading();
loadingMore.value = false
pageNum.value = 1
noMoreData.value = false
getList()
uni.setStorageSync('houseIsDefault', e.detail.value)
@@ -173,7 +160,7 @@
} catch (err) {
// uni.hideLoading();
uni.showToast({
title: `${err}`,
title: err.msg,
icon: 'none'
})
console.error('列表接口报错:', err)
@@ -253,6 +240,33 @@
margin-bottom: 10rpx;
}
.no-more {
text-align: center;
padding: 30rpx 0;
color: #999;
font-size: 24rpx;
}
.load-more-wrap {
padding: 20rpx 0 40rpx;
}
.load-more-btn {
width: 100%;
height: 80rpx;
line-height: 80rpx;
background: #ffffff;
color: #007aff;
border: 1rpx solid #007aff;
border-radius: 12rpx;
font-size: 28rpx;
text-align: center;
}
.load-more-btn::after {
border: none;
}
/* 底部按钮 */
.bottom-btn {
padding: 20rpx 30rpx 40rpx;

View File

@@ -103,7 +103,7 @@
const res = await getCarList({
pageNum: pageNum.value,
pageSize: pageSize.value,
residentId: uni.getStorageSync('userId')
// residentId: uni.getStorageSync('userId')
})
const data = res

View File

@@ -174,7 +174,8 @@ page {
.title {
font-size: 32rpx;
font-weight: bold;
width: 500rpx;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@@ -197,6 +198,19 @@ page {
margin: 20rpx 0;
background-color: #f9f9f9;
padding: 24rpx;
word-break: break-all;
/* 按高度截断,避免 line-clamp 导致文字重叠 */
max-height: 160rpx;
overflow: hidden;
/* 富文本里的图片不超出屏幕 */
:deep(img),
:deep(image) {
max-width: 100% !important;
height: auto !important;
display: block;
}
}
.detail {
display: flex;

View File

@@ -21,8 +21,8 @@
<view class="article-content">
<view class="paragraph" v-html="noticeDetail.noticeContent"></view>
<view class="articleimg">
<image src="https://wuyeadmin.bugtc.com/images/home/notice-1.png" mode="" style="width: 100%;height: 100%;border-radius: 20rpx;"></image>
<image src="https://wuyeadmin.bugtc.com/images/home/notice-2.png" mode="" style="width: 100%;height: 100%;border-radius: 20rpx;"></image>
<!-- <image src="https://wuyeadmin.bugtc.com/images/home/notice-1.png" mode="aspectFill" style="width: 100%;height: 100%;border-radius: 20rpx;"></image> -->
<!-- <image src="https://wuyeadmin.bugtc.com/images/home/notice-2.png" mode="aspectFill" style="width: 100%;height: 100%;border-radius: 20rpx;"></image> -->
</view>
</view>
@@ -279,6 +279,15 @@
margin-bottom: 20px;
text-align: justify;
text-indent: 2em;
/* 富文本里的图片不超出屏幕 */
:deep(img),
:deep(image) {
max-width: 100% !important;
height: auto !important;
display: block;
margin: 10px 0;
}
}
.bullet-list {

View File

@@ -11,7 +11,6 @@
<view class="container">
<!-- 已缴费/欠费列表 -->
<view class="bill-list" v-if="paymentList.length != 0">
<view class="bill-item" @click="goToBill(item)" v-for="item,index in paymentList" :key="index">
<image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/water.png"
v-if="item.type=='水费'"></image>
@@ -27,6 +26,25 @@
<view class="arrow"></view>
</view>
</view>
<!-- 已缴费/欠费列表 -->
<view class="bill-list" v-if="detailslist.length != 0">
<view class="bill-item" @click="goToBill(item)" v-for="item,index in detailslist" :key="index">
<image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/water.png"
v-if="item.type=='水费'"></image>
<image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png"
v-if="item.type=='电费'"></image>
<view class="bill-info">
<view class="bill-title">{{switchStatus(item.type)}}
<view class="bill-status debt" v-if="item.balance<0">已欠费</view>
</view>
<!-- <view class="bill-desc">{{item.villageName+item.buildingName+item.fullAddress}}</view> -->
<view class="bill-desc">{{item.name}}</view>
</view>
<view class="arrow"></view>
</view>
</view>
<!-- 新增缴费区域 -->
<view class="add-section">
@@ -81,7 +99,8 @@
import {
getTopUpSelectByResident,
postInsertOpenId,
postSubscribeAuth
postSubscribeAuth,
getTopUpDetails,
} from '/pageSubPack/api/apiSub.js'
// 响应式数据
const statusBarHeight = ref(20)
@@ -102,13 +121,13 @@
// address: '山东省日照市东港区桂花园别墅2号楼2层',
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/heating.png",
// },
// {
// id: 3,
// name: '电费',
// status: '已欠费',
// address: '山东省日照市东港区桂花园别墅2号楼2层',
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png",
// }
{
id: 3,
name: '电费',
status: '已欠费',
address: '山东省日照市东港区桂花园别墅2号楼2层',
icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png",
}
])
const addList = ref([
@@ -168,6 +187,11 @@
}
}
onShow(() => {
// Zy --------------
getBillDetails()
// Zy --------------
// 不再自动请求订阅消息,改为用户点击触发
})
// 生命周期
@@ -250,6 +274,30 @@
}
uni.removeStorageSync('sourcePage')
}
// Zy --------------
const detailslist = ref([])
const getBillDetails = ()=>{
getTopUpDetails({
userId:uni.getStorageSync('userId'),
villageId:uni.getStorageSync('currentVillageId'),
}).then(res=>{
console.log(res)
detailslist.value = res.data;
})
}
const switchStatus= (type)=>{
if(type === '0'){
return "物业费"
}else if(type === '1'){
return '车位费'
}else if(type === '2'){
return '垃圾处理费'
}
}
// Zy --------------
</script>
<style lang="scss">

View File

@@ -219,7 +219,7 @@
const selectAddress = (item) => {
form.address = item.label;
form.villageId = item.villageId || '';
form.houseId = item.id || '';
form.houseId = item.houseId || '';
closeAddressModal();
};

View File

@@ -37,7 +37,7 @@
<scroll-view class="main-scroll" scroll-y>
<!-- banner -->
<view class="bannarClass">
<up-swiper :list="bannerList" indicator indicatorMode="dot" imgMode="aspectFill" radius="10"></up-swiper>
<up-swiper :key="bannerSwiperKey" :list="bannerList" indicator indicatorMode="dot" imgMode="aspectFill" radius="10"></up-swiper>
</view>
<!-- 公告 -->
<view class="noticeClass" @click="getNoticeMore">
@@ -139,7 +139,10 @@
<text>{{activity.createName}}</text>
</view>
<view class="activity-enrollment">
<text>活动名额{{activity.quota}}已报名{{activity.appliedCount}}</text>
<text>
<text v-if="activity.quota !== 0">活动名额{{ activity.quota }},</text>
已报名{{activity.appliedCount}}
</text>
</view>
</view>
</up-col>
@@ -165,7 +168,7 @@
</template>
<script setup>
import { ref } from 'vue'
import { ref, nextTick } from 'vue'
import {onLoad,onUnload,onShow} from '@dcloudio/uni-app'
import moment from 'moment'
import {getNoticeLatest,getCurrentVillage,getActivitylatest,getBannarList,getReloadUserInfo} from "/pageSubPack/api/api.js"
@@ -179,6 +182,7 @@ const currentCommunity = ref('请绑定房屋')
const currentVillageId = ref('')
const statusBarHeight = ref(0)
const bannerList = ref([])
const bannerSwiperKey = ref(0)
const noticeText = ref('暂无公告')
const noticeId = ref('')
const lastUserId = ref('') // 用于检测是否切换账号
@@ -201,7 +205,13 @@ const getbannarData = async () =>{
try{
const res = await getBannarList({villageId:uni.getStorageSync('currentVillageId')})
if(res.code === 200){
bannerList.value = res.data.map(item =>item.url)
const newList = res.data.map(item => item.url)
// 只有 banner 数据真正变化时才更新,避免 swiper 反复重建
if (JSON.stringify(newList) !== JSON.stringify(bannerList.value)) {
bannerList.value = newList
await nextTick()
bannerSwiperKey.value++
}
}else{
uni.showToast({title:'获取失败',icon:'error'})
}
@@ -301,21 +311,24 @@ const refreshAllData = async () => {
getbannarData()
}
// 切换账号时重置页面数据
const resetPageData = () => {
currentCommunity.value = '请先绑定房屋'
currentVillageId.value = ''
activityList.value = []
bannerList.value = []
noticeText.value = '暂无公告'
noticeId.value = ''
}
onShow(() => {
const currentUserId = uni.getStorageSync('userId') || ''
// 检测到切换账号:重置数据并重新加载
if (lastUserId.value && lastUserId.value !== currentUserId) {
// 切换账号时重置页面数据
currentCommunity.value = '请先绑定房屋'
currentVillageId.value = ''
activityList.value = []
bannerList.value = []
noticeText.value = '暂无公告'
noticeId.value = ''
resetPageData()
refreshAllData()
}
// 首次显示 或 非切换账号的普通返回,刷新数据
else {
} else {
// 首次显示 或 非切换账号的普通返回,直接刷新数据(不清空已有数据)
refreshAllData()
}
lastUserId.value = currentUserId
@@ -331,8 +344,7 @@ onLoad(() => {
// 记录当前用户ID用于 onShow 中检测是否切换账号
lastUserId.value = uni.getStorageSync('userId') || ''
// 页面加载时刷新数据
refreshAllData()
// 数据刷新统一放到 onShow避免 onLoad + onShow 首次重复请求
})
// 页面销毁时移除监听(防止内存泄漏)