点击章节 存储章节id (临时)

This commit is contained in:
lyc 2024-09-22 12:34:15 +08:00
parent 71f7e4e5a1
commit 19a3b948c5
1 changed files with 28 additions and 0 deletions

View File

@ -109,6 +109,19 @@ const emitChangeBook = async () => {
}, },
node: curData node: curData
} }
/**
* 临时用 后续删除 unitId
*/
let levelFirstId = null
let levelSecondId = null
if (curData.parentNode) {
levelFirstId = curData.parentNode.id
levelSecondId = curData.id
} else {
levelFirstId = curData.id
levelSecondId = ''
}
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
emit('changeBook', data) emit('changeBook', data)
} }
@ -187,6 +200,21 @@ const handleNodeClick = (data, node) => {
} }
localStorage.setItem('defaultExpandedKeys', parentNode ? JSON.stringify([parentNode.id]) : JSON.stringify([data.id])) localStorage.setItem('defaultExpandedKeys', parentNode ? JSON.stringify([parentNode.id]) : JSON.stringify([data.id]))
localStorage.setItem('curNode', JSON.stringify(nodeData)) localStorage.setItem('curNode', JSON.stringify(nodeData))
/**
* 临时用 后续删除 unitId
*/
let levelFirstId = null
let levelSecondId = null
if (nodeData.parentNode) {
levelFirstId = nodeData.parentNode.id
levelSecondId = nodeData.id
} else {
levelFirstId = nodeData.id
levelSecondId = ''
}
localStorage.setItem('unitId', JSON.stringify({ levelFirstId, levelSecondId}))
emit('nodeClick', curData) emit('nodeClick', curData)
} }