feat: 收口多品牌与模板构建基础

This commit is contained in:
que01 committed 2026-09-25 02:55:46 +08:00
1 parent 0425a1c672
commit 77224ea51f
317 files changed
+11290 -1158

No files matched your search

+136 -3
View File
@@ -8,6 +8,7 @@ import type {
} from "@personal-brand/types";
export type { PublicOffering } from "@personal-brand/types";
export type { BookingStatus } from "@personal-brand/types";
export type { BrandTemplateKey } from "@personal-brand/types";
export interface BrandProfile {
id: string;
@@ -30,7 +31,34 @@ export interface AdminBrandMembership {
role: string;
brand: Pick<BrandProfile, "id" | "name" | "templateKey"> & { slug?: string };
}
export interface AdminBrandMember {
id: string;
role: string;
isEnabled: boolean;
adminUser: {
id: string;
username: string;
displayName: string;
isEnabled: boolean;
};
}
export type BrandUpdate = Partial<Omit<BrandProfile, "id">>;
export interface BrandReleaseSummary {
id: string;
version: number;
status: string;
note: string | null;
actorId: string;
createdAt: string;
revokedAt: string | null;
revokedBy?: string | null;
}
export type BrandPresentationUpdate = Partial<
Record<
"identity" | "home" | "offerings" | "detail" | "profile" | "inquiry" | "success" | "records",
Record<string, string>
>
>;
export interface OfferingUpdate {
name?: string;
description?: string;
@@ -227,6 +255,7 @@ export interface PublicWorkspace {
key: string;
version: string;
name: string;
supportedIndustryTemplates: BrandTemplateKey[];
variants: Record<string, string>;
} | null;
visualTemplateManifest?: {
@@ -278,6 +307,7 @@ export interface PublicWorkspace {
inquiryForm: InquiryForm | null;
runtimeOfferings?: Array<Record<string, unknown>>;
inquiryForms?: Array<Record<string, unknown>>;
trustPresentation?: Record<string, unknown>;
runtimeCapabilities?: Array<{ key: string; version: string; status?: string }>;
plugins?: Array<{
key: string;
@@ -392,9 +422,23 @@ export class ApiClient {
cancelCustomerBooking(id: string): Promise<Booking> {
return this.request(`/customer/bookings/${encodeURIComponent(id)}/cancel`, { method: "POST" });
}
loginAdmin(username: string, password: string): Promise<{ token: string; displayName: string }> {
loginAdmin(
username: string,
password: string,
): Promise<{
token: string;
displayName: string;
mustChangePassword: boolean;
role: string;
}> {
return this.request("/admin/session/login", { method: "POST", body: { username, password } });
}
changeAdminPassword(currentPassword: string, newPassword: string): Promise<{ changed: true }> {
return this.request("/admin/session/change-password", {
method: "POST",
body: { currentPassword, newPassword },
});
}
listAdminBookings(
filters: { status?: BookingStatus; unreadOnly?: boolean; tagId?: string } = {},
): Promise<AdminBooking[]> {
@@ -441,6 +485,26 @@ export class ApiClient {
): Promise<{ token: string; brand: AdminBrandMembership["brand"] }> {
return this.request(`/admin/brands/${encodeURIComponent(brandId)}/switch`, { method: "POST" });
}
listAdminMembers(): Promise<AdminBrandMember[]> {
return this.request("/admin/brands/members");
}
createAdminMember(body: {
username: string;
displayName: string;
password: string;
role: "owner" | "editor";
}): Promise<AdminBrandMember> {
return this.request("/admin/brands/members", { method: "POST", body });
}
updateAdminMember(
id: string,
body: Partial<Pick<AdminBrandMember, "role" | "isEnabled">>,
): Promise<AdminBrandMember> {
return this.request(`/admin/brands/members/${encodeURIComponent(id)}`, {
method: "PATCH",
body,
});
}
getAdminVisualTemplatePreview(): Promise<{
current: {
key: string;
@@ -464,6 +528,11 @@ export class ApiClient {
updateAdminBrand(body: BrandUpdate): Promise<BrandProfile> {
return this.request("/admin/config/brand", { method: "PATCH", body });
}
updateAdminBrandPresentation(body: BrandPresentationUpdate): Promise<{
visualPresentation: Record<string, Record<string, string>>;
}> {
return this.request("/admin/config/presentation", { method: "PATCH", body });
}
getPublicTemplate(key: BrandTemplateKey): Promise<BrandTemplateDefinition> {
return this.request(`/public/templates/${key}`);
}
@@ -474,11 +543,47 @@ export class ApiClient {
version: string;
name: string;
description: string;
supportedIndustryTemplates: BrandTemplateKey[];
variants: Record<string, string>;
theme: { colors: Record<string, string> };
}>;
}> {
return this.request("/public/templates");
return this.request<{
industries: BrandTemplateDefinition[];
visuals: Array<{
key: string;
version: string;
name: string;
description: string;
supportedIndustryTemplates?: unknown;
variants?: unknown;
theme?: unknown;
}>;
}>("/public/templates").then((catalog) => ({
industries: Array.isArray(catalog.industries) ? catalog.industries : [],
visuals: Array.isArray(catalog.visuals)
? catalog.visuals.map((visual) => ({
key: String(visual.key ?? ""),
version: String(visual.version ?? ""),
name: String(visual.name ?? "未命名视觉模板"),
description: String(visual.description ?? ""),
supportedIndustryTemplates: Array.isArray(visual.supportedIndustryTemplates)
? visual.supportedIndustryTemplates.filter(
(item): item is BrandTemplateKey =>
item === "personal" || item === "food" || item === "doors",
)
: [],
variants:
visual.variants && typeof visual.variants === "object"
? (visual.variants as Record<string, string>)
: {},
theme:
visual.theme && typeof visual.theme === "object"
? (visual.theme as { colors: Record<string, string> })
: { colors: {} },
}))
: [],
}));
}
previewPublicTemplateCombination(
industry: string,
@@ -490,6 +595,7 @@ export class ApiClient {
version: string;
name: string;
description: string;
supportedIndustryTemplates: BrandTemplateKey[];
variants: Record<string, string>;
theme: { colors: Record<string, string> };
};
@@ -516,9 +622,10 @@ export class ApiClient {
key: string;
version: string;
name: string;
supportedIndustryTemplates: BrandTemplateKey[];
variants: Record<string, string>;
} | null;
installations: unknown[];
installations: Array<{ id: string; templateKey: BrandTemplateKey; templateVersion: string }>;
modules: BrandModule[];
fields: BrandFieldDefinition[];
offerings: Offering[];
@@ -526,6 +633,32 @@ export class ApiClient {
}> {
return this.request("/admin/workspace");
}
listAdminReleases(): Promise<BrandReleaseSummary[]> {
return this.request("/admin/releases");
}
getAdminReleaseReadiness(): Promise<{
ready: boolean;
checks: Array<{ key: string; label: string; passed: boolean }>;
}> {
return this.request("/admin/releases/readiness");
}
publishAdminRelease(note?: string): Promise<BrandReleaseSummary> {
return this.request("/admin/releases/publish", {
method: "POST",
body: note === undefined ? {} : { note },
});
}
rollbackAdminRelease(version: number, note?: string): Promise<BrandReleaseSummary> {
return this.request(`/admin/releases/${version}/rollback`, {
method: "POST",
body: note === undefined ? {} : { note },
});
}
revokeAdminRelease(): Promise<
Pick<BrandReleaseSummary, "id" | "version" | "status" | "revokedAt">
> {
return this.request("/admin/releases/revoke", { method: "POST" });
}
installAdminTemplate(templateKey: "personal" | "food" | "doors"): Promise<unknown> {
return this.request("/admin/workspace/install", { method: "POST", body: { templateKey } });
}
+22
View File
@@ -47,3 +47,25 @@ test("客户端将统一错误响应转换为 ApiClientError", async () => {
},
);
});
test("发布检查与发布操作使用当前品牌的管理接口", async () => {
const calls: Array<{ url: string; method?: string; body?: string }> = [];
const client = new ApiClient({
baseUrl: "http://api.test",
token: "brand-token",
fetcher: async (url, init) => {
calls.push({ url, method: init?.method, body: init?.body });
return response({ ready: true, checks: [] });
},
});
await client.getAdminReleaseReadiness();
await client.publishAdminRelease("首次发布");
assert.deepEqual(calls, [
{ url: "http://api.test/admin/releases/readiness", method: "GET", body: undefined },
{
url: "http://api.test/admin/releases/publish",
method: "POST",
body: JSON.stringify({ note: "首次发布" }),
},
]);
});
+265 -19
View File
@@ -1,7 +1,7 @@
export const configPackageName = "personal-brand-config";
export type BrandTemplateKey = "personal" | "food" | "doors";
export type VisualTemplateKey = "linjing-editorial" | "minimal-neutral";
export type VisualTemplateKey = "linjing-editorial" | "acheng-campus-food";
export type CapabilityKey = "offerings" | "inquiry" | "booking" | "quote-request";
export interface WorkflowDefinition {
@@ -93,6 +93,7 @@ export interface VisualTemplateDefinition {
version: string;
name: string;
description: string;
supportedIndustryTemplates: BrandTemplateKey[];
variants: Record<string, string>;
theme: { colors: Record<string, string>; radius: Record<string, string> };
layout?: { home: string[]; offerings: string[]; detail: string[]; profile: string[] };
@@ -149,6 +150,7 @@ export interface VisualModuleDefinition {
export interface VisualPageDefinition {
key: VisualPageKey;
title: string;
renderer?: string;
modules: VisualModuleDefinition[];
}
@@ -158,6 +160,7 @@ export interface VisualTemplateManifest {
version: string;
name: string;
description: string;
supportedIndustryTemplates: BrandTemplateKey[];
brandFirst: true;
tokens: VisualTokenSet;
pages: VisualPageDefinition[];
@@ -178,12 +181,210 @@ export interface TemplatePackage {
};
}
export interface TemplatePackageManifest {
packageKey: string;
version: string;
displayName: string;
visualTemplateKey: VisualTemplateKey;
runtimeContract: "1.0";
supportedIndustryTemplates: BrandTemplateKey[];
entrypoints: Record<VisualPageKey, string>;
requiredCapabilities: CapabilityKey[];
}
export const templatePackageRegistry: readonly TemplatePackageManifest[] = [
{
packageKey: "linjing-editorial",
version: "1.0.0",
displayName: "林境建筑画册",
visualTemplateKey: "linjing-editorial",
runtimeContract: "1.0",
supportedIndustryTemplates: ["personal", "doors"],
entrypoints: {
home: "pages/index/index",
offerings: "pages/services/index",
detail: "pages/offering/detail",
inquiry: "pages/inquiry/index",
success: "pages/inquiry-success/index",
records: "pages/records/index",
profile: "pages/bookings/index",
},
requiredCapabilities: ["offerings", "inquiry"],
},
{
packageKey: "acheng-campus-food",
version: "1.0.0",
displayName: "阿成校园餐",
visualTemplateKey: "acheng-campus-food",
runtimeContract: "1.0",
supportedIndustryTemplates: ["food"],
entrypoints: {
home: "pages/index/index",
offerings: "pages/services/index",
detail: "pages/offering/detail",
inquiry: "pages/inquiry/index",
success: "pages/inquiry-success/index",
records: "pages/records/index",
profile: "pages/bookings/index",
},
requiredCapabilities: ["offerings", "inquiry", "booking"],
},
];
export function getTemplatePackageManifest(key: string): TemplatePackageManifest | undefined {
return templatePackageRegistry.find((item) => item.packageKey === key);
}
export function validateTemplatePackageManifest(manifest: TemplatePackageManifest): string[] {
const errors: string[] = [];
if (!manifest.packageKey.trim()) errors.push("packageKey is required");
if (!manifest.version.trim()) errors.push("version is required");
if (manifest.runtimeContract !== "1.0") errors.push("unsupported runtimeContract");
if (!manifest.supportedIndustryTemplates.length)
errors.push("supportedIndustryTemplates must not be empty");
for (const page of [
"home",
"offerings",
"detail",
"inquiry",
"success",
"records",
"profile",
] as const) {
if (!manifest.entrypoints[page]?.trim()) errors.push(`entrypoints.${page} is required`);
}
return errors;
}
export interface TemplateSampleContent {
templateKey: BrandTemplateKey;
offerings: Array<{
kind: "service" | "product" | "package" | "subscription";
name: string;
summary: string;
categoryKey: string;
}>;
trustContent: Array<{ type: string; title: string; content: string }>;
fields: Array<{ key: string; label: string; type: string; required: boolean }>;
capabilityKey: string;
}
const doorsSampleContent: TemplateSampleContent = {
templateKey: "doors",
offerings: [
{
kind: "product",
name: "序章·入户门",
summary: "为别墅入口定制的整樘门系统",
categoryKey: "entrance-door",
},
{
kind: "product",
name: "庭院·边界门",
summary: "连接建筑与庭院的定制门",
categoryKey: "garden-door",
},
{
kind: "product",
name: "室内·静谧门",
summary: "统一室内空间秩序的户内门",
categoryKey: "interior-door",
},
{
kind: "service",
name: "一对一门系统设计咨询",
summary: "从现场到方案的完整设计沟通",
categoryKey: "custom",
},
],
trustContent: [
{ type: "profile", title: "主理人的门作观", content: "示例内容,待品牌主理人完善。" },
{ type: "portfolio", title: "别墅门系统案例", content: "示例内容,待品牌主理人完善。" },
{ type: "process", title: "从测量到交付", content: "示例内容,待品牌主理人完善。" },
{ type: "credential", title: "材料与工艺标准", content: "示例内容,待品牌主理人完善。" },
],
fields: [
{ key: "projectType", label: "项目类型", type: "select", required: false },
{ key: "projectStage", label: "项目阶段", type: "select", required: false },
{ key: "siteDescription", label: "项目概况", type: "textarea", required: false },
{ key: "phone", label: "联系方式", type: "phone", required: true },
],
capabilityKey: "doors",
};
const foodSampleContent: TemplateSampleContent = {
templateKey: "food",
offerings: [
{
kind: "package",
name: "示例·今日套餐",
summary: "现做家常套餐示例内容。",
categoryKey: "set-meal",
},
{
kind: "service",
name: "示例·聚餐定制",
summary: "按人数和口味沟通定制餐品。",
categoryKey: "private-chef",
},
],
trustContent: [
{ type: "profile", title: "关于主理人", content: "示例内容,待品牌主理人完善。" },
{ type: "process", title: "从预订到取餐", content: "示例内容,待品牌主理人完善。" },
],
fields: [
{ key: "date", label: "用餐日期", type: "date", required: true },
{ key: "number", label: "用餐人数", type: "number", required: true },
{ key: "phone", label: "联系方式", type: "phone", required: true },
],
capabilityKey: "booking",
};
const personalSampleContent: TemplateSampleContent = {
templateKey: "personal",
offerings: [
{
kind: "service",
name: "示例·品牌定位咨询",
summary: "梳理品牌定位与下一步行动。",
categoryKey: "consulting",
},
{
kind: "service",
name: "示例·长期顾问支持",
summary: "围绕表达和转化提供持续支持。",
categoryKey: "advisory",
},
],
trustContent: [
{ type: "profile", title: "关于主理人", content: "示例内容,待品牌主理人完善。" },
{ type: "process", title: "合作方法", content: "示例内容,待品牌主理人完善。" },
],
fields: [
{ key: "name", label: "您的称呼", type: "text", required: true },
{ key: "phone", label: "联系方式", type: "phone", required: true },
{ key: "remark", label: "合作需求", type: "textarea", required: true },
],
capabilityKey: "inquiry",
};
export const templateSampleContent: Record<BrandTemplateKey, TemplateSampleContent> = {
personal: personalSampleContent,
food: foodSampleContent,
doors: doorsSampleContent,
};
export function getTemplateSampleContent(templateKey: string): TemplateSampleContent | undefined {
return templateSampleContent[templateKey as keyof typeof templateSampleContent];
}
const linjingEditorialManifest: VisualTemplateManifest = {
schemaVersion: "1.0",
key: "linjing-editorial",
version: "1.0.0",
name: "林境建筑画册",
description: "以个人品牌信任为主线、以高端项目作品为表达重点的编辑式视觉模板。",
supportedIndustryTemplates: ["personal", "doors"],
brandFirst: true,
tokens: {
colors: {
@@ -263,6 +464,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
{
key: "home",
title: "首页",
renderer: "linjing-home",
modules: [
{
key: "identity",
@@ -308,6 +510,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
{
key: "offerings",
title: "业务提供项",
renderer: "linjing-offerings",
modules: [
{
key: "offerings",
@@ -323,6 +526,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
{
key: "detail",
title: "提供项详情",
renderer: "linjing-offering-detail",
modules: [
{
key: "detail",
@@ -338,6 +542,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
{
key: "inquiry",
title: "咨询与预约",
renderer: "linjing-inquiry",
modules: [
{
key: "inquiry",
@@ -352,6 +557,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
{
key: "success",
title: "提交成功",
renderer: "linjing-success",
modules: [
{
key: "success",
@@ -365,6 +571,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
{
key: "records",
title: "我的记录",
renderer: "linjing-records",
modules: [
{
key: "records",
@@ -378,6 +585,7 @@ const linjingEditorialManifest: VisualTemplateManifest = {
{
key: "profile",
title: "主理人与我",
renderer: "linjing-profile",
modules: [
{
key: "identity",
@@ -402,24 +610,37 @@ const linjingEditorialManifest: VisualTemplateManifest = {
export const visualTemplateManifests: Record<VisualTemplateKey, VisualTemplateManifest> = {
"linjing-editorial": linjingEditorialManifest,
"minimal-neutral": {
"acheng-campus-food": {
...linjingEditorialManifest,
key: "minimal-neutral",
key: "acheng-campus-food",
version: "1.0.0",
name: "极简留白",
description: "适合咨询、设计和专业服务型个人品牌的中性视觉模板。",
name: "阿成校园餐",
description: "面向校园餐饮摊贩的菜单、出摊动态和团体预订视觉模板。",
supportedIndustryTemplates: ["food"],
tokens: {
...linjingEditorialManifest.tokens,
colors: {
background: "#FAFAF8",
background: "#FFF8F0",
surface: "#FFFFFF",
foreground: "#202221",
muted: "#6B7280",
accent: "#4B5563",
dark: "#202221",
foreground: "#29231F",
muted: "#7A6A60",
accent: "#E87532",
dark: "#3B2118",
},
radius: { card: "8rpx", button: "8rpx", media: "8rpx" },
radius: { card: "24rpx", button: "999rpx", media: "20rpx" },
},
pages: linjingEditorialManifest.pages.map((pageDefinition) => {
const renderer =
pageDefinition.key === "home"
? "acheng-home"
: pageDefinition.key === "offerings"
? "acheng-offerings"
: pageDefinition.key === "profile"
? "acheng-profile"
: pageDefinition.renderer;
return renderer ? { ...pageDefinition, renderer } : pageDefinition;
}),
capabilities: ["offerings", "inquiry", "booking"],
},
};
@@ -427,12 +648,22 @@ export function getVisualTemplateManifest(key: string): VisualTemplateManifest |
return visualTemplateManifests[key as VisualTemplateKey];
}
export function isVisualTemplateCompatible(
visualTemplate: VisualTemplateDefinition | VisualTemplateManifest,
industryTemplateKey: string,
): boolean {
return visualTemplate.supportedIndustryTemplates.includes(
industryTemplateKey as BrandTemplateKey,
);
}
export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition> = {
"linjing-editorial": {
key: "linjing-editorial",
version: "1.0.0",
name: "林境建筑画册",
description: "适合高端定制、建筑作品和项目型个人品牌。",
supportedIndustryTemplates: ["personal", "doors"],
variants: { hero: "architectural", offeringList: "editorial", detail: "project-case" },
theme: {
colors: { background: "#F7F5F1", foreground: "#252525", accent: "#8A6846", dark: "#202221" },
@@ -445,18 +676,19 @@ export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition
profile: ["profile"],
},
},
"minimal-neutral": {
key: "minimal-neutral",
"acheng-campus-food": {
key: "acheng-campus-food",
version: "1.0.0",
name: "极简留白",
description: "适合咨询、设计和专业服务型个人品牌。",
variants: { hero: "minimal", offeringList: "square-card", detail: "service-process" },
name: "阿成校园餐",
description: "适合校园餐饮、套餐预订和团体定制的暖橙菜单视觉。",
supportedIndustryTemplates: ["food"],
variants: { hero: "stall-board", offeringList: "menu-card", detail: "dish-detail" },
theme: {
colors: { background: "#FAFAF8", foreground: "#202221", accent: "#4B5563", dark: "#202221" },
radius: { card: "8rpx" },
colors: { background: "#FFF8F0", foreground: "#29231F", accent: "#E87532", dark: "#3B2118" },
radius: { card: "24rpx" },
},
layout: {
home: ["brand-hero", "founder-card", "offering-list", "trust-proof"],
home: ["founder-card", "brand-hero", "trust-proof", "offering-list"],
offerings: ["offering-list"],
detail: ["offering-detail"],
profile: ["profile"],
@@ -464,10 +696,24 @@ export const visualTemplates: Record<VisualTemplateKey, VisualTemplateDefinition
},
};
export function listVisualTemplateKeys(): VisualTemplateKey[] {
return Object.keys(visualTemplates) as VisualTemplateKey[];
}
export function getVisualTemplate(key: string): VisualTemplateDefinition | undefined {
return visualTemplates[key as VisualTemplateKey];
}
export function getDefaultVisualTemplateKey(industryTemplateKey: string): VisualTemplateKey {
return (
listVisualTemplateKeys().find((key) =>
visualTemplates[key].supportedIndustryTemplates.includes(
industryTemplateKey as BrandTemplateKey,
),
) ?? "linjing-editorial"
);
}
export function canTransitionWorkflow(workflowKey: string, from: string, to: string): boolean {
const workflow = workflowRegistry[workflowKey as keyof typeof workflowRegistry] as
WorkflowDefinition | undefined;
@@ -0,0 +1,3 @@
# 阿成校园餐模板包
此目录是模板包迁移阶段的构建输入。正式迁移后,所有阿成专属页面、组件和资源只允许存在于 `miniapp/`,公共 API 和 Runtime Contract 由 shell 提供。
Whitespace-only changes.
@@ -0,0 +1,8 @@
{
"pages": ["pages/index/index"],
"window": {
"navigationBarTitleText": "阿成校园餐",
"navigationBarBackgroundColor": "#FFF8F0",
"navigationBarTextStyle": "black"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

@@ -0,0 +1,22 @@
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");
},
openService() {
wx.navigateTo({ url: "/pages/stall-service/index" });
},
},
});
@@ -0,0 +1 @@
{ "component": true }
@@ -0,0 +1 @@
<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 || '17:00 - 22:30 · 今日营业中'}}</text><text class="notice-desc">晚高峰人多,可提前预约,下课直取不排队。</text></view><view class="actions"><button bindtap="openInquiry">预约 / 定制</button><button class="muted" bindtap="openOfferings">今日菜单</button></view></view><view class="scene-wrap"><view class="section-head"><text class="eyebrow">真实出摊现场</text><text class="more">大学城老校门夜市实拍</text></view><image class="scene" src="{{brand.heroImage}}" mode="aspectFill" bindtap="openService"/></view><view class="section-head"><view><text class="eyebrow">{{presentation.worksEyebrow || '本周学生票选招牌'}}</text><text class="heading">{{presentation.worksTitle || '现做现吃,认真管饱'}}</text><text class="subline">米饭免费续,附赠当日老汤或绿豆沙</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 class="promise-grid"><text>✓ 当天采购</text><text>✓ 现炒锅气</text><text>✓ 免费续饭</text><text>✓ 不用料理包</text></view><view class="quote">“上周街舞社订了 35 份,按寝室分组打包,送来还烫嘴!”<text>—— 街舞社负责人</text></view></view></view>
@@ -0,0 +1,225 @@
.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;
}
.notice-desc {
display: block;
margin-top: 8rpx;
color: #8c7b70;
font-size: 19rpx;
}
.scene-wrap {
margin-top: 24rpx;
}
.scene {
display: block;
width: 100%;
height: 270rpx;
border-radius: 22rpx;
}
.subline {
display: block;
margin-top: 6rpx;
color: #8c7b70;
font-size: 19rpx;
}
.promise-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10rpx;
margin-top: 16rpx;
}
.promise-grid text {
padding: 12rpx;
border-radius: 12rpx;
background: rgba(255, 255, 255, 0.1);
color: #ffe5d2;
font-size: 19rpx;
}
.quote {
margin-top: 18rpx;
padding-top: 16rpx;
border-top: 1rpx solid rgba(255, 255, 255, 0.15);
color: #ffe5d2;
font-size: 20rpx;
line-height: 1.6;
}
.quote text {
display: block;
margin-top: 8rpx;
color: #ffc79f;
font-size: 18rpx;
}
.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;
}
@@ -0,0 +1,36 @@
Component({
properties: {
brand: { type: Object, value: {} },
presentation: { type: Object, value: {} },
offerings: { type: Array, value: [] },
},
data: { query: "", visibleOfferings: [] },
observers: {
"offerings, query"(offerings, query) {
const keyword = String(query || "")
.trim()
.toLowerCase();
this.setData({
visibleOfferings: (offerings || []).filter((item) => {
if (!keyword) return true;
return [item.name, item.desc, ...(item.keywords || [])].some((value) =>
String(value || "")
.toLowerCase()
.includes(keyword),
);
}),
});
},
},
methods: {
search(e) {
this.setData({ query: e.detail.value });
},
open(e) {
this.triggerEvent("open", { id: e.currentTarget.dataset.id });
},
inquire() {
this.triggerEvent("inquire");
},
},
});
@@ -0,0 +1 @@
<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="filters"><view class="filter active">全部餐品</view><view class="filter">日常学生餐</view><view class="filter">寝室 / 团体</view><view class="filter">聚会定制</view></view><view class="search"><text class="search-icon">⌕</text><input value="{{query}}" placeholder="搜索餐品、牛肉、卤肉、鸡腿" bindinput="search" /></view><view class="tip">米饭免费续,支持微辣、免葱姜蒜,团体餐可提前预留。</view><view class="list"><view wx:for="{{visibleOfferings}}" wx:key="id" class="dish" data-id="{{item.id}}" bindtap="open"><view class="dish-media"><image src="{{item.image}}" mode="aspectFill"/><text class="tag">{{item.category || '现做餐品'}}</text></view><view class="copy"><text class="name">{{item.name}}</text><text class="desc">{{item.desc}}</text><view class="chips"><text>现做</text><text>今日有售</text></view><view class="bottom"><text class="price">{{item.priceRange}}</text><text class="action">详情 / 预留 ›</text></view></view></view></view><button class="cta" bindtap="inquire">团体活动 / 定制餐咨询</button></view>
@@ -0,0 +1,157 @@
.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;
}
.filters {
display: flex;
gap: 10rpx;
overflow: hidden;
margin-top: 20rpx;
white-space: nowrap;
}
.filter {
padding: 10rpx 18rpx;
border-radius: 999rpx;
background: #f2eee9;
color: #7a6a60;
font-size: 21rpx;
}
.filter.active {
background: #e87532;
color: #fff;
}
.search {
display: flex;
align-items: center;
gap: 8rpx;
margin-top: 16rpx;
padding: 0 20rpx;
height: 72rpx;
border: 1rpx solid #eee1d6;
border-radius: 20rpx;
background: #fff;
}
.search-icon {
color: #d2652b;
font-size: 34rpx;
}
.search input {
flex: 1;
font-size: 23rpx;
}
.dish-media {
position: relative;
flex: none;
}
.dish-media .tag {
position: absolute;
top: 10rpx;
left: 10rpx;
padding: 6rpx 10rpx;
border-radius: 10rpx;
background: rgba(59, 33, 24, 0.78);
color: #fff;
font-size: 18rpx;
}
.chips {
display: flex;
gap: 8rpx;
margin-top: 10rpx;
}
.chips text {
padding: 4rpx 8rpx;
border-radius: 8rpx;
background: #fff1e6;
color: #c65c28;
font-size: 17rpx;
}
.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,
.dish-media 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;
}
@@ -0,0 +1,18 @@
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");
},
},
});
@@ -0,0 +1 @@
<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>
@@ -0,0 +1,72 @@
.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;
}
@@ -0,0 +1,52 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
const { customerRequest, customerTokenKey } = require("../../utils/request");
Page({
data: {
brand: {},
trustContent: [],
records: [],
error: "",
navigation: [],
},
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
this.setData({
brand: workspace.brand || {},
trustContent: workspace.trustContent || [],
records: [],
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" });
},
});
@@ -0,0 +1,10 @@
{
"navigationBarTitleText": "我的订单",
"navigationBarBackgroundColor": "#FBF7F1",
"navigationBarTextStyle": "black",
"usingComponents": {
"t-icon": "/miniprogram_npm/tdesign-miniprogram/icon/icon",
"profile-module": "/components/modules/profile/profile",
"acheng-profile": "/components/templates/acheng-profile/acheng-profile"
}
}
@@ -0,0 +1 @@
<view class="page"><view wx:if="{{error}}" class="runtime-error">{{error}}</view><block wx:else><acheng-profile brand="{{brand}}" presentation="{{brand.visualPresentation.profile}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" /><view class="proof-grid"><view><text class="proof-icon">✓</text><text>健康证公示</text><text>每年体检合格</text></view><view><text class="proof-icon">◆</text><text>摊贩登记卡</text><text>正规合规备案</text></view><view><text class="proof-icon">✦</text><text>每日消杀</text><text>食具恒温消毒</text></view></view><view class="card"><text class="card-title">他们都在阿成这订过餐</text><text>校街舞社年度专场 · 52 人份</text><text>信息学院科创竞赛 · 连签 5 天</text><text>7 号楼庆功宴 · 8 人定制</text></view><view class="promise"><text>回复承诺:备料期 15 分钟内联系,出摊高峰 1 小时内回复。</text></view></block></view>
@@ -0,0 +1,197 @@
.page {
min-height: 100vh;
padding: 28rpx 32rpx 56rpx;
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;
}
.proof-grid {
display: flex;
gap: 12rpx;
margin-top: 20rpx;
}
.proof-grid view {
flex: 1;
padding: 18rpx 8rpx;
text-align: center;
border-radius: 18rpx;
background: #fff;
border: 1rpx solid #f2d9c6;
}
.proof-grid text {
display: block;
color: #7a6a60;
font-size: 18rpx;
}
.proof-grid .proof-icon {
color: #e87532;
font-size: 30rpx;
}
.promise {
margin-top: 18rpx;
padding: 22rpx;
border-radius: 20rpx;
background: #fff3d8;
color: #8c5c39;
font-size: 21rpx;
line-height: 1.6;
}
.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;
}
@@ -0,0 +1,26 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { brand: {}, presentation: {}, trustContent: [], offerings: [], error: "" },
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
this.setData({
brand: workspace.brand || {},
presentation: workspace.brand?.visualPresentation?.home || {},
trustContent: workspace.trustContent || [],
offerings: workspace.offerings || [],
}),
)
.catch((error) => this.setData({ error: error.message }));
},
selectOffering(event) {
wx.navigateTo({ url: "/pages/offering/detail?id=" + event.detail.id });
},
goWorks() {
wx.navigateTo({ url: "/pages/services/index" });
},
goInquiry() {
wx.navigateTo({ url: "/pages/inquiry/index" });
},
});
@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "阿成校园餐",
"usingComponents": {
"acheng-home": "/components/templates/acheng-home/acheng-home"
}
}
@@ -0,0 +1,4 @@
<view class="page">
<view wx:if="{{error}}" class="runtime-error">{{error}}</view>
<acheng-home wx:else brand="{{brand}}" presentation="{{presentation}}" trust-content="{{trustContent}}" offerings="{{offerings}}" bind:select="selectOffering" bind:inquiry="goInquiry" bind:offerings="goWorks" />
</view>
@@ -0,0 +1,11 @@
.page {
background: #fff8f0;
min-height: 100vh;
}
.runtime-error {
margin: 48rpx 32rpx;
padding: 28rpx;
color: #8a4b2a;
background: #fff;
border-radius: 16rpx;
}
@@ -0,0 +1,36 @@
const { customerRequest, customerTokenKey } = require("../../utils/request");
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { record: {}, presentation: {} },
onLoad(options) {
loadWorkspaceWithFallback()
.then((workspace) =>
this.setData({ presentation: workspace.brand?.visualPresentation?.success || {} }),
)
.catch(() => {});
const record = wx.getStorageSync("latestInquirySubmission") || {};
if (record.id === options.id) this.setData({ record });
if (options.id && wx.getStorageSync(customerTokenKey())) {
customerRequest("/customer/inquiry-submissions/" + encodeURIComponent(options.id))
.then((submission) =>
this.setData({
record: {
...record,
id: submission.id,
status: submission.status === "new" ? "待处理" : submission.status,
createdAt: submission.createdAt,
offeringName: submission.offering?.name || record.offeringName || "品牌合作",
},
}),
)
.catch(() => {});
}
},
viewRecords() {
wx.redirectTo({ url: "/pages/records/index" });
},
home() {
wx.navigateTo({ url: "/pages/index/index" });
},
});
@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "预订已收到",
"navigationBarBackgroundColor": "#F7F5F1",
"navigationBarTextStyle": "black",
"usingComponents": { "success-summary": "/components/modules/success-summary/success-summary" }
}
@@ -0,0 +1 @@
<view class="food-success"><success-summary record="{{record}}" presentation="{{presentation}}" bind:records="viewRecords" bind:home="home" /></view>
@@ -0,0 +1,83 @@
.page {
min-height: 100vh;
padding: 130rpx 48rpx;
background: #f7f5f1;
color: #252525;
}
.food-success {
min-height: 100vh;
padding: 32rpx;
background: #fff8f0;
}
.food-success .primary {
background: #e87532;
}
.food-success .secondary {
border-color: #e87532;
color: #c65c28;
}
.mark {
width: 120rpx;
height: 120rpx;
border: 3rpx solid #8a6846;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: #8a6846;
font-size: 70rpx;
font-family: serif;
}
.eyebrow {
display: block;
margin-top: 70rpx;
color: #8a6846;
font-size: 20rpx;
letter-spacing: 4rpx;
}
.title {
display: block;
margin-top: 18rpx;
font-family: serif;
font-size: 58rpx;
}
.intro {
display: block;
margin-top: 24rpx;
color: #77736b;
font-size: 28rpx;
line-height: 1.8;
}
.summary {
margin-top: 56rpx;
padding: 10rpx 26rpx;
background: #fff;
}
.summary view {
display: flex;
justify-content: space-between;
padding: 26rpx 0;
border-bottom: 1rpx solid #e6ded5;
font-size: 27rpx;
}
.summary view:last-child {
border-bottom: 0;
}
.summary text:last-child {
color: #8a6846;
}
.primary,
.secondary {
margin-top: 28rpx;
border-radius: 0;
font-size: 28rpx;
}
.primary {
background: #252827;
color: #fff;
}
.secondary {
background: transparent;
border: 1rpx solid #8a6846;
color: #8a6846;
}
@@ -0,0 +1,148 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
const { request, customerRequest, customerTokenKey } = require("../../utils/request");
const typeOptions = [
"日常留餐",
"宿舍开黑餐",
"社团 / 班级活动",
"生日聚会",
"考试周加餐",
"其他需求",
];
const peopleOptions = [
"1 人(单点)",
"2-4 人(寝室小聚)",
"5-10 人(部门小聚)",
"10-30 人(社团活动)",
"30 人以上(大型活动)",
];
const budgetOptions = [
"15 元左右 / 人(实惠)",
"18-22 元 / 人(荤素双拼)",
"25 元以上 / 人(高规格定制)",
];
const deliveryOptions = [
"摊位自取(报手机尾号即拿)",
"送至宿舍楼下(满 3 份)",
"送至指定教室 / 场地",
];
const labels = {
new: "待处理",
reviewing: "沟通中",
replied: "已回复",
qualified: "已确认",
converted: "已转化",
closed: "已关闭",
};
Page({
data: {
subView: "form",
records: [],
typeOptions,
peopleOptions,
budgetOptions,
deliveryOptions,
peopleIndex: 1,
budgetIndex: 1,
deliveryIndex: 0,
values: {
type: "日常留餐",
people: peopleOptions[1],
budget: budgetOptions[1],
delivery: deliveryOptions[0],
},
formId: "",
submitting: false,
formError: "",
},
onLoad(options) {
loadWorkspaceWithFallback()
.then((workspace) => {
const form =
(workspace.inquiryForms || []).find((item) => item.targetId === options.offeringId) ||
(workspace.inquiryForms || []).find((item) => item.target === "brand") ||
workspace.inquiryForms?.[0];
this.setData({ formId: form?.key || form?.id || "" });
})
.catch(() => {});
},
onShow() {
if (!wx.getStorageSync(customerTokenKey())) return;
customerRequest("/customer/inquiry-submissions")
.then((items) =>
this.setData({
records: (items || []).map((item) => ({
...item,
type: item.inquiryForm?.name || item.values?.type || "品牌咨询",
people: item.values?.people || "",
time: item.values?.date || "",
delivery: item.values?.delivery || "",
remark: item.values?.remark || "",
status: labels[item.status] || item.status,
replyNote: item.replyNote,
createdAt: new Date(item.createdAt).toLocaleDateString("zh-CN"),
})),
}),
)
.catch(() => {});
},
switchView(e) {
this.setData({ subView: e.currentTarget.dataset.view });
},
switchToForm() {
this.setData({ subView: "form" });
},
chooseType(e) {
this.setData({ "values.type": e.currentTarget.dataset.value });
},
choosePeople(e) {
const index = Number(e.detail.value);
this.setData({ peopleIndex: index, "values.people": peopleOptions[index] });
},
chooseBudget(e) {
const index = Number(e.detail.value);
this.setData({ budgetIndex: index, "values.budget": budgetOptions[index] });
},
chooseDelivery(e) {
const index = Number(e.detail.value);
this.setData({ deliveryIndex: index, "values.delivery": deliveryOptions[index] });
},
chooseDate(e) {
this.setData({ "values.date": e.detail.value });
},
input(e) {
this.setData({ ["values." + e.currentTarget.dataset.key]: e.detail.value });
},
submit() {
const { values, formId } = this.data;
if (!values.phone)
return this.setData({ formError: "请填写手机号或微信号,以便阿成加您发排菜菜单" });
if (!values.date) return this.setData({ formError: "请选择期望用餐日期" });
if (!formId) return this.setData({ formError: "咨询表单暂不可用,请稍后重试" });
this.setData({ submitting: true, formError: "" });
const send = () =>
customerRequest("/customer/inquiry-submissions", {
method: "POST",
data: { formId, values },
}).then((result) => {
wx.setStorageSync("latestInquirySubmission", result);
this.setData({ submitting: false, subView: "history" });
this.onShow();
wx.showToast({ title: "已提交,阿成会尽快联系你", icon: "none" });
});
const fail = (error) =>
this.setData({ submitting: false, formError: error.message || "提交失败,请重试" });
if (wx.getStorageSync(customerTokenKey())) return send().catch(fail);
wx.login({
success: (login) =>
request("/customer/session/wechat", { method: "POST", data: { code: login.code } })
.then((result) => {
wx.setStorageSync(customerTokenKey(), result.token);
return send();
})
.catch(fail),
fail,
});
},
});
@@ -0,0 +1,12 @@
{
"navigationBarTitleText": "提交咨询",
"navigationBarBackgroundColor": "#FBF7F1",
"navigationBarTextStyle": "black",
"usingComponents": {
"brand-button": "/components/ui/brand-button/brand-button",
"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"
}
}
@@ -0,0 +1,5 @@
<view class="page booking-page">
<view class="sub-tabs"><view class="sub-tab {{subView === 'form' ? 'active' : ''}}" data-view="form" bindtap="switchView">▤ 新建咨询 / 预订</view><view class="sub-tab {{subView === 'history' ? 'active' : ''}}" data-view="history" bindtap="switchView">▣ 我的咨询记录 ({{records.length}})</view></view>
<block wx:if="{{subView === 'form'}}"><view class="form-card"><text class="form-title">定制 / 预留需求登记</text><text class="form-desc">告诉阿成时间与人数,阿成量身帮你们排菜(免收预约定金)</text><view class="field"><text class="label">1. 咨询类型 <b>*</b></text><view class="type-grid"><view wx:for="{{typeOptions}}" wx:key="*this" class="type-option {{values.type === item ? 'selected' : ''}}" data-value="{{item}}" bindtap="chooseType">{{item}}</view></view></view><view class="two-col"><view class="field"><text class="label">预计用餐人数 <b>*</b></text><picker range="{{peopleOptions}}" value="{{peopleIndex}}" bindchange="choosePeople"><view class="picker">{{values.people || '请选择人数'}}</view></picker></view><view class="field"><text class="label">期望用餐时间 <b>*</b></text><picker mode="date" value="{{values.date}}" bindchange="chooseDate"><view class="picker">{{values.date || '请选择日期'}}</view></picker></view></view><view class="two-col"><view class="field"><text class="label">人均预算期望</text><picker range="{{budgetOptions}}" value="{{budgetIndex}}" bindchange="chooseBudget"><view class="picker">{{values.budget || '请选择预算'}}</view></picker></view><view class="field"><text class="label">取餐 / 配送偏好</text><picker range="{{deliveryOptions}}" value="{{deliveryIndex}}" bindchange="chooseDelivery"><view class="picker">{{values.delivery || '请选择方式'}}</view></picker></view></view><view class="field"><text class="label">预留餐品 / 口味偏好 / 忌口备注</text><textarea value="{{values.remark}}" data-key="remark" bindinput="input" placeholder="例:现炒牛肉饭 1 份,微辣多浇卤汁,不要香菜;或活动特殊要求" /></view><view class="field"><text class="label">联系手机或微信号 <b>*</b></text><input value="{{values.phone}}" data-key="phone" bindinput="input" placeholder="阿成将第一时间加微信发排菜明细与确认" /></view><view wx:if="{{formError}}" class="error">! {{formError}}</view><view class="promise">◷ <text>承诺:阿成将在 15~30 分钟内主动加微信沟通,未成单绝不骚扰。</text></view><button class="submit" loading="{{submitting}}" bindtap="submit">➤ 立即提交咨询(免收定金)</button></view></block>
<block wx:else><view wx:if="{{!records.length}}" class="empty"><text class="empty-icon">▣</text><text class="empty-title">暂无咨询记录</text><text>快向阿成提交一份预订需求吧~</text><button bindtap="switchToForm">新建咨询</button></view><view wx:else class="history-list"><view wx:for="{{records}}" wx:key="id" class="history-card"><view class="history-head"><text class="record-id">单号 #{{item.id}}</text><text class="record-status">{{item.status}}</text></view><text class="history-title">{{item.type}}({{item.people}})</text><text>◷ 时间:{{item.time || item.createdAt}}</text><text>⌖ 配送 / 取餐:{{item.delivery || '待确认'}}</text><text>备注:{{item.remark || item.flavor || '无'}}</text><view wx:if="{{item.replyNote}}" class="reply"><b>阿成微信留言:</b>{{item.replyNote}}</view><view class="history-foot">提交时间:{{item.createdAt}}<text>如有修改可随时微信留言</text></view></view><text class="history-note">仅展示近 30 天内的微信预约咨询历史</text></view></block>
</view>
@@ -0,0 +1,234 @@
.page {
min-height: 100vh;
padding: 28rpx 32rpx 150rpx;
background: #f7f5f1;
color: #292725;
}
.sub-tabs {
display: flex;
gap: 6rpx;
margin-bottom: 24rpx;
padding: 6rpx;
border-radius: 18rpx;
background: #e9e6e1;
color: #655f58;
font-size: 20rpx;
font-weight: 600;
}
.sub-tab {
flex: 1;
padding: 18rpx 4rpx;
border-radius: 14rpx;
text-align: center;
}
.sub-tab.active {
background: #fff;
color: #2c2925;
box-shadow: 0 4rpx 10rpx rgba(60, 45, 30, 0.08);
}
.form-card {
padding: 30rpx 28rpx;
border: 1rpx solid #eee9e3;
border-radius: 28rpx;
background: #fff;
box-shadow: 0 8rpx 20rpx rgba(60, 45, 30, 0.035);
}
.form-title {
display: block;
color: #282522;
font-size: 30rpx;
font-weight: 700;
}
.form-desc {
display: block;
margin-top: 8rpx;
color: #8e877f;
font-size: 19rpx;
}
.field {
margin-top: 26rpx;
}
.label {
display: block;
margin-bottom: 12rpx;
color: #4b4640;
font-size: 21rpx;
font-weight: 700;
}
.label b {
color: #e35237;
}
.type-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10rpx;
}
.type-option {
padding: 17rpx 6rpx;
border: 1rpx solid #e5e0da;
border-radius: 14rpx;
background: #fbfaf8;
color: #686159;
font-size: 18rpx;
text-align: center;
}
.type-option.selected {
border-color: #ef812d;
background: #fff2e7;
color: #d5661e;
font-weight: 700;
}
.two-col {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 18rpx;
}
.picker,
input,
textarea,
.picker {
box-sizing: border-box;
width: 100%;
min-height: 76rpx;
padding: 20rpx;
border: 1rpx solid #e6e0d9;
border-radius: 14rpx;
background: #fbfaf8;
color: #59534c;
font-size: 19rpx;
line-height: 1.5;
}
textarea {
min-height: 120rpx;
}
.picker {
white-space: normal;
}
.error {
margin-top: 22rpx;
padding: 16rpx;
border: 1rpx solid #f4c5bc;
border-radius: 14rpx;
background: #fff2f0;
color: #c34131;
font-size: 19rpx;
}
.promise {
display: flex;
gap: 10rpx;
align-items: flex-start;
margin-top: 22rpx;
padding: 18rpx;
border: 1rpx solid #eee9e3;
border-radius: 16rpx;
background: #faf9f7;
color: #7b746c;
font-size: 18rpx;
line-height: 1.5;
}
.promise:first-letter {
color: #ed7d25;
}
.submit {
width: 100%;
height: 78rpx;
margin-top: 24rpx;
border-radius: 18rpx;
background: #f18029;
color: #fff;
font-size: 22rpx;
font-weight: 700;
line-height: 78rpx;
}
.empty {
display: flex;
flex-direction: column;
align-items: center;
padding: 130rpx 28rpx;
color: #aaa39b;
font-size: 20rpx;
}
.empty-icon {
font-size: 60rpx;
color: #d8d1c8;
}
.empty-title {
margin: 18rpx 0 8rpx;
color: #655e56;
font-size: 27rpx;
font-weight: 700;
}
.empty button {
height: 70rpx;
margin-top: 28rpx;
padding: 0 34rpx;
border-radius: 16rpx;
background: #f18029;
color: #fff;
font-size: 21rpx;
line-height: 70rpx;
}
.history-card {
display: flex;
flex-direction: column;
gap: 12rpx;
margin-bottom: 18rpx;
padding: 24rpx;
border: 1rpx solid #eee9e3;
border-radius: 24rpx;
background: #fff;
color: #716a62;
font-size: 19rpx;
line-height: 1.5;
}
.history-head {
display: flex;
justify-content: space-between;
padding-bottom: 16rpx;
border-bottom: 1rpx solid #f0ece7;
}
.record-id {
color: #a39c94;
font-family: monospace;
font-size: 18rpx;
}
.record-status {
padding: 5rpx 12rpx;
border-radius: 999rpx;
background: #fff1e5;
color: #d36b20;
font-size: 17rpx;
}
.history-title {
color: #292622;
font-size: 24rpx;
font-weight: 700;
}
.reply {
padding: 16rpx;
border: 1rpx solid #f5d8bc;
border-radius: 14rpx;
background: #fff8ef;
color: #6f5744;
}
.reply b {
color: #e2762c;
}
.history-foot {
display: flex;
justify-content: space-between;
padding-top: 14rpx;
border-top: 1rpx solid #f3efea;
color: #aaa39b;
font-size: 17rpx;
}
.history-foot text {
color: #e2762c;
}
.history-note {
display: block;
padding: 10rpx;
text-align: center;
color: #aaa39b;
font-size: 17rpx;
}
@@ -0,0 +1,22 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { item: null, loading: true, error: "", presentation: {} },
onLoad(options) {
loadWorkspaceWithFallback()
.then((workspace) => {
const offerings = workspace.offerings || [];
const item = offerings.find((entry) => entry.id === options.id) || offerings[0];
if (!item) return this.setData({ loading: false, error: "未找到可展示的业务提供项" });
this.setData({
item,
loading: false,
presentation: workspace.brand?.visualPresentation?.detail || {},
});
wx.setNavigationBarTitle({ title: item.category || item.name });
})
.catch((error) => this.setData({ loading: false, error: error.message }));
},
inquire() {
wx.navigateTo({ url: "/pages/inquiry/index?offeringId=" + this.data.item.id });
},
});
@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "餐品详情",
"navigationBarBackgroundColor": "#FBF7F1",
"navigationBarTextStyle": "black",
"usingComponents": { "offering-detail": "/components/modules/offering-detail/offering-detail" }
}
@@ -0,0 +1 @@
<view wx:if="{{error}}" class="runtime-error">{{error}}</view><offering-detail wx:elif="{{item}}" item="{{item}}" presentation="{{presentation}}" bind:inquire="inquire" />
@@ -0,0 +1,104 @@
.page {
background: #f7f5f1;
min-height: 100vh;
color: #252525;
padding-bottom: 150rpx;
}
.page {
background: #fff8f0;
color: #29231f;
}
.bar button {
border-radius: 20rpx;
background: #e87532;
}
.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;
}
.hero {
width: 100%;
height: 600rpx;
display: block;
}
.content {
padding: 42rpx 40rpx;
}
.category,
.label {
font-size: 21rpx;
color: #8a6846;
display: block;
letter-spacing: 1rpx;
}
.title {
display: block;
font-size: 46rpx;
font-family: serif;
line-height: 1.35;
margin: 18rpx 0 8rpx;
}
.series {
display: block;
color: #77736b;
font-size: 26rpx;
}
.price {
display: block;
color: #8a6846;
font-size: 30rpx;
margin-top: 26rpx;
}
.rule {
height: 1px;
background: #ddd5cb;
margin: 38rpx 0;
}
.desc,
.body {
display: block;
color: #77736b;
font-size: 27rpx;
line-height: 1.9;
margin-top: 16rpx;
}
.chips {
display: flex;
flex-wrap: wrap;
gap: 14rpx;
margin: 30rpx 0;
}
.chips text {
border: 1px solid #c9b7a0;
color: #8a6846;
padding: 10rpx 18rpx;
font-size: 22rpx;
}
.section {
border-top: 1px solid #ddd5cb;
padding-top: 30rpx;
margin-top: 28rpx;
}
.bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #f7f5f1;
padding: 22rpx 32rpx calc(22rpx + env(safe-area-inset-bottom));
box-shadow: 0 -4rpx 18rpx rgba(37, 40, 39, 0.08);
}
.bar button {
background: #252827;
color: #fff;
border-radius: 0;
height: 86rpx;
line-height: 86rpx;
font-size: 28rpx;
}
@@ -0,0 +1,51 @@
const { customerRequest, customerTokenKey } = require("../../utils/request");
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
const statusLabels = {
new: "待处理",
reviewing: "沟通中",
replied: "已回复",
qualified: "已确认",
converted: "已转化",
closed: "已关闭",
};
Page({
data: { records: [], loading: false, presentation: {} },
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
this.setData({ presentation: workspace.brand?.visualPresentation?.records || {} }),
)
.catch(() => {});
},
onShow() {
if (!wx.getStorageSync(customerTokenKey())) return this.setData({ records: [] });
this.setData({ loading: true });
customerRequest("/customer/inquiry-submissions")
.then((items) =>
this.setData({
loading: false,
records: items.map((item) => ({
...item,
type: item.inquiryForm?.name || "品牌咨询",
status: statusLabels[item.status] || item.status,
timeline: (item.statusHistory || []).map((entry) => ({
status: statusLabels[entry.toStatus] || entry.toStatus,
createdAt: new Date(entry.createdAt).toLocaleString("zh-CN"),
})),
project: "咨询记录",
offeringName: item.offering?.name || "品牌合作",
createdAt: new Date(item.createdAt).toLocaleDateString("zh-CN"),
})),
}),
)
.catch((error) => {
this.setData({ loading: false });
wx.showToast({ title: error.message || "记录加载失败", icon: "none" });
});
},
inquire() {
wx.navigateTo({ url: "/pages/inquiry/index" });
},
});
@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "我的预订记录",
"navigationBarBackgroundColor": "#F7F5F1",
"navigationBarTextStyle": "black",
"usingComponents": { "records-module": "/components/modules/records/records" }
}
@@ -0,0 +1 @@
<view class="page food-records"><view class="head"><view><text class="eyebrow">我的预订</text><text class="title">{{presentation.title || '我的预订记录'}}</text></view><button bindtap="inquire">{{presentation.createAction || '新增预订'}}</button></view><records-module records="{{records}}" presentation="{{presentation}}" bind:create="inquire" /></view>
@@ -0,0 +1,94 @@
.page {
min-height: 100vh;
padding: 34rpx 36rpx;
background: #f7f5f1;
color: #252525;
}
.food-records {
background: #fff8f0;
color: #29231f;
}
.food-records .eyebrow {
display: block;
color: #d2652b;
font-size: 20rpx;
letter-spacing: 2rpx;
}
.food-records .title {
display: block;
margin-top: 8rpx;
color: #3b2118;
font-family: sans-serif;
font-size: 42rpx;
}
.food-records .head button {
border: 0;
border-radius: 18rpx;
background: #e87532;
color: #fff;
}
.head {
display: flex;
align-items: center;
justify-content: space-between;
}
.title {
font-family: serif;
font-size: 48rpx;
}
.head button {
margin: 0;
padding: 0 22rpx;
border: 1rpx solid #8a6846;
background: transparent;
color: #8a6846;
font-size: 24rpx;
}
.empty {
margin-top: 180rpx;
text-align: center;
color: #99928a;
font-size: 26rpx;
line-height: 1.8;
}
.empty-title {
display: block;
margin-bottom: 16rpx;
color: #252525;
font-family: serif;
font-size: 40rpx;
}
.empty button {
margin-top: 36rpx;
background: #8a6846;
color: #fff;
border-radius: 0;
}
.record {
margin-top: 22rpx;
padding: 28rpx;
background: #fff;
}
.record-head {
display: flex;
justify-content: space-between;
font-family: serif;
font-size: 33rpx;
}
.status {
font-family: inherit;
color: #8a6846;
font-size: 23rpx;
}
.project {
display: block;
margin-top: 20rpx;
color: #77736b;
font-size: 27rpx;
}
.meta {
display: block;
margin-top: 18rpx;
color: #aaa39a;
font-size: 22rpx;
}
@@ -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;
}
@@ -0,0 +1,18 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
Page({
data: { brand: {}, presentation: {}, loading: true },
onLoad() {
loadWorkspaceWithFallback()
.then((workspace) =>
this.setData({
brand: workspace.brand || {},
presentation: workspace.brand?.visualPresentation?.home || {},
loading: false,
}),
)
.catch(() => this.setData({ loading: false }));
},
inquire() {
wx.navigateTo({ url: "/pages/inquiry/index" });
},
});
@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "出摊服务",
"usingComponents": {}
}
@@ -0,0 +1,9 @@
<view class="page service-page">
<view class="service-card">
<view class="card-head"><view class="head-title"><text class="icon">◷</text><text>每周出摊固定日程</text></view><text class="status-pill">准时出摊</text></view>
<view class="schedule schedule-primary"><view class="schedule-main"><view class="schedule-title"><text class="dot orange"></text><text>周一至周五(晚餐 + 夜宵档)</text></view><text class="schedule-line">⌖ 地点:二号校门外小吃商业街 #07 号铺位</text><text class="schedule-muted">营业:17:00 - 22:30(下雨搭防雨防风棚正常营业)</text></view><text class="schedule-tag orange-tag">常规固定点</text></view>
<view class="schedule schedule-weekend"><view class="schedule-main"><view class="schedule-title"><text class="dot blue"></text><text>周六、周日(全天接团体单 + 夜市流动)</text></view><text class="schedule-line">▣ 白天专供:球赛、班级春游、社团集训、答辩餐</text><text class="schedule-muted">晚间:18:00 - 23:00 体育馆南侧流动出摊</text></view><text class="schedule-tag blue-tag">活动专车</text></view>
</view>
<view class="service-card"><view class="card-title"><text class="icon">⌁</text><text>取餐与配送范围</text></view><view class="delivery-grid"><view class="delivery-item"><text class="delivery-title orange-text">♧ 摊位现场自取</text><text>小程序提前留餐,报手机尾号即拿,附赠特制加厚保温袋,不用排长龙。</text></view><view class="delivery-item"><text class="delivery-title blue-text">♢ 校内楼下配送</text><text>满 3 份即可送至宿舍楼栋或实验楼门前,阿成骑专用恒温保温箱电动车直送。</text></view></view></view>
<view class="service-card process-card"><view class="card-title"><text class="icon">☷</text><text>定制餐品 4 步流程</text></view><text class="card-sub">专为班长、社长、活动干事设计的极简排菜流程</text><view class="steps"><view class="step"><text class="step-no">1</text><view><text class="step-title">提交基本需求</text><text>选择活动类型(如生日会、社团换届、答辩加餐)、预估人数与预算。</text></view></view><view class="step"><text class="step-no">2</text><view><text class="step-title">15 分钟内核算菜单</text><text>阿成微信直接联系,提供荤素搭配明细与个性化需求(免辣、清真配料等)。</text></view></view><view class="step"><text class="step-no">3</text><view><text class="step-title">当日新鲜烹饪打包</text><text>提前 2 小时生鲜采买,铁锅现炒,独立封盒并标注姓名 / 楼栋。</text></view></view><view class="step"><text class="step-no">4</text><view><text class="step-title">保温直达交付</text><text>约定时间准时送抵指定场地,确认菜品温度与数量无误后结算。</text></view></view></view><view class="process-foot"><text>起订门槛:<text class="strong">6 份起</text><text class="divider">|</text>退改:<text class="strong">出餐前 2 小时全退</text></text><button bindtap="inquire">立即咨询 <text>→</text></button></view></view>
</view>
@@ -0,0 +1,217 @@
.page {
min-height: 100vh;
padding: 28rpx 32rpx 150rpx;
background: #f7f5f1;
color: #292725;
}
.service-card {
margin-bottom: 24rpx;
padding: 30rpx 28rpx;
border: 1rpx solid #eee9e3;
border-radius: 28rpx;
background: #fff;
box-shadow: 0 8rpx 20rpx rgba(60, 45, 30, 0.035);
}
.card-head,
.card-title,
.head-title,
.schedule-title,
.process-foot {
display: flex;
align-items: center;
}
.card-head {
justify-content: space-between;
padding-bottom: 22rpx;
border-bottom: 1rpx solid #eeeae5;
}
.head-title,
.card-title {
gap: 14rpx;
color: #302d29;
font-size: 28rpx;
font-weight: 700;
}
.icon {
color: #ed7d25;
font-size: 34rpx;
font-weight: 400;
}
.status-pill {
padding: 7rpx 16rpx;
border: 1rpx solid #bce4d1;
border-radius: 999rpx;
background: #effaf4;
color: #16834c;
font-size: 20rpx;
}
.schedule {
display: flex;
justify-content: space-between;
gap: 12rpx;
margin-top: 22rpx;
padding: 22rpx 18rpx;
border: 1rpx solid #f1ddd0;
border-radius: 20rpx;
}
.schedule-primary {
background: #fffaf6;
}
.schedule-weekend {
border-color: #e6e9ef;
background: #fafbfc;
}
.schedule-main {
min-width: 0;
}
.schedule-title {
gap: 12rpx;
color: #272522;
font-size: 22rpx;
font-weight: 700;
}
.dot {
width: 14rpx;
height: 14rpx;
border-radius: 50%;
flex: none;
}
.orange {
background: #f27d27;
}
.blue {
background: #4b84d8;
}
.schedule-line,
.schedule-muted {
display: block;
margin-top: 12rpx;
margin-left: 26rpx;
color: #655e56;
font-size: 20rpx;
line-height: 1.45;
}
.schedule-muted {
margin-top: 5rpx;
color: #9a948c;
font-size: 18rpx;
}
.schedule-tag {
height: max-content;
padding: 6rpx 10rpx;
border-radius: 6rpx;
font-size: 17rpx;
white-space: nowrap;
}
.orange-tag {
background: #fff0e4;
color: #bd5d1b;
}
.blue-tag {
background: #eaf2ff;
color: #2e63a6;
}
.delivery-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 18rpx;
margin-top: 22rpx;
}
.delivery-item {
padding: 20rpx;
border: 1rpx solid #eeeae5;
border-radius: 20rpx;
background: #fbfaf8;
color: #777169;
font-size: 19rpx;
line-height: 1.6;
}
.delivery-title {
display: block;
margin-bottom: 8rpx;
font-size: 22rpx;
font-weight: 700;
}
.orange-text {
color: #eb7926;
}
.blue-text {
color: #3473c2;
}
.card-sub {
display: block;
margin-top: 12rpx;
color: #8b857e;
font-size: 19rpx;
}
.steps {
margin: 24rpx 0 0 14rpx;
padding-left: 26rpx;
border-left: 3rpx solid #f7cda9;
}
.step {
position: relative;
display: flex;
gap: 18rpx;
margin-bottom: 26rpx;
color: #79736c;
font-size: 19rpx;
line-height: 1.55;
}
.step:last-child {
margin-bottom: 0;
}
.step-no {
position: absolute;
left: -40rpx;
top: 0;
display: flex;
align-items: center;
justify-content: center;
width: 30rpx;
height: 30rpx;
border-radius: 50%;
background: #ef7c26;
color: #fff;
font-size: 18rpx;
font-weight: 700;
}
.step-title {
display: block;
margin-bottom: 5rpx;
color: #3d3934;
font-size: 22rpx;
font-weight: 700;
}
.process-foot {
justify-content: space-between;
gap: 12rpx;
margin-top: 28rpx;
padding-top: 22rpx;
border-top: 1rpx solid #eeeae5;
color: #777169;
font-size: 18rpx;
line-height: 1.5;
}
.strong {
color: #34312d;
}
.divider {
margin: 0 8rpx;
color: #d0cbc4;
}
.process-foot button {
height: 62rpx;
margin: 0;
padding: 0 22rpx;
border-radius: 16rpx;
background: #f18029;
color: #fff;
font-size: 20rpx;
line-height: 62rpx;
white-space: nowrap;
}
.process-foot button text {
margin-left: 8rpx;
font-size: 26rpx;
}
@@ -0,0 +1,12 @@
{
"name": "@personal-brand/template-acheng-campus-food",
"version": "1.0.0",
"private": true,
"type": "module",
"files": [
"template.json",
"miniapp",
"fixtures",
"README.md"
]
}
@@ -0,0 +1,75 @@
{
"packageKey": "acheng-campus-food",
"version": "1.0.0",
"displayName": "阿成校园餐",
"defaultBrandSlug": "default-brand",
"runtimeContract": "1.0",
"supportedIndustryTemplates": ["food"],
"entrypoints": {
"home": "pages/index/index",
"offerings": "pages/services/index",
"service": "pages/stall-service/index",
"detail": "pages/offering/detail",
"inquiry": "pages/inquiry/index",
"success": "pages/inquiry-success/index",
"records": "pages/records/index",
"profile": "pages/bookings/index"
},
"navigation": [
{
"key": "home",
"label": "首页/摊位",
"page": "home",
"iconPath": "assets/tab/home.png",
"selectedIconPath": "assets/tab/home-selected.png"
},
{
"key": "dishes",
"label": "套餐餐品",
"page": "offerings",
"iconPath": "assets/tab/dishes.png",
"selectedIconPath": "assets/tab/dishes-selected.png"
},
{
"key": "service",
"label": "出摊服务",
"page": "service",
"iconPath": "assets/tab/service.png",
"selectedIconPath": "assets/tab/service-selected.png"
},
{
"key": "owner",
"label": "主理人",
"page": "profile",
"iconPath": "assets/tab/owner.png",
"selectedIconPath": "assets/tab/owner-selected.png"
},
{
"key": "booking",
"label": "定制/咨询",
"page": "inquiry",
"iconPath": "assets/tab/booking.png",
"selectedIconPath": "assets/tab/booking-selected.png"
}
],
"requiredCapabilities": ["offerings", "inquiry", "booking"],
"renderers": {
"home": "acheng-home",
"offerings": "acheng-offerings",
"profile": "acheng-profile"
},
"runtimeOwnedPages": ["detail", "inquiry", "success", "records"],
"ownedPaths": [
"components/templates/acheng-home",
"components/templates/acheng-offerings",
"components/templates/acheng-profile",
"pages/index",
"pages/services",
"pages/bookings",
"pages/inquiry",
"pages/stall-service",
"pages/offering",
"pages/inquiry-success",
"pages/records"
]
}
+16
View File
@@ -0,0 +1,16 @@
{
"name": "@personal-brand/template-compiler",
"version": "0.1.0",
"private": true,
"type": "module",
"bin": {
"template-compiler": "src/cli.mjs"
},
"scripts": {
"typecheck": "node --check src/cli.mjs",
"test": "node --test test/**/*.test.mjs"
},
"dependencies": {
"@personal-brand/template-contract": "workspace:*"
}
}
+312
View File
@@ -0,0 +1,312 @@
#!/usr/bin/env node
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../..");
const packagesRoot = path.join(root, "packages");
const generatedRoot = path.join(root, "apps/miniapp-generated");
function usage() {
console.log("Usage: template-compiler --template <package-key> [--out <directory>]");
}
function validateManifest(manifest) {
const requiredPages = ["home", "offerings", "detail", "inquiry", "success", "records", "profile"];
if (!manifest.packageKey || !manifest.version || !manifest.displayName)
throw new Error("template.json requires packageKey, version and displayName");
if (manifest.runtimeContract !== "1.0") throw new Error("Only runtimeContract 1.0 is supported");
for (const page of requiredPages) {
if (typeof manifest.entrypoints?.[page] !== "string")
throw new Error(`template.json missing entrypoint: ${page}`);
}
if (!Array.isArray(manifest.navigation) || !manifest.navigation.length)
throw new Error("template.json navigation must not be empty");
if (
manifest.renderers !== undefined &&
(typeof manifest.renderers !== "object" || Array.isArray(manifest.renderers))
)
throw new Error("template.json renderers must be an object");
for (const page of ["home", "offerings", "profile"]) {
if (typeof manifest.renderers?.[page] !== "string" || !manifest.renderers[page]) {
throw new Error(`template.json requires a dedicated renderer for visual page: ${page}`);
}
}
if (
manifest.runtimeOwnedPages !== undefined &&
(!Array.isArray(manifest.runtimeOwnedPages) ||
manifest.runtimeOwnedPages.some(
(page) => !["detail", "inquiry", "success", "records"].includes(page),
))
)
throw new Error("template.json runtimeOwnedPages contains an unsupported page");
for (const item of manifest.navigation) {
if (!item || typeof item.key !== "string" || typeof item.label !== "string")
throw new Error("template.json navigation items require key and label");
if (typeof item.page !== "string" || typeof manifest.entrypoints?.[item.page] !== "string")
throw new Error(`template.json navigation page is not a declared entrypoint: ${item.key}`);
}
}
function validateEntrypoints(output, manifest) {
for (const [key, relativePath] of Object.entries(manifest.entrypoints || {})) {
const pagePath = path.join(output, relativePath);
for (const extension of [".js", ".json", ".wxml", ".wxss"]) {
if (!fs.existsSync(`${pagePath}${extension}`)) {
throw new Error(`Template entrypoint ${key} is missing ${relativePath}${extension}`);
}
}
}
}
function validateGeneratedIsolation(output) {
const forbidden = [
"components/templates",
"runtime-tab-bar",
"acheng-",
"linjing-",
"templateKey ===",
];
const visit = (directory) => {
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const filePath = path.join(directory, entry.name);
if (entry.isDirectory()) visit(filePath);
else if (/\.(wxml|json|js|wxss)$/.test(entry.name)) {
const source = fs.readFileSync(filePath, "utf8");
for (const token of forbidden) {
if (source.includes(token))
throw new Error(`Generated output contains forbidden token ${token}: ${filePath}`);
}
}
}
};
visit(path.join(output, "pages"));
}
function copyDirectory(source, target) {
fs.mkdirSync(target, { recursive: true });
for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
if (["node_modules", ".turbo", "dist"].includes(entry.name)) continue;
const from = path.join(source, entry.name);
const to = path.join(target, entry.name);
if (entry.isDirectory()) copyDirectory(from, to);
else fs.copyFileSync(from, to);
}
}
function removeOwnedPaths(rootDirectory, ownedPaths = []) {
for (const relativePath of ownedPaths) {
fs.rmSync(path.join(rootDirectory, relativePath), { recursive: true, force: true });
}
}
function removeRuntimeTabBar(output) {
const pagesDirectory = path.join(output, "pages");
if (!fs.existsSync(pagesDirectory)) return;
const visit = (directory) => {
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const filePath = path.join(directory, entry.name);
if (entry.isDirectory()) visit(filePath);
else if (entry.name.endsWith(".wxml")) {
const source = fs.readFileSync(filePath, "utf8");
const cleaned = source.replace(/<runtime-tab-bar\b[^>]*\/\s*>/g, "");
if (cleaned !== source) fs.writeFileSync(filePath, cleaned);
} else if (entry.name.endsWith(".json")) {
const json = JSON.parse(fs.readFileSync(filePath, "utf8"));
if (json.usingComponents?.["runtime-tab-bar"]) {
delete json.usingComponents["runtime-tab-bar"];
fs.writeFileSync(filePath, JSON.stringify(json, null, 2) + "\n");
}
}
}
};
visit(pagesDirectory);
fs.rmSync(path.join(output, "components/runtime-tab-bar"), { recursive: true, force: true });
}
function pruneUndeclaredPages(output, manifest) {
const appJsonPath = path.join(output, "app.json");
const appJson = JSON.parse(fs.readFileSync(appJsonPath, "utf8"));
const allowed = new Set([
...manifest.navigation.map((item) => manifest.entrypoints[item.page]),
...(manifest.runtimeOwnedPages || []).map((page) => manifest.entrypoints[page]),
]);
for (const page of appJson.pages || []) {
if (allowed.has(page)) continue;
fs.rmSync(path.join(output, path.dirname(page)), { recursive: true, force: true });
}
appJson.pages = (appJson.pages || []).filter((page) => allowed.has(page));
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 2) + "\n");
const appJsPath = path.join(output, "app.js");
if (fs.existsSync(appJsPath) && manifest.defaultBrandSlug) {
const appJs = fs
.readFileSync(appJsPath, "utf8")
.replace(
/const DEFAULT_BRAND_SLUG = "[^"]*";/,
`const DEFAULT_BRAND_SLUG = ${JSON.stringify(manifest.defaultBrandSlug)};`,
);
fs.writeFileSync(appJsPath, appJs);
}
}
function materializeRendererAliases(output, packageDirectory, manifest) {
const rendererRoot = path.join(packageDirectory, "miniapp/components/templates");
const pagePaths = {
home: "pages/index/index",
offerings: "pages/services/index",
profile: "pages/bookings/index",
};
for (const page of Object.keys(pagePaths)) {
const renderer = manifest.renderers?.[page];
const source = path.join(rendererRoot, renderer);
if (!fs.existsSync(source)) {
throw new Error(`Template renderer source is missing: ${renderer}`);
}
const aliasDirectory = path.join(output, "components/template-pages", page);
fs.mkdirSync(aliasDirectory, { recursive: true });
for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
if (!entry.isFile()) continue;
fs.copyFileSync(
path.join(source, entry.name),
path.join(aliasDirectory, `${page}${path.extname(entry.name)}`),
);
}
const pageDirectory = path.join(output, pagePaths[page]);
const jsonPath = `${pageDirectory}.json`;
const wxmlPath = `${pageDirectory}.wxml`;
const pageJson = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
pageJson.usingComponents = pageJson.usingComponents || {};
for (const key of Object.keys(pageJson.usingComponents)) {
if (/-home$|-offerings$|-profile$/.test(key)) delete pageJson.usingComponents[key];
}
pageJson.usingComponents[`template-${page}`] = `/components/template-pages/${page}/${page}`;
fs.writeFileSync(jsonPath, JSON.stringify(pageJson, null, 2) + "\n");
const rendererPattern = new RegExp(`<([a-z0-9-]+)-${page}\\b`, "g");
const originalWxml = fs.readFileSync(wxmlPath, "utf8");
const wxml =
page === "offerings"
? `<view class="page"><template-${page} brand="{{brand}}" presentation="{{presentation}}" offerings="{{offerings}}" bind:open="open" bind:more="inquire" /></view>`
: originalWxml.replace(rendererPattern, `<template-${page}`);
fs.writeFileSync(wxmlPath, wxml);
}
}
function freezeRendererConditions(output, manifest) {
const rendererByPage = manifest.renderers || {};
const pagePaths = {
home: "pages/index/index.wxml",
offerings: "pages/services/index.wxml",
profile: "pages/bookings/index.wxml",
};
for (const [page, relativePath] of Object.entries(pagePaths)) {
const filePath = path.join(output, relativePath);
if (!fs.existsSync(filePath)) continue;
const selected = rendererByPage[page] || "";
const source = fs.readFileSync(filePath, "utf8");
const frozen = source.replace(
/wx:(if|elif)="\{\{pageRenderer === '([^']+)'\}\}"/g,
(_match, branch, renderer) => `wx:${branch}="{{${renderer === selected}}}"`,
);
const selectedAlias =
page === "offerings"
? frozen.replace(
'<template-offerings wx:if="{{false}}"',
'<template-offerings wx:if="{{true}}"',
)
: frozen;
fs.writeFileSync(filePath, selectedAlias);
}
}
function main() {
const args = process.argv.slice(2);
const templateIndex = args.indexOf("--template");
if (templateIndex < 0 || !args[templateIndex + 1]) return usage();
const packageKey = args[templateIndex + 1];
const outputIndex = args.indexOf("--out");
const output = path.resolve(outputIndex >= 0 ? args[outputIndex + 1] : generatedRoot);
const packageDirectory = fs.existsSync(path.join(packagesRoot, packageKey))
? path.join(packagesRoot, packageKey)
: path.join(packagesRoot, `template-${packageKey}`);
const manifestPath = path.join(packageDirectory, "template.json");
if (!fs.existsSync(manifestPath)) throw new Error(`Template package not found: ${packageKey}`);
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
if (manifest.packageKey !== packageKey)
throw new Error("template.json packageKey does not match requested template");
validateManifest(manifest);
fs.rmSync(output, { recursive: true, force: true });
const shell = path.join(root, "apps/miniapp");
if (!fs.existsSync(shell)) throw new Error("Mini Program shell is missing: apps/miniapp");
copyDirectory(shell, output);
// 迁移期间保留 shell 的模板目录,直到模板包提供对应页面的完整覆盖。
// ownedPaths 只记录最终所有权,不在不完整迁移时删除可用 renderer。
const source = path.join(packageDirectory, "miniapp");
if (!fs.existsSync(source))
throw new Error(`Template package has no miniapp directory: ${packageKey}`);
for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
if (entry.name === "app.json") continue;
const from = path.join(source, entry.name);
const to = path.join(output, entry.name);
if (entry.isDirectory()) copyDirectory(from, to);
else fs.copyFileSync(from, to);
}
materializeRendererAliases(output, packageDirectory, manifest);
freezeRendererConditions(output, manifest);
removeRuntimeTabBar(output);
pruneUndeclaredPages(output, manifest);
validateEntrypoints(output, manifest);
for (const relativePath of manifest.ownedPaths || []) {
if (!fs.existsSync(path.join(output, relativePath)))
throw new Error(`Template package did not provide owned path: ${relativePath}`);
}
for (const renderer of Object.values(manifest.renderers || {})) {
const rendererPath = path.join(output, "components/templates", renderer, `${renderer}.wxml`);
if (!fs.existsSync(rendererPath)) throw new Error(`Template renderer is missing: ${renderer}`);
}
fs.rmSync(path.join(output, "components/templates"), { recursive: true, force: true });
validateGeneratedIsolation(output);
const appJsonPath = path.join(output, "app.json");
const appJson = JSON.parse(fs.readFileSync(appJsonPath, "utf8"));
appJson.window = {
...appJson.window,
navigationBarTitleText: manifest.displayName,
};
appJson.tabBar = {
color: "#8b8178",
selectedColor: "#3b2118",
backgroundColor: "#ffffff",
borderStyle: "white",
list: manifest.navigation.map((item) => ({
pagePath: manifest.entrypoints[item.page],
text: item.label,
...(item.iconPath ? { iconPath: item.iconPath } : {}),
...(item.selectedIconPath ? { selectedIconPath: item.selectedIconPath } : {}),
})),
};
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 2) + "\n");
fs.writeFileSync(
path.join(output, "template.manifest.json"),
JSON.stringify(manifest, null, 2) + "\n",
);
fs.writeFileSync(
path.join(output, "template.runtime.json"),
JSON.stringify(
{
packageKey: manifest.packageKey,
version: manifest.version,
runtimeContract: manifest.runtimeContract,
entrypoints: manifest.entrypoints,
navigation: manifest.navigation,
requiredCapabilities: manifest.requiredCapabilities,
renderers: manifest.renderers || {},
runtimeOwnedPages: manifest.runtimeOwnedPages || [],
ownedPaths: manifest.ownedPaths || [],
},
null,
2,
) + "\n",
);
console.log(`Generated ${packageKey}@${manifest.version} -> ${path.relative(root, output)}`);
}
main();
@@ -0,0 +1,126 @@
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { execFileSync } from "node:child_process";
import { fileURLToPath } from "node:url";
import test from "node:test";
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const workspaceRoot = path.resolve(packageRoot, "../..");
const compiler = path.join(packageRoot, "src/cli.mjs");
test("compiler generates an isolated Acheng runtime manifest", () => {
const output = fs.mkdtempSync(path.join(os.tmpdir(), "personal-brand-template-"));
execFileSync(process.execPath, [compiler, "--template", "acheng-campus-food", "--out", output], {
cwd: workspaceRoot,
stdio: "inherit",
});
const app = JSON.parse(fs.readFileSync(path.join(output, "app.json"), "utf8"));
const runtime = JSON.parse(fs.readFileSync(path.join(output, "template.runtime.json"), "utf8"));
assert.equal(app.window.navigationBarTitleText, "阿成校园餐");
assert.equal(runtime.packageKey, "acheng-campus-food");
assert.equal(runtime.renderers.home, "acheng-home");
assert.match(fs.readFileSync(path.join(output, "app.js"), "utf8"), /default-brand/);
assert.equal(runtime.navigation.length, 5);
assert.equal(runtime.navigation[2].page, "service");
assert.equal(
JSON.parse(fs.readFileSync(path.join(output, "app.json"), "utf8")).tabBar.list.length,
5,
);
assert.equal(fs.existsSync(path.join(output, "components/runtime-tab-bar")), false);
assert.equal(
fs
.readFileSync(path.join(output, "pages/index/index.wxml"), "utf8")
.includes("runtime-tab-bar"),
false,
);
assert.equal(
fs.existsSync(path.join(output, "components/templates/acheng-home/acheng-home.wxml")),
false,
);
assert.equal(fs.existsSync(path.join(output, "components/template-pages/home/home.wxml")), true);
assert.equal(fs.existsSync(path.join(output, "components/templates")), false);
assert.match(
fs.readFileSync(path.join(output, "pages/index/index.wxml"), "utf8"),
/<template-home/,
);
assert.doesNotMatch(
fs.readFileSync(path.join(output, "pages/index/index.wxml"), "utf8"),
/acheng-home/,
);
assert.equal(
fs.readFileSync(path.join(output, "pages/index/index.wxml"), "utf8").trim().length > 20,
true,
);
assert.doesNotMatch(
fs.readFileSync(path.join(output, "pages/index/index.wxml"), "utf8"),
/pageRenderer ===/,
);
assert.equal(fs.existsSync(path.join(output, "pages/stall-service/index.wxml")), true);
assert.match(
fs.readFileSync(path.join(output, "pages/services/index.wxml"), "utf8"),
/<template-offerings/,
);
assert.match(
fs.readFileSync(path.join(output, "pages/bookings/index.wxml"), "utf8"),
/<template-profile/,
);
assert.equal(
fs
.readFileSync(path.join(output, "pages/inquiry/index.wxml"), "utf8")
.includes("runtime-tab-bar"),
false,
);
});
test("compiler generates the Linjing navigation contract", () => {
const output = fs.mkdtempSync(path.join(os.tmpdir(), "personal-brand-template-"));
execFileSync(process.execPath, [compiler, "--template", "linjing-editorial", "--out", output], {
cwd: workspaceRoot,
stdio: "inherit",
});
const runtime = JSON.parse(fs.readFileSync(path.join(output, "template.runtime.json"), "utf8"));
assert.equal(runtime.packageKey, "linjing-editorial");
assert.equal(runtime.renderers.home, "linjing-home");
assert.equal(runtime.renderers.offerings, "linjing-offerings");
assert.match(fs.readFileSync(path.join(output, "app.js"), "utf8"), /linjing-doors/);
assert.equal(runtime.navigation.length, 3);
assert.equal(runtime.navigation[0].iconPath, "assets/tab/home.png");
assert.equal(
JSON.parse(fs.readFileSync(path.join(output, "app.json"), "utf8")).tabBar.list.length,
3,
);
assert.equal(fs.existsSync(path.join(output, "assets/tab/works.png")), true);
assert.equal(
fs.existsSync(path.join(output, "components/templates/linjing-home/linjing-home.wxml")),
false,
);
assert.equal(fs.existsSync(path.join(output, "pages/stall-service")), false);
assert.equal(fs.existsSync(path.join(output, "pages/booking")), false);
assert.doesNotMatch(
fs.readFileSync(path.join(output, "app.json"), "utf8"),
/stall-service|booking\/index/,
);
assert.match(
fs.readFileSync(path.join(output, "pages/services/index.wxml"), "utf8"),
/<template-offerings/,
);
});
test("release manifest pins every workspace template version", () => {
const releaseConfig = JSON.parse(
fs.readFileSync(path.join(workspaceRoot, "config/template-build.json"), "utf8"),
);
assert.equal(releaseConfig.runtimeContract, "1.0");
for (const entry of releaseConfig.templates) {
const manifest = JSON.parse(
fs.readFileSync(
path.join(workspaceRoot, `packages/template-${entry.packageKey}/template.json`),
"utf8",
),
);
assert.equal(manifest.version, entry.version);
assert.equal(manifest.runtimeContract, releaseConfig.runtimeContract);
}
});
+3
View File
@@ -0,0 +1,3 @@
# Template Contract
模板包是构建期输入。模板必须声明 runtime contract、页面入口、导航、行业兼容性和能力依赖;不得在模板包中实现数据库访问、鉴权或业务状态机。
+12
View File
@@ -0,0 +1,12 @@
{
"name": "@personal-brand/template-contract",
"version": "0.1.0",
"private": true,
"type": "module",
"exports": {
".": "./src/index.ts"
},
"scripts": {
"typecheck": "tsc -p tsconfig.json --noEmit"
}
}
+66
View File
@@ -0,0 +1,66 @@
export const TEMPLATE_RUNTIME_CONTRACT = "1.0" as const;
export type TemplatePageKey =
"home" | "offerings" | "detail" | "inquiry" | "success" | "records" | "profile" | (string & {});
export type TemplateRenderers = Partial<Record<"home" | "offerings" | "profile", string>>;
export type TemplateRuntimeOwnedPage = "detail" | "inquiry" | "success" | "records";
export type TemplatePackageManifest = {
packageKey: string;
version: string;
displayName: string;
runtimeContract: typeof TEMPLATE_RUNTIME_CONTRACT;
supportedIndustryTemplates: string[];
entrypoints: Record<string, string>;
navigation: Array<{
key: string;
label: string;
page: TemplatePageKey;
iconPath?: string;
selectedIconPath?: string;
}>;
requiredCapabilities: string[];
renderers?: TemplateRenderers;
runtimeOwnedPages?: TemplateRuntimeOwnedPage[];
ownedPaths?: string[];
};
export function validateTemplatePackageManifest(value: unknown): string[] {
const errors: string[] = [];
if (!value || typeof value !== "object") return ["manifest must be an object"];
const manifest = value as Partial<TemplatePackageManifest>;
if (!manifest.packageKey?.trim()) errors.push("packageKey is required");
if (!manifest.version?.trim()) errors.push("version is required");
if (manifest.runtimeContract !== TEMPLATE_RUNTIME_CONTRACT)
errors.push(`runtimeContract must be ${TEMPLATE_RUNTIME_CONTRACT}`);
if (!manifest.displayName?.trim()) errors.push("displayName is required");
if (
!Array.isArray(manifest.supportedIndustryTemplates) ||
!manifest.supportedIndustryTemplates.length
)
errors.push("supportedIndustryTemplates must not be empty");
if (!Array.isArray(manifest.navigation) || !manifest.navigation.length)
errors.push("navigation must not be empty");
if (manifest.ownedPaths !== undefined && !Array.isArray(manifest.ownedPaths))
errors.push("ownedPaths must be an array when provided");
if (
manifest.renderers !== undefined &&
(typeof manifest.renderers !== "object" || Array.isArray(manifest.renderers))
)
errors.push("renderers must be an object when provided");
for (const page of [
"home",
"offerings",
"detail",
"inquiry",
"success",
"records",
"profile",
] as const) {
if (!manifest.entrypoints || typeof manifest.entrypoints[page] !== "string")
errors.push(`entrypoints.${page} is required`);
}
return errors;
}
+5
View File
@@ -0,0 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": { "rootDir": "src", "outDir": "dist" },
"include": ["src/**/*.ts"]
}
@@ -0,0 +1,3 @@
# 林境建筑画册模板包
林境是个人品牌和项目型业务的编辑式视觉模板。页面只消费公共 Runtime Workspace。
Whitespace-only changes.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

