fix: 完善记录错误状态与缓存失效策略
This commit is contained in:
1 parent
476e3d93dd
commit
8973338c64
13 files changed
+53
-29
No files matched your search
@@ -28,6 +28,7 @@ Page({
|
||||
data: {
|
||||
subView: "form",
|
||||
records: [],
|
||||
recordsError: "",
|
||||
// 字段全部来自后台已发布的咨询表单,模板只负责呈现。
|
||||
fields: [],
|
||||
values: {},
|
||||
@@ -76,10 +77,13 @@ Page({
|
||||
this.loadRecords();
|
||||
},
|
||||
loadRecords() {
|
||||
if (!wx.getStorageSync(customerTokenKey())) return;
|
||||
if (!wx.getStorageSync(customerTokenKey()))
|
||||
return this.setData({ records: [], recordsError: "" });
|
||||
this.setData({ recordsError: "" });
|
||||
customerRequest("/customer/inquiry-submissions")
|
||||
.then((items) =>
|
||||
this.setData({
|
||||
recordsError: "",
|
||||
records: (items || []).map((item) => ({
|
||||
...item,
|
||||
title: item.inquiryForm?.name || "品牌咨询",
|
||||
@@ -90,7 +94,9 @@ Page({
|
||||
})),
|
||||
}),
|
||||
)
|
||||
.catch(() => {});
|
||||
.catch((error) =>
|
||||
this.setData({ recordsError: error.message || "记录加载失败,请下拉或稍后重试" }),
|
||||
);
|
||||
},
|
||||
switchView(e) {
|
||||
this.setData({ subView: e.currentTarget.dataset.view });
|
||||
|
||||
Reference in new issue
Block a user