feat: 能力插件元数据与运行时消费闭环
This commit is contained in:
1 parent
076c6124c8
commit
bb0709b8cc
26 files changed
+2188
-267
No files matched your search
@@ -4,6 +4,7 @@ import Taro from "@tarojs/taro";
|
||||
import type { TemplateProps } from "../../../apps/taro/src/runtime/template";
|
||||
import { navigate } from "../../../apps/taro/src/runtime/navigation";
|
||||
import { presentation, offering, slot, text, rows } from "../../../apps/taro/src/runtime/content";
|
||||
import { inquiryPluginState, pluginStateText } from "../../../apps/taro/src/runtime/plugins";
|
||||
import type { RuntimeWorkspace } from "@personal-brand/types";
|
||||
import "./style.css";
|
||||
const asset = (name: string) =>
|
||||
@@ -30,9 +31,17 @@ function Home({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
{p.stallTime && <Text className="notice-time">{p.stallTime}</Text>}
|
||||
</View>
|
||||
<View className="actions" data-editor-target="food.home.actions">
|
||||
<Button className="home-action" onClick={() => navigate("inquiry")}>
|
||||
{p.primaryAction || "咨询 / 预订"}
|
||||
</Button>
|
||||
{inquiryPluginState(workspace).enabled ? (
|
||||
<Button className="home-action" onClick={() => navigate("inquiry")}>
|
||||
{pluginStateText(workspace, "inquiry", "entryLabel") ||
|
||||
p.primaryAction ||
|
||||
"咨询 / 预订"}
|
||||
</Button>
|
||||
) : (
|
||||
<Text className="home-action disabled">
|
||||
{inquiryPluginState(workspace).disabledHint || "咨询 / 预订暂不可用"}
|
||||
</Text>
|
||||
)}
|
||||
<Button className="home-action muted" onClick={() => navigate("offerings")}>
|
||||
{p.secondaryAction || "查看餐品"}
|
||||
</Button>
|
||||
@@ -222,13 +231,25 @@ function Service({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
)}
|
||||
<Text>{text(process.config.refundNote)}</Text>
|
||||
</View>
|
||||
<Button
|
||||
data-editor-target="food.service.process-action"
|
||||
className="process-action"
|
||||
onClick={() => navigate("inquiry")}
|
||||
>
|
||||
{p.processAction || "立即咨询"} →
|
||||
</Button>
|
||||
{inquiryPluginState(workspace).enabled ? (
|
||||
<Button
|
||||
data-editor-target="food.service.process-action"
|
||||
className="process-action"
|
||||
onClick={() => navigate("inquiry")}
|
||||
>
|
||||
{pluginStateText(workspace, "inquiry", "entryLabel") ||
|
||||
p.processAction ||
|
||||
"立即咨询"}{" "}
|
||||
→
|
||||
</Button>
|
||||
) : (
|
||||
<Text
|
||||
data-editor-target="food.service.process-action"
|
||||
className="process-action disabled"
|
||||
>
|
||||
{inquiryPluginState(workspace).disabledHint || "咨询暂不可用"}
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
@@ -476,9 +497,15 @@ function OfferingList({ workspace }: { workspace: RuntimeWorkspace }) {
|
||||
<View className="empty-state">没有找到相关餐品,换个词试试</View>
|
||||
)}
|
||||
</View>
|
||||
<Button className="menu-cta" onClick={() => navigate("inquiry")}>
|
||||
咨询 / 预订
|
||||
</Button>
|
||||
{inquiryPluginState(workspace).enabled ? (
|
||||
<Button className="menu-cta" onClick={() => navigate("inquiry")}>
|
||||
{pluginStateText(workspace, "inquiry", "entryLabel") || "咨询 / 预订"}
|
||||
</Button>
|
||||
) : (
|
||||
<Text className="menu-cta disabled">
|
||||
{inquiryPluginState(workspace).disabledHint || "咨询 / 预订暂不可用"}
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
@@ -567,9 +594,15 @@ function Detail({ workspace, id }: { workspace: RuntimeWorkspace; id?: string })
|
||||
</View>
|
||||
</View>
|
||||
<View className="bar" data-editor-target="acheng-campus-food.detail.action">
|
||||
<Button onClick={() => navigate("inquiry", { offeringId: item.id })}>
|
||||
{p.inquiryAction || "咨询 / 提前预订"}
|
||||
</Button>
|
||||
{inquiryPluginState(workspace).enabled ? (
|
||||
<Button onClick={() => navigate("inquiry", { offeringId: item.id })}>
|
||||
{pluginStateText(workspace, "inquiry", "entryLabel") ||
|
||||
p.inquiryAction ||
|
||||
"咨询 / 提前预订"}
|
||||
</Button>
|
||||
) : (
|
||||
<Text>{inquiryPluginState(workspace).disabledHint || "咨询 / 提前预订暂不可用"}</Text>
|
||||
)}
|
||||
<Text>{p.inquiryHint}</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in new issue
Block a user