mirror of
http://36.133.248.69:3088/admin/RentWeAppFront.git
synced 2026-06-07 06:22:27 +08:00
优化,完善代码
This commit is contained in:
@@ -85,8 +85,14 @@ export default {
|
||||
pageNo: 1,
|
||||
pageSize:10,
|
||||
flowList: [],
|
||||
loadStatus: 'loadmore',
|
||||
isRefreshing: false
|
||||
loadStatus: 'more', // ✅ 修复为官方正确值
|
||||
isRefreshing: false,
|
||||
navbarStyle: {
|
||||
isTransparent: false,
|
||||
bgColor: '#fff',
|
||||
textColor: '#2D2B2C',
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(options){
|
||||
@@ -95,6 +101,7 @@ export default {
|
||||
onShow() {
|
||||
this.$checkToken(this.$getToken())
|
||||
},
|
||||
// ✅ 删除 scroll-view 冲突的 onReachBottom
|
||||
methods: {
|
||||
statusText(status) {
|
||||
switch (status) {
|
||||
@@ -107,7 +114,6 @@ export default {
|
||||
}
|
||||
},
|
||||
formatDate(dateStr) {
|
||||
// 格式化日期,例如:2025-11-10 周五 09:00
|
||||
if(!dateStr){return '-'}
|
||||
const date = new Date(dateStr);
|
||||
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
||||
@@ -121,8 +127,9 @@ export default {
|
||||
return `${year}-${month}-${day} ${weekday} ${hours}:${minutes}`;
|
||||
},
|
||||
fetchReserve(){
|
||||
if (this.loadStatus !== 'loadmore') return;
|
||||
this.loadStatus = 'loading';
|
||||
// ✅ 正确判断加载状态
|
||||
if (this.loadStatus !== 'more') return;
|
||||
this.loadStatus = 'loading';
|
||||
let url = '/reservate/queryPage'
|
||||
this.$u.post(url, {
|
||||
pageNo: this.pageNo,
|
||||
@@ -131,18 +138,19 @@ export default {
|
||||
WT: this.$getToken()
|
||||
}).then(res => {
|
||||
const rows = res.data.result || [];
|
||||
console.log(rows)
|
||||
if (this.pageNo === 1) this.flowList = [];
|
||||
this.flowList = this.flowList.concat(rows);
|
||||
|
||||
// ✅ 判断是否还有更多数据
|
||||
if (rows.length < this.pageSize) {
|
||||
this.loadStatus = 'nomore';
|
||||
} else {
|
||||
this.pageNo++;
|
||||
this.loadStatus = 'loadmore';
|
||||
this.loadStatus = 'more';
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("获取预约记录失败:", err)
|
||||
this.loadStatus = 'loadmore';
|
||||
this.loadStatus = 'more'; // ✅ 异常恢复
|
||||
})
|
||||
},
|
||||
viewLocation(item) {
|
||||
@@ -166,11 +174,16 @@ export default {
|
||||
loadMore() {
|
||||
this.fetchReserve()
|
||||
},
|
||||
// ✅ 修复下拉刷新(重置数据)
|
||||
refresh() {
|
||||
this.isRefreshing = true;
|
||||
this.pageNo = 1;
|
||||
this.flowList = [];
|
||||
this.loadStatus = 'more';
|
||||
this.fetchReserve();
|
||||
setTimeout(() => {
|
||||
this.isRefreshing = false;
|
||||
}, 1000);
|
||||
}, 800);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -179,12 +192,15 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.reserve-records {
|
||||
min-height: 100vh;
|
||||
padding-top: 175rpx; /* 给导航栏留空间 */
|
||||
padding-top: 175rpx;
|
||||
background: linear-gradient(0deg, #F3F1ED 43%, #F5E9DB 100%);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* ✅ 核心修复:正确的滚动区域高度 */
|
||||
.scroll-content {
|
||||
height: calc(100vh - -120rpx - 120rpx);
|
||||
height: calc(100vh - 175rpx);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.record-list {
|
||||
|
||||
Reference in New Issue
Block a user