Merge pull request '修改默认展示判定逻辑' (#315) from qinqing_dev into main

Reviewed-on: #315
This commit is contained in:
qinqing 2024-10-14 16:25:37 +08:00
commit d68e4fef0b
1 changed files with 8 additions and 6 deletions

View File

@ -253,10 +253,11 @@ const getAllSubject = async () => {
} }
}) })
bookList.value = dataList bookList.value = dataList
const { id, rootid } = sessionStore.get('subject.curNode') const session = sessionStore.get('subject.curNode')
if(id && rootid){ console.log('session',session);
const idx = dataList.findIndex(item => item.id === id && item.rootid === rootid) let filePath = import.meta.env.VITE_APP_RES_FILE_PATH;
let filePath = import.meta.env.VITE_APP_RES_FILE_PATH; if(session.rootid){
const idx = dataList.findIndex(item => item.id === session.rootid)
if(idx > -1){ if(idx > -1){
bookInfo.value = {...dataList[idx]} bookInfo.value = {...dataList[idx]}
filePath += dataList[idx].fileurl.replace('.txt','.pdf') filePath += dataList[idx].fileurl.replace('.txt','.pdf')
@ -265,9 +266,10 @@ const getAllSubject = async () => {
filePath += dataList[0].fileurl.replace('.txt','.pdf') filePath += dataList[0].fileurl.replace('.txt','.pdf')
} }
await loadPdfAnimation(filePath) await loadPdfAnimation(filePath)
}else{
bookInfo.value = {...dataList[0]}
filePath += dataList[0].fileurl.replace('.txt','.pdf')
} }
} }
const bookChange = async (item, idx) => { const bookChange = async (item, idx) => {
booksel.value = idx booksel.value = idx