Files
ai-write/src/App.vue
empty 56c851a715 refactor: 将范式润色和对照检查改为左中右布局
- App.vue: compare 和 rewrite 页面纳入持久化布局
- ArticleRewritePanel: 移除返回按钮,适配 flex-1 布局
- ComparePanel: 移除返回按钮,适配 flex-1 布局
- MainContent: 对这两个页面不渲染(它们有自己的内部布局)
2026-01-11 22:37:07 +08:00

89 lines
3.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="flex h-screen w-full bg-slate-950 overflow-hidden">
<!-- 全局导航侧边栏 -->
<GlobalSidebar v-if="currentPage !== 'diffAnnotation'" />
<!-- 主体区域 -->
<main class="flex-1 flex overflow-hidden relative">
<!-- 差异标注页面全屏独占 -->
<DiffAnnotationPanel v-if="currentPage === 'diffAnnotation'" />
<!-- 持久化布局面板 -->
<template v-else>
<!-- 左侧/中间配置侧边栏 -->
<WriterPanel v-if="currentPage === 'writer'" />
<AnalysisPanel v-else-if="currentPage === 'analysis'" />
<ParadigmWriterPanel v-else-if="currentPage === 'paradigmWriter'" />
<ComparePanel v-else-if="currentPage === 'compare'" />
<ArticleRewritePanel v-else-if="currentPage === 'rewrite'" />
<DocumentsPanel
v-else-if="currentPage === 'documents'"
@toggle-version-panel="toggleVersionPanel"
@document-selected="handleDocumentSelected"
/>
<MaterialsPanel v-else-if="currentPage === 'materials'" />
<SettingsPanel v-else-if="currentPage === 'settings'" />
<!-- 右侧核心内容区compare rewrite 页面使用自己的内部布局 -->
<MainContent v-if="currentPage !== 'compare' && currentPage !== 'rewrite'" />
<!-- 侧滑浮层面板 (仅文稿页) -->
<DocumentVersionPanel
v-if="currentPage === 'documents'"
:visible="showVersionPanel"
:document-id="selectedDocumentId"
:current-content="selectedDocumentContent"
@close="showVersionPanel = false"
@restore="handleVersionRestore"
/>
</template>
</main>
</div>
</template>
<script setup>
import { ref, computed } from 'vue'
import { useAppStore } from './stores/app'
import GlobalSidebar from './components/GlobalSidebar.vue'
import WriterPanel from './components/WriterPanel.vue'
import AnalysisPanel from './components/AnalysisPanel.vue'
import DocumentsPanel from './components/DocumentsPanel.vue'
import MaterialsPanel from './components/MaterialsPanel.vue'
import SettingsPanel from './components/SettingsPanel.vue'
import MainContent from './components/MainContent.vue'
import ComparePanel from './components/ComparePanel.vue'
import DocumentVersionPanel from './components/DocumentVersionPanel.vue'
import DiffAnnotationPanel from './components/DiffAnnotationPanel.vue'
import ArticleRewritePanel from './components/ArticleRewritePanel.vue'
import ParadigmWriterPanel from './components/ParadigmWriterPanel.vue'
const appStore = useAppStore()
const currentPage = computed(() => appStore.currentPage)
// 版本历史面板状态
const showVersionPanel = ref(false)
const selectedDocumentId = ref(null)
const selectedDocumentContent = ref('')
// 切换版本面板
const toggleVersionPanel = () => {
showVersionPanel.value = !showVersionPanel.value
}
// 处理文稿选择
const handleDocumentSelected = (doc) => {
selectedDocumentId.value = doc?.id || null
selectedDocumentContent.value = doc?.content || ''
}
// 处理版本恢复
const handleVersionRestore = (content) => {
selectedDocumentContent.value = content
// 刷新 MainContent 显示
if (appStore.currentDocument) {
appStore.currentDocument.content = content
}
}
</script>