feat: 收口多品牌与模板构建基础

This commit is contained in:
que01 committed 2026-09-25 02:55:46 +08:00
1 parent 0425a1c672
commit 77224ea51f
317 files changed
+11290 -1158

No files matched your search

+56 -39
View File
@@ -1,4 +1,5 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
const config = require("../../utils/config");
Page({
data: {
brand: {},
@@ -6,50 +7,66 @@ Page({
offerings: [],
modules: [],
moduleVariants: {},
pageRenderer: "",
layout: [],
theme: {},
hero: {
image:
"https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=900&q=80",
eyebrow: "",
title: "",
slogan: "",
cta: "了解业务与服务 →",
},
hero: { image: "", eyebrow: "", title: "", slogan: "", cta: "" },
loading: false,
loadedBrandSlug: "",
templateKey: "",
navigation: [],
},
onLoad() {
this.loadWorkspace();
},
onShow() {
if (this.data.loadedBrandSlug && this.data.loadedBrandSlug !== config.brandSlug) {
this.loadWorkspace();
}
},
loadWorkspace() {
this.setData({ loading: true });
loadWorkspaceWithFallback().then((workspace) => {
const activeBrand = workspace.brand || {};
const activeOfferings = workspace.offerings || [];
const layout = workspace.layout?.home || [
"founder-card",
"brand-hero",
"trust-proof",
"trust-manifesto",
"offering-list",
];
const firstOffering = activeOfferings[0] || {};
this.setData({
brand: activeBrand,
trustContent: workspace.trustContent || [],
offerings: activeOfferings,
modules: workspace.modules || [],
moduleVariants: workspace.moduleVariants || {},
layout,
theme: workspace.theme || {},
hero: {
...this.data.hero,
image: activeBrand.heroImage || this.data.hero.image,
eyebrow: activeBrand.tagline || activeBrand.name,
title: firstOffering.name || activeBrand.name,
slogan: activeBrand.description || "以专业经验建立长期信任",
},
loading: false,
});
wx.setNavigationBarTitle({ title: activeBrand.name || "个人品牌" });
});
loadWorkspaceWithFallback()
.then((workspace) => {
const activeBrand = workspace.brand || {};
const activeOfferings = workspace.offerings || [];
const layout = workspace.layout?.home || [
"founder-card",
"brand-hero",
"trust-proof",
"trust-manifesto",
"offering-list",
];
const firstOffering = activeOfferings[0] || {};
const configuredHero =
activeBrand.homeHero && typeof activeBrand.homeHero === "object"
? activeBrand.homeHero
: {};
this.setData({
brand: activeBrand,
trustContent: workspace.trustContent || [],
offerings: activeOfferings,
modules: workspace.modules || [],
moduleVariants: workspace.moduleVariants || {},
pageRenderer: workspace.pageRenderers?.home || "",
layout,
theme: workspace.theme || {},
hero: {
...this.data.hero,
image: activeBrand.heroImage || this.data.hero.image,
eyebrow: activeBrand.tagline || activeBrand.name,
title: firstOffering.name || activeBrand.name,
slogan: activeBrand.description || "",
...configuredHero,
},
loading: false,
loadedBrandSlug: config.brandSlug,
templateKey: workspace.visualTemplate?.key || "",
navigation: workspace.navigation || [],
});
wx.setNavigationBarTitle({ title: activeBrand.name || "个人品牌" });
})
.catch((error) => this.setData({ error: error.message, loading: false }));
},
showModule(e) {
return this.data.layout.includes(e);
@@ -65,6 +82,6 @@ Page({
wx.navigateTo({ url: "/pages/inquiry/index" });
},
goProfile() {
wx.switchTab({ url: "/pages/bookings/index" });
wx.navigateTo({ url: "/pages/bookings/index" });
},
});