feat: 补齐模板编译扩展性门禁与演练模板
- 新增第二行业演练模板 drill-consultant,验证新增行业无需修改编译器和运行��� - 补充 override 冲突与显式覆盖测试,产物校验覆盖 wxss - 修复 --template-dir 模板被误判引用其他模板组件的问题 - 修复运行时排除规则误删 TDesign 深层 src 目录,增加 miniprogram_npm 完整性回归 - 模板目录校验统一复用 template-contract,新增 template:check 并接入 pnpm check - tabBar 配色归属模板包,清理编译器过期排除项和旧 fixture - ADR 0015 明确对 0005/0008/0009 的替换范围 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e2e2340bfe
commit
a97cc860cf
31 files changed
+418
-158
No files matched your search
@@ -0,0 +1,5 @@
|
||||
# 第二行业演练模板
|
||||
|
||||
编译器扩展性的回归门禁。它是一个最小的咨询师模板:只包含模板包自己的页面和组件,数据访问、详情、咨询、记录等页面全部来自运行时。
|
||||
|
||||
`packages/template-compiler/test/cli.test.mjs` 会编译它。如果为了让它通过而必须修改编译器或 `apps/miniapp`,说明新增行业仍然需要改平台代码,应先修正平台边界。
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
Component({
|
||||
properties: {
|
||||
itemId: { type: String, value: "" },
|
||||
title: { type: String, value: "" },
|
||||
desc: { type: String, value: "" },
|
||||
meta: { type: String, value: "" },
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
if (this.data.itemId) this.triggerEvent("open", { id: this.data.itemId });
|
||||
},
|
||||
},
|
||||
});
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<view class="drill-card" bindtap="open">
|
||||
<view class="drill-card__title">{{title}}</view>
|
||||
<view wx:if="{{desc}}" class="drill-card__desc">{{desc}}</view>
|
||||
<view wx:if="{{meta}}" class="drill-card__meta">{{meta}}</view>
|
||||
</view>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
.drill-card {
|
||||
margin: 24rpx 32rpx;
|
||||
padding: 32rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.drill-card__title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.drill-card__desc,
|
||||
.drill-card__meta {
|
||||
margin-top: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
|
||||
Page({
|
||||
data: { brand: {}, offerings: [], error: "" },
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => {
|
||||
const brand = workspace.brand || {};
|
||||
this.setData({ brand, offerings: (workspace.offerings || []).slice(0, 3) });
|
||||
wx.setNavigationBarTitle({ title: brand.name || "个人品牌" });
|
||||
})
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
open(event) {
|
||||
wx.navigateTo({ url: "/pages/offering/detail?id=" + event.detail.id });
|
||||
},
|
||||
goServices() {
|
||||
wx.switchTab({ url: "/pages/services/index" });
|
||||
},
|
||||
inquire() {
|
||||
wx.navigateTo({ url: "/pages/inquiry/index" });
|
||||
},
|
||||
});
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"drill-card": "/components/templates/drill-card/drill-card",
|
||||
"brand-button": "/components/ui/brand-button/brand-button"
|
||||
}
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
<view class="page">
|
||||
<view wx:if="{{error}}" class="runtime-error">{{error}}</view>
|
||||
<block wx:else>
|
||||
<view class="drill-hero">
|
||||
<view class="drill-hero__name">{{brand.name}}</view>
|
||||
<view class="drill-hero__tagline">{{brand.tagline || brand.description}}</view>
|
||||
</view>
|
||||
<drill-card
|
||||
wx:for="{{offerings}}"
|
||||
wx:key="id"
|
||||
item-id="{{item.id}}"
|
||||
title="{{item.name}}"
|
||||
desc="{{item.desc}}"
|
||||
meta="{{item.priceRange}}"
|
||||
bind:open="open"
|
||||
/>
|
||||
<view class="drill-actions">
|
||||
<view class="drill-link" bindtap="goServices">查看全部服务</view>
|
||||
<brand-button bindtap="inquire">预约咨询</brand-button>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
.drill-hero {
|
||||
padding: 64rpx 32rpx 32rpx;
|
||||
}
|
||||
|
||||
.drill-hero__name {
|
||||
font-size: 44rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.drill-hero__tagline {
|
||||
margin-top: 16rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.drill-actions {
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.drill-link {
|
||||
margin-bottom: 24rpx;
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
|
||||
Page({
|
||||
data: { brand: {}, error: "" },
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => this.setData({ brand: workspace.brand || {} }))
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
openRecords() {
|
||||
wx.navigateTo({ url: "/pages/records/index" });
|
||||
},
|
||||
inquire() {
|
||||
wx.navigateTo({ url: "/pages/inquiry/index" });
|
||||
},
|
||||
});
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "关于我",
|
||||
"usingComponents": {
|
||||
"drill-card": "/components/templates/drill-card/drill-card",
|
||||
"brand-button": "/components/ui/brand-button/brand-button"
|
||||
}
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
<view class="page">
|
||||
<view wx:if="{{error}}" class="runtime-error">{{error}}</view>
|
||||
<block wx:else>
|
||||
<drill-card title="{{brand.name}}" desc="{{brand.description}}" />
|
||||
<view class="drill-actions">
|
||||
<view class="drill-link" bindtap="openRecords">我的咨询记录</view>
|
||||
<brand-button bindtap="inquire">预约咨询</brand-button>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
.drill-actions {
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.drill-link {
|
||||
margin-bottom: 24rpx;
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
|
||||
Page({
|
||||
data: { offerings: [], error: "" },
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => this.setData({ offerings: workspace.offerings || [] }))
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
open(event) {
|
||||
wx.navigateTo({ url: "/pages/offering/detail?id=" + event.detail.id });
|
||||
},
|
||||
});
|
||||
packages/template-compiler/test/fixtures/template-drill-consultant/miniapp/pages/services/index.json
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "服务",
|
||||
"usingComponents": {
|
||||
"drill-card": "/components/templates/drill-card/drill-card",
|
||||
"brand-empty": "/components/ui/brand-empty/brand-empty"
|
||||
}
|
||||
}
|
||||
packages/template-compiler/test/fixtures/template-drill-consultant/miniapp/pages/services/index.wxml
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
<view class="page">
|
||||
<view wx:if="{{error}}" class="runtime-error">{{error}}</view>
|
||||
<brand-empty wx:elif="{{!offerings.length}}" description="暂未发布服务" />
|
||||
<drill-card
|
||||
wx:for="{{offerings}}"
|
||||
wx:key="id"
|
||||
item-id="{{item.id}}"
|
||||
title="{{item.name}}"
|
||||
desc="{{item.desc}}"
|
||||
meta="{{item.priceRange}}"
|
||||
bind:open="open"
|
||||
/>
|
||||
</view>
|
||||
packages/template-compiler/test/fixtures/template-drill-consultant/miniapp/pages/services/index.wxss
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
.page {
|
||||
padding-bottom: 32rpx;
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"packageKey": "drill-consultant",
|
||||
"version": "0.1.0",
|
||||
"displayName": "咨询师演练模板",
|
||||
"defaultBrandSlug": "drill-consultant",
|
||||
"runtimeContract": "1.0",
|
||||
"supportedIndustryTemplates": ["consulting"],
|
||||
"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/profile/index"
|
||||
},
|
||||
"navigation": [
|
||||
{ "key": "home", "label": "首页", "page": "home" },
|
||||
{ "key": "offerings", "label": "服务", "page": "offerings" },
|
||||
{ "key": "profile", "label": "关于我", "page": "profile" }
|
||||
],
|
||||
"requiredCapabilities": ["offerings", "inquiry"],
|
||||
"pages": ["pages/index/index", "pages/services/index", "pages/profile/index"],
|
||||
"dataSlots": [
|
||||
{
|
||||
"key": "brand.identity",
|
||||
"source": "brand",
|
||||
"required": true,
|
||||
"description": "顾问姓名、定位和联系方式"
|
||||
},
|
||||
{
|
||||
"key": "offering.list",
|
||||
"source": "offering",
|
||||
"required": true,
|
||||
"description": "咨询服务项目"
|
||||
}
|
||||
],
|
||||
"assetSlots": [],
|
||||
"admin": {
|
||||
"sections": [
|
||||
{
|
||||
"key": "identity",
|
||||
"title": "顾问介绍",
|
||||
"description": "客户在首页看到的姓名和定位",
|
||||
"target": "brand",
|
||||
"fields": [
|
||||
{
|
||||
"key": "name",
|
||||
"binding": "brand.name",
|
||||
"label": "姓名",
|
||||
"input": "text",
|
||||
"required": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user