bug修复,及体验优化

This commit is contained in:
Dev
2026-10-09 16:59:09 +08:00
parent a35f78e03b
commit 8a9102ab47
11 changed files with 93 additions and 10 deletions
@@ -547,6 +547,8 @@ Page({
if (detailPage) {
detailPage.setData({ freshPage: true });
}
//标记该需求需要刷新,返回列表时同步最新状态与按钮
wx.$util.markDemandRefresh(this.data.demandId);
wx.$util.backAndRefresh(2);
},
@@ -302,6 +302,8 @@ Page({
content: agree ? '确认接单成功,请通过联系方式与客户沟通开发细节' : '已拒绝成功',
success: (res) => {
if (res.confirm) {
//标记该需求需要刷新,返回列表时同步最新状态与按钮
wx.$util.markDemandRefresh(this.data.id);
if (agree) {
//刷新当前页面,等沟通群二维码渲染完成后再回到顶部,方便直接看到
this.loadDemandDetail(this.data.id).then(() => {
@@ -90,8 +90,8 @@
</t-collapse>
<!-- 开发人员 -->
<view class="button-submit" wx:if="{{opType =='quote'}}">
<!-- 开发人员(优先按列表传入的 opType,站内消息等无 opType 的入口按身份判断) -->
<view class="button-submit" wx:if="{{_calc.isDevView(demandInfo, opType)}}">
<block>
<t-button wx:if="{{_calc.canSubmitBidding(demandInfo)}}" theme="danger" size="large" bind:tap="submitBidding" block>立即报名</t-button>
<view class="button-layout-flex" wx:elif="{{_calc.canConfirmOrder(demandInfo)}}">
@@ -104,6 +104,17 @@ var isDelivered = function (demandInfo) {
!!getDelivery(demandInfo);
}
// 是否开发者视角(决定按钮区渲染开发者操作还是需求方操作)
// 列表页会带 opType(quote=开发者视角,view=需求方视角);
// 站内消息等入口跳转不带 opType,此时按身份判断:需求发布者为需求方视角,其余为开发者视角
var isDevView = function (demandInfo, opType) {
if (opType === 'view') return false;
if (opType === 'quote') return true;
// 数据未加载前先不渲染按钮,避免短暂闪成错误视角
if (!demandInfo) return false;
return !demandInfo.isMy;
}
// 数值拼接单位,空值时不显示单位
var withUnit = function (value, unit) {
if (value === undefined || value === null || value === '') {
@@ -125,5 +136,6 @@ module.exports = {
getDelivery: getDelivery,
canDeliverGoods: canDeliverGoods,
isDelivered: isDelivered,
isDevView: isDevView,
withUnit: withUnit,
};
@@ -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);