fix: 完善记录错误状态与缓存失效策略

This commit is contained in:
que01 committed 2026-10-15 13:58:39 +08:00
1 parent 476e3d93dd
commit 8973338c64
13 files changed
+53 -29

No files matched your search

+5 -5
View File
@@ -12,7 +12,7 @@ const statusLabels = {
};
Page({
data: { records: [], loading: false, presentation: {} },
data: { records: [], loading: false, loadError: "", presentation: {} },
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
@@ -21,12 +21,13 @@ Page({
.catch(() => {});
},
onShow() {
if (!wx.getStorageSync(customerTokenKey())) return this.setData({ records: [] });
this.setData({ loading: true });
if (!wx.getStorageSync(customerTokenKey())) return this.setData({ records: [], loadError: "" });
this.setData({ loading: true, loadError: "" });
customerRequest("/customer/inquiry-submissions")
.then((items) =>
this.setData({
loading: false,
loadError: "",
records: items.map((item) => ({
...item,
type: item.inquiryForm?.name || "品牌咨询",
@@ -42,8 +43,7 @@ Page({
}),
)
.catch((error) => {
this.setData({ loading: false });
wx.showToast({ title: error.message || "记录加载失败", icon: "none" });
this.setData({ loading: false, loadError: error.message || "记录加载失败" });
});
},
inquire() {
+1 -1
View File
@@ -1 +1 @@
<view class="page"><view class="head"><text class="title">{{presentation.title}}</text><button bindtap="inquire">{{presentation.createAction}}</button></view><records-module records="{{records}}" presentation="{{presentation}}" bind:create="inquire" /></view>
<view class="page"><view class="head"><text class="title">{{presentation.title}}</text><button bindtap="inquire">{{presentation.createAction}}</button></view><records-module records="{{records}}" load-error="{{loadError}}" presentation="{{presentation}}" bind:create="inquire" /></view>