fix: 修复回忆页历史记录与重选节点交互
This commit is contained in:
@@ -51,6 +51,7 @@ const editViewer = ref<InstanceType<typeof MindMapViewer> | null>(null);
|
|||||||
// 回忆历史
|
// 回忆历史
|
||||||
const historyRecords = ref<RecallRecord[]>([]);
|
const historyRecords = ref<RecallRecord[]>([]);
|
||||||
const showHistory = ref(false);
|
const showHistory = ref(false);
|
||||||
|
const historyLoading = ref(false);
|
||||||
|
|
||||||
// 解析标准导图 JSON 为树节点
|
// 解析标准导图 JSON 为树节点
|
||||||
const standardTree = computed<MindMapTreeNode | null>(() => {
|
const standardTree = computed<MindMapTreeNode | null>(() => {
|
||||||
@@ -250,6 +251,8 @@ const resetComparison = () => {
|
|||||||
hasCompared.value = false;
|
hasCompared.value = false;
|
||||||
focusPath.value = "";
|
focusPath.value = "";
|
||||||
recallTree.value = buildEmptyRecallTree();
|
recallTree.value = buildEmptyRecallTree();
|
||||||
|
standardExpanded.value = true;
|
||||||
|
editingStandard.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 编辑标准导图
|
// 编辑标准导图
|
||||||
@@ -294,12 +297,19 @@ const cancelStandardEdit = () => {
|
|||||||
|
|
||||||
// 查看回忆历史
|
// 查看回忆历史
|
||||||
const loadHistory = async () => {
|
const loadHistory = async () => {
|
||||||
|
if (showHistory.value) {
|
||||||
|
showHistory.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
historyLoading.value = true;
|
||||||
try {
|
try {
|
||||||
const res = await listRecallRecords(taskNum.value);
|
const res = await listRecallRecords(taskNum.value);
|
||||||
historyRecords.value = res?.data || [];
|
historyRecords.value = res?.data || [];
|
||||||
showHistory.value = true;
|
showHistory.value = true;
|
||||||
} catch {
|
} catch {
|
||||||
ElMessage.error("加载历史记录失败");
|
ElMessage.error("加载历史记录失败");
|
||||||
|
} finally {
|
||||||
|
historyLoading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -311,6 +321,8 @@ const selectHistoryRecord = (record: RecallRecord) => {
|
|||||||
const tree = parseOutlineToTree(record.recallContent);
|
const tree = parseOutlineToTree(record.recallContent);
|
||||||
if (tree) recallTree.value = tree;
|
if (tree) recallTree.value = tree;
|
||||||
hasCompared.value = true;
|
hasCompared.value = true;
|
||||||
|
focusPath.value = record.focusPath || "";
|
||||||
|
standardExpanded.value = true;
|
||||||
} catch {
|
} catch {
|
||||||
ElMessage.error("解析对比记录失败");
|
ElMessage.error("解析对比记录失败");
|
||||||
}
|
}
|
||||||
@@ -375,8 +387,8 @@ onMounted(() => {
|
|||||||
<!-- 顶部操作栏 -->
|
<!-- 顶部操作栏 -->
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2>回忆复习</h2>
|
<h2>回忆复习</h2>
|
||||||
<el-button size="small" @click="loadHistory" v-if="!showHistory">
|
<el-button size="small" :loading="historyLoading" @click="loadHistory">
|
||||||
历史记录
|
{{ showHistory ? "收起历史" : "历史记录" }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -384,7 +396,7 @@ onMounted(() => {
|
|||||||
<div class="review-scope surface-card" v-if="focusPath">
|
<div class="review-scope surface-card" v-if="focusPath">
|
||||||
<span class="scope-label">复习起点</span>
|
<span class="scope-label">复习起点</span>
|
||||||
<el-tag size="small" type="success" effect="light">{{ focusPath }}</el-tag>
|
<el-tag size="small" type="success" effect="light">{{ focusPath }}</el-tag>
|
||||||
<el-button size="small" text @click="focusPath = ''">重选节点</el-button>
|
<el-button size="small" text @click="resetComparison">重选节点</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 节点选择确认弹窗 -->
|
<!-- 节点选择确认弹窗 -->
|
||||||
@@ -420,9 +432,9 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 回忆历史 -->
|
<!-- 回忆历史 -->
|
||||||
<article class="surface-card" v-if="showHistory && historyRecords.length > 0">
|
<article class="surface-card" v-if="showHistory">
|
||||||
<h3>回忆历史</h3>
|
<h3>回忆历史</h3>
|
||||||
<div class="history-list">
|
<div v-if="historyRecords.length > 0" class="history-list">
|
||||||
<div
|
<div
|
||||||
v-for="record in historyRecords"
|
v-for="record in historyRecords"
|
||||||
:key="record.id"
|
:key="record.id"
|
||||||
@@ -436,6 +448,7 @@ onMounted(() => {
|
|||||||
<span class="history-detail">✅{{ record.matchedCount }} ❌{{ record.missedCount }} ➕{{ record.extraCount }}</span>
|
<span class="history-detail">✅{{ record.matchedCount }} ❌{{ record.missedCount }} ➕{{ record.extraCount }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<el-empty v-else description="暂无回忆记录" :image-size="48" />
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<!-- 折叠时引导:告知用户展开标准导图 -->
|
<!-- 折叠时引导:告知用户展开标准导图 -->
|
||||||
|
|||||||
Reference in New Issue
Block a user