feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
@@ -1,4 +1,5 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const config = require("../../utils/config");
|
||||
Page({
|
||||
data: {
|
||||
loading: false,
|
||||
@@ -7,28 +8,64 @@ Page({
|
||||
filtered: [],
|
||||
modules: [],
|
||||
theme: {},
|
||||
category: "全部",
|
||||
brand: {},
|
||||
presentation: {},
|
||||
category: "all",
|
||||
categories: [],
|
||||
pageRenderer: "",
|
||||
loadedBrandSlug: "",
|
||||
templateKey: "",
|
||||
navigation: [],
|
||||
},
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback().then((workspace) => {
|
||||
const items = workspace.offerings || [];
|
||||
this.setData({
|
||||
offerings: items,
|
||||
filtered: items,
|
||||
modules: workspace.modules || [],
|
||||
theme: workspace.theme || {},
|
||||
});
|
||||
});
|
||||
this.loadWorkspace();
|
||||
},
|
||||
onShow() {
|
||||
if (this.data.loadedBrandSlug && this.data.loadedBrandSlug !== config.brandSlug) {
|
||||
this.loadWorkspace();
|
||||
}
|
||||
},
|
||||
loadWorkspace() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => {
|
||||
const items = workspace.offerings || [];
|
||||
this.setData({
|
||||
offerings: items,
|
||||
filtered: items,
|
||||
categories: [
|
||||
{ key: "all", label: "全部" },
|
||||
...Array.from(new Set(items.map((item) => item.category).filter(Boolean))).map(
|
||||
(key) => ({
|
||||
key,
|
||||
label: key,
|
||||
}),
|
||||
),
|
||||
],
|
||||
modules: workspace.modules || [],
|
||||
theme: workspace.theme || {},
|
||||
brand: workspace.brand || {},
|
||||
presentation: workspace.brand?.visualPresentation?.offerings || {},
|
||||
brand: workspace.brand || {},
|
||||
pageRenderer: workspace.pageRenderers?.offerings || "",
|
||||
loadedBrandSlug: config.brandSlug,
|
||||
templateKey: workspace.visualTemplate?.key || "",
|
||||
navigation: workspace.navigation || [],
|
||||
});
|
||||
})
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
switchCategory(e) {
|
||||
const category = e.currentTarget.dataset.category;
|
||||
const items = this.data.offerings || [];
|
||||
this.setData({
|
||||
category,
|
||||
filtered: category === "全部" ? items : items.filter((item) => item.category === category),
|
||||
filtered: category === "all" ? items : items.filter((item) => item.category === category),
|
||||
});
|
||||
},
|
||||
open(e) {
|
||||
wx.navigateTo({ url: "/pages/offering/detail?id=" + e.currentTarget.dataset.id });
|
||||
},
|
||||
inquire() {
|
||||
wx.navigateTo({ url: "/pages/inquiry/index" });
|
||||
},
|
||||
});
|
||||
@@ -3,7 +3,10 @@
|
||||
"navigationBarBackgroundColor": "#FBF7F1",
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"acheng-offerings": "/components/templates/acheng-offerings/acheng-offerings",
|
||||
"linjing-offerings": "/components/templates/linjing-offerings/linjing-offerings",
|
||||
"brand-loading": "/components/ui/brand-loading/brand-loading",
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty"
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty",
|
||||
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<view class="page"><view class="head"><text class="eyebrow">LINJING ATELIER</text><text class="title">作品与系统</text><text class="sub">每一扇门,都是建筑秩序的一部分。</text></view><scroll-view scroll-x class="tabs"><text wx:for="{{['全部','入户大门','庭院围墙门','室内户内门','装饰隐形门']}}" wx:key="*this" class="tab {{category===item?'active':''}}" data-category="{{item}}" bindtap="switchCategory">{{item}}</text></scroll-view><view class="list"><view wx:for="{{filtered}}" wx:key="id" class="card" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><view class="card-body"><text class="category">{{item.category}} · {{item.tag}}</text><text class="name">{{item.name}}</text><text class="series">{{item.series}}</text><text class="desc">{{item.desc}}</text><view class="foot"><text>{{item.area}}</text><text class="arrow">查看详情 →</text></view></view></view></view></view>
|
||||
<view class="page"><view wx:if="{{error}}" class="runtime-error">{{error}}</view><block wx:else><acheng-offerings wx:if="{{pageRenderer === 'acheng-offerings'}}" brand="{{brand}}" presentation="{{presentation}}" offerings="{{filtered}}" bind:open="open" bind:inquire="inquire" /><block wx:else><view class="head"><text class="eyebrow">{{brand.name}}</text><text class="title">{{presentation.title}}</text><text class="sub">{{presentation.subtitle}}</text></view><scroll-view scroll-x class="tabs"><text wx:for="{{categories}}" wx:key="key" class="tab {{category===item.key?'active':''}}" data-category="{{item.key}}" bindtap="switchCategory">{{item.label}}</text></scroll-view><view class="list"><view wx:for="{{filtered}}" wx:key="id" class="card"><view class="media" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><text class="media-category">{{item.category}}</text><text wx:if="{{item.tag}}" class="media-tag">{{item.tag}}</text><view wx:if="{{item.area || item.spaceType}}" class="media-meta"><text>{{item.area}}</text><text>{{item.spaceType}}</text></view></view><view class="card-body"><text class="name" data-id="{{item.id}}" bindtap="open">{{item.name}}</text><text class="series">{{item.series}}</text><view wx:if="{{item.woodMaterial || item.hardware}}" class="specs"><view wx:if="{{item.woodMaterial}}"><text>{{presentation.materialLabel}}</text><text>{{item.woodMaterial}}</text></view><view wx:if="{{item.hardware}}"><text>{{presentation.hardwareLabel}}</text><text>{{item.hardware}}</text></view></view><view class="actions"><button class="detail" data-id="{{item.id}}" bindtap="open">{{presentation.detailAction}}</button><button class="inquire" data-id="{{item.id}}" bindtap="open">{{presentation.inquiryAction}}</button></view></view></view></view></block></block><runtime-tab-bar template-key="{{templateKey}}" active="dishes" /></view>
|
||||
@@ -3,6 +3,16 @@
|
||||
min-height: 100vh;
|
||||
color: #252525;
|
||||
}
|
||||
.runtime-error {
|
||||
margin: 48rpx 32rpx;
|
||||
padding: 28rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 14rpx;
|
||||
background: #fff;
|
||||
color: #8a6846;
|
||||
font-size: 25rpx;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.head {
|
||||
background: #252827;
|
||||
color: #fff;
|
||||
@@ -48,12 +58,64 @@
|
||||
.card {
|
||||
background: #fff;
|
||||
margin-bottom: 30rpx;
|
||||
overflow: hidden;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 18rpx;
|
||||
box-shadow: 0 10rpx 30rpx -12rpx rgba(32, 34, 33, 0.08);
|
||||
}
|
||||
.media {
|
||||
position: relative;
|
||||
height: 380rpx;
|
||||
background: #202221;
|
||||
}
|
||||
.card image {
|
||||
width: 100%;
|
||||
height: 380rpx;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
.media-category,
|
||||
.media-tag,
|
||||
.media-meta {
|
||||
position: absolute;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.media-category {
|
||||
top: 20rpx;
|
||||
left: 20rpx;
|
||||
padding: 8rpx 14rpx;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.15);
|
||||
border-radius: 8rpx;
|
||||
background: rgba(32, 34, 33, 0.76);
|
||||
color: #d9c8b2;
|
||||
}
|
||||
.media-tag {
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
padding: 8rpx 14rpx;
|
||||
border-radius: 6rpx;
|
||||
background: #8a6846;
|
||||
}
|
||||
.media-meta {
|
||||
right: 20rpx;
|
||||
bottom: 20rpx;
|
||||
left: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
padding: 10rpx 14rpx;
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 10rpx;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
font-size: 19rpx;
|
||||
}
|
||||
.media-meta text:last-child {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
color: #d9c8b2;
|
||||
}
|
||||
.card-body {
|
||||
padding: 28rpx;
|
||||
}
|
||||
@@ -80,6 +142,49 @@
|
||||
line-height: 1.7;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
.specs {
|
||||
margin-top: 20rpx;
|
||||
padding: 18rpx;
|
||||
border: 1rpx solid #e6ded5;
|
||||
border-radius: 12rpx;
|
||||
background: #f7f5f1;
|
||||
color: #252525;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.55;
|
||||
}
|
||||
.specs view {
|
||||
display: flex;
|
||||
gap: 8rpx;
|
||||
}
|
||||
.specs view + view {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.specs text:first-child {
|
||||
flex: 0 0 auto;
|
||||
color: #77736b;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 14rpx;
|
||||
margin-top: 22rpx;
|
||||
}
|
||||
.actions button {
|
||||
flex: 1;
|
||||
height: 70rpx;
|
||||
margin: 0;
|
||||
border-radius: 12rpx;
|
||||
font-size: 21rpx;
|
||||
line-height: 70rpx;
|
||||
}
|
||||
.detail {
|
||||
border: 1rpx solid #202221;
|
||||
background: #fff;
|
||||
color: #202221;
|
||||
}
|
||||
.inquire {
|
||||
background: #8a6846;
|
||||
color: #fff;
|
||||
}
|
||||
.foot {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -92,3 +197,6 @@
|
||||
.arrow {
|
||||
color: #8a6846;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
Reference in new issue
Block a user