基础文件上传核心开发

This commit is contained in:
朱浩 2024-07-18 09:13:57 +08:00
parent 36989c5ba3
commit 50fc1e106d
2 changed files with 13 additions and 12 deletions

View File

@ -8,3 +8,13 @@ export const isHaveLocalFile = async (fileNewName)=>{
})
})
}
export const parseCataByNode = (node) => {
if (node.parentNode) {
let arr = parseCataByNode(node.parentNode)
arr.push(node.id)
return arr
} else {
return [node.id]
}
}

View File

@ -77,7 +77,7 @@ import FileListItem from '@/views/prepare/container/file-list-item.vue'
import { getSmarttalkPage, moveSmarttalk } from '@/api/file'
import { toTimeText } from '@/utils/date'
import { ElMessage } from 'element-plus'
import { isHaveLocalFile } from '@/utils/talkFile'
import { isHaveLocalFile, parseCataByNode } from '@/utils/talkFile'
import FileOperBatch from '@/views/prepare/container/file-oper-batch.vue'
const { ipcRenderer } = window.electron || {}
export default {
@ -192,7 +192,7 @@ export default {
id: ids.join(),
textbookId: cataData.textBook.curBookId
}
let cata = this.parseCataByNode(cataData.node)
let cata = parseCataByNode(cataData.node)
if (
this.uploadData.levelFirstId == cata[0] &&
this.uploadData.levelSecondId == cata[1] &&
@ -250,7 +250,7 @@ export default {
nodeClick(data) {
if (this.currentNode.id === data.node.id) return
this.checkFileList = []
let cata = this.parseCataByNode(data.node)
let cata = parseCataByNode(data.node)
this.currentNode = data.node
this.uploadData.levelFirstId = cata[0]
this.uploadData.levelSecondId = cata[1]
@ -276,15 +276,6 @@ export default {
console.log(res)
this.isLoading = false
})
},
parseCataByNode(node) {
if (node.parentNode) {
let arr = this.parseCataByNode(node.parentNode)
arr.push(node.id)
return arr
} else {
return [node.id]
}
}
}
}