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

@@ -2,7 +2,7 @@ const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
const { customerRequest, customerTokenKey } = require("../../utils/request");
Page({
data: { brand: {}, records: [], error: "" },
data: { brand: {}, records: [], error: "", recordsError: "" },
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
@@ -17,10 +17,15 @@ Page({
this.loadRecords();
},
loadRecords() {
if (!wx.getStorageSync(customerTokenKey())) return this.setData({ records: [] });
if (!wx.getStorageSync(customerTokenKey()))
return this.setData({ records: [], recordsError: "" });
customerRequest("/customer/inquiry-submissions")
.then((records) => this.setData({ records: Array.isArray(records) ? records : [] }))
.catch(() => this.setData({ records: [] }));
.then((records) =>
this.setData({ records: Array.isArray(records) ? records : [], recordsError: "" }),
)
.catch((error) =>
this.setData({ recordsError: error.message || "记录加载失败,请稍后重试" }),
);
},
call() {
wx.makePhoneCall({