feat: 对齐运行时模块映射

This commit is contained in:
que01 committed 2026-09-22 17:57:13 +08:00
1 parent 0867585f65
commit 777bdaa766
4 files changed
+9 -6

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
const { brand, trustContent, offerings } = require("../../utils/linjing-data");
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { brand, trustContent, offerings, loading: false },
onLoad() { this.setData({ loading: true }); loadWorkspaceWithFallback().then((workspace) => { this.setData({ brand: workspace.brand, trustContent: workspace.trustContent || trustContent, offerings: workspace.offerings || offerings, loading: false }); wx.setNavigationBarTitle({ title: workspace.brand.name || brand.name }); }); },
data: { brand, trustContent, offerings, modules: [], theme: {}, loading: false },
onLoad() { this.setData({ loading: true }); loadWorkspaceWithFallback().then((workspace) => { this.setData({ brand: workspace.brand, trustContent: workspace.trustContent || trustContent, offerings: workspace.offerings || offerings, modules: workspace.modules || [], theme: workspace.theme || {}, loading: false }); wx.setNavigationBarTitle({ title: workspace.brand.name || brand.name }); }); },
selectOffering(e) { wx.navigateTo({ url: "/pages/offering/detail?id=" + e.currentTarget.dataset.id }); },
goWorks() { wx.switchTab({ url: "/pages/services/index" }); },
goInquiry() { wx.navigateTo({ url: "/pages/inquiry/index" }); },
+2 -2
View File
@@ -1,8 +1,8 @@
const { offerings } = require("../../utils/linjing-data");
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { loading: false, error: "", offerings, filtered: offerings, category: "全部" },
onLoad() { loadWorkspaceWithFallback().then((workspace) => { const items = workspace.offerings || offerings; this.setData({ offerings: items, filtered: items }); }); },
data: { loading: false, error: "", offerings, filtered: offerings, modules: [], theme: {}, category: "全部" },
onLoad() { loadWorkspaceWithFallback().then((workspace) => { const items = workspace.offerings || offerings; this.setData({ offerings: items, filtered: items, modules: workspace.modules || [], theme: workspace.theme || {} }); }); },
switchCategory(e) { const category = e.currentTarget.dataset.category; const items = this.data.offerings || offerings; this.setData({ category, filtered: category === "全部" ? items : items.filter((item) => item.category === category) }); },
open(e) { wx.navigateTo({ url: "/pages/offering/detail?id=" + e.currentTarget.dataset.id }); },
});
+4 -2
View File
@@ -16,8 +16,10 @@ const FALLBACK_THEME = {
};
function resolveModule(module) {
const known = Object.values(CORE_MODULES).find((entry) => entry.key === module.type);
return { ...module, variant: module.variant || (known ? known.variants[0] : "default"), supported: Boolean(known || module.type === "custom") };
const aliases = { identity: "brand-hero", trust: "trust-proof", offering: "offering-list", inquiry: "inquiry", contact: "founder-card" };
const type = aliases[module.type] || module.type;
const known = Object.values(CORE_MODULES).find((entry) => entry.key === type);
return { ...module, type, variant: module.variant || (known ? known.variants[0] : "default"), supported: Boolean(known || type === "custom") };
}
function resolveRuntime(workspace) {
+1
View File
@@ -32,6 +32,7 @@
- [ ] Phase 2:标准模块库。
- [x] 建立小程序核心模块注册表、变体清单和未知模块降级策略。
- [x] 兼容旧模板模块 key,并将运行时模块状态注入首页和案例列表页面。
- [x] 更新基础 Design Tokens 到林境门作视觉基线,后续主题通过 Runtime Workspace 覆盖。
- [ ] Phase 3:模板中心、安装快照、升级和回滚。
- [ ] Phase 4:Capability Plugin。