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

@@ -60,7 +60,6 @@
<span class="group-desc">{{ meta.default_desc }}</span>
</div>
{% if key != 'bag' %}
<form class="new-box-form" method="post" action="{{ url_for('create_box') }}" {% if loop.first %}id="quick-add"{% endif %}>
<input type="hidden" name="box_type" value="{{ key }}">
{% if separate_mode %}<input type="hidden" name="return_to_type" value="{{ current_box_type }}">{% endif %}
@@ -75,19 +74,13 @@
<button class="btn" type="submit">新增盒子</button>
<span class="hint suggest-preview"></span>
</form>
{% else %}
<p class="hint">袋装清单为固定容器(大盒),不需要新增盒子。</p>
{% endif %}
<section class="box-list">
{% for item in groups[key] %}
<article class="box-card">
<h4>{{ item.box.name }}</h4>
<p>{{ item.box.description or '暂无描述' }}</p>
{% if item.box.box_type == 'bag' %}
<p>编号前缀: {{ item.box.slot_prefix }} | 袋装清单不使用范围</p>
<p>已记录: {{ item.used_count }} 项</p>
{% elif item.box.box_type == 'custom' %}
{% if item.box.box_type == 'custom' %}
<p>格数: {{ item.box.slot_capacity }} | 编号前缀: {{ item.box.slot_prefix }} | 范围: {{ item.slot_range }}</p>
<p>已启用: {{ item.used_count }}/{{ item.box.slot_capacity }}</p>
{% else %}
@@ -97,12 +90,10 @@
<div class="card-actions">
<a class="btn" href="{{ url_for('view_box', box_id=item.box.id) }}">进入列表</a>
{% if item.box.box_type != 'bag' %}
<form method="post" action="{{ url_for('delete_box', box_id=item.box.id) }}" onsubmit="return confirm('确认删除这个盒子及其内部记录吗?')">
{% if separate_mode %}<input type="hidden" name="return_to_type" value="{{ current_box_type }}">{% endif %}
<button class="btn btn-danger" type="submit">删除</button>
</form>
{% endif %}
</div>
<details class="box-overview">