From 04df078fcf3121368a08cd291cbc4d9fd452c6d0 Mon Sep 17 00:00:00 2001 From: cat-shark <1716967236@qq.com> Date: Sun, 2 Aug 2026 11:32:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B8=85=E7=90=86=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E6=BA=90=E7=A0=81=E7=89=87=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/standardMindMap.ts | 11 ----------- src/components/MindMapViewer.vue | 10 ---------- src/components/ReviewRecall.vue | 1 - src/components/TaskForm.vue | 24 +++++++++--------------- src/components/Welcome.vue | 2 -- src/components/composables/useTimer.ts | 6 ------ 6 files changed, 9 insertions(+), 45 deletions(-) diff --git a/src/api/standardMindMap.ts b/src/api/standardMindMap.ts index f84d711..4b85bf6 100644 --- a/src/api/standardMindMap.ts +++ b/src/api/standardMindMap.ts @@ -32,12 +32,6 @@ export interface RecallRecord { createdTime: string; } -export interface FindNodeResult { - path: string; - nodeTitle: string; - score: number; -} - /** 获取/自动生成标准思维导图 */ export const getStandardMindMap = (taskNum: string) => { return request.get(`/review/standard-mind-map/${taskNum}`); @@ -69,8 +63,3 @@ export const findNode = (taskNum: string, content: string) => { export const listRecallRecords = (taskNum: string) => { return request.get(`/review/standard-mind-map/${taskNum}/recall-records`); }; - -/** 获取单条回忆对比记录 */ -export const getRecallRecord = (recordId: number) => { - return request.get(`/review/standard-mind-map/recall-records/${recordId}`); -}; diff --git a/src/components/MindMapViewer.vue b/src/components/MindMapViewer.vue index 3ad2bab..4be3aa3 100644 --- a/src/components/MindMapViewer.vue +++ b/src/components/MindMapViewer.vue @@ -27,13 +27,9 @@ const props = defineProps<{ height?: string; /** 节点可选择模式(点击节点触发 node-select 事件) */ selectable?: boolean; - /** 当前选中的节点路径(用于高亮,仅在 selectable 模式下生效) */ - selectedPath?: string; }>(); const emit = defineEmits<{ - /** 编辑模式下结构变化时抛出最新大纲文本 */ - (e: "change", outline: string): void; /** 点击带溯源信息的节点 */ (e: "node-click", node: { sourceType: string; sourceId: number }): void; /** 选择模式下点击节点,返回标题+路径 */ @@ -156,12 +152,6 @@ const render = () => { }); instance.init(toElixirData(props.tree)); - if (props.editable) { - instance.bus.addListener("operation", () => { - emit("change", toOutline()); - }); - } - // mind-elixir v5: selectNode(el) is called on every node click, but the // selectNewNode event is never fired (it requires selectNode(el, true), // which the default click handler never passes). Monkey-patch selectNode diff --git a/src/components/ReviewRecall.vue b/src/components/ReviewRecall.vue index 521c460..42a9dea 100644 --- a/src/components/ReviewRecall.vue +++ b/src/components/ReviewRecall.vue @@ -7,7 +7,6 @@ import { recallCompare, updateStandardMindMap, listRecallRecords, - findNode, type StandardMindMap, type RecallRecord, } from "@/api/standardMindMap"; diff --git a/src/components/TaskForm.vue b/src/components/TaskForm.vue index 47fc233..3001bb9 100644 --- a/src/components/TaskForm.vue +++ b/src/components/TaskForm.vue @@ -276,7 +276,6 @@ const isMobile = computed(() => screenWidth.value <= 900); // 学习材料 Markdown 预览 const showPreview = ref(false); const materialPreview = ref(""); -const previewLoading = ref(false); const escapeHtml = (s: string) => s.replace(/&/g, "&").replace(//g, ">"); const escapeAttr = (s: string) => s.replace(/"/g, """).replace(/&/g, "&"); @@ -312,20 +311,15 @@ async function previewMaterial() { showPreview.value = true; const raw = materialUrl.value || ""; if (!raw.trim()) { materialPreview.value = ""; return; } - previewLoading.value = true; - try { - const titles: Record = {}; - const bareUrls = new Set(); - raw.replace(/https?:\/\/[^\s)\u3001\uFF09\u300D\u300B<>]+/g, (url) => { - bareUrls.add(url.replace(/[.。,,;;!!??)】」』\]]+$/, "")); - return url; - }); - const results = await Promise.all([...bareUrls].map(async (u) => ({ u, t: await getUrlTitle(u) }))); - results.forEach(({ u, t }) => { titles[u] = t; }); - materialPreview.value = renderMarkdown(raw, titles); - } finally { - previewLoading.value = false; - } + const titles: Record = {}; + const bareUrls = new Set(); + raw.replace(/https?:\/\/[^\s)\u3001\uFF09\u300D\u300B<>]+/g, (url) => { + bareUrls.add(url.replace(/[.。,,;;!!??)】」』\]]+$/, "")); + return url; + }); + const results = await Promise.all([...bareUrls].map(async (u) => ({ u, t: await getUrlTitle(u) }))); + results.forEach(({ u, t }) => { titles[u] = t; }); + materialPreview.value = renderMarkdown(raw, titles); } diff --git a/src/components/Welcome.vue b/src/components/Welcome.vue index 18a3d64..c293210 100644 --- a/src/components/Welcome.vue +++ b/src/components/Welcome.vue @@ -12,7 +12,6 @@ interface SessionGroup { taskNum: string; content: string; hasReport: boolean; - fragmentCount: number; navigateType: string; navigateId: number; } @@ -43,7 +42,6 @@ const sessionGroups = computed(() => { taskNum: first.taskNum, content, hasReport: !!report, - fragmentCount: fragments.length, navigateType: report ? "report" : "fragment", navigateId: report ? report.id : (fragments[0]?.id ?? 0), }); diff --git a/src/components/composables/useTimer.ts b/src/components/composables/useTimer.ts index cd13a1c..278a8fe 100644 --- a/src/components/composables/useTimer.ts +++ b/src/components/composables/useTimer.ts @@ -8,7 +8,6 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') { const remainingTime = ref(25 * 60 * 1000); const timerRunning = ref(false); const timerIsOver = ref(false); - const audioActivated = ref(false); let timerInterval: number; const audio = new Audio(audioUrl); @@ -65,10 +64,8 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') { await audio.play(); audio.pause(); audio.currentTime = 0; - audioActivated.value = true; return true; } catch { - audioActivated.value = false; return false; } }; @@ -82,7 +79,6 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') { await audio.play(); audio.pause(); audio.currentTime = 0; - audioActivated.value = true; resolve(true); } catch { resolve(false); @@ -95,7 +91,6 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') { return { timerMinutes, timerSeconds, - remainingTime, timerRunning, timerIsOver, runCountdown, @@ -103,6 +98,5 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') { clear, checkAudioPermission, requestAudioPermission, - audioActivated, }; }