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

@@ -1,17 +1,18 @@
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
const { openPage } = require("../../utils/navigation");
const config = require("../../utils/config");
Page({
data: {
loading: false,
error: "",
offerings: [],
filtered: [],
brand: {},
presentation: {},
category: "all",
// 分类来自后台为业务提供项设置的分类,不在模板里写死。
categories: [],
loadedBrandSlug: "",
navigation: [],
},
onLoad() {
this.loadWorkspace();
@@ -25,28 +26,24 @@ Page({
loadWorkspaceWithFallback()
.then((workspace) => {
const items = workspace.offerings || [];
const labels = Array.from(new Set(items.map((item) => item.category).filter(Boolean)));
this.setData({
offerings: items,
filtered: items,
category: "all",
categories: [
{ key: "all", label: "全部" },
...Array.from(new Set(items.map((item) => item.category).filter(Boolean))).map(
(key) => ({
key,
label: key,
}),
),
...labels.map((label) => ({ key: label, label })),
],
brand: workspace.brand || {},
presentation: workspace.brand?.visualPresentation?.offerings || {},
brand: workspace.brand || {},
loadedBrandSlug: config.brandSlug,
});
})
.catch((error) => this.setData({ error: error.message }));
},
switchCategory(e) {
const category = e.currentTarget.dataset.category;
const category = e.detail.key;
const items = this.data.offerings || [];
this.setData({
category,
@@ -54,9 +51,9 @@ Page({
});
},
open(e) {
wx.navigateTo({ url: "/pages/offering/detail?id=" + e.currentTarget.dataset.id });
openPage("/pages/offering/detail?id=" + e.detail.id);
},
inquire() {
wx.navigateTo({ url: "/pages/inquiry/index" });
openPage("/pages/inquiry/index");
},
});
@@ -1 +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>
<view class="page"><view wx:if="{{error}}" class="runtime-error">{{error}}</view><block wx:else><acheng-offerings brand="{{brand}}" presentation="{{presentation}}" offerings="{{filtered}}" categories="{{categories}}" category="{{category}}" bind:category="switchCategory" bind:open="open" bind:inquire="inquire" /></block></view>