优化全局下拉刷新

This commit is contained in:
zhouyanli
2026-08-20 15:41:27 +08:00
parent 325813c67e
commit ec66ed3076
19 changed files with 258 additions and 338 deletions

View File

@@ -1,15 +1,8 @@
<template>
<view class="container">
<view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
<!-- 顶部标题栏 固定 -->
<view class="top-bar">
<uni-nav-bar left-icon="left" title="活动列表" backgroundColor="none" :border="false" :statusBar="false"
@clickLeft="narBack" />
</view>
<!-- 滚动区域从banner开始滚动 -->
<scroll-view class="scroll-container" scroll-y="true" @scrolltolower="loadMoreData"
:lower-threshold="100">
<view class="scroll-container">
<!-- 顶部图片 -->
<view class="top-img">
<image class="banner-img" src="http://47.104.199.163:9090/images/home/banner.png" mode="aspectFill"></image>
@@ -121,13 +114,13 @@
</view>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import { ref, watch } from 'vue'
import { onLoad, onUnload, onShow } from '@dcloudio/uni-app'
import { onLoad, onUnload, onShow, onPullDownRefresh, onReachBottom, onBackPress } from '@dcloudio/uni-app'
import moment from 'moment';
import { getActivityList,getMyActivityList} from '../api/api.js'
@@ -140,7 +133,6 @@ const currentPage = ref(1)
const pageSize = ref(10)
const total = ref(0)
const displayedActivities = ref([]) // 当前显示的活动列表
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// 筛选条件status ''全部, '0'未开始, '1'进行中, '2'已结束
const filters = ref([
@@ -161,19 +153,17 @@ const resetAndLoad = () => {
getActivityListData(1)
}
/**
* 返回上一级页面
*/
const narBack = () => {
// 页面返回拦截:根据来源页返回对应 tab否则走默认返回
onBackPress(() => {
const sourcePage = uni.getStorageSync('sourcePage')
if (sourcePage === "index") {
uni.switchTab({ url: "/pages/index/index" })
return true
} else if (sourcePage === "serviceIndex") {
uni.switchTab({ url: "/pages/serviceIndex/serviceIndex" })
} else {
uni.navigateBack()
return true
}
}
})
/**
* 切换选项卡(活动列表/我的活动)
@@ -249,6 +239,7 @@ const getActivityListData = async (pageNum = 1) => {
if (pageNum === 1) displayedActivities.value = []
} finally {
isLoading.value = false
uni.stopPullDownRefresh();
}
}
@@ -294,6 +285,7 @@ const getMyActivityListData = async (pageNum = 1) => {
if (pageNum === 1) displayedActivities.value = []
} finally {
isLoading.value = false
uni.stopPullDownRefresh();
}
}
@@ -407,7 +399,21 @@ onLoad(() => {
*/
onUnload(() => {
uni.$off('refreshActivityList')
})
});
// 下拉刷新
onPullDownRefresh(() => {
if (activeTab.value === 'list') {
resetAndLoad();
} else {
resetAndLoadMy();
}
});
// 上拉加载更多
onReachBottom(() => {
loadMoreData();
});
/**
* 监听我的活动筛选条件变化
@@ -423,33 +429,14 @@ watch(() => myFilter.value, () => {
/* 页面容器 */
.container {
width: 100%;
height: 100vh;
min-height: 100vh;
background-color: #fff;
display: flex;
flex-direction: column;
padding: 0;
}
/* 状态栏 - 自适应设备状态栏高度 */
.status-bar {
/* height: var(--status-bar-height); */
/* height: 46px; */
width: 100%;
flex-shrink: 0;
}
/* 顶部标题 固定 */
.top-bar {
width: 100%;
flex-shrink: 0;
background: #fff;
}
/* 滚动区域 */
.scroll-container {
flex: 1;
width: 100%;
overflow-y: auto;
padding: 0 30rpx;
box-sizing: border-box;
}

View File