@@ -0,0 +1,24 @@
Component({
properties: {
brand: { type: Object, value: {} },
presentation: { type: Object, value: {} },
hero: { type: Object, value: {} },
trustContent: { type: Object, value: {} },
offerings: { type: Array, value: [] },
},
data: { resolvedHeroImage: "" },
observers: {
"brand.heroImage, hero.image"(brandHeroImage, heroImage) {
if (!heroImage && !brandHeroImage) return;
this.setData({ resolvedHeroImage: heroImage || brandHeroImage });
},
},
methods: {
selectOffering(event) {
this.triggerEvent("select", { id: event.currentTarget.dataset.id });
},
goWorks() {
this.triggerEvent("works");
},
},
});
@@ -0,0 +1,8 @@
<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="{{resolvedHeroImage}}" 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>
@@ -0,0 +1,261 @@
.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;
}
@@ -0,0 +1,43 @@
Component({
properties: {
brand: { type: Object, value: {} },
presentation: { type: Object, value: {} },
offerings: { type: Array, value: [] },
},
data: {
activeCategory: "全部案例",
categories: ["全部案例", "入户大门", "庭院围墙门", "室内户内门", "装饰隐形门"],
visibleOfferings: [],
},
observers: {
offerings(offerings) {
this.filterOfferings(offerings, this.data.activeCategory);
},
},
lifetimes: {
attached() {
this.filterOfferings(this.data.offerings, this.data.activeCategory);
},
},
methods: {
filterOfferings(offerings, category) {
const normalizedCategory = (item) =>
item.category || item.presentation?.categoryLabel || item.presentation?.categoryKey || "";
const visibleOfferings = (offerings || []).filter(
(item) => category === "全部案例" || normalizedCategory(item) === category,
);
this.setData({ visibleOfferings });
},
chooseCategory(event) {
const activeCategory = event.currentTarget.dataset.category;
this.setData({ activeCategory });
this.filterOfferings(this.data.offerings, activeCategory);
},
open(event) {
this.triggerEvent("open", { id: event.currentTarget.dataset.id });
},
more() {
this.triggerEvent("more");
},
},
});
@@ -0,0 +1 @@
<view class="page linjing-works"><view class="works-intro"><text class="eyebrow">{{presentation.worksEyebrow || 'SELECTED WORKS'}}</text><text class="title">{{presentation.worksTitle || '案例与体系'}}</text><text class="subtitle">{{presentation.subtitle || '从建筑入口到室内秩序,呈现每一扇门的完整构造。'}}</text></view><view class="category-line"><text wx:for="{{categories}}" wx:key="*this" class="category-tab {{activeCategory === item ? 'active' : ''}}" data-category="{{item}}" bindtap="chooseCategory">{{item}}</text></view><view wx:if="{{!visibleOfferings.length}}" class="empty">暂无该类别案例</view><view class="works-list"><view wx:for="{{visibleOfferings}}" wx:key="id" class="work" data-id="{{item.id}}" bindtap="open"><image src="{{item.image || item.coverUrl}}" mode="aspectFill"/><view class="work-copy"><text class="category">{{item.category || item.presentation.categoryLabel}}</text><text class="name">{{item.name}}</text><text class="series">{{item.series || item.summary}}</text><view class="meta"><text>{{item.area || 'PRIVATE RESIDENCE'}}</text><text>查看项目 →</text></view></view></view></view><view class="closing"><text>每一套门系统,都是建筑秩序的一部分。</text><text class="more" bindtap="more">预约一次私宅门系统沟通 →</text></view></view>
@@ -0,0 +1,117 @@
.page {
min-height: 100vh;
padding: 56rpx 36rpx 150rpx;
background: #202221;
color: #f4f0e8;
}
.works-intro {
padding: 12rpx 4rpx 42rpx;
}
.eyebrow {
display: block;
color: #c5ad8b;
font-size: 18rpx;
letter-spacing: 4rpx;
}
.title {
display: block;
margin-top: 18rpx;
font-family: serif;
font-size: 56rpx;
line-height: 1.15;
}
.subtitle {
display: block;
max-width: 620rpx;
margin-top: 18rpx;
color: #bcb8b0;
font-size: 22rpx;
line-height: 1.7;
}
.category-line {
display: flex;
gap: 22rpx;
overflow: hidden;
padding: 18rpx 0;
border-top: 1rpx solid #444641;
border-bottom: 1rpx solid #444641;
color: #aaa69d;
font-size: 19rpx;
white-space: nowrap;
}
.category-tab {
flex: none;
padding-bottom: 8rpx;
}
.category-tab.active {
color: #e8d9c2;
border-bottom: 2rpx solid #c5ad8b;
}
.empty {
padding: 60rpx 0;
color: #aaa69d;
font-size: 22rpx;
text-align: center;
}
.works-list {
margin-top: 28rpx;
}
.work {
overflow: hidden;
margin-bottom: 24rpx;
border: 1rpx solid #444641;
background: #292b29;
}
.work image {
display: block;
width: 100%;
height: 360rpx;
filter: saturate(0.75);
}
.work-copy {
padding: 22rpx 24rpx 24rpx;
}
.category {
display: block;
color: #bba585;
font-size: 18rpx;
letter-spacing: 2rpx;
}
.name {
display: block;
margin-top: 10rpx;
color: #f3eee5;
font-family: serif;
font-size: 30rpx;
line-height: 1.35;
}
.series {
display: block;
margin-top: 9rpx;
color: #aaa69d;
font-size: 20rpx;
line-height: 1.5;
}
.meta {
display: flex;
justify-content: space-between;
margin-top: 20rpx;
color: #888b84;
font-size: 17rpx;
letter-spacing: 1rpx;
}
.meta text:last-child {
color: #d5c09c;
}
.closing {
padding: 38rpx 4rpx;
color: #aaa69d;
font-size: 21rpx;
line-height: 1.7;
}
.closing .more {
display: block;
margin-top: 22rpx;
color: #d5c09c;
font-size: 20rpx;
}
@@ -0,0 +1,18 @@
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");
},
},
});
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"t-icon": "/miniprogram_npm/tdesign-miniprogram/icon/icon"
}
}
@@ -0,0 +1,26 @@
<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>
@@ -0,0 +1,195 @@
.profile {
min-height: 100vh;
padding: 0;
background: #f7f5f1;
color: #252525;
}
.founder-card {
margin: 18rpx 28rpx 0;
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: 20rpx 28rpx 0;
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;
}
@@ -0,0 +1,11 @@
{
"name": "@personal-brand/template-linjing-editorial",
"version": "1.0.0",
"private": true,
"type": "module",
"files": [
"template.json",
"miniapp",
"README.md"
]
}
@@ -0,0 +1,52 @@
{
"packageKey": "linjing-editorial",
"version": "1.0.0",
"displayName": "林境建筑画册",
"defaultBrandSlug": "linjing-doors",
"runtimeContract": "1.0",
"supportedIndustryTemplates": ["personal", "doors"],
"entrypoints": {
"home": "pages/index/index",
"offerings": "pages/services/index",
"detail": "pages/offering/detail",
"inquiry": "pages/inquiry/index",
"success": "pages/inquiry-success/index",
"records": "pages/records/index",
"profile": "pages/bookings/index"
},
"navigation": [
{
"key": "home",
"label": "首页",
"page": "home",
"iconPath": "assets/tab/home.png",
"selectedIconPath": "assets/tab/home-selected.png"
},
{
"key": "offerings",
"label": "案例与体系",
"page": "offerings",
"iconPath": "assets/tab/works.png",
"selectedIconPath": "assets/tab/works-selected.png"
},
{
"key": "profile",
"label": "主理人与我",
"page": "profile",
"iconPath": "assets/tab/profile.png",
"selectedIconPath": "assets/tab/profile-selected.png"
}
],
"requiredCapabilities": ["offerings", "inquiry"],
"renderers": {
"home": "linjing-home",
"offerings": "linjing-offerings",
"profile": "linjing-profile"
},
"runtimeOwnedPages": ["detail", "inquiry", "success", "records"],
"ownedPaths": [
"components/templates/linjing-home",
"components/templates/linjing-offerings",
"components/templates/linjing-profile"
]
}
+30
View File
@@ -76,8 +76,25 @@ export interface RuntimeOffering {
name: string;
summary: string;
enabled: boolean;
kind: "service" | "product" | "package" | "subscription";
coverUrl: string | null;
priceText: string | null;
priceAmount: number | null;
schemaKey: string;
schemaVersion: string;
presentation: {
categoryKey: string;
categoryLabel: string;
heroImage: string | null;
keywords: string[];
media: Array<{ url: string; alt: string; type: "image" }>;
details: {
background: string;
designConcept: string;
crafts: string[];
materialsList: Array<{ name: string; spec: string }>;
};
};
sections: Array<{
key: string;
type: "text" | "image-list" | "timeline" | "faq" | "specification";
@@ -111,6 +128,13 @@ export interface RuntimeCapability {
status: "enabled" | "disabled" | "degraded";
}
export interface TrustPresentation {
bio?: string;
stats?: Array<{ value: string; label: string; sub?: string }>;
pillars?: Array<{ icon: string; title: string; desc: string }>;
serviceFlow?: Array<{ step: string; name: string; desc: string }>;
}
export interface CapabilityPluginManifest {
key: string;
version: string;
@@ -123,6 +147,11 @@ export interface CapabilityPluginManifest {
export interface RuntimeWorkspace {
schemaVersion: string;
publication?: {
status: "published" | "unpublished";
version: number | null;
publishedAt?: string;
};
brand: Record<string, unknown>;
navigation: {
tabs: Array<{ key: string; label: string; page: string }>;
@@ -130,6 +159,7 @@ export interface RuntimeWorkspace {
modules: RuntimeModule[];
offerings: RuntimeOffering[];
inquiryForms: RuntimeInquiryForm[];
trustPresentation: TrustPresentation;
capabilities: RuntimeCapability[];
plugins?: Array<
CapabilityPluginManifest & {