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