修改首页轮播报错、活动显示、公共页样式显示、我的车位等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" : {}, "Gallery" : {},
"Push" : {}, "Push" : {},
"Barcode" : {}, "Barcode" : {},
"Payment" : {} "Payment" : {},
"Bluetooth" : {}
}, },
/* */ /* */
"distribute" : { "distribute" : {
@@ -83,7 +84,7 @@
"offline" : true, "offline" : true,
"icons" : { "icons" : {
"small" : { "small" : {
"mdpi" : "D:/图片文档/logo-app.png" "mdpi" : "unpackage/res/icons/logo-app.png"
} }
} }
} }

View File

@@ -83,7 +83,10 @@
</view> </view>
<view class="activity-detail"> <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>
</view> </view>
</up-col> </up-col>
@@ -91,7 +94,7 @@
</view> </view>
<view class="action-buttons"> <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)"> @tap.stop="signupActivity(activity)">
立即报名 立即报名
</button> </button>

View File

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

View File

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

View File

@@ -134,6 +134,18 @@ export const getTopUpSelectByResident = (data) => {
console.log(data); console.log(data);
return get(`/api/topUp/selectByResident/${data.residentUserId}`, 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) => { export const getTopUpBindDevice = (data) => {
return post(`/api/topUp/bindDevice/${data.deviceCode}/${data.residentUserId}/${data.deviceType}`, data) return post(`/api/topUp/bindDevice/${data.deviceCode}/${data.residentUserId}/${data.deviceType}`, data)

View File

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

View File

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

View File

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

View File

@@ -174,7 +174,8 @@ page {
.title { .title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
width: 500rpx; flex: 1;
min-width: 0;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@@ -197,6 +198,19 @@ page {
margin: 20rpx 0; margin: 20rpx 0;
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 24rpx; 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 { .detail {
display: flex; display: flex;

View File

@@ -21,8 +21,8 @@
<view class="article-content"> <view class="article-content">
<view class="paragraph" v-html="noticeDetail.noticeContent"></view> <view class="paragraph" v-html="noticeDetail.noticeContent"></view>
<view class="articleimg"> <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-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="" 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>
</view> </view>
@@ -279,6 +279,15 @@
margin-bottom: 20px; margin-bottom: 20px;
text-align: justify; text-align: justify;
text-indent: 2em; text-indent: 2em;
/* 富文本里的图片不超出屏幕 */
:deep(img),
:deep(image) {
max-width: 100% !important;
height: auto !important;
display: block;
margin: 10px 0;
}
} }
.bullet-list { .bullet-list {

View File

@@ -11,7 +11,6 @@
<view class="container"> <view class="container">
<!-- 已缴费/欠费列表 --> <!-- 已缴费/欠费列表 -->
<view class="bill-list" v-if="paymentList.length != 0"> <view class="bill-list" v-if="paymentList.length != 0">
<view class="bill-item" @click="goToBill(item)" v-for="item,index in paymentList" :key="index"> <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" <image class="billIcon" src="https://wuyeadmin.bugtc.com/images/propertyImgs/water.png"
v-if="item.type=='水费'"></image> v-if="item.type=='水费'"></image>
@@ -27,6 +26,25 @@
<view class="arrow"></view> <view class="arrow"></view>
</view> </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"> <view class="add-section">
@@ -81,7 +99,8 @@
import { import {
getTopUpSelectByResident, getTopUpSelectByResident,
postInsertOpenId, postInsertOpenId,
postSubscribeAuth postSubscribeAuth,
getTopUpDetails,
} from '/pageSubPack/api/apiSub.js' } from '/pageSubPack/api/apiSub.js'
// 响应式数据 // 响应式数据
const statusBarHeight = ref(20) const statusBarHeight = ref(20)
@@ -102,13 +121,13 @@
// address: '山东省日照市东港区桂花园别墅2号楼2层', // address: '山东省日照市东港区桂花园别墅2号楼2层',
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/heating.png", // icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/heating.png",
// }, // },
// { {
// id: 3, id: 3,
// name: '电费', name: '电费',
// status: '已欠费', status: '已欠费',
// address: '山东省日照市东港区桂花园别墅2号楼2层', address: '山东省日照市东港区桂花园别墅2号楼2层',
// icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png", icon: "https://wuyeadmin.bugtc.com/images/propertyImgs/electric.png",
// } }
]) ])
const addList = ref([ const addList = ref([
@@ -168,6 +187,11 @@
} }
} }
onShow(() => { onShow(() => {
// Zy --------------
getBillDetails()
// Zy --------------
// 不再自动请求订阅消息,改为用户点击触发 // 不再自动请求订阅消息,改为用户点击触发
}) })
// 生命周期 // 生命周期
@@ -250,6 +274,30 @@
} }
uni.removeStorageSync('sourcePage') 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> </script>
<style lang="scss"> <style lang="scss">

View File

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

View File

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