refactor: 清理未使用的源码片段

This commit is contained in:
2026-08-02 11:32:39 +08:00
parent bcec8512f4
commit 04df078fcf
6 changed files with 9 additions and 45 deletions
-11
View File
@@ -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}`);
};
-10
View File
@@ -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
-1
View File
@@ -7,7 +7,6 @@ import {
recallCompare,
updateStandardMindMap,
listRecallRecords,
findNode,
type StandardMindMap,
type RecallRecord,
} from "@/api/standardMindMap";
+9 -15
View File
@@ -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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
const escapeAttr = (s: string) => s.replace(/"/g, "&quot;").replace(/&/g, "&amp;");
@@ -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<string, string> = {};
const bareUrls = new Set<string>();
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<string, string> = {};
const bareUrls = new Set<string>();
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);
}
</script>
-2
View File
@@ -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<SessionGroup[]>(() => {
taskNum: first.taskNum,
content,
hasReport: !!report,
fragmentCount: fragments.length,
navigateType: report ? "report" : "fragment",
navigateId: report ? report.id : (fragments[0]?.id ?? 0),
});
-6
View File
@@ -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,
};
}