mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-05 15:36:45 +08:00
feat(ui): 支持值得注意的Key多选、全选与批量操作
为“值得注意的Key”列表新增可见复选框和全选开关,提供 批量验证/复制/删除操作,并优化选择逻辑与样式。 - attentionKeysList 每行新增可见复选框并设置 data-key - 新增“全选”和批量操作栏,实时显示已选数量 - getSelectedKeys/updateBatchActions/toggleSelectAll 适配 attention 根节点,且仅作用于可见项 - initializeKeySelectionListeners 增加 attention 事件绑定 - fetchAndRenderAttentionKeys 阻止按钮冒泡、绑定复选框变更, 在加载成功/失败后刷新批量栏状态 - attention 列表不与 valid/invalid 主列表同步勾选,避免交叉影响 - CSS 仅隐藏有效/无效列表复选框,新增 attention 列表 hover/选中态样式 - 增强空值判断,避免批量栏或全选元素缺失时报错
This commit is contained in:
@@ -322,12 +322,13 @@ endblock %} {% block head_extra_styles %}
|
||||
border-color: rgba(59, 130, 246, 0.3);
|
||||
}
|
||||
|
||||
/* 隐藏原生复选框 */
|
||||
.key-checkbox {
|
||||
/* 隐藏原生复选框(仅隐藏有效/无效列表中的复选框,保留值得注意的Key列表中的复选框可见) */
|
||||
#validKeys .key-checkbox,
|
||||
#invalidKeys .key-checkbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 自定义复选框样式 */
|
||||
/* 自定义复选框样式(仅针对有效/无效列表) */
|
||||
#validKeys li::before,
|
||||
#invalidKeys li::before {
|
||||
content: "";
|
||||
@@ -363,6 +364,31 @@ endblock %} {% block head_extra_styles %}
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
/* 值得注意的Key列表样式与选中态(保留原生复选框可见) */
|
||||
#attentionKeysList li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
border: 1px solid rgba(0, 0, 0, 0.08);
|
||||
border-radius: 0.5rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
#attentionKeysList li:hover {
|
||||
border-color: rgba(0, 0, 0, 0.12);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
||||
background-color: rgba(249, 250, 251, 0.95);
|
||||
}
|
||||
#attentionKeysList li.selected {
|
||||
background-color: rgba(239, 246, 255, 0.95); /* light blue */
|
||||
border-color: rgba(59, 130, 246, 0.35);
|
||||
}
|
||||
#attentionKeysList .key-checkbox {
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.key-text {
|
||||
color: #374151 !important; /* gray-700 for light theme */
|
||||
text-shadow: none;
|
||||
@@ -1293,18 +1319,59 @@ endblock %} {% block head_extra_styles %}
|
||||
<input id="attentionErrCustom" type="number" min="100" max="599" placeholder="自定义" class="form-input h-7 w-20 px-2 py-1 text-xs border rounded focus:ring-primary-500 focus:border-primary-500" />
|
||||
<button id="attentionErrGo" class="px-2 py-1 rounded bg-blue-500 hover:bg-blue-600 text-white" title="查询">查询</button>
|
||||
</div>
|
||||
<div class="flex items-center gap-1 ml-3">
|
||||
<div class="flex items-center gap-2 ml-3">
|
||||
<label for="attentionLimitInput" class="text-xs text-gray-600">数量</label>
|
||||
<input id="attentionLimitInput" type="number" min="1" max="1000" value="10" class="form-input h-7 w-20 px-2 py-1 text-xs border rounded focus:ring-primary-500 focus:border-primary-500" />
|
||||
<!-- 全选移动到数量输入框右侧 -->
|
||||
<div class="flex items-center gap-1">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="selectAllAttention"
|
||||
class="form-checkbox h-4 w-4 text-primary-600 border-gray-300 rounded focus:ring-primary-500"
|
||||
onchange="toggleSelectAll('attention', this.checked)"
|
||||
/>
|
||||
<label for="selectAllAttention" class="text-xs select-none whitespace-nowrap font-semibold" style="color: #1f2937 !important;">全选</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-4">
|
||||
<ul id="attentionKeysList" class="space-y-2">
|
||||
<li class="text-center text-gray-500 py-2">加载中...</li>
|
||||
</ul>
|
||||
<div class="p-4">
|
||||
<!-- 批量操作按钮组 (仅在选中时显示) -->
|
||||
<div
|
||||
id="attentionBatchActions"
|
||||
class="p-3 border mb-3 hidden flex items-center flex-wrap gap-3"
|
||||
style="background-color: rgba(249, 250, 251, 0.95); border-color: rgba(0, 0, 0, 0.08);"
|
||||
>
|
||||
<span class="text-sm font-semibold whitespace-nowrap" style="color: #1f2937 !important;">
|
||||
已选择 <span id="attentionSelectedCount">0</span> 项
|
||||
</span>
|
||||
<button
|
||||
class="flex items-center gap-1 bg-success-600 hover:bg-success-700 text-white px-2.5 py-1 rounded-lg text-xs font-medium transition-all duration-200 disabled:cursor-not-allowed"
|
||||
onclick="event.stopPropagation(); showVerifyModal('attention', event)"
|
||||
disabled
|
||||
>
|
||||
<i class="fas fa-check-double"></i> 批量验证
|
||||
</button>
|
||||
<button
|
||||
class="flex items-center gap-1 bg-blue-500 hover:bg-blue-600 text-white px-2.5 py-1 rounded-lg text-xs font-medium transition-all duration-200 disabled:cursor-not-allowed"
|
||||
onclick="event.stopPropagation(); copySelectedKeys('attention')"
|
||||
disabled
|
||||
>
|
||||
<i class="fas fa-copy"></i> 批量复制
|
||||
</button>
|
||||
<button
|
||||
class="flex items-center gap-1 bg-red-800 hover:bg-red-900 text-white px-2.5 py-1 rounded-lg text-xs font-medium transition-all duration-200 disabled:cursor-not-allowed"
|
||||
onclick="event.stopPropagation(); showDeleteConfirmationModal('attention', event)"
|
||||
disabled
|
||||
>
|
||||
<i class="fas fa-trash-alt"></i> 批量删除
|
||||
</button>
|
||||
</div>
|
||||
<ul id="attentionKeysList" class="space-y-2">
|
||||
<li class="text-center text-gray-500 py-2">加载中...</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 有效密钥区域 -->
|
||||
|
||||
Reference in New Issue
Block a user