[前端] 研读模块改造为三栏布局:文件树+预览+问答

This commit is contained in:
2026-04-02 12:01:27 +08:00
parent 4355e45580
commit a339757596
8 changed files with 1138 additions and 2159 deletions

View File

@@ -59,11 +59,11 @@
import {copyToClip} from "@/utils";
import {ElMessage} from "element-plus";
import {fileGuidInfo} from "@/api";
import {onMounted, ref} from "vue";
import {computed, inject, ref, type Ref} from "vue";
import MarkdownIt from "markdown-it";
import {transforMd} from "@/utils/markdown";
const state=history.state;
const selectedFile = inject('selectedFile') as Ref<any>;
const emits=defineEmits(["refreshAbs","refreshCon"]);
const mardown=new MarkdownIt();
@@ -73,18 +73,29 @@ const refreshAbs=()=>{
const refreshCon=()=>{
emits('refreshCon');
}
const historyParams=history.state;
const articleAbstract=ref(historyParams.articleAbstract);
const articleKeywords=ref(historyParams.articleKeywords);
const articleParagraph=ref(historyParams.articleParagraph);
//总结提炼
onMounted(async () => {
if(articleKeywords.value&&(articleKeywords.value.indexOf('关键词:')>-1||articleKeywords.value.indexOf('关键词:')>-1)){
articleKeywords.value=articleKeywords.value.substring(articleKeywords.value.indexOf('关键词:')+4,articleKeywords.value.length);
articleKeywords.value=articleKeywords.value.substring(articleKeywords.value.indexOf('关键词:')+4,articleKeywords.value.length);
const articleAbstract=ref('');
const articleKeywords=ref('');
const articleParagraph=ref('');
// 监听选中文件变化,更新导读内容
import {watch} from "vue";
watch(() => selectedFile.value, (newFile) => {
if (newFile) {
articleAbstract.value = newFile.articleAbstract || '';
let kw = newFile.articleKeywords || '';
if (kw && (kw.indexOf('关键词:') > -1 || kw.indexOf('关键词:') > -1)) {
kw = kw.substring(kw.indexOf('关键词:') + 4, kw.length);
kw = kw.substring(kw.indexOf('关键词:') + 4, kw.length);
}
articleKeywords.value = kw;
articleParagraph.value = newFile.articleParagraph || '';
} else {
articleAbstract.value = '';
articleKeywords.value = '';
articleParagraph.value = '';
}
})
}, {immediate: true});
const copyText=(text)=>{
copyToClip(text);
ElMessage.success("复制成功");
@@ -95,7 +106,7 @@ const refreshGuide=async (type:string)=>{
let param = {
type: type,
context: fileBox.innerText,
fileId: historyParams.fileId,
fileId: selectedFile.value?.fileId,
}
if(type==='6'){
articleAbstract.value=''