feat:集成 LCSC 产品 API 用于袋子管理

- 增加了 LCSC API 集成,可利用 app_id、access_key 和 secret_key 获取产品详情。
- 实现了用于安全 API 请求的一次性和签名生成。
- 通过新端点提升包容量管理,更新插槽容量。
- 更新界面,支持 LCSC 产品直接导入袋口。
- 改进了 API 响应和用户输入验证的错误处理。
- 重构箱子渲染逻辑,以适应新的包包功能和展示产品详情。
- 为与 LCSC 产品信息相关的新 UI 元素添加了 CSS 样式。
- 更新了 AI 设置页面,包含了 LCSC API 配置选项。
This commit is contained in:
2026-03-12 13:46:28 +08:00
parent f7a82528e7
commit 10da4c2859
8 changed files with 661 additions and 119 deletions

View File

@@ -660,11 +660,26 @@ body {
grid-template-columns: repeat(2, minmax(130px, 1fr));
}
.slot-grid-bag-fixed {
grid-template-columns: repeat(7, minmax(88px, 1fr));
}
.slot-grid-bag-fixed .slot {
min-height: 136px;
height: 136px;
}
.slot-toolbar {
display: flex;
justify-content: flex-end;
margin: 0 0 var(--space-1);
}
.slot {
display: flex;
flex-direction: column;
gap: 4px;
min-height: 112px;
min-height: 136px;
padding: 10px;
border-radius: var(--radius);
text-decoration: none;
@@ -690,6 +705,16 @@ body {
overflow-wrap: anywhere;
}
.slot-part {
font-size: 12px;
font-weight: 700;
line-height: 1.25;
letter-spacing: 0.1px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.slot-name-text {
display: block;
}
@@ -707,6 +732,41 @@ body {
text-overflow: ellipsis;
}
.slot-details {
display: grid;
gap: 2px;
}
.slot-field {
font-size: 12px;
color: color-mix(in srgb, var(--text) 86%, var(--muted));
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.slot-lcsc {
width: fit-content;
max-width: 100%;
font-size: 11px;
line-height: 1.2;
padding: 3px 6px;
border-radius: 999px;
border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
background: color-mix(in srgb, var(--accent) 16%, var(--card));
color: color-mix(in srgb, var(--accent-press) 75%, var(--text));
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: copy;
user-select: all;
}
.slot-lcsc.copied {
border-color: var(--accent-press);
background: color-mix(in srgb, var(--accent) 26%, var(--card));
}
.slot-alert {
font-size: 12px;
color: var(--danger);
@@ -771,6 +831,27 @@ body.modal-open {
color: var(--muted);
}
.slot-grid.compact .slot {
min-height: 96px;
}
.slot-grid-bag-fixed.compact .slot {
min-height: 96px;
height: 96px;
}
.slot-grid.compact .slot-name {
max-height: 1.35em;
}
.slot-grid.compact .slot-spec,
.slot-grid.compact .slot-lcsc,
.slot-grid.compact .slot-field,
.slot-grid.compact .slot-details,
.slot-grid.compact .slot-alert {
display: none;
}
.form-grid {
display: grid;
grid-template-columns: 1fr 1fr;