bug修复,及体验优化
This commit is contained in:
@@ -149,6 +149,40 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 保持当前分页与滚动位置重新拉取列表
|
||||
* 用于「详情页/签约页操作后返回」时刷新该条数据的状态与按钮:
|
||||
* 一次拉回已加载的全部条目,避免像 loadDemandList(true) 那样回到第一页
|
||||
*/
|
||||
async refreshListKeepPosition() {
|
||||
const { status, keywords, opType, demandList } = this.data;
|
||||
const loadedCount = demandList.length;
|
||||
if (!loadedCount) {
|
||||
await this.loadDemandList(true);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await fetchDemandList({
|
||||
page: 1,
|
||||
pageSize: loadedCount,
|
||||
status,
|
||||
keywords,
|
||||
opType
|
||||
});
|
||||
const nextList = res.data.data || [];
|
||||
//只替换数据,不动 page / hasMore,保持原有的分页进度
|
||||
this.setData({
|
||||
demandList: nextList,
|
||||
isEmpty: nextList.length === 0
|
||||
});
|
||||
wx.nextTick(() => {
|
||||
this.checkDescOverflow();
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Failed to refresh demand list:', err);
|
||||
}
|
||||
},
|
||||
|
||||
// 检查每条内容是否超出最大高度,决定是否显示“查看全文”
|
||||
checkDescOverflow() {
|
||||
const query = this.createSelectorQuery();
|
||||
@@ -253,6 +287,15 @@ Page({
|
||||
}
|
||||
return;
|
||||
}
|
||||
//详情页/签约页操作完成后会写入该标记,回到列表时刷新对应条目的状态与按钮
|
||||
const app = getApp();
|
||||
const refreshDemandId = app && app.globalData ? app.globalData.refreshDemandId : 0;
|
||||
if (refreshDemandId) {
|
||||
//先清除标记,避免同一条被重复处理
|
||||
app.globalData.refreshDemandId = 0;
|
||||
this.refreshListKeepPosition();
|
||||
return;
|
||||
}
|
||||
if (this.data.freshPage) {
|
||||
this.setData({ freshPage: false });
|
||||
this.loadDemandList(true);
|
||||
|
||||
Reference in New Issue
Block a user