refactor: 重构模板叠加式编译产物
This commit is contained in:
1 parent
c46297b13b
commit
25d1fe983c
93 files changed
+870
-2467
No files matched your search
@@ -0,0 +1,41 @@
|
||||
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" });
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarTitleText": "品牌首页",
|
||||
"usingComponents": {
|
||||
"linjing-home": "/components/templates/linjing-home/linjing-home"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<view class="page">
|
||||
<view wx:if="{{error}}" class="runtime-error">{{error}}</view>
|
||||
<linjing-home wx:else brand="{{brand}}" presentation="{{brand.visualPresentation.home}}" hero="{{hero}}" trust-content="{{trustContent}}" offerings="{{offerings}}" bind:select="selectOffering" bind:works="goWorks" />
|
||||
</view>
|
||||
@@ -0,0 +1 @@
|
||||
/* 页面样式由林境模板组件提供。 */
|
||||
Reference in new issue
Block a user