From 4ab07d247f48069b133adb65e2d84490cde212b7 Mon Sep 17 00:00:00 2001 From: lyc Date: Tue, 14 Jan 2025 11:25:57 +0800 Subject: [PATCH] =?UTF-8?q?edit=20=E8=80=83=E8=AF=95=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/api/mode/index.js | 8 + .../template-study/container/left-dialog.vue | 203 ++++++++---------- .../template-study/container/left.vue | 22 +- .../template-study/container/right.vue | 29 ++- .../views/teachingDesign/container/center.vue | 60 ++---- 5 files changed, 144 insertions(+), 178 deletions(-) diff --git a/src/renderer/src/api/mode/index.js b/src/renderer/src/api/mode/index.js index efbdcdb..40c4ce5 100644 --- a/src/renderer/src/api/mode/index.js +++ b/src/renderer/src/api/mode/index.js @@ -118,6 +118,14 @@ export function docList(params) { }) } +// 删除 doc ai文档 +export function removeDoc(id) { + return request({ + url: '/education/doc/' + id, + method: 'delete', + }) +} + // 保存教学大纲 export function addSyllabus(data) { return request({ diff --git a/src/renderer/src/components/template-study/container/left-dialog.vue b/src/renderer/src/components/template-study/container/left-dialog.vue index 3c34298..e251cc2 100644 --- a/src/renderer/src/components/template-study/container/left-dialog.vue +++ b/src/renderer/src/components/template-study/container/left-dialog.vue @@ -2,34 +2,44 @@ -
- +
-
    -
  • - - 预览 - {{ item.fileName }} -
  • -
+ + + + + {{ item.fileName }} +
+ 预览 + 删除 +
+
+
+
+
@@ -41,21 +51,18 @@
-
+
@@ -63,20 +70,19 @@ \ No newline at end of file + diff --git a/src/renderer/src/components/template-study/container/left.vue b/src/renderer/src/components/template-study/container/left.vue index d2b9285..4cd2bdc 100644 --- a/src/renderer/src/components/template-study/container/left.vue +++ b/src/renderer/src/components/template-study/container/left.vue @@ -2,8 +2,9 @@
- {{ curNode.edustage }}{{ curNode.edusubject }}{{ type == 1 ? '课标研读' : type == 2 ? '教材分析' : '考试分析' }} + {{ curNode.edustage }}{{ curNode.edusubject + }}{{ type == 1 ? '课标研读' : type == 2 ? '教材分析' : '考试分析' + }}
@@ -20,6 +21,7 @@ import { ref, onMounted, nextTick, reactive } from 'vue' import { sessionStore } from '@/utils/store' import PDF from '@/components/PdfJs/index.vue' import LeftDialog from './left-dialog.vue' +import emitter from '@/utils/mitt' const props = defineProps(['type']) @@ -29,6 +31,12 @@ const onClick = () => { showDialog.value = true } +emitter.on('changePdfUrl', async (data) => { + pdfUrl.value = '' + await nextTick() + pdfUrl.value = data.fileUrl +}) + // 加载PDF const pdfUrl = ref('') const curNode = reactive({}) @@ -36,16 +44,15 @@ onMounted(async () => { await nextTick() // 当前节点 let nodeData = sessionStore.get('subject.curNode') - Object.assign(curNode, nodeData); + Object.assign(curNode, nodeData) let data = sessionStore.get('subject.curBook') let fileurl = data.fileurl - if(props.type == 1){ + if (props.type == 1) { fileurl = `${data.edustage}-${data.edusubject}-课标.txt` } - if(fileurl == '') return + if (fileurl == '') return pdfUrl.value = import.meta.env.VITE_APP_RES_FILE_PATH + fileurl.replace('.txt', '.pdf') - }) @@ -53,6 +60,7 @@ onMounted(async () => { .container-left-page { height: 100%; flex-direction: column; + .container-left-header { height: 45px; background: #fff; @@ -70,4 +78,4 @@ onMounted(async () => { flex: 1; } } - \ No newline at end of file + diff --git a/src/renderer/src/components/template-study/container/right.vue b/src/renderer/src/components/template-study/container/right.vue index 543c928..e2cba23 100644 --- a/src/renderer/src/components/template-study/container/right.vue +++ b/src/renderer/src/components/template-study/container/right.vue @@ -16,7 +16,7 @@
- + 删除 @@ -104,6 +104,12 @@ import { cloneDeep } from 'lodash' const props = defineProps(['type']) const { user } = useUserStore() +const params = reactive( + { + prompt: '', + dataset_id: '' + } +) const curMode = ref(2) const modeOptions = ref([ { @@ -112,7 +118,8 @@ const modeOptions = ref([ }, { label: '知识库模型', - value: 2 + value: 2, + disabled: false } ]) @@ -288,12 +295,7 @@ const onEdit = (index, item) => { } // 重新研读 -const params = reactive( - { - prompt: '', - dataset_id: '' - } -) + const prompt = ref('') // 重新研读 @@ -483,7 +485,18 @@ onMounted(() => { getTemplateList() let jsonKey = `${modeType.value}-${data.edustage}-${data.edusubject}` + + params.dataset_id = dataSetJson[jsonKey] + if(!params.dataset_id){ + curMode.value = 1 + modeOptions.value.forEach(item => { + if(item.value == 2){ + item.disabled = true + } + }) + } + // 获取百度千帆会话ID conversation_id.value = localStorage.getItem('conversation_id') if (!conversation_id.value) { diff --git a/src/renderer/src/views/teachingDesign/container/center.vue b/src/renderer/src/views/teachingDesign/container/center.vue index b6472fe..f3efd8b 100644 --- a/src/renderer/src/views/teachingDesign/container/center.vue +++ b/src/renderer/src/views/teachingDesign/container/center.vue @@ -22,24 +22,22 @@
- +