feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
@@ -0,0 +1,67 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const config = require("../../utils/config");
|
||||
Page({
|
||||
data: {
|
||||
loading: false,
|
||||
error: "",
|
||||
offerings: [],
|
||||
filtered: [],
|
||||
modules: [],
|
||||
theme: {},
|
||||
brand: {},
|
||||
presentation: {},
|
||||
category: "all",
|
||||
categories: [],
|
||||
loadedBrandSlug: "",
|
||||
navigation: [],
|
||||
},
|
||||
onLoad() {
|
||||
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 || {},
|
||||
loadedBrandSlug: config.brandSlug,
|
||||
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 === "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" });
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"navigationBarTitleText": "服务列表",
|
||||
"navigationBarBackgroundColor": "#FBF7F1",
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"acheng-offerings": "/components/templates/acheng-offerings/acheng-offerings",
|
||||
"brand-loading": "/components/ui/brand-loading/brand-loading",
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<view class="page"><view wx:if="{{error}}" class="runtime-error">{{error}}</view><block wx:else><acheng-offerings brand="{{brand}}" presentation="{{presentation}}" offerings="{{filtered}}" bind:open="open" bind:inquire="inquire" /></block></view>
|
||||
@@ -0,0 +1,202 @@
|
||||
.page {
|
||||
background: #f7f5f1;
|
||||
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;
|
||||
padding: 70rpx 40rpx 55rpx;
|
||||
}
|
||||
.eyebrow {
|
||||
font-size: 20rpx;
|
||||
letter-spacing: 3rpx;
|
||||
color: #d9c8b2;
|
||||
display: block;
|
||||
margin-bottom: 18rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 52rpx;
|
||||
font-family: serif;
|
||||
display: block;
|
||||
}
|
||||
.sub {
|
||||
font-size: 26rpx;
|
||||
color: #c6c2ba;
|
||||
display: block;
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
.tabs {
|
||||
white-space: nowrap;
|
||||
padding: 28rpx 32rpx;
|
||||
background: #f7f5f1;
|
||||
}
|
||||
.tab {
|
||||
display: inline-block;
|
||||
font-size: 25rpx;
|
||||
color: #77736b;
|
||||
margin: 0 14rpx;
|
||||
padding-bottom: 12rpx;
|
||||
}
|
||||
.tab.active {
|
||||
color: #8a6846;
|
||||
border-bottom: 2px solid #8a6846;
|
||||
}
|
||||
.list {
|
||||
padding: 0 32rpx 40rpx;
|
||||
}
|
||||
.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: 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;
|
||||
}
|
||||
.category {
|
||||
font-size: 20rpx;
|
||||
color: #8a6846;
|
||||
display: block;
|
||||
}
|
||||
.name {
|
||||
display: block;
|
||||
font-size: 34rpx;
|
||||
line-height: 1.45;
|
||||
margin: 12rpx 0 6rpx;
|
||||
}
|
||||
.series {
|
||||
display: block;
|
||||
color: #77736b;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.desc {
|
||||
display: block;
|
||||
color: #77736b;
|
||||
font-size: 25rpx;
|
||||
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;
|
||||
border-top: 1px solid #eee7de;
|
||||
margin-top: 24rpx;
|
||||
padding-top: 20rpx;
|
||||
color: #999;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
.arrow {
|
||||
color: #8a6846;
|
||||
}
|
||||
.page {
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
Reference in new issue
Block a user