fix: 让首页主视觉跟随品牌接口数据
This commit is contained in:
1 parent
cd9784b59c
commit
accc113b2a
1 file changed
+1
-1
@@ -2,7 +2,7 @@ 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) => { 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 }); }); },
|
||||
onLoad() { this.setData({ loading: true }); loadWorkspaceWithFallback().then((workspace) => { const activeBrand = workspace.brand || brand; const layout = workspace.layout?.home || ["founder-card", "brand-hero", "trust-proof", "trust-manifesto", "offering-list"]; const firstOffering = (workspace.offerings || offerings)[0] || {}; this.setData({ brand: activeBrand, trustContent: workspace.trustContent || trustContent, offerings: workspace.offerings || offerings, modules: workspace.modules || [], layout, theme: workspace.theme || {}, hero: { ...this.data.hero, eyebrow: activeBrand.tagline || activeBrand.name, title: firstOffering.name || activeBrand.name, slogan: activeBrand.description || "以专业经验建立长期信任", cta: "了解业务与服务 →" }, loading: false }); wx.setNavigationBarTitle({ title: activeBrand.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" }); },
|
||||
|
||||
Reference in new issue
Block a user