diff --git a/frontend/src/views/strategy/Code.vue b/frontend/src/views/strategy/Code.vue index d947e0d..b5a5fd9 100644 --- a/frontend/src/views/strategy/Code.vue +++ b/frontend/src/views/strategy/Code.vue @@ -170,12 +170,14 @@ async function openVersions(): Promise { } } +const activeVersion = ref('') async function showDiff(h8: string): Promise { if (!active.value) return diffReady.value = false + activeVersion.value = h8 try { diffCode.value = await getCodeVersion(active.value.name, h8) - // 抽屉展开动画(~300ms)期间容器宽为 0,Monaco diff 在其中创建会把左右分栏算死 + // 模态展开动画(~300ms)期间容器宽为 0,Monaco diff 在其中创建会把左右分栏算死 // (左栏被压扁且事后 layout() 救不回)。等动画结束容器全宽后再挂载组件。 setTimeout(() => { diffReady.value = true }, 360) } catch { @@ -245,31 +247,39 @@ async function showDiff(h8: string): Promise { - - -
-
-
-
版本历史 · {{ activeName }}
-
发起回测/模拟/实盘时的代码快照(内容寻址去重);点「对比」查看与当前代码差异
+ + +
+
+
+ 版本历史 · {{ activeName }} + 发起回测/模拟/实盘时的代码快照 · 点版本卡片对比当前 +
+
- +
+ 还没有快照——从策略档案发起过回测/模拟/实盘后自动生成 +
+
+ +
+
+ +
+
选择上方版本开始对比 · 左=快照 右=当前 滚动联动
-
- 还没有快照——从策略档案发起过回测/模拟/实盘后自动生成 -
-
- v{{ v.code_version }} - {{ v.saved_at }} - {{ (v.size / 1024).toFixed(1) }} KB - -
-
-
左右滚动联动 · 快照 vs 当前
- -
-
- +
@@ -402,13 +412,17 @@ async function showDiff(h8: string): Promise { background: #05080d; } -/* 版本历史抽屉 */ -.ver-drawer { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; } -.ver-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; } -.ver-row { - display: flex; align-items: center; gap: 12px; padding: 8px 10px; - border: 1px solid var(--border-2); border-radius: var(--r-sm); +/* 版本历史:全屏模态 */ +.ver-full { display: flex; flex-direction: column; gap: 10px; height: calc(100vh - 60px); padding: 4px 2px; } +.ver-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; } +.ver-chips { display: flex; gap: 8px; flex-wrap: wrap; } +.ver-chip { + display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px; + border: 1px solid var(--border-2); border-radius: var(--r-sm); background: transparent; + cursor: pointer; transition: border-color 0.12s var(--ease); } -.ver-row:hover { background: var(--bg-hover); } -.ver-diff { height: 460px; border: 1px solid var(--border-2); border-radius: var(--r-sm); overflow: hidden; } +.ver-chip:hover { border-color: rgba(0, 229, 255, 0.5); } +.ver-chip.on { border-color: var(--brand); background: rgba(0, 229, 255, 0.08); } +.ver-diff-full { flex: 1; min-height: 0; border: 1px solid var(--border-2); border-radius: var(--r-sm); overflow: hidden; } +.ver-empty { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 12.5px; } diff --git a/frontend/src/views/strategy/CodeSnapshotDrawer.vue b/frontend/src/views/strategy/CodeSnapshotDrawer.vue index 1fc8919..9bb5103 100644 --- a/frontend/src/views/strategy/CodeSnapshotDrawer.vue +++ b/frontend/src/views/strategy/CodeSnapshotDrawer.vue @@ -43,30 +43,30 @@ onMounted(load)