修复bug

This commit is contained in:
zhouyanli
2026-08-01 08:01:17 +08:00
parent 3b66b76e40
commit a34b625092
7 changed files with 141 additions and 110 deletions

View File

@@ -5,13 +5,16 @@
</uni-nav-bar>
<!-- -->
<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">
{{ '暂无数据'}}
</text>
</view>
<pull-refresh-scroll
custom-class="page"
:refreshing="isRefreshing"
:loading-more="loading"
:no-more-data="noMoreData"
:empty="houseList.length === 0"
empty-text="暂无数据"
@refresh="onRefresh"
@loadMore="loadMore"
>
<!-- 房屋列表 v-for 渲染 -->
<view class="house-list">
<view class="house-card" v-for="(item, index) in houseList" :key="index" @click="tapHouse(item)">
@@ -51,12 +54,7 @@
</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>
</pull-refresh-scroll>
<!-- 底部添加按钮 -->
<view class="bottom-btn">
<button class="add-btn" @click="addHouse">添加房屋</button>
@@ -76,6 +74,7 @@
getMyHouseList,
setMyHouseDefault
} from '/pageSubPack/api/apiSub.js'
import PullRefreshScroll from '/components/pull-refresh-scroll/pull-refresh-scroll.vue'
const houseList = ref([])
@@ -83,6 +82,18 @@
const pageNum = ref(1)
const pageSize = ref(10)
const noMoreData = ref(false)
const isRefreshing = ref(false)
// ==================== 下拉刷新 ====================
const onRefresh = () => {
isRefreshing.value = true
pageNum.value = 1
noMoreData.value = false
houseList.value = []
loading.value = false
getList()
}
// ==================== 获取列表数据 ====================
const getList = async () => {
if (loading.value) return
@@ -110,6 +121,9 @@
console.error('列表接口报错:', err)
} finally {
loading.value = false
if (isRefreshing.value) {
isRefreshing.value = false
}
}
}
@@ -223,55 +237,6 @@
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;
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;
}
/* 列表 */
.house-list {
height: 100%;
@@ -395,6 +360,10 @@
.bottom-btn {
padding: 20rpx 30rpx 40rpx;
}
.add-btn {
width: 100%;
height: 88rpx;