42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
|
|
|
Page({
|
|
data: {
|
|
brand: {},
|
|
trustContent: {},
|
|
offerings: [],
|
|
hero: { image: "", eyebrow: "", title: "", slogan: "", cta: "" },
|
|
error: "",
|
|
},
|
|
onLoad() {
|
|
loadWorkspaceWithFallback()
|
|
.then((workspace) => {
|
|
const brand = workspace.brand || {};
|
|
const offerings = workspace.offerings || [];
|
|
const configuredHero =
|
|
brand.homeHero && typeof brand.homeHero === "object" ? brand.homeHero : {};
|
|
this.setData({
|
|
brand,
|
|
trustContent: workspace.trustPresentation || {},
|
|
offerings,
|
|
hero: {
|
|
...this.data.hero,
|
|
image: brand.heroImage || "",
|
|
eyebrow: brand.tagline || brand.name,
|
|
title: (offerings[0] && offerings[0].name) || brand.name,
|
|
slogan: brand.description || "",
|
|
...configuredHero,
|
|
},
|
|
});
|
|
wx.setNavigationBarTitle({ title: brand.name || "个人品牌" });
|
|
})
|
|
.catch((error) => this.setData({ error: error.message }));
|
|
},
|
|
selectOffering(event) {
|
|
wx.navigateTo({ url: "/pages/offering/detail?id=" + event.detail.id });
|
|
},
|
|
goWorks() {
|
|
wx.switchTab({ url: "/pages/services/index" });
|
|
},
|
|
});
|