refactor: 清理未使用的源码片段
This commit is contained in:
@@ -32,12 +32,6 @@ export interface RecallRecord {
|
|||||||
createdTime: string;
|
createdTime: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FindNodeResult {
|
|
||||||
path: string;
|
|
||||||
nodeTitle: string;
|
|
||||||
score: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 获取/自动生成标准思维导图 */
|
/** 获取/自动生成标准思维导图 */
|
||||||
export const getStandardMindMap = (taskNum: string) => {
|
export const getStandardMindMap = (taskNum: string) => {
|
||||||
return request.get(`/review/standard-mind-map/${taskNum}`);
|
return request.get(`/review/standard-mind-map/${taskNum}`);
|
||||||
@@ -69,8 +63,3 @@ export const findNode = (taskNum: string, content: string) => {
|
|||||||
export const listRecallRecords = (taskNum: string) => {
|
export const listRecallRecords = (taskNum: string) => {
|
||||||
return request.get(`/review/standard-mind-map/${taskNum}/recall-records`);
|
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}`);
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -27,13 +27,9 @@ const props = defineProps<{
|
|||||||
height?: string;
|
height?: string;
|
||||||
/** 节点可选择模式(点击节点触发 node-select 事件) */
|
/** 节点可选择模式(点击节点触发 node-select 事件) */
|
||||||
selectable?: boolean;
|
selectable?: boolean;
|
||||||
/** 当前选中的节点路径(用于高亮,仅在 selectable 模式下生效) */
|
|
||||||
selectedPath?: string;
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
/** 编辑模式下结构变化时抛出最新大纲文本 */
|
|
||||||
(e: "change", outline: string): void;
|
|
||||||
/** 点击带溯源信息的节点 */
|
/** 点击带溯源信息的节点 */
|
||||||
(e: "node-click", node: { sourceType: string; sourceId: number }): void;
|
(e: "node-click", node: { sourceType: string; sourceId: number }): void;
|
||||||
/** 选择模式下点击节点,返回标题+路径 */
|
/** 选择模式下点击节点,返回标题+路径 */
|
||||||
@@ -156,12 +152,6 @@ const render = () => {
|
|||||||
});
|
});
|
||||||
instance.init(toElixirData(props.tree));
|
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
|
// mind-elixir v5: selectNode(el) is called on every node click, but the
|
||||||
// selectNewNode event is never fired (it requires selectNode(el, true),
|
// selectNewNode event is never fired (it requires selectNode(el, true),
|
||||||
// which the default click handler never passes). Monkey-patch selectNode
|
// which the default click handler never passes). Monkey-patch selectNode
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
recallCompare,
|
recallCompare,
|
||||||
updateStandardMindMap,
|
updateStandardMindMap,
|
||||||
listRecallRecords,
|
listRecallRecords,
|
||||||
findNode,
|
|
||||||
type StandardMindMap,
|
type StandardMindMap,
|
||||||
type RecallRecord,
|
type RecallRecord,
|
||||||
} from "@/api/standardMindMap";
|
} from "@/api/standardMindMap";
|
||||||
|
|||||||
@@ -276,7 +276,6 @@ const isMobile = computed(() => screenWidth.value <= 900);
|
|||||||
// 学习材料 Markdown 预览
|
// 学习材料 Markdown 预览
|
||||||
const showPreview = ref(false);
|
const showPreview = ref(false);
|
||||||
const materialPreview = ref("");
|
const materialPreview = ref("");
|
||||||
const previewLoading = ref(false);
|
|
||||||
|
|
||||||
const escapeHtml = (s: string) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
const escapeHtml = (s: string) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||||
const escapeAttr = (s: string) => s.replace(/"/g, """).replace(/&/g, "&");
|
const escapeAttr = (s: string) => s.replace(/"/g, """).replace(/&/g, "&");
|
||||||
@@ -312,8 +311,6 @@ async function previewMaterial() {
|
|||||||
showPreview.value = true;
|
showPreview.value = true;
|
||||||
const raw = materialUrl.value || "";
|
const raw = materialUrl.value || "";
|
||||||
if (!raw.trim()) { materialPreview.value = ""; return; }
|
if (!raw.trim()) { materialPreview.value = ""; return; }
|
||||||
previewLoading.value = true;
|
|
||||||
try {
|
|
||||||
const titles: Record<string, string> = {};
|
const titles: Record<string, string> = {};
|
||||||
const bareUrls = new Set<string>();
|
const bareUrls = new Set<string>();
|
||||||
raw.replace(/https?:\/\/[^\s)\u3001\uFF09\u300D\u300B<>]+/g, (url) => {
|
raw.replace(/https?:\/\/[^\s)\u3001\uFF09\u300D\u300B<>]+/g, (url) => {
|
||||||
@@ -323,9 +320,6 @@ async function previewMaterial() {
|
|||||||
const results = await Promise.all([...bareUrls].map(async (u) => ({ u, t: await getUrlTitle(u) })));
|
const results = await Promise.all([...bareUrls].map(async (u) => ({ u, t: await getUrlTitle(u) })));
|
||||||
results.forEach(({ u, t }) => { titles[u] = t; });
|
results.forEach(({ u, t }) => { titles[u] = t; });
|
||||||
materialPreview.value = renderMarkdown(raw, titles);
|
materialPreview.value = renderMarkdown(raw, titles);
|
||||||
} finally {
|
|
||||||
previewLoading.value = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ interface SessionGroup {
|
|||||||
taskNum: string;
|
taskNum: string;
|
||||||
content: string;
|
content: string;
|
||||||
hasReport: boolean;
|
hasReport: boolean;
|
||||||
fragmentCount: number;
|
|
||||||
navigateType: string;
|
navigateType: string;
|
||||||
navigateId: number;
|
navigateId: number;
|
||||||
}
|
}
|
||||||
@@ -43,7 +42,6 @@ const sessionGroups = computed<SessionGroup[]>(() => {
|
|||||||
taskNum: first.taskNum,
|
taskNum: first.taskNum,
|
||||||
content,
|
content,
|
||||||
hasReport: !!report,
|
hasReport: !!report,
|
||||||
fragmentCount: fragments.length,
|
|
||||||
navigateType: report ? "report" : "fragment",
|
navigateType: report ? "report" : "fragment",
|
||||||
navigateId: report ? report.id : (fragments[0]?.id ?? 0),
|
navigateId: report ? report.id : (fragments[0]?.id ?? 0),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') {
|
|||||||
const remainingTime = ref(25 * 60 * 1000);
|
const remainingTime = ref(25 * 60 * 1000);
|
||||||
const timerRunning = ref(false);
|
const timerRunning = ref(false);
|
||||||
const timerIsOver = ref(false);
|
const timerIsOver = ref(false);
|
||||||
const audioActivated = ref(false);
|
|
||||||
|
|
||||||
let timerInterval: number;
|
let timerInterval: number;
|
||||||
const audio = new Audio(audioUrl);
|
const audio = new Audio(audioUrl);
|
||||||
@@ -65,10 +64,8 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') {
|
|||||||
await audio.play();
|
await audio.play();
|
||||||
audio.pause();
|
audio.pause();
|
||||||
audio.currentTime = 0;
|
audio.currentTime = 0;
|
||||||
audioActivated.value = true;
|
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
audioActivated.value = false;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -82,7 +79,6 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') {
|
|||||||
await audio.play();
|
await audio.play();
|
||||||
audio.pause();
|
audio.pause();
|
||||||
audio.currentTime = 0;
|
audio.currentTime = 0;
|
||||||
audioActivated.value = true;
|
|
||||||
resolve(true);
|
resolve(true);
|
||||||
} catch {
|
} catch {
|
||||||
resolve(false);
|
resolve(false);
|
||||||
@@ -95,7 +91,6 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') {
|
|||||||
return {
|
return {
|
||||||
timerMinutes,
|
timerMinutes,
|
||||||
timerSeconds,
|
timerSeconds,
|
||||||
remainingTime,
|
|
||||||
timerRunning,
|
timerRunning,
|
||||||
timerIsOver,
|
timerIsOver,
|
||||||
runCountdown,
|
runCountdown,
|
||||||
@@ -103,6 +98,5 @@ export function useTimer(audioUrl: string = '/resource/notification.mp3') {
|
|||||||
clear,
|
clear,
|
||||||
checkAudioPermission,
|
checkAudioPermission,
|
||||||
requestAudioPermission,
|
requestAudioPermission,
|
||||||
audioActivated,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user