将项目列为行,尺寸列为列,并在两者交汇处放置价格。对咖啡、水龙头、葡萄酒、药房重量和燃料使用相同清晰网格,并显示附加项。
直播卡片
类别:食品和饮料。标签:餐厅和咖啡馆,酒吧和酒馆,商店,价格和费率。
布局
此全屏卡在横屏或竖屏时填满整个屏幕,不作为角落、芯片或条带放置。
布局:全屏。表单:横向,纵向。
数据与隐私
此卡使用其配置的属性和实时卡数据。
属性
有关主题、背景、强调色和位置,请参见通用属性。
创建卡片时,在卡片的params中设置静态属性。其数据文档仅包含动态属性。嵌套行描述其父属性的内容。
静态属性
| 名称 | 类型 | 默认 | 数值和限制 | 描述 |
|---|---|---|---|---|
title | string | "Coffee" | maxLength:40 | |
metaLabel | string | "" | maxLength:16 | 额外列的标题,例如ABV。 |
glyph | string | "cup" | "none", "cup", "glass" | 每个尺寸上方有一个杯子或玻璃,随尺寸增长而变大。 |
currency | string | "$" | maxLength:3 | |
decimals | 数字,字符串 | "auto" | "auto", 0, 1, 2, 3 | 当所有价格均为整数时,自动使用整数。 |
perPage | integer | 0 | 最小值:0;最大值:20 | 每页行数。0表示根据房间自动设置。 |
pageSeconds | number | 10 | 最小值:5;最大值:120 | |
footnote | string | "" | maxLength:120 | |
backgroundColor | 字符串,空值 | null | 模式:"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$" | 用纯色 CSS 顺序覆盖卡片背景和底板。#RRGGBBAA 提供透明度。背景无则优先。 |
textColor | 字符串,空值 | null | 模式:"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$" | 覆盖主文本和次要文本颜色。强调色和语义状态色保持原有功能。 |
动态属性
| 名称 | 类型 | 默认 | 数值和限制 | 描述 |
|---|---|---|---|---|
columns | array | ["Small","Medium","Large"] | minItems:1;maxItems:6 | 顶部尺寸:S/M/L,12/16/20 盎司,品脱/半品脱,杯/瓶,1克/3.5克/28克,现金/信用。 |
sections | array | [{"name":"Espresso bar","items":[{"name":"Espresso","prices":[3.25,3.75,null],"note":"Double shot"},{"name":"Americano","prices":[3.5,4.0,4.5]},{"name":"Flat white","prices":[4.5,5.0,5.5],"note":"Whole or oat milk","badge":"House"},{"name":"Latte","prices":[4.75,5.25,5.75],"note":"Vanilla, caramel or maple"}]},{"name":"Cold","items":[{"name":"Iced latte","prices":[5.0,5.5,6.0]},{"name":"Cold brew","prices":[4.5,5.0,5.5],"note":"Steeped 18 hours"}]}] | maxItems:12 | 侧边的项目组;组名位于首行。 |
sections[].name | string | maxLength:80 | ||
sections[].items | array | maxItems:40;必填 | ||
sections[].items[].name | string | minLength:1;maxLength:80;必填 | ||
sections[].items[].note | string | maxLength:160 | 名字下方的一行。 | |
sections[].items[].meta | string | maxLength:24 | 额外列:酒精度、THC、产地。 | |
sections[].items[].badge | string | maxLength:16 | ||
sections[].items[].prices | array | maxItems:6 | 每列一个价格;空白表示该尺寸未提供。 | |
sections[].items[].soldOut | boolean | false | ||
addOns | array | [{"name":"Oat milk","price":0.7},{"name":"Extra shot","price":1},{"name":"Syrup","price":0.5}] | maxItems:8 | 表格下方的额外内容行。 |
addOns[].name | string | maxLength:40;必填 | ||
addOns[].price | 数字,空值 | |||
featuredItem | string | "" | maxLength:80 | Primetime 中要显示的确切行名称。空白时使用第一个带徽章的可用行。 |
featuredColumn | integer | 2 | 最小值:1;最大值:6 | Primetime 中以一为起点的特色尺寸列。 |
updatedAt | string | "" | maxLength:40 | 同步价格变更强调的 ISO 时间点。 |
画布示例
将静态属性保存为 params.json 并创建卡片。结果中包含它的 crd_ ID。
{
"theme": "neomustard"
}
screenrig card create --type price-matrix --major 1 --file params.json
将此项目添加到播放列表页面的primitives中,并用该 ID 替换示例中的 ID。发布播放列表并分配屏幕。
{
"id": "price-matrix",
"primitive": "card",
"card": "crd_01EXAMPLECARD000000000",
"layout": "full",
"content_fit": "fill"
}
写入实时数据
创建卡片后向其写入文档,之后替换该文档即可更新屏幕,无需重新发布。卡片会按其动态属性检查每次写入,并拒绝它不接受的文档。请使用与播放列表相同的项目。
将文档保存为card-data.json。CLI直接读取文档,无需包装:
{
"columns": [
"Small",
"Medium",
"Large"
],
"sections": [
{
"name": "Espresso bar",
"items": [
{
"name": "Espresso",
"prices": [
3.25,
3.75,
null
],
"note": "Double shot"
},
{
"name": "Americano",
"prices": [
3.5,
4.0,
4.5
]
},
{
"name": "Flat white",
"prices": [
4.5,
5.0,
5.5
],
"note": "Whole or oat milk",
"badge": "House"
},
{
"name": "Latte",
"prices": [
4.75,
5.25,
5.75
],
"note": "Vanilla, caramel or maple"
}
]
},
{
"name": "Cold",
"items": [
{
"name": "Iced latte",
"prices": [
5.0,
5.5,
6.0
]
},
{
"name": "Cold brew",
"prices": [
4.5,
5.0,
5.5
],
"note": "Steeped 18 hours"
}
]
}
],
"addOns": [
{
"name": "Oat milk",
"price": 0.7
},
{
"name": "Extra shot",
"price": 1
},
{
"name": "Syrup",
"price": 0.5
}
],
"featuredItem": "",
"featuredColumn": 2,
"updatedAt": ""
}
screenrig card data put crd_01EXAMPLECARD000000000 --file card-data.json
或直接调用 API。API 将相同文档包装在 document 字段中。智能体令牌已指定其项目,因此不发送项目头;若发送 ScreenRig-Project,必须与令牌项目匹配。通过环境提供 API 授权;详见 API 认证。
curl --request PUT "https://api.screenrig.ai/api/cards/crd_01EXAMPLECARD000000000/data" \
--header "Authorization: Bearer $SCREENRIG_TOKEN" \
--header "Content-Type: application/json" \
--data '{"document":{"columns":["Small","Medium","Large"],"sections":[{"name":"Espresso bar","items":[{"name":"Espresso","prices":[3.25,3.75,null],"note":"Double shot"},{"name":"Americano","prices":[3.5,4.0,4.5]},{"name":"Flat white","prices":[4.5,5.0,5.5],"note":"Whole or oat milk","badge":"House"},{"name":"Latte","prices":[4.75,5.25,5.75],"note":"Vanilla, caramel or maple"}]},{"name":"Cold","items":[{"name":"Iced latte","prices":[5.0,5.5,6.0]},{"name":"Cold brew","prices":[4.5,5.0,5.5],"note":"Steeped 18 hours"}]}],"addOns":[{"name":"Oat milk","price":0.7},{"name":"Extra shot","price":1},{"name":"Syrup","price":0.5}],"featuredItem":"","featuredColumn":2,"updatedAt":""}}'