fix(frontend): 修复合并审阅发现的构建与契约问题

恢复 Vue TypeScript 生产构建,补齐可运行页面壳子,并修复文件树与 SSE 状态问题。

按 FastAPI Wire Contract 统一 Service DTO 映射,同时补充前端开发说明和问题修复复盘。
This commit is contained in:
2026-08-29 12:10:33 +08:00
parent c6c28e4ebe
commit 610fc77b0f
32 changed files with 1204 additions and 611 deletions
@@ -0,0 +1,31 @@
<script setup lang="ts">
import type { FileNode } from '@/contracts'
defineProps<{ node: FileNode; activePath: string | null }>()
const emit = defineEmits<{
open: [node: FileNode]
contextMenu: [event: MouseEvent, node: FileNode]
}>()
</script>
<template>
<div>
<div class="tree-node" :class="{ active: node.path === activePath }"
@click="emit('open', node)" @contextmenu="emit('contextMenu', $event, node)">
<span>{{ node.type === 'folder' ? (node.is_open ? '📂' : '📁') : '📄' }}</span>
<span class="name">{{ node.name }}</span>
<span v-if="node.is_dirty"></span>
</div>
<div v-if="node.type === 'folder' && node.is_open" class="children">
<FileTreeNode v-for="child in node.children ?? []" :key="child.id" :node="child" :active-path="activePath"
@open="emit('open', $event)" @context-menu="(event, target) => emit('contextMenu', event, target)" />
</div>
</div>
</template>
<style scoped>
.tree-node { display: flex; align-items: center; gap: var(--space-xs); min-height: 28px; padding: 0 var(--space-sm); border-radius: var(--radius-sm); cursor: pointer; }
.tree-node:hover, .tree-node.active { background: var(--color-background-secondary); }
.name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.children { padding-left: var(--space-md); }
</style>