需求按钮状态优化

This commit is contained in:
Dev
2026-10-28 16:59:16 +08:00
parent f552fb957f
commit d47beb3f56
13 changed files with 166 additions and 43 deletions
+11 -2
View File
@@ -39,7 +39,16 @@ Page({
return new Promise((resolve) => {
fetchDemandDetail({ id: id }).then(
(res) => {
console.log(res);
if (!res || res.code !== 1 || !res.data) {
wx.showToast({ title: (res && res.msg) || '加载失败', icon: 'none' });
if (!this.data.demandInfo) {
setTimeout(() => {
wx.navigateBack({ delta: 1 });
}, 1500);
}
resolve();
return;
}
const demandInfo = res.data;
this.setData({
demandInfo,
@@ -47,7 +56,7 @@ Page({
}, () => resolve()); // setData 回调:页面已重新渲染
},
() => {
//接口异常处理
wx.showToast({ title: '网络异常,请重试', icon: 'none' });
resolve();
},
);