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