diff --git a/apps/taro/src/runtime/content.ts b/apps/taro/src/runtime/content.ts index fe64f18..45325cf 100644 --- a/apps/taro/src/runtime/content.ts +++ b/apps/taro/src/runtime/content.ts @@ -51,7 +51,7 @@ export function offering(item: RuntimeOffering): Offering { image: item.presentation.heroImage || item.coverUrl || "", desc: item.summary || "", priceRange: item.priceText || "沟通报价", - category: item.presentation.categoryLabel, + category: item.presentation.categoryLabel || item.presentation.categoryKey, area: text(item.presentation.area), series: text(item.presentation.series), keywords: item.presentation.keywords, diff --git a/apps/taro/test/browser/services-editor.spec.ts b/apps/taro/test/browser/services-editor.spec.ts index e423860..8dba7ed 100644 --- a/apps/taro/test/browser/services-editor.spec.ts +++ b/apps/taro/test/browser/services-editor.spec.ts @@ -39,6 +39,7 @@ const adminOffering = { sortOrder: 0, config: { categoryKey: "private-chef", + categoryLabel: "私厨", area: "东门", series: "预约制", spaceType: "8 人聚餐", diff --git a/packages/template-contract/test/editability.test.mjs b/packages/template-contract/test/editability.test.mjs index b8747ae..70ba85a 100644 --- a/packages/template-contract/test/editability.test.mjs +++ b/packages/template-contract/test/editability.test.mjs @@ -94,7 +94,7 @@ function renderedFields(templateRoot, entrypoint) { } const sharedOfferingBindings = [ - "offering.config.categoryLabel", + "offering.config.categoryKey", "offering.config.detailHero", "offering.config.area", "offering.config.series", @@ -106,7 +106,7 @@ const sharedOfferingBindings = [ "offering.config.details.materialsList", ]; const offeringRuntimeBindings = { - "offering.config.categoryLabel": "item.presentation.categoryLabel", + "offering.config.categoryKey": "item.presentation.categoryLabel", "offering.config.detailHero": "item.detailHero", "offering.config.area": "item.area", "offering.config.series": "item.series", diff --git a/scripts/lib/template-doctor.mjs b/scripts/lib/template-doctor.mjs index aa7a934..c34ee24 100644 --- a/scripts/lib/template-doctor.mjs +++ b/scripts/lib/template-doctor.mjs @@ -126,6 +126,8 @@ export function diagnoseTemplate(manifest, source, file = "taro/index.tsx") { } if (ts.isCallExpression(node) && ["object", "rows"].includes(node.expression.getText(ast))) return resolve(node.arguments[0]); + if (ts.isCallExpression(node) && node.expression.getText(ast) === "text" && node.arguments[0]) + return resolve(node.arguments[0]); if (ts.isCallExpression(node) && node.expression.getText(ast) === "offering") return "offering"; if (ts.isCallExpression(node) && node.expression.getText(ast) === "slot") return "trust";