@tbox.cn/app-module-activity-play 0.4.0 → 1.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INTEGRATION.md +12 -7
- package/README.md +8 -6
- package/dist/chunk-OFPXH7OI.js +469 -0
- package/dist/{chunk-XIDGKP5D.js → chunk-YH6HTRSS.js} +7 -76
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -4
- package/dist/server/index.d.ts +261 -156
- package/dist/server/index.js +1 -3
- package/package.json +15 -10
- package/skills/activity-play/SKILL.md +13 -0
- package/src/client/cards/ListPresentation.tsx +83 -0
- package/src/client/cards/activity-play/ActivityDetailSheet.tsx +143 -0
- package/src/client/cards/activity-play/ActivityPlayCard.tsx +60 -40
- package/src/client/cards/activity-play-prize/ActivityPlayPrizeListCard.tsx +55 -44
- package/src/client/cards/activity-play-prize/PrizeDetailContent.tsx +33 -0
- package/src/client/cards/activity-play-prize/PrizeDetailSheet.tsx +52 -0
- package/src/client/cards/activity-play-prize/index.ts +0 -7
- package/src/client/cards/view.ts +16 -0
- package/src/client/index.ts +2 -13
- package/src/server/cards/index.ts +1 -3
- package/src/server/index.ts +2 -19
- package/src/server/prizes/cards.ts +6 -6
- package/src/server/prizes/tools.ts +4 -6
- package/src/server/tools.ts +1 -1
- package/tbox.module.json +1 -6
- package/tests/activity-card.test.tsx +169 -0
- package/tests/prizes-tools.test.ts +7 -4
- package/tests/prizes.test.ts +6 -12
- package/tests/routes.test.ts +13 -0
- package/tests/smoke.test.ts +7 -5
- package/tsup.config.ts +1 -0
- package/dist/chunk-GDHTMID6.js +0 -185
- package/dist/client/index.css +0 -107
- package/dist/index.css +0 -107
- package/src/client/cards/activity-play-prize/ActivityPlayPrizeDetailCard.tsx +0 -44
- package/src/client/styles/activity-play.css +0 -136
- package/src/server/cards/activity-play-prize-detail/meta.ts +0 -29
- package/src/server/cards/activity-play-prize-detail/samples.ts +0 -54
package/dist/chunk-GDHTMID6.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
// src/client/cards/view.ts
|
|
2
|
-
function activityPlayStatusText(status) {
|
|
3
|
-
switch (status) {
|
|
4
|
-
case "active":
|
|
5
|
-
return "\u8FDB\u884C\u4E2D";
|
|
6
|
-
case "not_started":
|
|
7
|
-
return "\u672A\u5F00\u59CB";
|
|
8
|
-
case "ended":
|
|
9
|
-
return "\u5DF2\u7ED3\u675F";
|
|
10
|
-
case "disabled":
|
|
11
|
-
return "\u5DF2\u4E0B\u7EBF";
|
|
12
|
-
case "unknown":
|
|
13
|
-
return "\u72B6\u6001\u672A\u77E5";
|
|
14
|
-
default:
|
|
15
|
-
return status;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function activityPlayStatusTone(status) {
|
|
19
|
-
switch (status) {
|
|
20
|
-
case "active":
|
|
21
|
-
return "success";
|
|
22
|
-
case "not_started":
|
|
23
|
-
return "warning";
|
|
24
|
-
case "disabled":
|
|
25
|
-
case "unknown":
|
|
26
|
-
return "muted";
|
|
27
|
-
default:
|
|
28
|
-
return "muted";
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function formatActivityPlayTime(value) {
|
|
32
|
-
if (!value) return "";
|
|
33
|
-
const d = new Date(value);
|
|
34
|
-
if (Number.isNaN(d.getTime())) return value;
|
|
35
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
36
|
-
return `${d.getFullYear()}.${pad(d.getMonth() + 1)}.${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// src/client/cards/activity-play/ActivityPlayCard.tsx
|
|
40
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
41
|
-
function ActivityRow({ item }) {
|
|
42
|
-
const tone = activityPlayStatusTone(item.status);
|
|
43
|
-
return /* @__PURE__ */ jsx("div", { className: "ap-card__row", children: /* @__PURE__ */ jsxs("div", { className: "ap-card__row-main", children: [
|
|
44
|
-
/* @__PURE__ */ jsxs("div", { className: "ap-card__row-title", children: [
|
|
45
|
-
/* @__PURE__ */ jsx("strong", { children: item.title }),
|
|
46
|
-
/* @__PURE__ */ jsx("span", { className: `ap-badge ap-badge--${tone}`, children: activityPlayStatusText(item.status) })
|
|
47
|
-
] }),
|
|
48
|
-
item.description && /* @__PURE__ */ jsx("p", { className: "ap-card__row-desc", children: item.description })
|
|
49
|
-
] }) });
|
|
50
|
-
}
|
|
51
|
-
function ActivityPlayCard(props) {
|
|
52
|
-
const { data } = props;
|
|
53
|
-
if (data.mode === "detail") {
|
|
54
|
-
const item = data.items[0];
|
|
55
|
-
if (!item) return null;
|
|
56
|
-
const range = [formatActivityPlayTime(item.startsAt), formatActivityPlayTime(item.endsAt)].filter(Boolean).join(" \u2014 ");
|
|
57
|
-
return /* @__PURE__ */ jsxs("section", { className: "ap-card ap-card--detail", children: [
|
|
58
|
-
/* @__PURE__ */ jsx("span", { className: "ap-card__eyebrow", children: "\u6D3B\u52A8\u73A9\u6CD5" }),
|
|
59
|
-
/* @__PURE__ */ jsxs("div", { className: "ap-card__detail-head", children: [
|
|
60
|
-
/* @__PURE__ */ jsx("strong", { children: item.title }),
|
|
61
|
-
/* @__PURE__ */ jsx("span", { className: `ap-badge ap-badge--${activityPlayStatusTone(item.status)}`, children: activityPlayStatusText(item.status) })
|
|
62
|
-
] }),
|
|
63
|
-
item.description && /* @__PURE__ */ jsx("p", { className: "ap-card__detail-desc", children: item.description }),
|
|
64
|
-
item.imageUrl && /* @__PURE__ */ jsx("img", { className: "ap-card__cover", src: item.imageUrl, alt: `${item.title}\u5C01\u9762`, loading: "lazy" }),
|
|
65
|
-
range && /* @__PURE__ */ jsxs("p", { className: "ap-card__meta", children: [
|
|
66
|
-
"\u6D3B\u52A8\u65F6\u95F4\uFF1A",
|
|
67
|
-
range
|
|
68
|
-
] })
|
|
69
|
-
] });
|
|
70
|
-
}
|
|
71
|
-
if (data.items.length === 0) {
|
|
72
|
-
return /* @__PURE__ */ jsxs("section", { className: "ap-card ap-card--list", children: [
|
|
73
|
-
/* @__PURE__ */ jsx("span", { className: "ap-card__eyebrow", children: "\u6D3B\u52A8\u73A9\u6CD5" }),
|
|
74
|
-
/* @__PURE__ */ jsx("p", { className: "ap-card__empty", children: "\u5F53\u524D\u5546\u573A\u6682\u65E0\u8FDB\u884C\u4E2D\u7684\u6D3B\u52A8\u73A9\u6CD5" })
|
|
75
|
-
] });
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ jsxs("section", { className: "ap-card ap-card--list", children: [
|
|
78
|
-
/* @__PURE__ */ jsxs("span", { className: "ap-card__eyebrow", children: [
|
|
79
|
-
"\u6D3B\u52A8\u73A9\u6CD5\uFF08",
|
|
80
|
-
data.items.length,
|
|
81
|
-
"\uFF09"
|
|
82
|
-
] }),
|
|
83
|
-
/* @__PURE__ */ jsx("div", { className: "ap-card__list", children: data.items.map((item) => /* @__PURE__ */ jsx(ActivityRow, { item }, item.activityId)) })
|
|
84
|
-
] });
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/client/cards/activity-play-prize/ActivityPlayPrizeListCard.tsx
|
|
88
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
89
|
-
function statusLabel(value) {
|
|
90
|
-
return value === "UNKNOWN" ? "\u72B6\u6001\u672A\u77E5" : value;
|
|
91
|
-
}
|
|
92
|
-
function PrizeRow({ item }) {
|
|
93
|
-
return /* @__PURE__ */ jsx2("div", { className: "ap-card__row", children: /* @__PURE__ */ jsxs2("div", { className: "ap-card__row-main", children: [
|
|
94
|
-
/* @__PURE__ */ jsxs2("div", { className: "ap-card__row-title", children: [
|
|
95
|
-
/* @__PURE__ */ jsx2("strong", { children: item.title }),
|
|
96
|
-
/* @__PURE__ */ jsx2("span", { className: "ap-badge ap-badge--muted", children: statusLabel(item.claimStatus) })
|
|
97
|
-
] }),
|
|
98
|
-
/* @__PURE__ */ jsxs2("p", { className: "ap-card__row-desc", children: [
|
|
99
|
-
statusLabel(item.prizeType),
|
|
100
|
-
" \xB7 \u4F7F\u7528\u72B6\u6001 ",
|
|
101
|
-
statusLabel(item.useStatus),
|
|
102
|
-
item.wonAt ? ` \xB7 ${item.wonAt}` : ""
|
|
103
|
-
] })
|
|
104
|
-
] }) });
|
|
105
|
-
}
|
|
106
|
-
function ActivityPlayPrizeListCard(props) {
|
|
107
|
-
const { data } = props;
|
|
108
|
-
if (data.items.length === 0) {
|
|
109
|
-
return /* @__PURE__ */ jsxs2("section", { className: "ap-card ap-card--list", children: [
|
|
110
|
-
/* @__PURE__ */ jsx2("span", { className: "ap-card__eyebrow", children: "\u672C\u4EBA\u5956\u54C1" }),
|
|
111
|
-
/* @__PURE__ */ jsx2("p", { className: "ap-card__empty", children: data.noResultsReason ?? "\u6682\u65E0\u4E2D\u5956\u8BB0\u5F55" })
|
|
112
|
-
] });
|
|
113
|
-
}
|
|
114
|
-
return /* @__PURE__ */ jsxs2("section", { className: "ap-card ap-card--list", children: [
|
|
115
|
-
/* @__PURE__ */ jsxs2("span", { className: "ap-card__eyebrow", children: [
|
|
116
|
-
"\u672C\u4EBA\u5956\u54C1\uFF08",
|
|
117
|
-
data.total,
|
|
118
|
-
"\uFF09"
|
|
119
|
-
] }),
|
|
120
|
-
/* @__PURE__ */ jsx2("div", { className: "ap-card__list", children: data.items.map((item) => /* @__PURE__ */ jsx2(PrizeRow, { item }, item.prizeRecordRef)) }),
|
|
121
|
-
data.truncated && /* @__PURE__ */ jsxs2("p", { className: "ap-card__meta", children: [
|
|
122
|
-
"\u5171 ",
|
|
123
|
-
data.total,
|
|
124
|
-
" \u6761\u8BB0\u5F55\uFF0C\u5F53\u524D\u5C55\u793A\u524D ",
|
|
125
|
-
data.items.length,
|
|
126
|
-
" \u6761"
|
|
127
|
-
] })
|
|
128
|
-
] });
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/client/cards/activity-play-prize/ActivityPlayPrizeDetailCard.tsx
|
|
132
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
133
|
-
function statusLabel2(value) {
|
|
134
|
-
return value === "UNKNOWN" ? "\u72B6\u6001\u672A\u77E5" : value;
|
|
135
|
-
}
|
|
136
|
-
function ActivityPlayPrizeDetailCard(props) {
|
|
137
|
-
const { data } = props;
|
|
138
|
-
return /* @__PURE__ */ jsxs3("section", { className: "ap-card ap-card--detail", children: [
|
|
139
|
-
/* @__PURE__ */ jsx3("span", { className: "ap-card__eyebrow", children: "\u672C\u4EBA\u5956\u54C1" }),
|
|
140
|
-
/* @__PURE__ */ jsxs3("div", { className: "ap-card__detail-head", children: [
|
|
141
|
-
/* @__PURE__ */ jsx3("strong", { children: data.title }),
|
|
142
|
-
/* @__PURE__ */ jsx3("span", { className: "ap-badge ap-badge--muted", children: statusLabel2(data.claimStatus) })
|
|
143
|
-
] }),
|
|
144
|
-
/* @__PURE__ */ jsxs3("p", { className: "ap-card__row-desc", children: [
|
|
145
|
-
statusLabel2(data.prizeType),
|
|
146
|
-
" \xB7 \u4F7F\u7528\u72B6\u6001 ",
|
|
147
|
-
statusLabel2(data.useStatus),
|
|
148
|
-
data.wonAt ? ` \xB7 ${data.wonAt}` : ""
|
|
149
|
-
] }),
|
|
150
|
-
data.activityTitle && /* @__PURE__ */ jsxs3("p", { className: "ap-card__meta", children: [
|
|
151
|
-
"\u6765\u6E90\u6D3B\u52A8\uFF1A",
|
|
152
|
-
data.activityTitle
|
|
153
|
-
] }),
|
|
154
|
-
data.usageRuleText && /* @__PURE__ */ jsxs3("p", { className: "ap-card__detail-desc", children: [
|
|
155
|
-
"\u4F7F\u7528\u89C4\u5219\uFF1A",
|
|
156
|
-
data.usageRuleText
|
|
157
|
-
] }),
|
|
158
|
-
data.redemptionInstruction && /* @__PURE__ */ jsxs3("p", { className: "ap-card__detail-desc", children: [
|
|
159
|
-
"\u9886\u53D6\u8BF4\u660E\uFF1A",
|
|
160
|
-
data.redemptionInstruction
|
|
161
|
-
] }),
|
|
162
|
-
data.prizeUrl && /* @__PURE__ */ jsxs3("p", { className: "ap-card__meta", children: [
|
|
163
|
-
"\u9886\u53D6\u6307\u5F15\uFF1A",
|
|
164
|
-
data.prizeUrl,
|
|
165
|
-
"\uFF08\u4EE5\u6D3B\u52A8\u9875\u9762\u4E3A\u51C6\uFF09"
|
|
166
|
-
] })
|
|
167
|
-
] });
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// src/client/index.ts
|
|
171
|
-
var cards = {
|
|
172
|
-
"activity-play": ActivityPlayCard,
|
|
173
|
-
"activity-play-prize-list": ActivityPlayPrizeListCard,
|
|
174
|
-
"activity-play-prize-detail": ActivityPlayPrizeDetailCard
|
|
175
|
-
};
|
|
176
|
-
var clientModule = {
|
|
177
|
-
cards,
|
|
178
|
-
register(ctx) {
|
|
179
|
-
ctx.cards.registerMap(cards);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
export {
|
|
184
|
-
clientModule
|
|
185
|
-
};
|
package/dist/client/index.css
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/* src/client/styles/activity-play.css */
|
|
2
|
-
.ap-card {
|
|
3
|
-
--ap-muted: var(--tbox-text-secondary, #8a8a8a);
|
|
4
|
-
--ap-faint: var(--tbox-text-muted, #b0b0b0);
|
|
5
|
-
--ap-border: var(--tbox-border-color, #ebebeb);
|
|
6
|
-
--ap-surface: var(--tbox-surface-subtle, #fafafa);
|
|
7
|
-
--ap-success: var(--tbox-success, #0f8a5f);
|
|
8
|
-
--ap-success-light: var(--tbox-success-light, #e6f7f0);
|
|
9
|
-
--ap-warning: var(--tbox-warning, #b26a00);
|
|
10
|
-
--ap-warning-light: var(--tbox-warning-light, #fff4e0);
|
|
11
|
-
}
|
|
12
|
-
.ap-card {
|
|
13
|
-
padding: 12px;
|
|
14
|
-
background: var(--ap-surface);
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
gap: 10px;
|
|
18
|
-
}
|
|
19
|
-
.ap-card__eyebrow {
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
line-height: 1;
|
|
22
|
-
color: var(--ap-faint);
|
|
23
|
-
letter-spacing: 1px;
|
|
24
|
-
}
|
|
25
|
-
.ap-badge {
|
|
26
|
-
flex: none;
|
|
27
|
-
font-size: 12px;
|
|
28
|
-
line-height: 18px;
|
|
29
|
-
padding: 0 6px;
|
|
30
|
-
border-radius: 9px;
|
|
31
|
-
}
|
|
32
|
-
.ap-badge--success {
|
|
33
|
-
color: var(--ap-success);
|
|
34
|
-
background: var(--ap-success-light);
|
|
35
|
-
}
|
|
36
|
-
.ap-badge--warning {
|
|
37
|
-
color: var(--ap-warning);
|
|
38
|
-
background: var(--ap-warning-light);
|
|
39
|
-
}
|
|
40
|
-
.ap-badge--muted {
|
|
41
|
-
color: var(--ap-muted);
|
|
42
|
-
background: rgba(0, 0, 0, 0.06);
|
|
43
|
-
}
|
|
44
|
-
.ap-card__list {
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
}
|
|
48
|
-
.ap-card__row {
|
|
49
|
-
padding: 10px 0;
|
|
50
|
-
border-top: 1px solid var(--ap-border);
|
|
51
|
-
}
|
|
52
|
-
.ap-card__row:first-child {
|
|
53
|
-
border-top: none;
|
|
54
|
-
}
|
|
55
|
-
.ap-card__row-title {
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
gap: 6px;
|
|
59
|
-
}
|
|
60
|
-
.ap-card__row-title strong {
|
|
61
|
-
font-size: 14px;
|
|
62
|
-
color: var(--tbox-text-primary, #303030);
|
|
63
|
-
overflow: hidden;
|
|
64
|
-
text-overflow: ellipsis;
|
|
65
|
-
white-space: nowrap;
|
|
66
|
-
}
|
|
67
|
-
.ap-card__row-desc {
|
|
68
|
-
margin-top: 4px;
|
|
69
|
-
font-size: 12px;
|
|
70
|
-
line-height: 18px;
|
|
71
|
-
color: var(--ap-muted);
|
|
72
|
-
display: -webkit-box;
|
|
73
|
-
-webkit-box-orient: vertical;
|
|
74
|
-
-webkit-line-clamp: 2;
|
|
75
|
-
overflow: hidden;
|
|
76
|
-
}
|
|
77
|
-
.ap-card__empty {
|
|
78
|
-
font-size: 13px;
|
|
79
|
-
line-height: 20px;
|
|
80
|
-
color: var(--ap-muted);
|
|
81
|
-
}
|
|
82
|
-
.ap-card--detail .ap-card__detail-head {
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
gap: 8px;
|
|
86
|
-
flex-wrap: wrap;
|
|
87
|
-
}
|
|
88
|
-
.ap-card--detail .ap-card__detail-head strong {
|
|
89
|
-
font-size: 16px;
|
|
90
|
-
color: var(--tbox-text-primary, #303030);
|
|
91
|
-
}
|
|
92
|
-
.ap-card--detail .ap-card__detail-desc {
|
|
93
|
-
font-size: 13px;
|
|
94
|
-
line-height: 20px;
|
|
95
|
-
color: var(--ap-muted);
|
|
96
|
-
}
|
|
97
|
-
.ap-card__cover {
|
|
98
|
-
width: 100%;
|
|
99
|
-
max-height: 180px;
|
|
100
|
-
object-fit: cover;
|
|
101
|
-
border-radius: 6px;
|
|
102
|
-
}
|
|
103
|
-
.ap-card__meta {
|
|
104
|
-
font-size: 12px;
|
|
105
|
-
line-height: 18px;
|
|
106
|
-
color: var(--ap-faint);
|
|
107
|
-
}
|
package/dist/index.css
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/* src/client/styles/activity-play.css */
|
|
2
|
-
.ap-card {
|
|
3
|
-
--ap-muted: var(--tbox-text-secondary, #8a8a8a);
|
|
4
|
-
--ap-faint: var(--tbox-text-muted, #b0b0b0);
|
|
5
|
-
--ap-border: var(--tbox-border-color, #ebebeb);
|
|
6
|
-
--ap-surface: var(--tbox-surface-subtle, #fafafa);
|
|
7
|
-
--ap-success: var(--tbox-success, #0f8a5f);
|
|
8
|
-
--ap-success-light: var(--tbox-success-light, #e6f7f0);
|
|
9
|
-
--ap-warning: var(--tbox-warning, #b26a00);
|
|
10
|
-
--ap-warning-light: var(--tbox-warning-light, #fff4e0);
|
|
11
|
-
}
|
|
12
|
-
.ap-card {
|
|
13
|
-
padding: 12px;
|
|
14
|
-
background: var(--ap-surface);
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
gap: 10px;
|
|
18
|
-
}
|
|
19
|
-
.ap-card__eyebrow {
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
line-height: 1;
|
|
22
|
-
color: var(--ap-faint);
|
|
23
|
-
letter-spacing: 1px;
|
|
24
|
-
}
|
|
25
|
-
.ap-badge {
|
|
26
|
-
flex: none;
|
|
27
|
-
font-size: 12px;
|
|
28
|
-
line-height: 18px;
|
|
29
|
-
padding: 0 6px;
|
|
30
|
-
border-radius: 9px;
|
|
31
|
-
}
|
|
32
|
-
.ap-badge--success {
|
|
33
|
-
color: var(--ap-success);
|
|
34
|
-
background: var(--ap-success-light);
|
|
35
|
-
}
|
|
36
|
-
.ap-badge--warning {
|
|
37
|
-
color: var(--ap-warning);
|
|
38
|
-
background: var(--ap-warning-light);
|
|
39
|
-
}
|
|
40
|
-
.ap-badge--muted {
|
|
41
|
-
color: var(--ap-muted);
|
|
42
|
-
background: rgba(0, 0, 0, 0.06);
|
|
43
|
-
}
|
|
44
|
-
.ap-card__list {
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-direction: column;
|
|
47
|
-
}
|
|
48
|
-
.ap-card__row {
|
|
49
|
-
padding: 10px 0;
|
|
50
|
-
border-top: 1px solid var(--ap-border);
|
|
51
|
-
}
|
|
52
|
-
.ap-card__row:first-child {
|
|
53
|
-
border-top: none;
|
|
54
|
-
}
|
|
55
|
-
.ap-card__row-title {
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
gap: 6px;
|
|
59
|
-
}
|
|
60
|
-
.ap-card__row-title strong {
|
|
61
|
-
font-size: 14px;
|
|
62
|
-
color: var(--tbox-text-primary, #303030);
|
|
63
|
-
overflow: hidden;
|
|
64
|
-
text-overflow: ellipsis;
|
|
65
|
-
white-space: nowrap;
|
|
66
|
-
}
|
|
67
|
-
.ap-card__row-desc {
|
|
68
|
-
margin-top: 4px;
|
|
69
|
-
font-size: 12px;
|
|
70
|
-
line-height: 18px;
|
|
71
|
-
color: var(--ap-muted);
|
|
72
|
-
display: -webkit-box;
|
|
73
|
-
-webkit-box-orient: vertical;
|
|
74
|
-
-webkit-line-clamp: 2;
|
|
75
|
-
overflow: hidden;
|
|
76
|
-
}
|
|
77
|
-
.ap-card__empty {
|
|
78
|
-
font-size: 13px;
|
|
79
|
-
line-height: 20px;
|
|
80
|
-
color: var(--ap-muted);
|
|
81
|
-
}
|
|
82
|
-
.ap-card--detail .ap-card__detail-head {
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
gap: 8px;
|
|
86
|
-
flex-wrap: wrap;
|
|
87
|
-
}
|
|
88
|
-
.ap-card--detail .ap-card__detail-head strong {
|
|
89
|
-
font-size: 16px;
|
|
90
|
-
color: var(--tbox-text-primary, #303030);
|
|
91
|
-
}
|
|
92
|
-
.ap-card--detail .ap-card__detail-desc {
|
|
93
|
-
font-size: 13px;
|
|
94
|
-
line-height: 20px;
|
|
95
|
-
color: var(--ap-muted);
|
|
96
|
-
}
|
|
97
|
-
.ap-card__cover {
|
|
98
|
-
width: 100%;
|
|
99
|
-
max-height: 180px;
|
|
100
|
-
object-fit: cover;
|
|
101
|
-
border-radius: 6px;
|
|
102
|
-
}
|
|
103
|
-
.ap-card__meta {
|
|
104
|
-
font-size: 12px;
|
|
105
|
-
line-height: 18px;
|
|
106
|
-
color: var(--ap-faint);
|
|
107
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* activity-play-prize-detail 占位渲染器(任务07——沿活动卡 2026-11-16 授权先例占位)。
|
|
3
|
-
* - 数据契约:contracts-mall activityPlayPrizeDetailCardDataSchema({mallId, ...PrizeDetail}
|
|
4
|
-
* 平铺——不套 mode/items/prize 包装);
|
|
5
|
-
* - 占位边界:中立保形展示(奖品名/类型/状态/中奖时间/使用规则/领取说明——
|
|
6
|
-
* prizeUrl 仅事实展示为指引文本,占位期不加跳转按钮);正式渲染器(历史禁用与
|
|
7
|
-
* 品牌视觉)由前端负责人按任务线交付后整体替换本文件;
|
|
8
|
-
* - 视觉纪律:中立形态(无厂商关联、无 --tbox-asset-* 元素级声明、域变量兜底)。
|
|
9
|
-
*/
|
|
10
|
-
import type { ActivityPlayPrizeDetailCardData } from '@tbox.cn/app-contracts-mall';
|
|
11
|
-
|
|
12
|
-
/** 状态桶占位文案(UNKNOWN 保守中文;供应商枚举按原文展示) */
|
|
13
|
-
function statusLabel(value: string): string {
|
|
14
|
-
return value === 'UNKNOWN' ? '状态未知' : value;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function ActivityPlayPrizeDetailCard(props: { data: ActivityPlayPrizeDetailCardData }) {
|
|
18
|
-
const { data } = props;
|
|
19
|
-
return (
|
|
20
|
-
<section className="ap-card ap-card--detail">
|
|
21
|
-
<span className="ap-card__eyebrow">本人奖品</span>
|
|
22
|
-
<div className="ap-card__detail-head">
|
|
23
|
-
<strong>{data.title}</strong>
|
|
24
|
-
<span className="ap-badge ap-badge--muted">{statusLabel(data.claimStatus)}</span>
|
|
25
|
-
</div>
|
|
26
|
-
<p className="ap-card__row-desc">
|
|
27
|
-
{statusLabel(data.prizeType)} · 使用状态 {statusLabel(data.useStatus)}
|
|
28
|
-
{data.wonAt ? ` · ${data.wonAt}` : ''}
|
|
29
|
-
</p>
|
|
30
|
-
{data.activityTitle && <p className="ap-card__meta">来源活动:{data.activityTitle}</p>}
|
|
31
|
-
{data.usageRuleText && (
|
|
32
|
-
<p className="ap-card__detail-desc">使用规则:{data.usageRuleText}</p>
|
|
33
|
-
)}
|
|
34
|
-
{data.redemptionInstruction && (
|
|
35
|
-
<p className="ap-card__detail-desc">领取说明:{data.redemptionInstruction}</p>
|
|
36
|
-
)}
|
|
37
|
-
{data.prizeUrl && (
|
|
38
|
-
<p className="ap-card__meta">领取指引:{data.prizeUrl}(以活动页面为准)</p>
|
|
39
|
-
)}
|
|
40
|
-
</section>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default ActivityPlayPrizeDetailCard;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/* ============================================================
|
|
2
|
-
* module-activity-play 客户端域样式(占位渲染器 2026-11-16)。
|
|
3
|
-
* 中立形态:卡框纪律沿平台 .tbox-card(描边/圆角/裁切平台统一),本文件只铺域 surface
|
|
4
|
-
* 与占位排版;厂商/品牌视觉归正式渲染器与主题包(模块兜底 = 中立,禁 --tbox-asset-* 声明)。
|
|
5
|
-
* 机械规则:直引 --tbox-* 恒带 fallback;rgba() 传统语法;禁 color-mix / !important。
|
|
6
|
-
* ============================================================ */
|
|
7
|
-
|
|
8
|
-
/* ===== 域变量 ===== */
|
|
9
|
-
.ap-card {
|
|
10
|
-
--ap-muted: var(--tbox-text-secondary, #8a8a8a);
|
|
11
|
-
--ap-faint: var(--tbox-text-muted, #b0b0b0);
|
|
12
|
-
--ap-border: var(--tbox-border-color, #ebebeb);
|
|
13
|
-
--ap-surface: var(--tbox-surface-subtle, #fafafa);
|
|
14
|
-
--ap-success: var(--tbox-success, #0f8a5f);
|
|
15
|
-
--ap-success-light: var(--tbox-success-light, #e6f7f0);
|
|
16
|
-
--ap-warning: var(--tbox-warning, #b26a00);
|
|
17
|
-
--ap-warning-light: var(--tbox-warning-light, #fff4e0);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/* ===== 卡根 ===== */
|
|
21
|
-
.ap-card {
|
|
22
|
-
padding: 12px;
|
|
23
|
-
background: var(--ap-surface);
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
gap: 10px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.ap-card__eyebrow {
|
|
30
|
-
font-size: 12px;
|
|
31
|
-
line-height: 1;
|
|
32
|
-
color: var(--ap-faint);
|
|
33
|
-
letter-spacing: 1px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* ===== 状态徽标 ===== */
|
|
37
|
-
.ap-badge {
|
|
38
|
-
flex: none;
|
|
39
|
-
font-size: 12px;
|
|
40
|
-
line-height: 18px;
|
|
41
|
-
padding: 0 6px;
|
|
42
|
-
border-radius: 9px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.ap-badge--success {
|
|
46
|
-
color: var(--ap-success);
|
|
47
|
-
background: var(--ap-success-light);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.ap-badge--warning {
|
|
51
|
-
color: var(--ap-warning);
|
|
52
|
-
background: var(--ap-warning-light);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.ap-badge--muted {
|
|
56
|
-
color: var(--ap-muted);
|
|
57
|
-
background: rgba(0, 0, 0, 0.06);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* ===== 列表形态 ===== */
|
|
61
|
-
.ap-card__list {
|
|
62
|
-
display: flex;
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.ap-card__row {
|
|
67
|
-
padding: 10px 0;
|
|
68
|
-
border-top: 1px solid var(--ap-border);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.ap-card__row:first-child {
|
|
72
|
-
border-top: none;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.ap-card__row-title {
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
gap: 6px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.ap-card__row-title strong {
|
|
82
|
-
font-size: 14px;
|
|
83
|
-
color: var(--tbox-text-primary, #303030);
|
|
84
|
-
overflow: hidden;
|
|
85
|
-
text-overflow: ellipsis;
|
|
86
|
-
white-space: nowrap;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.ap-card__row-desc {
|
|
90
|
-
margin-top: 4px;
|
|
91
|
-
font-size: 12px;
|
|
92
|
-
line-height: 18px;
|
|
93
|
-
color: var(--ap-muted);
|
|
94
|
-
display: -webkit-box;
|
|
95
|
-
-webkit-box-orient: vertical;
|
|
96
|
-
-webkit-line-clamp: 2;
|
|
97
|
-
overflow: hidden;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.ap-card__empty {
|
|
101
|
-
font-size: 13px;
|
|
102
|
-
line-height: 20px;
|
|
103
|
-
color: var(--ap-muted);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/* ===== 详情形态 ===== */
|
|
107
|
-
.ap-card--detail .ap-card__detail-head {
|
|
108
|
-
display: flex;
|
|
109
|
-
align-items: center;
|
|
110
|
-
gap: 8px;
|
|
111
|
-
flex-wrap: wrap;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.ap-card--detail .ap-card__detail-head strong {
|
|
115
|
-
font-size: 16px;
|
|
116
|
-
color: var(--tbox-text-primary, #303030);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.ap-card--detail .ap-card__detail-desc {
|
|
120
|
-
font-size: 13px;
|
|
121
|
-
line-height: 20px;
|
|
122
|
-
color: var(--ap-muted);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.ap-card__cover {
|
|
126
|
-
width: 100%;
|
|
127
|
-
max-height: 180px;
|
|
128
|
-
object-fit: cover;
|
|
129
|
-
border-radius: 6px;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.ap-card__meta {
|
|
133
|
-
font-size: 12px;
|
|
134
|
-
line-height: 18px;
|
|
135
|
-
color: var(--ap-faint);
|
|
136
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* activity-play-prize-detail 卡元数据(任务07——本人奖品详情稳定卡型)。
|
|
3
|
-
* 数据契约单源 = contracts-mall activityPlayPrizeDetailCardDataSchema(平铺形态——
|
|
4
|
-
* 不套 mode/items/prize 包装);信封字段由 SDK 卡片框架承载。
|
|
5
|
-
* 正式渲染组件由前端外部交付(历史态禁用约定见 api.md);注册接线在步骤 2。
|
|
6
|
-
*/
|
|
7
|
-
import type { CardMeta } from '@tbox.cn/app-contracts';
|
|
8
|
-
import { activityPlayPrizeDetailCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
9
|
-
import { activityPlayPrizeDetailCardSamples } from './samples';
|
|
10
|
-
|
|
11
|
-
const meta: CardMeta<typeof activityPlayPrizeDetailCardDataSchema> = {
|
|
12
|
-
cardType: 'activity-play-prize-detail',
|
|
13
|
-
dataSchema: activityPlayPrizeDetailCardDataSchema,
|
|
14
|
-
displayName: '本人奖品详情',
|
|
15
|
-
description: '本人中奖记录详情卡片(奖品事实、供应商规则与领取说明——平铺展示)',
|
|
16
|
-
schemaVersion: 1,
|
|
17
|
-
sampleData: {
|
|
18
|
-
mallId: 'mall-demo',
|
|
19
|
-
prizeRecordRef: 'prize-demo-001',
|
|
20
|
-
title: '咖啡兑换券',
|
|
21
|
-
prizeType: 'COUPON',
|
|
22
|
-
claimStatus: 'CLAIMED',
|
|
23
|
-
useStatus: 'UNUSED',
|
|
24
|
-
redemptionInstruction: '请按活动页面的领取及使用指引操作',
|
|
25
|
-
},
|
|
26
|
-
samples: activityPlayPrizeDetailCardSamples,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default meta;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* activity-play-prize-detail 卡附加预览样本(任务07——覆盖领取说明完整面与最小面)。
|
|
3
|
-
*
|
|
4
|
-
* 方法论(对齐 member/parking 画廊沉淀约定):
|
|
5
|
-
* - 样本即契约:全样本 data 必须过 activityPlayPrizeDetailCardDataSchema(本文件
|
|
6
|
-
* 下方自证 + tests/prizes.test.ts 双断言);
|
|
7
|
-
* - 详情平铺形态({mallId, ...detail}——不套 mode/items/prize 包装);
|
|
8
|
-
* - prizeUrl 为事实字段样本(展示层不据此加按钮);时间为含时区 ISO。
|
|
9
|
-
*/
|
|
10
|
-
import type { CardSample } from '@tbox.cn/app-contracts';
|
|
11
|
-
import { activityPlayPrizeDetailCardDataSchema } from '@tbox.cn/app-contracts-mall';
|
|
12
|
-
import type { ActivityPlayPrizeDetailCardData } from '@tbox.cn/app-contracts-mall';
|
|
13
|
-
|
|
14
|
-
export const activityPlayPrizeDetailCardSamples: CardSample<ActivityPlayPrizeDetailCardData>[] = [
|
|
15
|
-
{
|
|
16
|
-
label: '详情·完整面',
|
|
17
|
-
group: '本人奖品·详情',
|
|
18
|
-
note: '含来源活动/图片/时间/规则/领取方式/说明/指引全量可选字段',
|
|
19
|
-
data: {
|
|
20
|
-
mallId: 'mall-demo',
|
|
21
|
-
prizeRecordRef: 'prize-demo-001',
|
|
22
|
-
title: '咖啡兑换券',
|
|
23
|
-
prizeType: 'COUPON',
|
|
24
|
-
claimStatus: 'CLAIMED',
|
|
25
|
-
useStatus: 'UNUSED',
|
|
26
|
-
activityId: 'demo-wheel',
|
|
27
|
-
activityTitle: '幸运转盘',
|
|
28
|
-
imageUrl: 'https://example.com/prize.png',
|
|
29
|
-
wonAt: '2026-11-01T10:00:00+08:00',
|
|
30
|
-
usageRuleText: '请在有效期内到店使用',
|
|
31
|
-
redemptionMethod: '门店柜台',
|
|
32
|
-
redemptionInstruction: '请按活动页面的领取及使用指引操作',
|
|
33
|
-
prizeUrl: 'https://example.com/claim',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: '详情·最小面',
|
|
38
|
-
group: '本人奖品·详情',
|
|
39
|
-
note: '仅必填字段 + UNKNOWN 状态桶(未知状态保守展示——不编造具体状态)',
|
|
40
|
-
data: {
|
|
41
|
-
mallId: 'mall-demo',
|
|
42
|
-
prizeRecordRef: 'prize-demo-002',
|
|
43
|
-
title: '周年庆礼盒',
|
|
44
|
-
prizeType: 'UNKNOWN',
|
|
45
|
-
claimStatus: 'WAIT_CLAIM',
|
|
46
|
-
useStatus: 'UNKNOWN',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
// 样本自证(样本即契约——schema 不过即测试失败,不留坏样本入画廊)
|
|
52
|
-
for (const sample of activityPlayPrizeDetailCardSamples) {
|
|
53
|
-
activityPlayPrizeDetailCardDataSchema.parse(sample.data);
|
|
54
|
-
}
|