diff --git a/chat_web_front/src/App.vue b/chat_web_front/src/App.vue index 51e6122..498f295 100644 --- a/chat_web_front/src/App.vue +++ b/chat_web_front/src/App.vue @@ -1,6 +1,6 @@ diff --git a/chat_web_front/src/components/Introduction.vue b/chat_web_front/src/components/Introduction.vue index 6dcad70..7d04a24 100644 --- a/chat_web_front/src/components/Introduction.vue +++ b/chat_web_front/src/components/Introduction.vue @@ -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; 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='' diff --git a/chat_web_front/src/components/Literatures.vue b/chat_web_front/src/components/Literatures.vue index a087468..2a095a9 100644 --- a/chat_web_front/src/components/Literatures.vue +++ b/chat_web_front/src/components/Literatures.vue @@ -27,9 +27,9 @@ diff --git a/chat_web_front/src/components/ReadingCreate.vue b/chat_web_front/src/components/ReadingCreate.vue index f5a6c12..ed89db3 100644 --- a/chat_web_front/src/components/ReadingCreate.vue +++ b/chat_web_front/src/components/ReadingCreate.vue @@ -47,7 +47,7 @@ - - \ No newline at end of file diff --git a/chat_web_front/src/views/reading/fileList.vue b/chat_web_front/src/views/reading/fileList.vue deleted file mode 100644 index 2918240..0000000 --- a/chat_web_front/src/views/reading/fileList.vue +++ /dev/null @@ -1,766 +0,0 @@ - - - - - \ No newline at end of file diff --git a/chat_web_front/src/views/reading/index.vue b/chat_web_front/src/views/reading/index.vue index 5754ed8..6d53906 100644 --- a/chat_web_front/src/views/reading/index.vue +++ b/chat_web_front/src/views/reading/index.vue @@ -1,565 +1,1167 @@