fix: 修复模板页面跳转并移除无入口的下单页

新增运行时 openPage/takePageQuery,tabBar 页自动使用 switchTab 并传递参数
- 编译器写入 tabPages,并拒绝 navigateTo/redirectTo 到 tabBar 页或 switchTab 带参数
- 阿成首页、套餐、出摊、主理人、详情、记录、成功页跳转统一改用 openPage
- 套餐筛选改用后台业务提供项分类;详情跳咨询时携带业务提供项
- 移除 capability-booking:小程序无入口且依赖已删除的 /public/brand,需求由咨询表单覆盖"
This commit is contained in:
que01 committed 2026-09-27 10:10:23 +08:00
1 parent a97cc860cf
commit 55989a5dfe
29 files changed
+353 -119

No files matched your search

+31 -1
View File
@@ -43,7 +43,7 @@ test("compiler generates an isolated Acheng runtime manifest", () => {
true,
);
assert.equal(fs.existsSync(path.join(output, "pages/stall-service/index.wxml")), true);
assert.equal(fs.existsSync(path.join(output, "pages/booking/index.wxml")), true);
assert.equal(fs.existsSync(path.join(output, "pages/booking")), false);
assert.equal(fs.existsSync(path.join(output, "assets/tab/booking.png")), true);
// 运行时的 npm 构建产物必须完整复制,不能被按名称排除的 src/test/dist 误伤。
const runtimeNpm = path.join(workspaceRoot, "apps/miniapp/miniprogram_npm");
@@ -190,6 +190,36 @@ test("compiler lets a template replace a runtime page declared in overrides", ()
);
});
test("compiler rejects navigateTo calls that target tabBar pages", () => {
const templateDirectory = copyTemplate("linjing-editorial");
fs.appendFileSync(
path.join(templateDirectory, "miniapp/pages/index/index.js"),
'\nfunction broken() { wx.navigateTo({ url: "/pages/services/index" }); }\n',
);
const output = fs.mkdtempSync(path.join(os.tmpdir(), "personal-brand-template-"));
assert.throws(
() =>
execFileSync(
process.execPath,
[compiler, "--template-dir", templateDirectory, "--out", output],
{ cwd: workspaceRoot, stdio: "pipe" },
),
/wx\.navigateTo cannot open tabBar page pages\/services\/index/,
);
});
test("compiler writes tabBar pages into runtime-config for openPage", () => {
const output = fs.mkdtempSync(path.join(os.tmpdir(), "personal-brand-template-"));
execFileSync(process.execPath, [compiler, "--template", "acheng-campus-food", "--out", output], {
cwd: workspaceRoot,
stdio: "pipe",
});
const config = fs.readFileSync(path.join(output, "runtime-config.js"), "utf8");
assert.match(config, /"tabPages"/);
assert.match(config, /"pages\/inquiry\/index"/);
assert.equal(fs.existsSync(path.join(output, "utils/navigation.js")), true);
});
test("compiler rejects unknown capabilities before copying layers", () => {
const templateDirectory = copyTemplate("linjing-editorial");
const manifestPath = path.join(templateDirectory, "template.json");