fix: 收敛模板编辑发布契约并还原餐饮页面视觉
This commit is contained in:
1 parent
20bcb43534
commit
f4061a24bd
102 files changed
+4510
-870
No files matched your search
@@ -1,18 +1,71 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const { openPage } = require("../../utils/navigation");
|
||||
// 每种内容对应一个固定视觉区域,按已配置记录优先选择,避免旧记录遮住编辑结果。
|
||||
function selectSlot(items, type) {
|
||||
return (
|
||||
items
|
||||
.filter((item) => item.type === type)
|
||||
.sort(
|
||||
(a, b) =>
|
||||
Number(Object.keys(b.config || {}).length > 0) -
|
||||
Number(Object.keys(a.config || {}).length > 0),
|
||||
)[0] || null
|
||||
);
|
||||
}
|
||||
Page({
|
||||
data: { brand: {}, presentation: {}, trustItems: [], loading: true },
|
||||
data: {
|
||||
brand: {},
|
||||
presentation: {},
|
||||
schedule: null,
|
||||
coverage: null,
|
||||
process: null,
|
||||
loading: true,
|
||||
error: false,
|
||||
},
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) =>
|
||||
this.load();
|
||||
},
|
||||
load() {
|
||||
this.setData({ loading: true, error: false });
|
||||
return loadWorkspaceWithFallback()
|
||||
.then((workspace) => {
|
||||
const items = workspace.trustItems || [];
|
||||
const schedule = selectSlot(items, "schedule");
|
||||
const coverage = selectSlot(items, "coverage");
|
||||
const process = selectSlot(items, "process");
|
||||
const config = schedule?.config || {};
|
||||
const rows = [
|
||||
{
|
||||
title: config.weekdayLabel,
|
||||
detail: config.weekdayDetail,
|
||||
hours: config.weekdayHours,
|
||||
tag: config.weekdayTag,
|
||||
tone: "orange",
|
||||
},
|
||||
{
|
||||
title: config.weekendLabel,
|
||||
detail: config.weekendDetail,
|
||||
hours: config.weekendHours,
|
||||
tag: config.weekendTag,
|
||||
tone: "blue",
|
||||
},
|
||||
].filter((row) => row.title && row.detail);
|
||||
const steps = Array.isArray(process?.config?.steps)
|
||||
? process.config.steps
|
||||
.filter((step) => step.title && step.detail)
|
||||
.map((step, index) => ({ ...step, index }))
|
||||
: [];
|
||||
this.setData({
|
||||
brand: workspace.brand || {},
|
||||
presentation: workspace.brand?.visualPresentation?.service || {},
|
||||
trustItems: workspace.trustItems || [],
|
||||
schedule: rows.length ? { ...schedule, rows } : null,
|
||||
coverage:
|
||||
coverage?.config?.pickupDetail && coverage?.config?.deliveryDetail ? coverage : null,
|
||||
process: steps.length ? { ...process, steps } : null,
|
||||
loading: false,
|
||||
}),
|
||||
)
|
||||
.catch(() => this.setData({ loading: false }));
|
||||
});
|
||||
})
|
||||
.catch(() => this.setData({ loading: false, error: true }));
|
||||
},
|
||||
inquire() {
|
||||
openPage("/pages/inquiry/index");
|
||||
|
||||
Reference in new issue
Block a user