From 0f35cab43658cde9786419fc9237a9ab3bea0746 Mon Sep 17 00:00:00 2001 From: que01 Date: Wed, 23 Sep 2026 00:00:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=A9=E9=A6=96=E9=A1=B5=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E8=BF=90=E8=A1=8C=E6=97=B6=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/miniapp/pages/index/index.js | 4 ++-- apps/miniapp/utils/module-registry.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/miniapp/pages/index/index.js b/apps/miniapp/pages/index/index.js index c443f87..56fce8f 100644 --- a/apps/miniapp/pages/index/index.js +++ b/apps/miniapp/pages/index/index.js @@ -1,8 +1,8 @@ const { brand, trustContent, offerings } = require("../../utils/linjing-data"); const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace"); Page({ - data: { brand, trustContent, offerings, modules: [], 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 || [], theme: workspace.theme || {}, loading: false }); wx.setNavigationBarTitle({ title: workspace.brand.name || brand.name }); }); }, + 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 }); }); }, 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" }); }, diff --git a/apps/miniapp/utils/module-registry.js b/apps/miniapp/utils/module-registry.js index dfb6747..d5fafd3 100644 --- a/apps/miniapp/utils/module-registry.js +++ b/apps/miniapp/utils/module-registry.js @@ -24,7 +24,9 @@ function resolveModule(module) { function resolveRuntime(workspace) { const modules = Array.isArray(workspace && workspace.modules) ? workspace.modules : []; - return { theme: workspace && workspace.theme ? workspace.theme : FALLBACK_THEME, modules: modules.map(resolveModule), capabilities: workspace && Array.isArray(workspace.capabilities) ? workspace.capabilities : [] }; + const resolved = modules.map(resolveModule); + const home = workspace && workspace.layout && Array.isArray(workspace.layout.home) ? workspace.layout.home : resolved.map((item) => item.type); + return { theme: workspace && workspace.theme ? workspace.theme : FALLBACK_THEME, modules: resolved, layout: { home: home.filter((key) => resolved.some((item) => item.type === key)) }, capabilities: workspace && Array.isArray(workspace.capabilities) ? workspace.capabilities : [] }; } module.exports = { CORE_MODULES, FALLBACK_THEME, resolveRuntime };