feat: 按运行时布局渲染首页模块

This commit is contained in:
que01 committed 2026-09-23 00:03:46 +08:00
1 parent 0f35cab436
commit 13a2d3c676
3 files changed
+8 -6

No files matched your search

+2 -1
View File
@@ -2,7 +2,8 @@ const { brand, trustContent, offerings } = require("../../utils/linjing-data");
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { brand, trustContent, offerings, modules: [], layout: [], theme: {}, hero: { image: "https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=900&q=80", eyebrow: "年度落成实景 · 莫干山庄园", title: "万籁系列 · 铸铜冷锻双轴入户门", slogan: "门高 3.4m · 德国静音地轴", cta: "探索全系作品 →" }, 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 || [], layout: workspace.layout?.home || [], theme: workspace.theme || {}, loading: false }); wx.setNavigationBarTitle({ title: workspace.brand.name || brand.name }); }); },
onLoad() { this.setData({ loading: true }); loadWorkspaceWithFallback().then((workspace) => { const layout = workspace.layout?.home || ["founder-card", "brand-hero", "trust-proof", "trust-manifesto", "offering-list"]; this.setData({ brand: workspace.brand, trustContent: workspace.trustContent || trustContent, offerings: workspace.offerings || offerings, modules: workspace.modules || [], layout, theme: workspace.theme || {}, loading: false }); wx.setNavigationBarTitle({ title: workspace.brand.name || brand.name }); }); },
showModule(e) { return this.data.layout.includes(e); },
selectOffering(e) { const id = e.detail ? e.detail.id : e.currentTarget.dataset.id; wx.navigateTo({ url: "/pages/offering/detail?id=" + id }); },
goWorks() { wx.switchTab({ url: "/pages/services/index" }); },
goInquiry() { wx.navigateTo({ url: "/pages/inquiry/index" }); },
+5 -5
View File
@@ -1,7 +1,7 @@
<view class="page">
<founder-card brand="{{brand}}" />
<brand-hero hero="{{hero}}" bind:explore="goWorks" />
<trust-proof content="{{trustContent}}" />
<trust-manifesto content="{{trustContent}}" />
<offering-list offerings="{{offerings}}" bind:open="selectOffering" bind:more="goWorks" />
<founder-card wx:if="{{layout.indexOf('founder-card') !== -1}}" brand="{{brand}}" />
<brand-hero wx:if="{{layout.indexOf('brand-hero') !== -1}}" hero="{{hero}}" bind:explore="goWorks" />
<trust-proof wx:if="{{layout.indexOf('trust-proof') !== -1}}" content="{{trustContent}}" />
<trust-manifesto wx:if="{{layout.indexOf('trust-manifesto') !== -1}}" content="{{trustContent}}" />
<offering-list wx:if="{{layout.indexOf('offering-list') !== -1}}" offerings="{{offerings}}" bind:open="selectOffering" bind:more="goWorks" />
</view>
+1
View File
@@ -54,6 +54,7 @@
- [x] Admin 展示视觉模板主题色、适用场景和模块变体预览卡片。
- [x] 增加行业模板与视觉模板的安装前组合预览接口,不写入品牌配置。
- [x] Admin 接入模板组合预览,可在安装前查看模块变体和能力依赖。
- [x] 首页标准模块按 `layout.home` 受控显示,未知模块安全隐藏。
- [ ] Phase 4:Capability Plugin。
- [ ] Phase 5:林境门作与第二行业双模板验证。
- [ ] Phase 6:Stitch 到 Manifest 的转换流水线。