@@ -2,8 +2,8 @@ import { navigateToLogin } from '@/common/checkLogin.js'
let baseUrl = '';
if (process.env.NODE_ENV === 'development') {
// baseUrl = 'http://192.168.1.6:8080'; // 开发环境
baseUrl = 'http://192.168.1.222:8080';
baseUrl = 'http://192.168.1.6:8080'; // 开发环境
// baseUrl = 'http://192.168.1.222:8080';
} else {
baseUrl = 'https://wuyeapi.ckdzkj.com'; // 生产环境
}

View File

@@ -1,7 +1,5 @@
<template>
<view class="contentStyle">
<view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
<uni-nav-bar title="巡检记录" backgroundColor="transparent" :border="false" left-icon="left" @click-left="goBack" />
<view class="content-wrap">
<!-- 时间选择器 -->
<view class="timebox">
@@ -18,7 +16,7 @@
</view>
</view>
<!-- 巡检列表 -->
<scroll-view scroll-y class="scroll-view">
<view class="scroll-view">
<view class="list-container" v-if="listData.length > 0">
<view class="card-item" v-for="(item, index) in listData" :key="index" @click="goToInspectionDetail(item)">
<view class="card-head">
@@ -35,7 +33,7 @@
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
<text class="empty-text">暂无数据</text>
</view>
</scroll-view>
</view>
</view>
</view>
@@ -111,14 +109,11 @@
// ---------- 日期变更(使用 moment ----------
const handleChangeTime = (e) => {
if (e) {
// e 格式为 YYYY-MM-DD用 moment 解析并格式化为 MM-DD
showDate.value = moment(e).format('MM-DD')
datetime.value = e
} else {
// 用户清空日期,可根据业务设置默认值或置空
showDate.value = '选择日期'
datetime.value = ''
// 如果希望清空时不请求,可 return否则也重置列表
}
// 重置分页并刷新
pageNum.value = 1
@@ -140,11 +135,6 @@
fetchList(true)
})
// ---------- 返回 ----------
const goBack = () => {
uni.navigateBack()
}
// ---------- 页面返回拦截 ----------
onBackPress(() => {
const pages = getCurrentPages()
@@ -165,9 +155,9 @@
<style lang="scss" scoped>
.contentStyle {
display: flex;
flex-direction: column;
height: 100vh;
// display: flex;
// flex-direction: column;
min-height: 100vh;
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
}
@@ -180,11 +170,6 @@
overflow: hidden;
}
.status-bar {
width: 100%;
flex-shrink: 0;
}
.timebox {
width: 188rpx;
height: 48rpx;
@@ -249,10 +234,10 @@
}
}
//滚动容器 App重点高度自适应 \*/
.scroll-view {
flex: 1;
height: 0;
}
// .scroll-view {
// flex: 1;
// height: 0;
// }
.list-container {
display: flex;
flex-direction: column;

View File

@@ -1,20 +1,8 @@
<template>
<view class="page">
<!-- 滚动区域 -->
<pull-refresh-scroll
custom-class="scroll-box"
:refreshing="refreshing"
:loading-more="loadingMore"
:no-more-data="noMoreData"
:empty="revenueList.length === 0 && !loading"
empty-text="暂无通知"
no-more-text="没有更多通知了"
@refresh="onRefresh"
@load-more="loadMore"
>
<view class="list-wrap">
<!-- 列表 -->
<!-- 列表 -->
<view class="list-wrap">
<view
v-for="revenue in revenueList"
:key="revenue.noticeId"
@@ -30,18 +18,16 @@
<uni-icons type="right" size="13" color="#007AFF"/>
</view>
</view>
</view>
</pull-refresh-scroll>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad ,onShow,onUnload} from '@dcloudio/uni-app'
import { onLoad, onShow, onUnload, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { getRevenueList } from '../api/apiSub.js'
const revenueList = ref([])
const refreshing = ref(false)
const loadingMore = ref(false)
const noMoreData = ref(false)
const loading = ref(false)
@@ -73,8 +59,8 @@ const loadRevenue = async (isRefresh = false) => {
} catch (e) {}
finally {
loading.value = false
refreshing.value = false
loadingMore.value = false
uni.stopPullDownRefresh()
}
}
// 更新单条已读状态
@@ -93,10 +79,13 @@ onShow(() =>{
loadRevenue(true)
})
const onRefresh = () => {
refreshing.value = true
onPullDownRefresh(() => {
loadRevenue(true)
}
})
onReachBottom(() => {
loadMore()
})
const loadMore = () => {
if (noMoreData.value || loadingMore.value) return
@@ -123,21 +112,7 @@ page {
background: #f9f9f9;
}
.page {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
}
.status_bar {
width: 100%;
flex-shrink: 0;
}
.scroll-box {
flex: 1;
height: 0; /* 让滚动区域生效 */
min-height: 100vh;
}
.list-wrap {
padding: 50rpx 40rpx;

View File

@@ -1,7 +1,7 @@
<template>
<view class="contentStyle" style="">
<scroll-view class="page" scroll-y="true" @scrolltolower="getList" refresher-enabled="true" :refresher-triggered="isRefreshing" @refresherrefresh="onRefresh">
<view class="page">
<view v-if="carList.length === 0" class="empty-state">
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
<text class="empty-text">暂无数据</text>
@@ -22,7 +22,7 @@
{{ item.certificationStatus }}
</view> -->
</view>
</scroll-view>
</view>
<view class="bottom-btn">
<button class="confirm-btn" @click="addCar">添加车辆</button>
</view>
@@ -38,27 +38,27 @@
getMyCarList
} from '@/pageSubPack/api/apiSub.js'
import {
onShow
onShow,
onPullDownRefresh,
onReachBottom
} from '@dcloudio/uni-app'
const statusBarHeight = ref(20)
const defaultCarImg = "http://47.104.199.163:9090/images/propertyImgs/defaultCarImg.png"
const carList = ref([])
const loadingMore = ref(false)
const noMoreData = ref(false)
const isRefreshing = ref(false)
const pageNum = ref(1)
const pageSize = ref(10)
// ==================== 下拉刷新 ====================
const onRefresh = () => {
isRefreshing.value = true
onPullDownRefresh(() => {
pageNum.value = 1
noMoreData.value = false
carList.value = []
loadingMore.value = false
getList()
}
})
// 页面加载时请求第一页
onMounted(() => {
@@ -107,14 +107,16 @@
console.error('列表接口报错:', err)
} finally {
loadingMore.value = false
// 关闭 refresher 下拉刷新状态
if (isRefreshing.value) {
isRefreshing.value = false
}
uni.stopPullDownRefresh()
}
}
// ==================== 上拉加载更多 ====================
onReachBottom(() => {
getList()
})
const getStatusText = (status) => {
if (status === 0) return '未绑定'
if (status === 1) return '已绑定'
@@ -144,24 +146,16 @@
<style lang="scss">
page {
background: #F3F8FD;
overflow: hidden;
}
</style>
<style scoped>
.contentStyle {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
min-height: 100vh;
background-color: #f5f7fa;
}
.page {
flex: 1;
min-height: 0;
height: 0;
overflow-y: auto;
padding: 0px 40rpx 140rpx;
box-sizing: border-box;
}

View File

@@ -1,7 +1,7 @@
<template>
<view class="contentStyle" style="">
<scroll-view class="page" scroll-y :refresher-enabled="true" :refresher-triggered="isRefreshing" @refresherrefresh="onRefresh" @scrolltolower="loadMore">
<view class="page">
<!-- 空状态 -->
<view v-if="houseList.length === 0" class="empty-state">
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
@@ -46,7 +46,7 @@
</view>
</view>
</view>
</scroll-view>
</view>
<!-- 底部添加按钮 -->
<view class="bottom-btn">
<button class="add-btn" @click="addHouse">添加房屋</button>
@@ -62,7 +62,9 @@
onMounted,
} from 'vue'
import {
onShow
onShow,
onPullDownRefresh,
onReachBottom
} from '@dcloudio/uni-app'
import {
getMyHouseList,
@@ -74,17 +76,15 @@
const pageNum = ref(1)
const pageSize = ref(10)
const noMoreData = ref(false)
const isRefreshing = ref(false)
// ==================== 下拉刷新 ====================
const onRefresh = () => {
isRefreshing.value = true
// ==================== 下拉刷新 ====================
onPullDownRefresh(() => {
pageNum.value = 1
noMoreData.value = false
houseList.value = []
loading.value = false
getList()
}
})
// ==================== 获取列表数据 ====================
const getList = async () => {
@@ -113,8 +113,7 @@
console.error('列表接口报错:', err)
} finally {
loading.value = false
isRefreshing.value = false
uni.stopPullDownRefresh()
uni.stopPullDownRefresh()
}
}
@@ -125,6 +124,11 @@
getList()
}
// ==================== 上拉加载更多 ====================
onReachBottom(() => {
loadMore()
})
// 页面加载时请求第一页
onMounted(() => {
pageNum.value = 1
@@ -211,16 +215,11 @@
<style scoped>
.contentStyle {
display: flex;
flex-direction: column;
height: 100vh;
/* 关键:固定高度,底部按钮不动 */
min-height: 100vh;
background-color: #f5f7fa;
}
.page {
flex: 1;
overflow-y: auto;
padding: 0px 40rpx 120rpx;
box-sizing: border-box;
}

View File

@@ -3,7 +3,7 @@
<!-- <view class="status-bar"></view>
<uni-nav-bar title="我的车位" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
</uni-nav-bar> -->
<scroll-view class="page" scroll-y="true" @scrolltolower="getList" refresher-enabled="true" :refresher-triggered="isRefreshing" @refresherrefresh="onRefresh">
<view class="page">
<view v-if="parkingSpaceList.length === 0" class="empty-state">
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
<text class="empty-text">暂无数据</text>
@@ -54,7 +54,7 @@
</view>
</view>
</view>
</scroll-view>
</view>
<view class="bottom-btn">
<button class="add-btn" @click="addParkingSpace">添加车位</button>
</view>
@@ -66,7 +66,9 @@
ref
} from 'vue'
import {
onShow
onShow,
onPullDownRefresh,
onReachBottom
} from '@dcloudio/uni-app'
import {
getCarList
@@ -76,14 +78,13 @@
const parkingSpaceList = ref([])
// ==================== 下拉刷新 ====================
const onRefresh = () => {
isRefreshing.value = true
onPullDownRefresh(() => {
pageNum.value = 1
noMoreData.value = false
parkingSpaceList.value = []
loadingMore.value = false
getList()
}
})
// 页面显示时请求第一页(首次进入和从详情/修改页返回时都会刷新)
onShow(() => {
@@ -96,7 +97,6 @@
const loadingMore = ref(false)
const noMoreData = ref(false)
const isRefreshing = ref(false)
const pageNum = ref(1)
const pageSize = ref(10)
@@ -148,13 +148,15 @@
console.error('列表接口报错:', err)
} finally {
loadingMore.value = false
// 关闭 refresher 下拉刷新状态
if (isRefreshing.value) {
isRefreshing.value = false
}
uni.stopPullDownRefresh()
}
}
// ==================== 上拉加载更多 ====================
onReachBottom(() => {
getList()
})
const tapParkingSpace = (item) => {
console.log(item);
uni.navigateTo({
@@ -187,15 +189,11 @@
}
.contentStyle {
display: flex;
flex-direction: column;
height: 100vh;
min-height: 100vh;
background-color: #f5f7fa;
}
.page {
flex: 1;
overflow-y: auto;
padding: 0px 40rpx 140rpx;
box-sizing: border-box;
}

View File

@@ -1,30 +1,7 @@
<template>
<view class="page">
<view class="status_bar"></view>
<!-- 固定导航栏 -->
<uni-nav-bar
left-icon="left"
title="通知公告"
background-color="#F9F9F9"
@clickLeft="narBack"
/>
<!-- 滚动区域 -->
<scroll-view
scroll-y
class="scroll-box"
:refresher-enabled="true"
:refresher-triggered="refreshing"
@refresherrefresh="onRefresh"
@scrolltolower="loadMore"
>
<view class="list-wrap">
<!-- 下拉刷新 -->
<view class="refresh" v-if="refreshing">
<uni-icons type="spinner-cycle" class="spin"/> 刷新中...
</view>
<!-- 列表 -->
<!-- 列表 -->
<view class="list-wrap">
<view
v-for="notice in noticeList"
:key="notice.noticeId"
@@ -48,18 +25,16 @@
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
<text class="empty-text">暂无通知</text>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad ,onShow,onUnload} from '@dcloudio/uni-app'
import { onLoad, onShow, onUnload, onBackPress, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
import { getNoticeList } from '../api/api.js'
const noticeList = ref([])
const refreshing = ref(false)
const loadingMore = ref(false)
const noMoreData = ref(false)
const loading = ref(false)
@@ -90,8 +65,8 @@ const loadNotices = async (isRefresh = false) => {
} catch (e) {}
finally {
loading.value = false
refreshing.value = false
loadingMore.value = false
uni.stopPullDownRefresh()
}
}
// 更新单条已读状态
@@ -107,10 +82,13 @@ onShow(() =>{
loadNotices(true)
})
const onRefresh = () => {
refreshing.value = true
onPullDownRefresh(() => {
loadNotices(true)
}
})
onReachBottom(() => {
loadMore()
})
const loadMore = () => {
if (noMoreData.value || loadingMore.value) return
@@ -119,12 +97,18 @@ const loadMore = () => {
loadNotices()
}
const narBack = () => {
onBackPress(() => {
const page = uni.getStorageSync('sourcePage')
if (page === 'index') uni.switchTab({ url: '/pages/index/index' })
if (page === 'serviceIndex') uni.switchTab({ url: '/pages/serviceIndex/serviceIndex' })
uni.removeStorageSync('sourcePage')
}
if (page === 'index') {
uni.switchTab({ url: '/pages/index/index' })
return true
}
if (page === 'serviceIndex') {
uni.switchTab({ url: '/pages/serviceIndex/serviceIndex' })
return true
}
})
onLoad(() => {
isFirstShow.value = false
@@ -140,23 +124,6 @@ onUnload(()=>{
page {
background: #f9f9f9;
}
.page {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
flex-direction: column;
}
.status_bar {
height: 46px;
width: 100%;
}
.scroll-box {
flex: 1;
height: 0; /* 让滚动区域生效 */
}
.list-wrap {
padding: 40rpx;
}
@@ -217,7 +184,7 @@ page {
justify-content: space-between;
align-items: center;
}
.refresh, .load-more, .no-more {
.load-more, .no-more {
text-align: center;
padding: 20rpx;
color: #999;
@@ -245,11 +212,4 @@ page {
padding: 10rpx 30rpx;
margin-top: 20rpx;
}
.spin {
animation: rotate 1s linear infinite;
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>

View File

@@ -1,18 +1,8 @@
<template>
<view class="repair-page">
<!-- <view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view> -->
<!-- 顶部导航栏 -->
<!-- <view class="nav-bar">
<view class="nav-left" @tap="goBack">
<image src="https://wuyeadmin.bugtc.com/images/home/arr-left.png" style="width: 18px; height: 18px;"></image>
</view>
<view class="nav-title">在线报修</view>
<view class="nav-right"></view>
</view> -->
<!-- 报修类型Tab -->
<scroll-view class="scroll-container" scroll-y="true"
:lower-threshold="100" @scrolltolower="loadMore">
<view class="scroll-container">
<view class="repair-type-tabs">
<view
class="type-tab"
@@ -108,13 +98,13 @@
<text v-if="loading">加载中...</text>
<text v-else-if="!hasMoreData">没有更多数据了</text>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import { ref, watch, computed } from 'vue';
import { onLoad, onShow, onUnload } from '@dcloudio/uni-app';
import { onLoad, onShow, onUnload, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
import { getQueryRepair } from '../api/api.js';
// 报修类型public:公共报修personal:个人报修)
@@ -192,6 +182,7 @@ const fetchRepairList = async (reset = false) => {
uni.showToast({ title: '网络异常', icon: 'none' });
} finally {
loading.value = false;
uni.stopPullDownRefresh();
}
};
@@ -202,6 +193,16 @@ const loadMore = () => {
fetchRepairList();
};
// 下拉刷新
onPullDownRefresh(() => {
fetchRepairList(true);
});
// 上拉加载更多
onReachBottom(() => {
loadMore();
});
// 监听状态变化自动刷新(切换 tab 时重置到第一页)
watch(activeStatus, () => {
fetchRepairList(true);
@@ -259,10 +260,8 @@ onUnload(() =>{
/* 页面整体样式 */
.repair-page {
background: linear-gradient(to bottom left, #E2F0FF 0%, #f9f9f9 50%);
height: 100vh;
min-height: 100vh;
padding: 0 40rpx;
display: flex;
flex-direction: column;
}
.status_bar {
height: var(--status-bar-height);
@@ -307,9 +306,7 @@ onUnload(() =>{
}
/* 滚动区域 */
.scroll-container {
flex: 1;
width: 100%;
overflow-y: auto;
box-sizing: border-box;
}
/* 报修类型Tab */
@@ -324,7 +321,7 @@ onUnload(() =>{
flex-direction: column;
align-items: center;
justify-content: center;
height: 100px;
height: 85px;
border-radius: 8px;
color: #fff;
font-size: 14px;
@@ -474,10 +471,10 @@ onUnload(() =>{
display: flex;
flex-wrap: wrap;
margin: -6rpx;
margin-bottom: 4px;
margin-bottom: 16px;
}
.img-placeholder {
width: 80px;
width: 95px;
height: 80px;
background-color: #f5f5f5;
border-radius: 4px;

View File

@@ -654,9 +654,10 @@ textarea {
.time-item {
height: 80rpx;
line-height: 80rpx;
font-size: 28rpx;
font-size: 26rpx;
color: #BBBCBE;
position: relative;
white-space: nowrap;
}
/* 选中项样式(高亮) */

View File

@@ -274,7 +274,7 @@ const previewImage = (url) => {
}
.photo-item {
width: 80px;
width: 95px;
height: 80px;
border-radius: 4px;
display: flex;

View File

@@ -13,7 +13,7 @@
<view class="page">
<view class="container">
<!-- /电费列表 -->
<scroll-view class="details-scroll" scroll-y="true" @scrolltolower="onPayLoadMore" :style="{ height: paymentList.length ? '550rpx' : '180rpx' }">
<scroll-view class="details-scroll" scroll-y="true" @scrolltolower="onPayLoadMore">
<view class="bill-list">
<template v-if="paymentList.length != 0">
<view class="bill-item" @click="goToBill(item)" v-for="item,index in paymentList" :key="index">
@@ -45,7 +45,7 @@
</view>
</scroll-view>
<!-- 物业费/垃圾处理费列表 -->
<scroll-view class="details-scroll-bill" scroll-y="true" @scrolltolower="onLoadMore" :style="{ height: detailslist.length ? '550rpx' : '180rpx' }">
<scroll-view class="details-scroll-bill" scroll-y="true" @scrolltolower="onLoadMore">
<view class="bill-list">
<template v-if="detailslist.length != 0">
<view class="bill-item" :class="{ 'bill-paid': !item.amount }" @click="!item.amount ? null : goToBill(item)" v-for="item,index in detailslist" :key="index">
@@ -100,7 +100,7 @@
<script setup>
import { ref } from 'vue'
import { onShow, onLoad, onBackPress, onUnload } from '@dcloudio/uni-app'
import { onShow, onLoad, onBackPress, onUnload, onPullDownRefresh } from '@dcloudio/uni-app'
import { getTopUpDetails, getTopUpSelectByResident } from '/pageSubPack/api/apiSub.js'
import { getCurrentVillage } from '/pageSubPack/api/api.js'
@@ -266,6 +266,8 @@ const getBillDetails = (isLoadMore = false) => {
pageNum.value--
loadingMore.value = false
}
}).finally(() => {
uni.stopPullDownRefresh();
})
}
const onLoadMore = () => {
@@ -307,12 +309,20 @@ const getPayList = async (isLoadMore = false) => {
title: err.msg || '网络异常',
icon: 'none'
})
} finally {
uni.stopPullDownRefresh();
}
}
const onPayLoadMore = () => {
getPayList(true)
}
// 下拉刷新:同时刷新水电费和物业费列表
onPullDownRefresh(() => {
getBillDetails();
getPayList();
});
</script>
<style lang="scss">
@@ -391,6 +401,8 @@ page {
background-color: #fff;
padding: 30rpx;
border-radius: 10rpx;
min-height: 550rpx;
box-sizing: border-box;
}
.bill-item {
@@ -576,7 +588,7 @@ page {
flex-direction: column;
align-items: center;
justify-content: center;
height: 120rpx;
height: 490rpx;
}
.empty-text {

View File

@@ -1,8 +1,8 @@
<template>
<view class="contentStyle" style="">
<view class="status-bar"></view>
<!-- <view class="status-bar"></view>
<uni-nav-bar title="缴费记录" left-icon="left" @clickLeft="goBack" backgroundColor="transparent" :border="false">
</uni-nav-bar>
</uni-nav-bar> -->
<view class="page">
<!-- 累计缴费 -->

View File

@@ -9,7 +9,7 @@
</view>
<!-- 列表区域 -->
<scroll-view class="page" scroll-y>
<view class="page">
<view class="page-container">
<view v-if="dataList.length === 0" class="empty-state">
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
@@ -42,7 +42,7 @@
</view>
</view>
</view>
</scroll-view>
</view>
<!-- 底部按钮 -->
<view class="bottom-btn-wrap">
@@ -53,7 +53,7 @@
<script setup>
import { ref, onMounted } from 'vue'
import {onLoad, onShow} from '@dcloudio/uni-app'
import {onLoad, onShow, onPullDownRefresh} from '@dcloudio/uni-app'
import {getComplainList} from '../api/apiSub.js'
// 分段器
@@ -111,6 +111,8 @@ const getComplainListData = async () =>{
}catch(err){
// console.log('dess',err)
uni.showToast({title:err.msg || '网络异常',icon:'error'})
}finally{
uni.stopPullDownRefresh();
}
}
onLoad(() =>{
@@ -118,7 +120,11 @@ onLoad(() =>{
})
onShow(() => {
getComplainListData()
})
});
onPullDownRefresh(() => {
getComplainListData();
});
// 跳转到详情
const turnToDetail = (item) => {
@@ -149,16 +155,12 @@ const addComplaintsSuggestions = () => {
<style scoped>
.contentStyle {
display: flex;
flex-direction: column;
height: 100%;
min-height: 100vh;
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
}
.page {
flex: 1;
overflow-y: auto;
padding: 0px 40rpx;
padding: 0px 40rpx 200rpx;
box-sizing: border-box;
}
@@ -183,6 +185,10 @@ const addComplaintsSuggestions = () => {
}
.tab-wrap {
position: sticky;
top: 0;
z-index: 10;
background: #e2efff;
display: flex;
justify-content: flex-start;
align-items: center;
@@ -310,9 +316,15 @@ const addComplaintsSuggestions = () => {
}
.bottom-btn-wrap {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 10;
padding: 20rpx 30rpx 40rpx;
display: flex;
gap: 20rpx;
background: #f9f9f9;
}
.next-btn {

View File

@@ -6,7 +6,7 @@
</view>
<!-- 表单区域 -->
<scroll-view class="page" scroll-y>
<view class="page">
<view class="list-container">
<view v-if="currentList.length === 0" class="empty-state">
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
@@ -43,13 +43,13 @@
</view>
</view>
<view style="width: 100%;height:2rpx;"></view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { onShow,onPullDownRefresh } from '@dcloudio/uni-app'
import {getQuestionnaireList} from '../api/apiSub.js'
// 状态栏高度
@@ -102,7 +102,9 @@
}
}catch(err){
uni.showToast({ title: err.msg ||'网络异常', icon: 'none' })
}
}finally{
uni.stopPullDownRefresh();
}
}
// 列表项点击index 控制高亮)
@@ -131,10 +133,13 @@
})
}
// 生命周期:每次显示时刷新数据
onShow(() => {
getDataList()
})
// 下拉刷新
onPullDownRefresh(() => {
getDataList();
});
</script>
<style lang="scss">
@@ -145,9 +150,10 @@
<style lang="scss" scoped>
.contentStyle {
display: flex;
flex-direction: column;
height: 100%;
// display: flex;
// flex-direction: column;
min-height: 100%;
// height: 100%;
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
}

View File

@@ -19,7 +19,7 @@
</view>
<!-- 访客列表 -->
<scroll-view class="list-container" scroll-y>
<view class="list-container">
<view
class="visitor-item"
v-for="(item, index) in filterdList"
@@ -79,7 +79,7 @@
<!-- 底部占位防止最后一项贴底 -->
<view class="list-bottom-space"></view>
</scroll-view>
</view>
<!-- 新增邀请按钮 -->
<view class="add-btn-wrapper">
@@ -92,7 +92,7 @@
<script setup>
import { ref, computed } from "vue";
import { onShow } from "@dcloudio/uni-app";
import { onShow, onPullDownRefresh } from "@dcloudio/uni-app";
import { getVisitorList } from "../api/api.js";
const activeTab = ref("waiting");
@@ -124,12 +124,18 @@ const fetchVisitorList = async () => {
visitorList.value = mapData(res.data || []);
} catch (err) {
uni.showToast({ title: err.msg, icon: "none" });
} finally {
uni.stopPullDownRefresh();
}
};
onShow(() => {
fetchVisitorList();
})
});
onPullDownRefresh(() => {
fetchVisitorList();
});
const filterdList = computed(() => {
return visitorList.value.filter((item) => item.status === activeTab.value);
@@ -149,10 +155,7 @@ const addInvitation = () => {
<style scoped>
/* 页面根容器 */
.visitor-page {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
min-height: 100vh;
box-sizing: border-box;
background: linear-gradient(135deg, #e2f0ff 0%, #f9f9f9 50%);
padding: 0 30rpx;
@@ -160,7 +163,11 @@ const addInvitation = () => {
/* 标签切换栏 */
.tab-bar {
position: sticky;
top: 0;
z-index: 10;
display: flex;
background: #e2f0ff;
}
.tab-item {
@@ -190,9 +197,6 @@ const addInvitation = () => {
/* 列表区域 */
.list-container {
flex: 1;
height: 0;
overflow: hidden;
}
/* 访客卡片 */
@@ -332,10 +336,3 @@ const addInvitation = () => {
}
</style>
<style>
/* 页面容器撑满并禁止整体滚动,让内部 scroll-view 单独滚动 */
page {
height: 100%;
overflow: hidden;
}
</style>