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

-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;
}