refactor: 重构模板叠加式编译产物

This commit is contained in:
que01 committed 2026-09-26 11:21:29 +08:00
1 parent c46297b13b
commit 25d1fe983c
93 files changed
+870 -2467

No files matched your search

@@ -279,10 +279,7 @@ export class PublicWorkspaceController {
templatePackageManifest?.navigation.map((tab) => ({
key: tab.key,
label: tab.label,
page:
templatePackageManifest.entrypoints[
tab.page as keyof typeof templatePackageManifest.entrypoints
] ?? tab.page,
page: templatePackageManifest.entrypoints[tab.page] ?? tab.page,
})) ?? [],
},
modules: runtimeModules,
+9 -4
View File
@@ -1,11 +1,16 @@
const DEFAULT_API_BASE_URL = "http://localhost:3001";
const DEFAULT_BRAND_SLUG = "default-brand";
const runtimeConfig = require("./runtime-config");
// 仅开发构建允许用本地 storage 覆盖 API 地址和品牌,便于局域网真机调试。
function devOverride(key) {
return runtimeConfig.env === "dev" ? wx.getStorageSync(key) : "";
}
App({
onLaunch() {
this.globalData = {
apiBaseUrl: wx.getStorageSync("apiBaseUrl") || DEFAULT_API_BASE_URL,
brandSlug: wx.getStorageSync("brandSlug") || DEFAULT_BRAND_SLUG,
apiBaseUrl: devOverride("apiBaseUrl") || runtimeConfig.apiBaseUrl,
brandSlug: devOverride("brandSlug") || runtimeConfig.brandSlug,
templateKey: runtimeConfig.templateKey,
brand: {},
};
},
-5
View File
@@ -1,10 +1,5 @@
{
"pages": [
"pages/index/index",
"pages/services/index",
"pages/stall-service/index",
"pages/booking/index",
"pages/bookings/index",
"pages/offering/detail",
"pages/inquiry/index",
"pages/inquiry-success/index",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 913 B

@@ -1,33 +0,0 @@
Component({
properties: {
active: { type: String, value: "home" },
navigation: { type: Array, value: [] },
},
data: {
tabs: [],
},
methods: {
navigate(e) {
const tab = e.currentTarget.dataset.tab;
if (!tab || tab.key === this.data.active) return;
wx.navigateTo({ url: tab.page });
},
},
observers: {
navigation(navigation) {
this.setData({
tabs: Array.isArray(navigation)
? navigation.map((item) => ({
...item,
page: item.page && item.page.startsWith("/") ? item.page : `/${item.page || ""}`,
}))
: [],
});
},
},
lifetimes: {
attached() {
this.setData({ tabs: this.data.navigation || [] });
},
},
});
@@ -1 +0,0 @@
{ "component": true }
@@ -1 +0,0 @@
<view class="runtime-tab-bar"><view wx:for="{{tabs}}" wx:key="key" class="tab {{active === item.key ? 'active' : ''}}" data-tab="{{item}}" bindtap="navigate"><text class="icon">{{item.key === 'home' ? '⌂' : item.key === 'dishes' ? '♨' : item.key === 'service' ? '⌖' : item.key === 'owner' ? '♙' : item.key === 'booking' ? '✉' : '◈'}}</text><text>{{item.label}}</text></view></view>
@@ -1,32 +0,0 @@
.runtime-tab-bar {
position: fixed;
right: 0;
bottom: 0;
left: 0;
z-index: 20;
display: flex;
justify-content: space-around;
padding: 10rpx 6rpx calc(10rpx + env(safe-area-inset-bottom));
border-top: 1rpx solid #eee5dc;
background: rgba(255, 255, 255, 0.97);
box-shadow: 0 -8rpx 24rpx rgba(48, 32, 20, 0.08);
}
.tab {
display: flex;
min-width: 0;
flex: 1;
flex-direction: column;
align-items: center;
gap: 4rpx;
color: #9a8d83;
font-size: 19rpx;
}
.icon {
height: 34rpx;
font-size: 31rpx;
line-height: 34rpx;
}
.tab.active {
color: #e87532;
font-weight: 700;
}
@@ -1,19 +0,0 @@
Component({
properties: {
brand: { type: Object, value: {} },
presentation: { type: Object, value: {} },
trustContent: { type: Object, value: {} },
offerings: { type: Array, value: [] },
},
methods: {
openOffering(e) {
this.triggerEvent("select", { id: e.currentTarget.dataset.id });
},
openInquiry() {
this.triggerEvent("inquiry");
},
openOfferings() {
this.triggerEvent("offerings");
},
},
});
@@ -1 +0,0 @@
{ "component": true }
@@ -1 +0,0 @@
<view class="page"><view class="brand-card"><view class="identity"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><view><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="slogan">“{{brand.slogan}}”</text></view></view><view class="notice"><text class="notice-title">{{presentation.stallTitle || '今日出摊点'}}</text><text>{{brand.studioAddress || brand.address}}</text><text class="notice-time">{{presentation.stallTime || '今日营业中'}}</text></view><view class="actions"><button bindtap="openInquiry">预约 / 定制</button><button class="muted" bindtap="openOfferings">今日菜单</button></view></view><view class="section-head"><view><text class="eyebrow">{{presentation.worksEyebrow || '本周学生票选招牌'}}</text><text class="heading">{{presentation.worksTitle || '现做现吃,认真管饱'}}</text></view><text class="more" bindtap="openOfferings">全部餐品 ›</text></view><view class="dish-grid"><view wx:for="{{offerings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="openOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="dish-copy"><text class="dish-name">{{item.name}}</text><text class="dish-sub">{{item.desc}}</text><text class="price">{{item.priceRange}}</text></view></view></view><view class="promise"><text class="eyebrow light">{{presentation.manifestoEyebrow || '阿成的开档底线'}}</text><text class="promise-title">{{presentation.manifestoTitle || '真材实料,当天现做'}}</text><view wx:for="{{trustContent.pillars}}" wx:key="title" class="promise-item"><text>✓</text><text>{{item.title}}</text></view></view></view>
@@ -1,177 +0,0 @@
.page {
min-height: 100vh;
padding: 20rpx 28rpx 48rpx;
background: #fff8f0;
color: #29231f;
}
.brand-card {
padding: 28rpx;
border: 1rpx solid #f2d9c6;
border-radius: 28rpx;
background: #fff;
box-shadow: 0 12rpx 30rpx rgba(145, 75, 33, 0.08);
}
.identity {
display: flex;
gap: 20rpx;
align-items: center;
}
.identity image {
width: 96rpx;
height: 96rpx;
border: 4rpx solid #ffd9bb;
border-radius: 50%;
background: #fff1e5;
}
.name,
.title,
.slogan,
.notice-title,
.notice text,
.eyebrow,
.heading,
.more,
.dish-name,
.dish-sub,
.price,
.promise-title,
.promise-item text {
display: block;
}
.name {
font-size: 32rpx;
font-weight: 700;
}
.title {
margin-top: 6rpx;
color: #a2613b;
font-size: 21rpx;
}
.slogan {
margin-top: 10rpx;
color: #7a6a60;
font-size: 21rpx;
}
.notice {
position: relative;
margin-top: 24rpx;
padding: 20rpx;
border: 1rpx solid #f8d7b4;
border-radius: 20rpx;
background: #fff7df;
color: #6b4a35;
font-size: 22rpx;
line-height: 1.6;
}
.notice-title {
font-weight: 700;
color: #4f3020;
}
.notice-time {
position: absolute;
right: 18rpx;
top: 18rpx;
color: #c65c28;
font-size: 19rpx;
}
.actions {
display: flex;
gap: 14rpx;
margin-top: 20rpx;
}
.actions button {
flex: 1;
height: 76rpx;
border-radius: 20rpx;
background: #e87532;
color: #fff;
font-size: 24rpx;
line-height: 76rpx;
}
.actions .muted {
background: #fff0e5;
color: #b85e2c;
}
.section-head {
display: flex;
justify-content: space-between;
align-items: end;
margin: 34rpx 4rpx 18rpx;
}
.eyebrow {
color: #d2652b;
font-size: 19rpx;
letter-spacing: 2rpx;
}
.heading {
margin-top: 8rpx;
font-size: 34rpx;
font-weight: 700;
}
.more {
color: #d2652b;
font-size: 21rpx;
}
.dish-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16rpx;
}
.dish {
overflow: hidden;
border: 1rpx solid #f2e2d6;
border-radius: 22rpx;
background: #fff;
}
.dish image {
display: block;
width: 100%;
height: 220rpx;
background: #f3e7de;
}
.dish-copy {
padding: 18rpx;
}
.dish-name {
font-size: 24rpx;
font-weight: 700;
line-height: 1.4;
}
.dish-sub {
margin-top: 6rpx;
color: #8c7b70;
font-size: 19rpx;
line-height: 1.4;
}
.price {
margin-top: 14rpx;
color: #dc6429;
font-size: 24rpx;
font-weight: 700;
}
.promise {
margin-top: 28rpx;
padding: 28rpx;
border-radius: 24rpx;
background: #3b2118;
color: #fff;
}
.light {
color: #ffc79f;
}
.promise-title {
margin-top: 8rpx;
font-size: 30rpx;
font-weight: 700;
}
.promise-item {
display: flex;
gap: 12rpx;
margin-top: 18rpx;
color: #ffe5d2;
font-size: 21rpx;
}
.promise-item text:first-child {
color: #ff9a5a;
font-weight: 700;
}
@@ -1,15 +0,0 @@
Component({
properties: {
brand: { type: Object, value: {} },
presentation: { type: Object, value: {} },
offerings: { type: Array, value: [] },
},
methods: {
open(e) {
this.triggerEvent("open", { id: e.currentTarget.dataset.id });
},
inquire() {
this.triggerEvent("inquire");
},
},
});
@@ -1 +0,0 @@
{ "component": true }
@@ -1 +0,0 @@
<view class="page"><view class="head"><text class="eyebrow">{{brand.name}}</text><text class="title">{{presentation.title || '今日菜单'}}</text><text class="subtitle">{{presentation.subtitle || '现做现吃,支持提前预留和团体定制'}}</text></view><view class="tip">米饭免费续,口味和忌口都可以在预约时备注</view><view class="list"><view wx:for="{{offerings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="open"><image src="{{item.image}}" mode="aspectFill"/><view class="copy"><text class="name">{{item.name}}</text><text class="desc">{{item.desc}}</text><view class="bottom"><text class="price">{{item.priceRange}}</text><text class="action">查看详情 ›</text></view></view></view></view><button class="cta" bindtap="inquire">团体活动 / 定制餐咨询</button></view>
@@ -1,93 +0,0 @@
.page {
min-height: 100vh;
padding: 28rpx;
background: #fff8f0;
color: #29231f;
}
.eyebrow {
display: block;
color: #d2652b;
font-size: 19rpx;
letter-spacing: 2rpx;
}
.title {
display: block;
margin-top: 8rpx;
font-size: 42rpx;
font-weight: 700;
}
.subtitle {
display: block;
margin-top: 8rpx;
color: #8c7b70;
font-size: 22rpx;
}
.tip {
margin-top: 22rpx;
padding: 18rpx 20rpx;
border: 1rpx solid #f8d7b4;
border-radius: 18rpx;
background: #fff7df;
color: #8c5c39;
font-size: 21rpx;
}
.list {
margin-top: 18rpx;
}
.dish {
display: flex;
gap: 18rpx;
margin-bottom: 16rpx;
padding: 14rpx;
border: 1rpx solid #f2e2d6;
border-radius: 22rpx;
background: #fff;
}
.dish image {
width: 196rpx;
height: 196rpx;
flex: none;
border-radius: 16rpx;
background: #f3e7de;
}
.copy {
display: flex;
min-width: 0;
flex: 1;
flex-direction: column;
}
.name {
font-size: 26rpx;
font-weight: 700;
line-height: 1.45;
}
.desc {
margin-top: 10rpx;
color: #8c7b70;
font-size: 20rpx;
line-height: 1.5;
}
.bottom {
display: flex;
align-items: end;
justify-content: space-between;
margin-top: auto;
}
.price {
color: #dc6429;
font-size: 25rpx;
font-weight: 700;
}
.action {
color: #d2652b;
font-size: 20rpx;
}
.cta {
margin: 22rpx 0 0;
height: 76rpx;
border-radius: 20rpx;
background: #e87532;
color: #fff;
font-size: 24rpx;
line-height: 76rpx;
}
@@ -1,18 +0,0 @@
Component({
properties: {
brand: { type: Object, value: {} },
presentation: { type: Object, value: {} },
recordsCount: { type: Number, value: 0 },
},
methods: {
call() {
this.triggerEvent("call");
},
copy() {
this.triggerEvent("copy");
},
records() {
this.triggerEvent("records");
},
},
});
@@ -1 +0,0 @@
{ "component": true }
@@ -1 +0,0 @@
<view class="page"><view class="profile-card"><image src="{{brand.avatarUrl}}" mode="aspectFill"/><text class="name">{{brand.founder}}</text><text class="title">{{brand.title}}</text><text class="bio">{{brand.slogan}}</text><view class="contact"><button bindtap="call">电话联系</button><button bindtap="copy">复制微信</button></view></view><view class="card"><text class="card-title">{{presentation.coverageTitle || '出摊与配送'}}</text><text>{{brand.studioAddress || brand.address}}</text><text>{{presentation.coverageContent || '支持校园摊位自取、宿舍配送和班级活动定制。'}}</text></view><view class="card" bindtap="records"><text class="card-title">我的预约记录</text><text>{{recordsCount}} 条记录 ›</text></view></view>
@@ -1,72 +0,0 @@
.page {
min-height: 100vh;
padding: 28rpx;
background: #fff8f0;
color: #29231f;
}
.profile-card {
padding: 36rpx 28rpx;
text-align: center;
border-radius: 28rpx;
background: #3b2118;
color: #fff;
}
.profile-card image {
width: 132rpx;
height: 132rpx;
border: 5rpx solid #ffbd8e;
border-radius: 50%;
}
.name,
.title,
.bio,
.card-title,
.card text {
display: block;
}
.name {
margin-top: 18rpx;
font-size: 36rpx;
font-weight: 700;
}
.title {
margin-top: 6rpx;
color: #ffc79f;
font-size: 22rpx;
}
.bio {
margin-top: 16rpx;
color: #ffe5d2;
font-size: 23rpx;
line-height: 1.6;
}
.contact {
display: flex;
gap: 14rpx;
margin-top: 24rpx;
}
.contact button {
flex: 1;
height: 70rpx;
border-radius: 18rpx;
background: #e87532;
color: #fff;
font-size: 22rpx;
line-height: 70rpx;
}
.card {
margin-top: 18rpx;
padding: 26rpx;
border: 1rpx solid #f2d9c6;
border-radius: 22rpx;
background: #fff;
color: #7a6a60;
font-size: 22rpx;
line-height: 1.7;
}
.card-title {
margin-bottom: 10rpx;
color: #4b2b1d;
font-size: 27rpx;
font-weight: 700;
}
@@ -1,17 +0,0 @@
Component({
properties: {
brand: { type: Object, value: {} },
presentation: { type: Object, value: {} },
hero: { type: Object, value: {} },
trustContent: { type: Object, value: {} },
offerings: { type: Array, value: [] },
},
methods: {
selectOffering(event) {
this.triggerEvent("select", { id: event.currentTarget.dataset.id });
},
goWorks() {
this.triggerEvent("works");
},
},
});
@@ -1 +0,0 @@
{ "component": true }
@@ -1,8 +0,0 @@
<view class="page">
<view class="founder-card"><image class="avatar" src="{{brand.avatarUrl}}" mode="aspectFill"/><view class="founder-copy"><text class="founder-name">{{brand.founder}}</text><text class="founder-title">{{brand.title}}</text><text class="quote">“{{brand.slogan}}”</text></view><text class="badge">{{presentation.founderBadge}}</text></view>
<view class="hero" bindtap="goWorks"><image class="hero-image" src="{{brand.heroImage}}" mode="aspectFill"/><view class="hero-shade"/><view class="hero-copy"><text class="eyebrow">{{hero.eyebrow}}</text><text class="hero-title">{{hero.title}}</text><text class="hero-slogan">{{hero.slogan}}</text><text class="hero-button">{{hero.cta}}</text></view></view>
<view class="intro"><text class="eyebrow dark">{{presentation.proofEyebrow}}</text><text class="section-title">{{presentation.proofTitle}}</text><text class="body">{{trustContent.bio}}</text><view class="stats"><view wx:for="{{trustContent.stats}}" wx:key="value"><text class="stat-value">{{item.value}}</text><text class="stat-label">{{item.label}}</text><text class="stat-sub">{{item.sub}}</text></view></view></view>
<view class="trust"><text class="eyebrow">{{presentation.manifestoEyebrow}}</text><text class="section-title light">{{presentation.manifestoTitle}}</text><view wx:for="{{trustContent.pillars}}" wx:key="title" class="pillar"><text class="pillar-title">{{item.title}}</text><text class="pillar-desc">{{item.desc}}</text></view></view>
<view class="section"><view class="section-head"><view><text class="eyebrow dark">{{presentation.worksEyebrow}}</text><text class="section-title">{{presentation.worksTitle}}</text></view><text class="more" bindtap="goWorks">{{presentation.worksAction}}</text></view><view wx:for="{{offerings}}" wx:key="id" class="work-card" data-id="{{item.id}}" bindtap="selectOffering"><image src="{{item.image}}" mode="aspectFill"/><view class="work-info"><text class="work-category">{{item.category}} · {{item.area}}</text><text class="work-name">{{item.name}}</text><text class="work-desc">{{item.series}} · {{item.keywords[0]}} · {{item.keywords[1]}}</text></view></view></view>
<view class="flow"><text class="flow-eyebrow">{{presentation.flowEyebrow}}</text><text class="flow-title">{{presentation.flowTitle}}</text><view class="flow-grid"><view wx:for="{{trustContent.serviceFlow}}" wx:key="step" class="flow-item"><text class="flow-step">{{item.step}}</text><text class="flow-name">{{item.name}}</text><text class="flow-desc">{{item.desc}}</text></view></view></view>
</view>
@@ -1,261 +0,0 @@
.page {
background: #f7f5f1;
color: #252525;
padding-bottom: 30rpx;
}
.founder-card {
position: relative;
display: flex;
gap: 20rpx;
align-items: flex-start;
margin: 32rpx 40rpx 20rpx;
padding: 28rpx;
border: 1rpx solid #e6ded5;
border-radius: 28rpx;
background: #fff;
}
.avatar {
width: 112rpx;
height: 112rpx;
flex: 0 0 112rpx;
border: 4rpx solid #d9c8b2;
border-radius: 50%;
}
.founder-copy {
min-width: 0;
padding-right: 78rpx;
}
.founder-name,
.founder-title,
.quote,
.eyebrow,
.hero-title,
.hero-slogan,
.section-title,
.body,
.stat-value,
.stat-label,
.stat-sub,
.pillar-title,
.pillar-desc,
.work-category,
.work-name,
.work-desc,
.flow-eyebrow,
.flow-title,
.flow-step,
.flow-name,
.flow-desc {
display: block;
}
.founder-name {
font: 30rpx serif;
}
.founder-title {
margin-top: 6rpx;
color: #77736b;
font-size: 20rpx;
}
.quote {
margin-top: 14rpx;
font: 21rpx serif;
}
.badge {
position: absolute;
top: 24rpx;
right: 20rpx;
padding: 8rpx 12rpx;
border-radius: 20rpx;
background: #f3ede6;
color: #8a6846;
font-size: 18rpx;
}
.hero {
position: relative;
height: 400rpx;
margin: 0 40rpx 42rpx;
overflow: hidden;
border-radius: 28rpx;
}
.hero-image {
width: 100%;
height: 100%;
}
.hero-shade {
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(20, 22, 21, 0.1), rgba(20, 22, 21, 0.82));
}
.hero-copy {
position: absolute;
right: 28rpx;
bottom: 28rpx;
left: 28rpx;
color: #fff;
}
.eyebrow {
margin-bottom: 14rpx;
color: #d9c8b2;
font-size: 18rpx;
letter-spacing: 3rpx;
}
.dark {
color: #8a6846;
}
.hero-title,
.section-title {
font: 34rpx serif;
}
.hero-slogan {
margin-top: 10rpx;
font-size: 21rpx;
}
.hero-button {
position: absolute;
right: 0;
bottom: 0;
padding: 12rpx 16rpx;
border: 1rpx solid rgba(255, 255, 255, 0.3);
color: #d9c8b2;
font-size: 19rpx;
}
.intro,
.section {
padding: 0 40rpx 48rpx;
}
.body {
color: #77736b;
font-size: 24rpx;
line-height: 1.8;
}
.stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16rpx;
margin-top: 22rpx;
}
.stats view {
padding: 22rpx;
border: 1rpx solid #e6ded5;
border-radius: 20rpx;
background: #fff;
}
.stat-value {
color: #8a6846;
font: 38rpx serif;
}
.stat-label {
margin-top: 4rpx;
font-size: 22rpx;
font-weight: 600;
}
.stat-sub {
margin-top: 6rpx;
color: #77736b;
font-size: 18rpx;
line-height: 1.5;
}
.trust {
padding: 42rpx 40rpx;
background: #202221;
color: #fff;
}
.light {
color: #fff;
}
.pillar {
margin-top: 24rpx;
}
.pillar-title {
color: #fff;
font: 28rpx serif;
}
.pillar-desc {
margin-top: 8rpx;
color: #c6c2ba;
font-size: 22rpx;
line-height: 1.65;
}
.section-head {
display: flex;
align-items: end;
justify-content: space-between;
margin-bottom: 22rpx;
}
.more {
color: #8a6846;
font-size: 21rpx;
}
.work-card {
margin-bottom: 24rpx;
overflow: hidden;
border: 1rpx solid #e6ded5;
border-radius: 28rpx;
background: #fff;
}
.work-card image {
width: 100%;
height: 300rpx;
}
.work-info {
padding: 24rpx;
}
.work-category {
color: #8a6846;
font-size: 19rpx;
}
.work-name {
margin: 10rpx 0;
font: 28rpx serif;
}
.work-desc {
color: #77736b;
font-size: 22rpx;
line-height: 1.6;
}
.flow {
margin: 0 40rpx 42rpx;
padding: 30rpx 24rpx;
border: 1rpx solid #e6ded5;
border-radius: 20rpx;
background: #efece6;
text-align: center;
}
.flow-eyebrow {
color: #8a6846;
font-size: 18rpx;
letter-spacing: 2rpx;
}
.flow-title {
margin-top: 6rpx;
font: 30rpx serif;
}
.flow-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16rpx;
margin-top: 24rpx;
text-align: left;
}
.flow-item {
padding: 18rpx;
border: 1rpx solid #e6ded5;
border-radius: 14rpx;
background: #fff;
}
.flow-step {
color: #8a6846;
font-size: 18rpx;
font-weight: 700;
}
.flow-name {
margin-top: 5rpx;
font-size: 21rpx;
font-weight: 600;
}
.flow-desc {
margin-top: 6rpx;
color: #77736b;
font-size: 17rpx;
line-height: 1.5;
}
@@ -1,18 +0,0 @@
Component({
properties: {
brand: { type: Object, value: {} },
presentation: { type: Object, value: {} },
recordsCount: { type: Number, value: 0 },
},
methods: {
call() {
this.triggerEvent("call");
},
copy() {
this.triggerEvent("copy");
},
records() {
this.triggerEvent("records");
},
},
});
@@ -1,6 +0,0 @@
{
"component": true,
"usingComponents": {
"t-icon": "/miniprogram_npm/tdesign-miniprogram/icon/icon"
}
}
@@ -1,26 +0,0 @@
<view class="profile">
<view class="founder-card">
<view class="identity">
<image class="avatar" src="{{brand.avatarUrl}}" mode="aspectFill" />
<view><text class="founder">{{brand.founder}}</text><text class="role">{{brand.title}}</text></view>
</view>
<view class="contact-lines">
<view class="contact-line"><text class="label">{{presentation.phoneLabel}}</text><view class="contact-action"><text class="value">{{brand.phone}}</text><button bindtap="call"><t-icon name="call" size="24rpx" />{{presentation.callAction}}</button></view></view>
<view class="contact-line"><text class="label">{{presentation.wechatLabel}}</text><view class="contact-action"><text class="value accent">{{brand.wechat}}</text><button bindtap="copy"><t-icon name="file-copy" size="24rpx" />{{presentation.copyAction}}</button></view></view>
<view class="contact-line address"><text class="label">{{presentation.addressLabel}}</text><text class="address-value">{{brand.studioAddress}}</text></view>
</view>
</view>
<view class="records-card" bindtap="records">
<view class="entry-icon"><t-icon name="logo-notion" size="34rpx" /></view>
<view class="entry-copy"><text>{{presentation.recordsTitle}}</text><text>{{presentation.recordsSubtitle}}</text></view>
<view class="entry-count"><text>{{recordsCount}} {{presentation.recordsCountUnit}}</text><t-icon name="chevron-right" size="30rpx" /></view>
</view>
<view class="info-card">
<view class="card-title"><t-icon name="map" size="32rpx" /><text>{{presentation.coverageTitle}}</text></view>
<view wx:for="{{brand.profilePresentation.coverage}}" wx:key="title" class="note"><text class="note-title">{{item.title}}</text><text>{{item.content}}</text></view>
</view>
<view class="info-card">
<view class="card-title"><t-icon name="secured" size="32rpx" /><text>{{presentation.warrantyTitle}}</text></view>
<view wx:for="{{brand.profilePresentation.warranty}}" wx:key="*this" class="warranty"><text class="dot">•</text><text>{{item}}</text></view>
</view>
</view>
@@ -1,194 +0,0 @@
.profile {
min-height: 100vh;
padding: 28rpx 32rpx 56rpx;
background: #f7f5f1;
color: #252525;
}
.founder-card {
padding: 34rpx 30rpx;
border-radius: 20rpx;
background: #202221;
color: #fff;
box-shadow: 0 12rpx 34rpx rgba(32, 34, 33, 0.12);
}
.identity {
display: flex;
align-items: center;
gap: 22rpx;
}
.avatar {
width: 92rpx;
height: 92rpx;
border: 2rpx solid #8a6846;
border-radius: 50%;
background: #343736;
}
.founder,
.role,
.label,
.value,
.address-value,
.entry-copy text,
.entry-count text,
.note-title,
.note text,
.warranty text {
display: block;
}
.founder {
font: 34rpx serif;
}
.role {
margin-top: 8rpx;
color: #d9c8b2;
font-size: 22rpx;
}
.contact-lines {
margin-top: 24rpx;
border-top: 1rpx solid rgba(255, 255, 255, 0.12);
}
.contact-line {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20rpx;
padding-top: 18rpx;
margin-top: 18rpx;
border-top: 1rpx solid rgba(255, 255, 255, 0.1);
font-size: 22rpx;
}
.contact-line:first-child {
border-top: 0;
margin-top: 0;
}
.label {
flex: 0 0 auto;
color: rgba(255, 255, 255, 0.52);
}
.contact-action {
display: flex;
min-width: 0;
align-items: center;
gap: 12rpx;
}
.value {
color: #fff;
font-family: monospace;
white-space: nowrap;
}
.accent {
color: #d9c8b2;
}
.contact-action button {
display: flex;
align-items: center;
justify-content: center;
gap: 5rpx;
min-width: 86rpx;
height: 46rpx;
margin: 0;
padding: 0 12rpx;
border-radius: 9rpx;
background: rgba(255, 255, 255, 0.1);
color: #d9c8b2;
font-size: 20rpx;
line-height: 46rpx;
}
.address {
align-items: flex-start;
}
.address-value {
max-width: 410rpx;
color: rgba(255, 255, 255, 0.82);
line-height: 1.55;
text-align: right;
}
.records-card,
.info-card {
margin-top: 20rpx;
border: 1rpx solid #e6ded5;
border-radius: 18rpx;
background: #fff;
box-shadow: 0 10rpx 30rpx -12rpx rgba(32, 34, 33, 0.08);
}
.records-card {
display: flex;
align-items: center;
gap: 18rpx;
padding: 26rpx;
}
.entry-icon {
display: flex;
align-items: center;
justify-content: center;
width: 66rpx;
height: 66rpx;
border-radius: 12rpx;
background: rgba(138, 104, 70, 0.1);
color: #8a6846;
}
.entry-copy {
flex: 1;
min-width: 0;
}
.entry-copy text:first-child {
color: #202221;
font-size: 25rpx;
font-weight: 600;
}
.entry-copy text:last-child {
margin-top: 7rpx;
color: #77736b;
font-size: 20rpx;
line-height: 1.4;
}
.entry-count {
display: flex;
align-items: center;
gap: 4rpx;
flex: 0 0 auto;
color: #8a6846;
font-size: 20rpx;
}
.info-card {
padding: 28rpx;
}
.card-title {
display: flex;
align-items: center;
gap: 12rpx;
color: #202221;
font-size: 26rpx;
font-weight: 700;
}
.card-title t-icon {
color: #8a6846;
}
.note {
margin-top: 18rpx;
padding: 20rpx;
border: 1rpx solid #e6ded5;
border-radius: 12rpx;
background: #f7f5f1;
color: #57534e;
font-size: 23rpx;
line-height: 1.7;
}
.note-title {
margin-bottom: 5rpx;
color: #202221;
font-size: 23rpx;
font-weight: 700;
}
.warranty {
display: flex;
gap: 10rpx;
margin-top: 16rpx;
color: #77736b;
font-size: 23rpx;
line-height: 1.65;
}
.dot {
flex: 0 0 auto;
color: #8a6846;
}
-92
View File
@@ -1,92 +0,0 @@
const { request, customerRequest, customerTokenKey } = require("../../utils/request");
const { getTemplate } = require("../../utils/templates");
Page({
data: {
service: {},
form: {},
offeringId: "",
quantity: 1,
fulfillment: "pickup",
submitting: false,
template: getTemplate("personal"),
},
onLoad(query) {
Promise.all([request("/public/offerings"), request("/public/brand")])
.then(([services, brand]) => {
const list = Array.isArray(services) ? services : [];
const service =
list.find((item) => item.id === query.offeringId || item.id === query.serviceId) ||
list.find((item) => item.priceAmount !== null) ||
{};
this.setData({
service,
offeringId: service.id || "",
template: getTemplate(brand.templateKey),
});
})
.catch(() => wx.showToast({ title: "服务加载失败", icon: "none" }));
},
input(event) {
this.setData({ ["form." + event.currentTarget.dataset.key]: event.detail.value });
},
chooseFulfillment(event) {
this.setData({ fulfillment: event.currentTarget.dataset.value });
},
increase() {
if (this.data.quantity < 50) this.setData({ quantity: this.data.quantity + 1 });
},
decrease() {
if (this.data.quantity > 1) this.setData({ quantity: this.data.quantity - 1 });
},
submit() {
const form = this.data.form;
if (!this.data.offeringId) return wx.showToast({ title: "请先选择服务", icon: "none" });
if (!form.customerName || !form.wechatId)
return wx.showToast({ title: "请填写称呼和联系方式", icon: "none" });
if (this.data.fulfillment === "delivery" && !form.deliveryAddress)
return wx.showToast({ title: "请填写" + this.data.template.locationLabel, icon: "none" });
this.setData({ submitting: true });
const send = () =>
customerRequest("/customer/bookings", {
method: "POST",
data: {
requestType: this.data.template.requestType,
customerName: form.customerName,
wechatId: form.wechatId,
contactPreference: "wechat",
fulfillmentType: this.data.fulfillment,
deliveryAddress: form.deliveryAddress,
requestedTime: form.requestedTime,
note: form.note,
items: [{ offeringId: this.data.offeringId, quantity: this.data.quantity }],
},
})
.then(() => {
this.setData({ submitting: false });
wx.showToast({ title: "预约已提交" });
setTimeout(() => wx.navigateTo({ url: "/pages/bookings/index" }), 500);
})
.catch((error) => {
this.setData({ submitting: false });
wx.showToast({ title: error.message || "提交失败", icon: "none" });
});
const token = wx.getStorageSync(customerTokenKey());
if (token) return send();
wx.login({
success: (login) =>
request("/customer/session/wechat", { method: "POST", data: { code: login.code } })
.then((result) => {
wx.setStorageSync(customerTokenKey(), result.token);
send();
})
.catch((error) => {
this.setData({ submitting: false });
wx.showToast({ title: error.message || "微信登录失败", icon: "none" });
}),
fail: (error) => {
this.setData({ submitting: false });
wx.showToast({ title: error.errMsg || "微信登录失败", icon: "none" });
},
});
},
});
-10
View File
@@ -1,10 +0,0 @@
{
"navigationBarTitleText": "提交需求",
"navigationBarBackgroundColor": "#FBF7F1",
"navigationBarTextStyle": "black",
"usingComponents": {
"brand-button": "/components/ui/brand-button/brand-button",
"brand-field": "/components/ui/brand-field/brand-field",
"brand-card": "/components/ui/brand-card/brand-card"
}
}
-7
View File
@@ -1,7 +0,0 @@
<view class="page">
<view class="product"><view class="product-image"><image wx:if="{{service.coverUrl}}" src="{{service.coverUrl}}" mode="aspectFill"/><view wx:else class="dish-placeholder"></view></view><view class="product-copy"><text class="name">{{service.name || '选择服务'}}</text><text class="price">{{service.priceText || '沟通报价'}}</text></view><text class="available">{{template.available}}</text></view>
<view class="quantity"><text>数量</text><view class="stepper"><button bindtap="decrease">−</button><text>{{quantity}} 份</text><button bindtap="increase">+</button></view></view>
<view class="fulfillment"><text class="field-title">{{template.modeLabel}}</text><view class="choices"><button class="choice {{fulfillment === 'pickup' ? 'active' : ''}}" data-value="pickup" bindtap="chooseFulfillment">{{template.modeA}}</button><button class="choice {{fulfillment === 'delivery' ? 'active' : ''}}" data-value="delivery" bindtap="chooseFulfillment">{{template.modeB}}</button></view></view>
<brand-card><view class="form"><brand-field label="怎么称呼" placeholder="请输入你的称呼" required value="{{form.customerName}}" bind:change="input" data-key="customerName"/><brand-field label="联系方式" placeholder="手机号或微信号" required value="{{form.wechatId}}" bind:change="input" data-key="wechatId"/><brand-field label="期望时间" placeholder="例如:下周三 14:00" value="{{form.requestedTime}}" bind:change="input" data-key="requestedTime"/><brand-field wx:if="{{fulfillment === 'delivery'}}" label="{{template.locationLabel}}" placeholder="{{template.locationPlaceholder}}" value="{{form.deliveryAddress}}" bind:change="input" data-key="deliveryAddress"/><brand-field label="{{template.requestType === 'package' ? '备注' : '需求说明'}}" placeholder="{{template.notePlaceholder}}" type="textarea" value="{{form.note}}" bind:change="input" data-key="note"/></view></brand-card>
<view class="notice">● {{template.submitNotice}}</view><brand-button loading="{{submitting}}" disabled="{{submitting}}" bind:tap="submit">{{submitting ? '提交中...' : template.submitLabel}}</brand-button>
</view>
-138
View File
@@ -1,138 +0,0 @@
.page {
min-height: 100vh;
padding: 24rpx 32rpx 60rpx;
background: #fbf7f1;
color: #2b2b2b;
}
.product {
display: flex;
align-items: center;
gap: 20rpx;
padding: 20rpx;
background: #f4ebd9;
border-radius: 16rpx;
}
.product-image {
width: 220rpx;
height: 180rpx;
overflow: hidden;
border-radius: 12rpx;
flex: none;
}
.product-image image,
.dish-placeholder {
width: 100%;
height: 100%;
display: block;
background: #c79555;
}
.product-copy {
flex: 1;
}
.name {
display: block;
font-size: 34rpx;
font-weight: 700;
}
.price {
display: block;
margin-top: 18rpx;
color: #b54a2c;
font-size: 38rpx;
}
.available {
color: #7a4a2b;
font-size: 26rpx;
white-space: nowrap;
align-self: flex-start;
margin-top: 14rpx;
}
.quantity,
.fulfillment {
margin-top: 20rpx;
padding: 28rpx;
background: #f4ebd9;
border-radius: 16rpx;
font-size: 32rpx;
}
.stepper {
float: right;
display: flex;
align-items: center;
gap: 18rpx;
}
.stepper button {
width: 56rpx;
height: 56rpx;
line-height: 52rpx;
padding: 0;
border-radius: 50%;
background: #fff;
color: #b54a2c;
}
.field-title {
font-weight: 700;
}
.choices {
display: flex;
gap: 16rpx;
margin-top: 18rpx;
}
.choice {
flex: 1;
border-radius: 12rpx;
background: #7a4a2b;
color: #fff;
}
.choice.active {
background: #b54a2c;
}
.form {
margin-top: 20rpx;
background: #fff;
border-radius: 16rpx;
padding: 8rpx 28rpx;
}
.form label {
display: flex;
justify-content: space-between;
gap: 20rpx;
padding: 28rpx 0;
border-bottom: 1rpx solid #eee;
font-size: 30rpx;
}
.form input,
.form textarea {
flex: 1;
text-align: right;
}
.form textarea {
min-height: 100rpx;
}
.notice {
margin: 20rpx 0;
padding: 24rpx;
background: #f4ebd9;
border-radius: 16rpx;
color: #7a4a2b;
}
.submit {
background: #b54a2c;
color: #fff;
border-radius: 12rpx;
font-size: 34rpx;
}
.stepper button {
display: flex;
width: 64rpx;
height: 64rpx;
align-items: center;
justify-content: center;
padding: 0;
border: 0;
border-radius: 16rpx;
background: #fff;
color: #b54a2c;
font-size: 40rpx;
line-height: 1;
}
-56
View File
@@ -1,56 +0,0 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
const { customerRequest, customerTokenKey } = require("../../utils/request");
Page({
data: {
brand: {},
trustContent: [],
records: [],
pageRenderer: "",
error: "",
templateKey: "",
navigation: [],
},
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
this.setData({
brand: workspace.brand || {},
trustContent: workspace.trustPresentation || {},
pageRenderer: workspace.pageRenderers?.profile || "",
records: [],
templateKey: workspace.visualTemplate?.key || "",
navigation: workspace.navigation || [],
}),
)
.catch((error) => this.setData({ error: error.message }));
},
onShow() {
this.loadRecords();
},
loadRecords() {
if (!wx.getStorageSync(customerTokenKey())) return this.setData({ records: [] });
customerRequest("/customer/inquiry-submissions")
.then((records) => this.setData({ records: Array.isArray(records) ? records : [] }))
.catch(() => this.setData({ records: [] }));
},
call() {
wx.makePhoneCall({
phoneNumber: (this.data.brand.phone || this.data.brand.contactPhone || "").replace(
/[^0-9-]/g,
"",
),
});
},
copyWechat() {
wx.setClipboardData({
data: this.data.brand.wechat || this.data.brand.contactWechat || "",
success: () => wx.showToast({ title: "微信号已复制", icon: "none" }),
});
},
recordsPage() {
wx.navigateTo({ url: "/pages/records/index" });
},
inquire() {
wx.navigateTo({ url: "/pages/inquiry/index" });
},
});
-12
View File
@@ -1,12 +0,0 @@
{
"navigationBarTitleText": "我的订单",
"navigationBarBackgroundColor": "#FBF7F1",
"navigationBarTextStyle": "black",
"usingComponents": {
"t-icon": "/miniprogram_npm/tdesign-miniprogram/icon/icon",
"profile-module": "/components/modules/profile/profile",
"linjing-profile": "/components/templates/linjing-profile/linjing-profile",
"acheng-profile": "/components/templates/acheng-profile/acheng-profile",
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
}
}
-1
View File
@@ -1 +0,0 @@
<view class="page"><view wx:if="{{error}}" class="runtime-error">{{error}}</view><block wx:else><acheng-profile wx:if="{{pageRenderer === 'acheng-profile'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.profile}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" /><linjing-profile wx:elif="{{pageRenderer === 'linjing-profile'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.profile}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" /><block wx:else><profile-module brand="{{brand}}" presentation="{{brand.visualPresentation.profile}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" /></block><runtime-tab-bar template-key="{{templateKey}}" active="owner" /></block></view>
-166
View File
@@ -1,166 +0,0 @@
.page {
min-height: 100vh;
padding: 0;
background: #f7f5f1;
color: #252525;
}
.runtime-error {
margin: 48rpx 0;
padding: 28rpx;
border: 1rpx solid #e6ded5;
border-radius: 14rpx;
background: #fff;
color: #8a6846;
font-size: 25rpx;
line-height: 1.6;
}
.contact-card {
padding: 34rpx 30rpx;
background: #202221;
color: #fff;
border-radius: 18rpx;
}
.identity {
display: flex;
align-items: center;
gap: 20rpx;
}
.avatar {
width: 88rpx;
height: 88rpx;
border: 2rpx solid #8a6846;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: #d9c8b2;
font: 42rpx serif;
}
.founder {
display: block;
font: 34rpx serif;
}
.role {
display: block;
margin-top: 8rpx;
color: #d9c8b2;
font-size: 22rpx;
}
.contact-line {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 22rpx;
padding-top: 18rpx;
border-top: 1rpx solid rgba(255, 255, 255, 0.12);
color: #aaa;
font-size: 23rpx;
}
.contact-line > view {
display: flex;
align-items: center;
gap: 10rpx;
color: #fff;
}
.contact-line button {
margin: 0;
padding: 0 14rpx;
background: rgba(255, 255, 255, 0.1);
color: #d9c8b2;
font-size: 21rpx;
}
.records-entry,
.info-card {
margin-top: 20rpx;
padding: 28rpx;
background: #fff;
border: 1rpx solid #e6ded5;
border-radius: 16rpx;
}
.records-entry {
display: flex;
justify-content: space-between;
font-size: 26rpx;
}
.records-entry text:last-child {
color: #8a6846;
}
.card-title {
display: block;
font-weight: 700;
font-size: 27rpx;
}
.note,
.bullet {
display: block;
margin-top: 16rpx;
color: #77736b;
font-size: 24rpx;
line-height: 1.75;
}
.entry-icon {
width: 64rpx;
height: 64rpx;
border-radius: 12rpx;
background: rgba(138, 104, 70, 0.1);
color: #8a6846;
display: flex;
align-items: center;
justify-content: center;
}
.records-entry {
align-items: center;
gap: 18rpx;
}
.entry-copy {
flex: 1;
}
.entry-copy text {
display: block;
}
.entry-copy text:last-child {
margin-top: 8rpx;
color: #77736b;
font-size: 21rpx;
}
.count {
color: #8a6846;
font-size: 22rpx;
}
.card-title {
display: flex;
align-items: center;
gap: 12rpx;
color: #202221;
}
.note {
padding: 20rpx;
background: #f7f5f1;
border: 1rpx solid #e6ded5;
border-radius: 12rpx;
}
.note-title {
display: block;
margin-bottom: 6rpx;
color: #202221;
font-weight: 700;
}
.bullet {
padding-left: 8rpx;
}
.contact-line button {
display: flex;
align-items: center;
justify-content: center;
gap: 6rpx;
height: 44rpx;
line-height: 44rpx;
white-space: nowrap;
}
.contact-line button t-icon {
display: inline-flex;
vertical-align: middle;
}
.page {
padding-bottom: 150rpx;
}
-87
View File
@@ -1,87 +0,0 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
const config = require("../../utils/config");
Page({
data: {
brand: {},
trustContent: [],
offerings: [],
modules: [],
moduleVariants: {},
pageRenderer: "",
layout: [],
theme: {},
hero: { image: "", eyebrow: "", title: "", slogan: "", cta: "" },
loading: false,
loadedBrandSlug: "",
templateKey: "",
navigation: [],
},
onLoad() {
this.loadWorkspace();
},
onShow() {
if (this.data.loadedBrandSlug && this.data.loadedBrandSlug !== config.brandSlug) {
this.loadWorkspace();
}
},
loadWorkspace() {
this.setData({ loading: true });
loadWorkspaceWithFallback()
.then((workspace) => {
const activeBrand = workspace.brand || {};
const activeOfferings = workspace.offerings || [];
const layout = workspace.layout?.home || [
"founder-card",
"brand-hero",
"trust-proof",
"trust-manifesto",
"offering-list",
];
const firstOffering = activeOfferings[0] || {};
const configuredHero =
activeBrand.homeHero && typeof activeBrand.homeHero === "object"
? activeBrand.homeHero
: {};
this.setData({
brand: activeBrand,
trustContent: workspace.trustPresentation || {},
offerings: activeOfferings,
modules: workspace.modules || [],
moduleVariants: workspace.moduleVariants || {},
pageRenderer: workspace.pageRenderers?.home || "",
layout,
theme: workspace.theme || {},
hero: {
...this.data.hero,
image: activeBrand.heroImage || this.data.hero.image,
eyebrow: activeBrand.tagline || activeBrand.name,
title: firstOffering.name || activeBrand.name,
slogan: activeBrand.description || "",
...configuredHero,
},
loading: false,
loadedBrandSlug: config.brandSlug,
templateKey: workspace.visualTemplate?.key || "",
navigation: workspace.navigation || [],
});
wx.setNavigationBarTitle({ title: activeBrand.name || "个人品牌" });
})
.catch((error) => this.setData({ error: error.message, loading: false }));
},
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" });
},
goInquiry() {
wx.navigateTo({ url: "/pages/inquiry/index" });
},
goProfile() {
wx.navigateTo({ url: "/pages/bookings/index" });
},
});
-13
View File
@@ -1,13 +0,0 @@
{
"navigationBarTitleText": "品牌首页",
"usingComponents": {
"linjing-home": "/components/templates/linjing-home/linjing-home",
"acheng-home": "/components/templates/acheng-home/acheng-home",
"founder-card": "/components/modules/founder-card/founder-card",
"brand-hero": "/components/modules/brand-hero/brand-hero",
"trust-proof": "/components/modules/trust-proof/trust-proof",
"trust-manifesto": "/components/modules/trust-manifesto/trust-manifesto",
"offering-list": "/components/modules/offering-list/offering-list",
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
}
}
-17
View File
@@ -1,17 +0,0 @@
<view class="page">
<view wx:if="{{error}}" class="runtime-error">{{error}}</view>
<block wx:else>
<linjing-home wx:if="{{pageRenderer === 'linjing-home'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.home}}" hero="{{hero}}" trust-content="{{trustContent}}" offerings="{{offerings}}" bind:select="selectOffering" bind:works="goWorks" />
<acheng-home wx:elif="{{pageRenderer === 'acheng-home'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.home}}" trust-content="{{trustContent}}" offerings="{{offerings}}" bind:select="selectOffering" bind:inquiry="goInquiry" bind:offerings="goWorks" />
<block wx:else>
<block wx:for="{{layout}}" wx:key="*this" wx:for-item="moduleKey">
<founder-card wx:if="{{moduleKey === 'founder-card'}}" brand="{{brand}}" presentation="{{brand.visualPresentation.home}}" variant="{{moduleVariants[moduleKey]}}" />
<brand-hero wx:if="{{moduleKey === 'brand-hero'}}" hero="{{hero}}" variant="{{moduleVariants[moduleKey]}}" bind:explore="goWorks" />
<trust-proof wx:if="{{moduleKey === 'trust-proof'}}" content="{{trustContent}}" presentation="{{brand.visualPresentation.home}}" variant="{{moduleVariants[moduleKey]}}" />
<trust-manifesto wx:if="{{moduleKey === 'trust-manifesto'}}" content="{{trustContent}}" presentation="{{brand.visualPresentation.home}}" variant="{{moduleVariants[moduleKey]}}" />
<offering-list wx:if="{{moduleKey === 'offering-list'}}" offerings="{{offerings}}" presentation="{{brand.visualPresentation.home}}" variant="{{moduleVariants[moduleKey]}}" bind:open="selectOffering" bind:more="goWorks" />
</block>
</block>
</block>
</view>
<runtime-tab-bar template-key="{{templateKey}}" active="home" />
-221
View File
@@ -1,221 +0,0 @@
.page {
background: #f7f5f1;
color: #252525;
min-height: 100vh;
padding-bottom: 30rpx;
}
.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;
}
.founder {
margin: 32rpx 40rpx 20rpx;
padding: 28rpx;
background: #fff;
border: 1px solid #e6ded5;
border-radius: 28rpx;
display: flex;
gap: 20rpx;
align-items: flex-start;
position: relative;
}
.avatar {
width: 112rpx;
height: 112rpx;
border-radius: 50%;
border: 4rpx solid #d9c8b2;
}
.founder-name {
display: block;
font-family: serif;
font-size: 30rpx;
}
.founder-title {
display: block;
color: #77736b;
font-size: 20rpx;
margin-top: 6rpx;
}
.quote {
display: block;
font-family: serif;
font-size: 21rpx;
margin-top: 14rpx;
}
.badge {
position: absolute;
right: 20rpx;
top: 24rpx;
color: #8a6846;
background: #f3ede6;
padding: 8rpx 12rpx;
border-radius: 20rpx;
font-size: 18rpx;
}
.hero {
margin: 0 40rpx 42rpx;
height: 400rpx;
position: relative;
border-radius: 28rpx;
overflow: hidden;
}
.hero-image {
width: 100%;
height: 100%;
}
.hero-shade {
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(20, 22, 21, 0.1), rgba(20, 22, 21, 0.82));
}
.hero-copy {
position: absolute;
left: 28rpx;
right: 28rpx;
bottom: 28rpx;
color: #fff;
}
.eyebrow {
display: block;
font-size: 18rpx;
letter-spacing: 3rpx;
color: #d9c8b2;
margin-bottom: 14rpx;
}
.eyebrow.dark {
color: #8a6846;
}
.hero-title {
display: block;
font-size: 34rpx;
font-family: serif;
}
.hero-slogan {
display: block;
font-size: 21rpx;
margin-top: 10rpx;
}
.hero-button {
position: absolute;
right: 0;
bottom: 0;
background: rgba(255, 255, 255, 0.12);
color: #d9c8b2;
border: 1px solid rgba(255, 255, 255, 0.3);
font-size: 19rpx;
height: 54rpx;
line-height: 54rpx;
margin: 0;
}
.intro,
.section {
padding: 0 40rpx 48rpx;
}
.section-title {
display: block;
font-size: 34rpx;
font-family: serif;
margin-bottom: 16rpx;
}
.body {
display: block;
color: #77736b;
line-height: 1.8;
font-size: 24rpx;
}
.stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16rpx;
margin-top: 22rpx;
}
.stats view {
background: #fff;
border: 1px solid #e6ded5;
border-radius: 20rpx;
padding: 22rpx;
}
.stat-value {
display: block;
font-size: 38rpx;
color: #8a6846;
font-family: serif;
}
.stat-label {
display: block;
font-size: 22rpx;
font-weight: 600;
margin-top: 4rpx;
}
.section-head {
display: flex;
justify-content: space-between;
align-items: end;
margin-bottom: 22rpx;
}
.more {
font-size: 21rpx;
color: #8a6846;
}
.work-card {
background: #fff;
border: 1px solid #e6ded5;
border-radius: 28rpx;
overflow: hidden;
margin-bottom: 24rpx;
}
.work-card image {
width: 100%;
height: 300rpx;
display: block;
}
.work-info {
padding: 24rpx;
}
.work-category {
font-size: 19rpx;
color: #8a6846;
}
.work-name {
display: block;
font-family: serif;
font-size: 28rpx;
margin: 10rpx 0;
}
.work-desc {
font-size: 22rpx;
color: #77736b;
line-height: 1.6;
}
.trust {
margin-top: 10rpx;
background: #202221;
color: #fff;
padding: 42rpx 40rpx;
}
.light {
color: #fff;
}
.light-body {
color: #c6c2ba;
margin-bottom: 26rpx;
}
.outline-button {
margin: 0;
background: transparent;
border: 1px solid #d9c8b2;
color: #d9c8b2;
border-radius: 0;
font-size: 24rpx;
height: 72rpx;
line-height: 72rpx;
}
.page {
padding-bottom: 150rpx;
}
-4
View File
@@ -13,8 +13,6 @@ Page({
fields: [],
formId: "",
error: "",
templateKey: "",
navigation: [],
},
onLoad(options) {
loadWorkspaceWithFallback()
@@ -39,8 +37,6 @@ Page({
subtitle: presentation.subtitle || "提交信息后由主理人与你联系",
submitLabel: isQuote ? "提交报价需求" : presentation.submitLabel || "提交需求",
presentation,
templateKey: workspace.visualTemplate?.key || "",
navigation: workspace.navigation || [],
});
})
.catch((error) => this.setData({ error: error.message }));
+1 -2
View File
@@ -7,7 +7,6 @@
"brand-field": "/components/ui/brand-field/brand-field",
"brand-loading": "/components/ui/brand-loading/brand-loading",
"brand-empty": "/components/ui/brand-empty/brand-empty",
"inquiry-form": "/components/modules/inquiry-form/inquiry-form",
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
"inquiry-form": "/components/modules/inquiry-form/inquiry-form"
}
}
-71
View File
@@ -1,71 +0,0 @@
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: [],
pageRenderer: "",
loadedBrandSlug: "",
templateKey: "",
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 || {},
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 === "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" });
},
});
-12
View File
@@ -1,12 +0,0 @@
{
"navigationBarTitleText": "服务列表",
"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",
"runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar"
}
}
-1
View File
@@ -1 +0,0 @@
<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>
-202
View File
@@ -1,202 +0,0 @@
.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;
}
-17
View File
@@ -1,17 +0,0 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { brand: {}, templateKey: "", presentation: {}, navigation: [], loading: true },
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
this.setData({
brand: workspace.brand || {},
templateKey: workspace.visualTemplate?.key || "",
presentation: workspace.brand?.visualPresentation?.home || {},
navigation: workspace.navigation || [],
loading: false,
}),
)
.catch(() => this.setData({ loading: false }));
},
});
@@ -1,4 +0,0 @@
{
"navigationBarTitleText": "出摊服务",
"usingComponents": { "runtime-tab-bar": "/components/runtime-tab-bar/runtime-tab-bar" }
}
@@ -1 +0,0 @@
<view class="page"><view class="head"><text class="eyebrow">出摊与服务</text><text class="title">今天在哪里,怎么取餐</text><text class="sub">{{brand.hours || '营业时间以当天通知为准'}}</text></view><view class="card"><text class="card-title">固定出摊与取餐</text><text>{{brand.studioAddress || brand.address || '校园生活区附近'}}</text><text>支持摊位自取、校内配送,以及班级和社团活动定制。</text></view><view class="card"><text class="card-title">定制餐品流程</text><text>1. 提交人数、时间和口味需求</text><text>2. 主理人确认菜单与取餐方式</text><text>3. 当天现做并按约定时间交付</text></view><runtime-tab-bar template-key="{{templateKey}}" active="service" /></view>
@@ -1,42 +0,0 @@
.page {
min-height: 100vh;
padding: 28rpx 32rpx 150rpx;
background: #fff8f0;
color: #29231f;
}
.head {
padding: 38rpx 4rpx 28rpx;
}
.eyebrow {
display: block;
color: #c65c28;
font-size: 22rpx;
}
.title {
display: block;
margin-top: 12rpx;
font-size: 42rpx;
font-weight: 800;
}
.sub {
display: block;
margin-top: 12rpx;
color: #7a6a60;
font-size: 24rpx;
}
.card {
display: flex;
flex-direction: column;
gap: 14rpx;
margin-bottom: 22rpx;
padding: 28rpx;
border: 1rpx solid #f2d9c6;
border-radius: 24rpx;
background: #fff;
line-height: 1.7;
}
.card-title {
color: #4f3020;
font-size: 29rpx;
font-weight: 700;
}
+9
View File
@@ -0,0 +1,9 @@
// 开发默认配置。template:dev 编译时会用品牌构建参数覆盖此文件。
module.exports = {
env: "dev",
apiBaseUrl: "http://localhost:3001",
brandSlug: "default-brand",
templateKey: "",
templateVersion: "",
runtimeContract: "1.0",
};
+21 -3
View File
@@ -1,5 +1,7 @@
const fs = require("node:fs");
const path = require("node:path");
const os = require("node:os");
const { execFileSync } = require("node:child_process");
const root = path.resolve(__dirname, "..");
const requestSource = fs.readFileSync(path.join(root, "utils/request.js"), "utf8");
const configSource = fs.readFileSync(path.join(root, "utils/config.js"), "utf8");
@@ -13,7 +15,7 @@ if (
console.error("miniapp: public requests must carry the configured brand slug");
process.exit(1);
}
if (!moduleRegistrySource.includes("Object.values(manifest?.pages || {})")) {
if (!moduleRegistrySource.includes("manifest.pages")) {
console.error("miniapp: visual page renderers must resolve from the manifest");
process.exit(1);
}
@@ -24,10 +26,11 @@ if (
console.error("miniapp: customer sessions must be brand-scoped");
process.exit(1);
}
const productionRoots = ["components/modules", "components/templates", "pages"];
const productionRoots = ["components/modules", "pages"];
const productionSources = [];
function collectSources(directory) {
const current = path.join(root, directory);
if (!fs.existsSync(current)) return;
for (const item of fs.readdirSync(current, { withFileTypes: true })) {
const itemPath = path.join(current, item.name);
if (item.isDirectory()) collectSources(path.relative(root, itemPath));
@@ -83,8 +86,23 @@ for (const fixture of fixtures) {
records: "pages/records/index",
profile: "pages/bookings/index",
};
const templateKey = fixture.templateKey.startsWith("acheng")
? "acheng-campus-food"
: "linjing-editorial";
const output = fs.mkdtempSync(path.join(os.tmpdir(), "personal-brand-fixture-"));
execFileSync(
process.execPath,
[
path.resolve(root, "../../packages/template-compiler/src/cli.mjs"),
"--template",
templateKey,
"--out",
output,
],
{ stdio: "ignore" },
);
const missingPages = fixture.pages.filter(
(key) => !fs.existsSync(path.join(root, `${pageMap[key]}.json`)),
(key) => !fs.existsSync(path.join(output, `${pageMap[key]}.json`)),
);
if (missingPages.length) {
console.error(`${fixture.templateKey}: missing page manifests: ${missingPages.join(", ")}`);
+4 -2
View File
@@ -1,13 +1,15 @@
const runtimeConfig = require("../runtime-config");
const app = getApp();
module.exports = {
get apiBaseUrl() {
return app.globalData.apiBaseUrl;
return app.globalData.apiBaseUrl || runtimeConfig.apiBaseUrl;
},
get brand() {
return app.globalData.brand || {};
},
get brandSlug() {
return wx.getStorageSync("brandSlug") || app.globalData.brandSlug || "default-brand";
return app.globalData.brandSlug || runtimeConfig.brandSlug;
},
};
-5
View File
@@ -90,10 +90,6 @@ function resolveRuntime(workspace) {
: resolved.map((item) => item.type);
const moduleVariants = {};
for (const item of manifestHome || []) moduleVariants[item.type] = item.variant;
const pageRenderers = {};
for (const page of Object.values(manifest?.pages || {})) {
if (page.renderer) pageRenderers[page.key] = page.renderer;
}
const navigation = Array.isArray(manifest?.navigation)
? manifest.navigation.map((item) => ({
...item,
@@ -110,7 +106,6 @@ function resolveRuntime(workspace) {
modules: resolved,
layout: { home: home.filter((key) => resolved.some((item) => item.type === key)) },
moduleVariants,
pageRenderers,
navigation,
visualManifest: manifest,
capabilities: workspace && Array.isArray(workspace.capabilities) ? workspace.capabilities : [],
-78
View File
@@ -1,78 +0,0 @@
const TEMPLATES = {
food: {
modeLabels: { pickup: "自取", delivery: "配送" },
contactLabel: "联系摊主",
cancelLabel: "取消预约",
cancelNote: "取消后请及时告知摊主,避免食材浪费。",
hero: "今天吃什么",
heroSub: "现做家常饭",
about: "品牌简介",
description: "个人经营的家常小灶,套餐现做,也可预约小型聚餐和私厨定制。",
primary: "预约套餐",
secondary: "咨询私厨",
timeLabel: "营业时间",
time: "11:00—20:00",
addressLabel: "摊位地址",
address: "校园路社区便民点 12 号",
noteLabel: "配送说明",
note: "满 30 元周边配送,也可自取",
serviceSub: "今日可订",
first: "普通套餐",
firstSub: "日常家常饭",
second: "私厨服务",
secondSub: "聚餐定制",
available: "今日可订",
unavailable: "暂不可订",
empty: "暂无可订服务",
bookingTitle: "预约套餐",
requestType: "package",
modeLabel: "取餐方式",
modeA: "自取",
modeB: "配送",
locationLabel: "配送地址",
locationPlaceholder: "请输入配送地址",
notePlaceholder: "口味、餐具或其他说明",
submitNotice: "提交后由摊主人工确认,确认后再安排制作。",
submitLabel: "提交预约",
},
personal: {
modeLabels: { pickup: "线上沟通", delivery: "线下沟通" },
contactLabel: "联系品牌方",
cancelLabel: "取消申请",
cancelNote: "如需调整,请尽早联系品牌方。",
hero: "个人品牌",
heroSub: "把专业能力,变成值得信赖的体验",
about: "关于我",
description: "这里展示你的专业背景、工作方式与品牌理念。",
primary: "查看服务",
secondary: "发起咨询",
timeLabel: "服务时间",
time: "工作日 10:00—18:00",
addressLabel: "所在位置",
address: "线上 / 线下均可沟通",
noteLabel: "合作说明",
note: "提交需求后,我会尽快与你联系",
serviceSub: "可咨询",
first: "标准服务",
firstSub: "清晰的服务方案",
second: "定制合作",
secondSub: "按需求沟通",
available: "可咨询",
unavailable: "暂不可用",
empty: "暂无可咨询服务",
bookingTitle: "合作咨询",
requestType: "inquiry",
modeLabel: "沟通方式",
modeA: "线上沟通",
modeB: "线下沟通",
locationLabel: "沟通方式或地点",
locationPlaceholder: "请输入会议方式、地点或链接",
notePlaceholder: "请介绍你的需求、预算或期待结果",
submitNotice: "提交后品牌方会与你确认需求、时间和合作方式。",
submitLabel: "提交需求",
},
};
function getTemplate(key) {
return TEMPLATES[key] || TEMPLATES.personal;
}
module.exports = { getTemplate, TEMPLATES };