feat(demo): 按插件当前实现重写演示页

- 列表/筛选对齐真实 Console:八维筛选、语义动作中文描述、登录失败结果语义
- 详情抽屉展示字段级 diff(脱敏/截断/封顶)与 AuditLog Extension 原始 JSON
- 新增行内「历史」快捷、按筛选条件导出 UTF-8 BOM CSV
- 设置页覆盖审计开关/字段变更/系统变更/保留期与登录失败告警(含测试与模拟触发)
- 模拟器支持 HTTP 捕获管线与系统内部变更两条通道
- 核心纯函数重写并扩充至 56 个单元用例
This commit is contained in:
2026-11-23 00:05:12 +08:00
parent 602744debd
commit afda8d04fd
8 changed files with 3759 additions and 828 deletions
+308 -79
View File
@@ -15,6 +15,8 @@
--warn-tint: rgba(217, 119, 6, 0.1);
--info: #2563eb;
--info-tint: rgba(37, 99, 235, 0.1);
--purple: #7c3aed;
--purple-tint: rgba(124, 58, 237, 0.1);
--gray-50: #f9fafb;
--gray-100: #f3f4f6;
--gray-200: #e5e7eb;
@@ -30,12 +32,16 @@
* { box-sizing: border-box; }
html, body { height: 100%; }
/* hidden 属性优先于组件的 display 声明(如 .alert-banner{display:flex}) */
[hidden] { display: none !important; }
html { height: 100%; }
body {
margin: 0;
min-height: 100vh;
display: flex;
min-width: 1080px;
min-width: 1100px;
font-size: 14px;
color: var(--gray-900);
background: var(--gray-100);
@@ -165,6 +171,8 @@ body {
.readonly-hint { color: var(--primary-dark); }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tabs {
display: flex;
gap: 4px;
@@ -207,6 +215,13 @@ body {
padding: 14px 18px 0;
}
.card-sub {
font-size: 12.5px;
color: var(--gray-500);
line-height: 1.6;
padding: 6px 18px 0;
}
.btn {
appearance: none;
border: none;
@@ -219,12 +234,17 @@ body {
align-items: center;
gap: 6px;
transition: filter 0.15s, background 0.15s;
white-space: nowrap;
}
.btn svg {
width: 13px;
height: 13px;
fill: currentColor;
width: 14px;
height: 14px;
fill: none;
stroke: currentColor;
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
.btn-primary { background: var(--primary); color: #fff; }
@@ -237,6 +257,8 @@ body {
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-link {
appearance: none;
border: none;
@@ -244,10 +266,8 @@ body {
color: var(--primary-dark);
font-size: 13px;
cursor: pointer;
padding: 8px 4px;
align-self: flex-end;
padding: 6px 4px;
}
.btn-link:hover { text-decoration: underline; }
.icon-btn {
@@ -262,8 +282,8 @@ body {
cursor: pointer;
line-height: 1;
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.icon-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.input {
border: 1px solid var(--gray-300);
@@ -277,12 +297,13 @@ body {
}
.input:focus,
select:focus {
select:focus,
textarea:focus {
border-color: var(--primary);
box-shadow: 0 0 0 2px var(--primary-tint);
}
select, .input { min-width: 0; }
select, .input, textarea { min-width: 0; }
select {
appearance: none;
@@ -296,8 +317,21 @@ select {
cursor: pointer;
}
textarea {
border: 1px solid var(--gray-300);
border-radius: 6px;
padding: 8px 10px;
font-family: ui-monospace, Consolas, monospace;
font-size: 12px;
line-height: 1.55;
resize: vertical;
width: 100%;
}
.hint { font-size: 12px; color: var(--gray-400); }
.muted { color: var(--gray-400); font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.break-all { word-break: break-all; }
/* ============ 横幅 ============ */
.banner {
@@ -305,31 +339,64 @@ select {
padding: 10px 14px;
font-size: 13px;
margin-bottom: 14px;
line-height: 1.55;
}
.banner-warn { background: var(--warn-tint); color: var(--warn); border: 1px solid rgba(217, 119, 6, 0.25); }
.banner-danger { background: var(--danger-tint); color: var(--danger); border: 1px solid rgba(215, 29, 29, 0.25); }
.alert-banner {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.alert-banner-body { flex: 1; }
.alert-banner-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.alert-banner-actions .btn-link { color: var(--danger); }
/* ============ 筛选栏 ============ */
.filter-bar {
display: flex;
align-items: flex-end;
gap: 12px;
.filter-card {
padding: 12px 16px;
margin-bottom: 14px;
flex-wrap: wrap;
}
.filter-item { display: flex; flex-direction: column; gap: 4px; }
.filter-item.grow { flex: 1; min-width: 180px; }
.filter-item label { font-size: 11px; color: var(--gray-500); font-weight: 600; }
.filter-item select, .filter-item .input { min-width: 120px; width: 100%; }
.filter-grid {
display: grid;
grid-template-columns: repeat(8, minmax(0, 1fr)) auto;
gap: 10px 12px;
align-items: end;
}
/* ============ 表格 ============ */
.filter-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-item > span { font-size: 11px; color: var(--gray-500); font-weight: 600; white-space: nowrap; }
.filter-item input,
.filter-item select { width: 100%; height: 32px; font-size: 12.5px; }
.filter-actions { display: flex; gap: 8px; }
.filter-note {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 10px;
padding-top: 10px;
border-top: 1px dashed var(--gray-200);
font-size: 12px;
color: var(--gray-500);
}
/* ============ 列表 ============ */
.table-card { overflow: hidden; }
.audit-list-wrap { overflow-x: auto; }
.audit-table {
width: 100%;
min-width: 900px;
border-collapse: collapse;
table-layout: fixed;
}
.audit-table th {
@@ -337,17 +404,18 @@ select {
font-size: 12px;
font-weight: 600;
color: var(--gray-500);
padding: 10px 16px;
padding: 10px 14px;
background: var(--gray-50);
border-bottom: 1px solid var(--gray-200);
white-space: nowrap;
}
.audit-table td {
padding: 10px 16px;
padding: 9px 14px;
border-bottom: 1px solid var(--gray-100);
font-size: 13px;
vertical-align: middle;
overflow: hidden;
}
.audit-table tbody tr {
@@ -356,20 +424,20 @@ select {
}
.audit-table tbody tr:hover { background: var(--gray-50); }
.audit-table tbody tr.selected td { background: var(--primary-tint); }
@keyframes rowFlash {
0% { background: var(--primary-tint); }
100% { background: transparent; }
}
tr.row-new td { animation: rowFlash 2.8s ease-out; }
tr.row-new td { animation: rowFlash 2.6s ease-out; }
.td-ip { color: var(--gray-500); font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-time { color: var(--gray-700); font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-ip { color: var(--gray-500); font-variant-numeric: tabular-nums; }
.cell-user { display: flex; align-items: center; gap: 8px; }
.cell-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-lines { min-width: 0; }
.u-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-time { font-size: 11.5px; color: var(--gray-400); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 动作徽标 */
.method {
@@ -384,10 +452,17 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
.m-post { background: var(--info-tint); color: var(--info); }
.m-put { background: var(--warn-tint); color: var(--warn); }
.m-delete { background: var(--danger-tint); color: var(--danger); }
.m-patch { background: rgba(124, 58, 237, 0.1); color: #6d28d9; }
.m-patch { background: var(--purple-tint); color: var(--purple); }
.m-get { background: var(--gray-100); color: var(--gray-500); }
/* 资源列 */
.res-line {
display: flex;
align-items: center;
gap: 6px;
overflow: hidden;
white-space: nowrap;
}
.rt {
display: inline-block;
font-size: 11px;
@@ -396,29 +471,64 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
background: var(--gray-100);
border-radius: 4px;
padding: 2px 7px;
margin-right: 8px;
}
.rn { color: var(--gray-500); font-size: 12.5px; word-break: break-all; }
/* 结果徽标 */
.result {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 12.5px;
font-weight: 500;
font-variant-numeric: tabular-nums;
}
.result i {
width: 7px;
height: 7px;
border-radius: 50%;
flex-shrink: 0;
}
.result.ok { color: #16a34a; }
.result.ok i { background: #16a34a; }
.result.fail { color: var(--danger); }
.result.fail i { background: var(--danger); }
.rn {
color: var(--gray-700);
font-size: 12.5px;
overflow: hidden;
text-overflow: ellipsis;
}
.history-link {
flex-shrink: 0;
font-size: 11.5px;
color: var(--primary-dark);
text-decoration: none;
cursor: pointer;
}
.history-link:hover { text-decoration: underline; }
.path-line {
margin-top: 2px;
font-family: ui-monospace, Consolas, monospace;
font-size: 11px;
color: var(--gray-400);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 描述列 */
.action-desc {
display: inline-block;
max-width: 100%;
font-size: 12.5px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
.changes-hint {
display: inline-block;
margin-left: 4px;
padding: 1px 5px;
border-radius: 4px;
font-size: 10.5px;
color: var(--warn);
background: var(--warn-tint);
vertical-align: middle;
}
/* 结果徽标 */
.status-badge {
display: inline-block;
padding: 2px 7px;
border-radius: 4px;
font-size: 11.5px;
font-weight: 600;
font-family: ui-monospace, Consolas, monospace;
}
.status-ok { color: #0f766e; background: rgba(76, 203, 160, 0.15); }
.status-fail { color: var(--danger); background: rgba(215, 29, 29, 0.12); }
/* 空状态 */
.empty-state {
@@ -444,11 +554,11 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
.pg-right { display: flex; align-items: center; gap: 8px; }
.pg-right select { padding: 5px 24px 5px 8px; font-size: 12.5px; }
.icon-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.pg-page { font-size: 12.5px; color: var(--gray-500); font-variant-numeric: tabular-nums; }
/* ============ 设置页 ============ */
#panel-settings .settings-card { max-width: 780px; }
.settings-card { margin-bottom: 16px; padding-bottom: 6px; }
#panel-settings .settings-card { max-width: 820px; }
.settings-card { margin-bottom: 16px; padding-bottom: 4px; }
.setting-row {
display: flex;
@@ -459,11 +569,18 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
border-bottom: 1px solid var(--gray-100);
}
.setting-text { max-width: 640px; }
.setting-text { max-width: 620px; }
.s-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.s-desc { font-size: 12.5px; color: var(--gray-500); line-height: 1.5; }
.s-desc { font-size: 12.5px; color: var(--gray-500); line-height: 1.55; }
.s-desc code {
background: var(--gray-100);
border-radius: 4px;
padding: 1px 5px;
font-size: 11.5px;
}
.input.num { width: 90px; text-align: center; }
.input.num { width: 96px; text-align: center; flex-shrink: 0; }
.input.secret-input { width: 280px; flex-shrink: 0; }
.settings-actions {
display: flex;
@@ -480,7 +597,16 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
}
.clean-stats .num-warn { color: var(--danger); font-weight: 600; }
.settings-card .btn { margin: 0 18px 16px; }
.alert-preview {
margin: 0 18px 16px;
padding: 12px;
background: var(--secondary);
color: #d1fae5;
border-radius: 6px;
font-size: 11.5px;
line-height: 1.55;
overflow-x: auto;
}
/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
@@ -525,7 +651,7 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
flex-shrink: 0;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.c-a { background: #4ccba0; }
.c-b { background: #6366f1; }
@@ -545,8 +671,8 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
position: fixed;
top: 0;
right: 0;
width: 440px;
max-width: 92vw;
width: 480px;
max-width: 94vw;
height: 100vh;
background: #fff;
z-index: 50;
@@ -571,7 +697,13 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
}
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-sub { font-size: 12px; color: var(--gray-400); margin-top: 3px; font-family: ui-monospace, Consolas, monospace; }
.drawer-sub {
font-size: 11.5px;
color: var(--gray-400);
margin-top: 3px;
font-family: ui-monospace, Consolas, monospace;
word-break: break-all;
}
.readonly-banner {
background: var(--primary-tint);
@@ -586,24 +718,26 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
.detail-list { margin: 0; }
.detail-list .d-row {
padding: 9px 0;
display: flex;
gap: 12px;
padding: 8px 0;
border-bottom: 1px dashed var(--gray-200);
}
.detail-list dt {
font-size: 11.5px;
flex: 0 0 5.5rem;
font-size: 12px;
color: var(--gray-500);
font-weight: 600;
margin-bottom: 5px;
padding-top: 1px;
}
.detail-list dd {
flex: 1;
margin: 0;
font-size: 13px;
font-size: 12.5px;
word-break: break-all;
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.path-code {
@@ -617,9 +751,48 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
line-height: 1.6;
}
.ua { font-size: 12px; color: var(--gray-500); line-height: 1.6; }
.ua { font-size: 11.5px; color: var(--gray-500); line-height: 1.6; }
.raw-json { margin-top: 16px; }
.changes { margin-top: 18px; }
.changes-title {
font-size: 13px;
font-weight: 600;
color: var(--gray-900);
margin: 0 0 6px;
}
.change-row {
display: flex;
gap: 10px;
padding: 8px 0;
border-bottom: 1px dashed var(--gray-200);
}
.change-badge {
flex: 0 0 auto;
align-self: flex-start;
margin-top: 1px;
padding: 1px 6px;
border-radius: 4px;
font-size: 11px;
font-weight: 600;
}
.change-added { color: #0f766e; background: rgba(76, 203, 160, 0.15); }
.change-updated { color: var(--warn); background: var(--warn-tint); }
.change-removed { color: var(--danger); background: var(--danger-tint); }
.change-body { flex: 1; min-width: 0; }
.change-field { font-size: 12px; color: var(--gray-900); word-break: break-all; }
.change-values {
display: flex;
align-items: baseline;
flex-wrap: wrap;
gap: 5px;
margin-top: 2px;
font-size: 12px;
color: var(--gray-700);
}
.change-old { color: var(--danger); text-decoration: line-through; }
.change-arrow { color: var(--gray-400); flex-shrink: 0; }
.raw-json { margin-top: 18px; }
.raw-json summary {
font-size: 12.5px;
color: var(--gray-500);
@@ -631,11 +804,12 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
.raw-json pre {
background: var(--secondary);
color: #d1fae5;
font-size: 11.5px;
font-size: 11px;
border-radius: 6px;
padding: 12px;
overflow-x: auto;
line-height: 1.6;
max-height: 320px;
}
/* ============ 模拟操作弹窗 ============ */
@@ -644,8 +818,10 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 520px;
max-width: 92vw;
width: 680px;
max-width: 94vw;
max-height: 90vh;
overflow-y: auto;
background: #fff;
border-radius: 10px;
z-index: 50;
@@ -656,7 +832,7 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
.modal[hidden] { display: none; }
@keyframes popIn {
from { transform: translate(-50%, -50%) scale(0.96); opacity: 0; }
from { transform: translate(-50%, -50%) scale(0.97); opacity: 0; }
to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@@ -674,7 +850,7 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
font-size: 12.5px;
color: var(--gray-500);
line-height: 1.6;
margin: 8px 0 14px;
margin: 8px 0 12px;
}
.modal-sub code {
@@ -684,9 +860,35 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
font-size: 11.5px;
}
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; flex: 1; }
.seg-tabs {
display: inline-flex;
background: var(--gray-100);
border-radius: 7px;
padding: 3px;
margin-bottom: 14px;
}
.seg-tab {
appearance: none;
border: none;
background: none;
padding: 6px 14px;
font-size: 12.5px;
font-weight: 500;
color: var(--gray-500);
border-radius: 5px;
cursor: pointer;
}
.seg-tab.active {
background: #fff;
color: var(--gray-900);
font-weight: 600;
box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; flex: 1; min-width: 0; }
.field label { font-size: 12px; color: var(--gray-500); font-weight: 600; }
.field select, .field .input { width: 100%; }
.field textarea { width: 100%; }
.field-row { display: flex; gap: 12px; }
@@ -710,7 +912,13 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 6px;
/* 弹窗内容超高时操作按钮始终可见 */
position: sticky;
bottom: -20px;
margin: 6px -22px -20px;
padding: 12px 22px 20px;
border-top: 1px solid var(--gray-100);
background: #fff;
}
/* ============ Toast ============ */
@@ -729,9 +937,30 @@ tr.row-new td { animation: rowFlash 2.6s ease-out; }
pointer-events: none;
transition: opacity 0.25s, transform 0.25s;
z-index: 100;
max-width: 60vw;
max-width: 70vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--primary-dark); }
.toast.warn { background: #92400e; }
/* ============ 响应式(演示页以桌面为主,窄屏保证可用) ============ */
@media (max-width: 1400px) {
.filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 1180px) {
body { min-width: 900px; }
.page-header { flex-direction: column; }
.header-actions { align-self: flex-end; }
}
@media (max-width: 760px) {
body { min-width: 0; }
.sidebar { display: none; }
.main { padding: 16px 14px 32px; }
.filter-grid { grid-template-columns: minmax(0, 1fr); }
.field-row { flex-direction: column; gap: 0; }
.modal { width: 94vw; }
}