Files
study-agent-ui/src/views/Library.vue
2026-08-02 21:01:42 +08:00

92 lines
2.2 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="library-view common-view">
<div class="view-header">
<div class="view-content">
<h2 class="view-title">知识库</h2>
<p class="view-subtitle">管理学习资料查看 AI 解析结果</p>
</div>
<el-button type="primary" :icon="Plus" @click="addFileClick">新增资料</el-button>
</div>
<library-file-list />
<library-file-dialog />
<library-file-content-dialog />
<library-file-train-dialog />
</div>
</template>
<script setup lang="ts">
import LibraryFileList from '@/components/Library/LibraryFileList.vue'
import LibraryFileDialog from '@/components/Library/LibraryFileDialog.vue'
import LibraryFileTrainDialog from '@/components/Library/LibraryFileTrainDialog.vue'
import LibraryFileContentDialog from '@/components/Library/LibraryFileContentDialog.vue'
import { useLibraryStore } from '@/stores/library.ts'
import { Plus } from '@element-plus/icons-vue'
import { onMounted } from 'vue'
const libraryStore = useLibraryStore()
onMounted(async () => {
await libraryStore.queryFileList()
})
const addFileClick = () => {
libraryStore.currentFile = libraryStore.getEmptyFile()
libraryStore.fileApiType = 'ADD'
libraryStore.activeStep = 1
libraryStore.fileDialogVisible = true
}
</script>
<style lang="scss">
.library-view {
.file-list {
display: flex;
flex-direction: column;
gap: 10px;
.file-card {
display: flex;
justify-content: space-between;
align-items: center;
.file-info {
display: flex;
align-items: center;
gap: 12px;
cursor: pointer;
.file-icon {
width: 42px;
height: 42px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
flex-shrink: 0;
}
.icon-pdf { background: #fee2e2; }
.icon-image { background: #dbeafe; }
.file-name {
font-size: 14px;
font-weight: 600;
color: #1e293b;
}
.file-meta {
font-size: 12px;
color: #94a3b8;
margin-top: 2px;
}
}
}
}
}
</style>