Merge pull request '点击章节 存储章节id (临时)' (#244) from lyc-dev into main

This commit is contained in:
lyc 2024-09-22 12:34:16 +08:00
commit df1f8737bd
1 changed files with 28 additions and 0 deletions

View File

@ -109,6 +109,19 @@ const emitChangeBook = async () => {
},
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)
}
@ -187,6 +200,21 @@ const handleNodeClick = (data, node) => {
}
localStorage.setItem('defaultExpandedKeys', parentNode ? JSON.stringify([parentNode.id]) : JSON.stringify([data.id]))
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)
}