From 50fc1e106d9455735d39cd9742cf5078361fe6cf Mon Sep 17 00:00:00 2001 From: zhuhao <979263092@qq.com> Date: Thu, 18 Jul 2024 09:13:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=96=87=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E6=A0=B8=E5=BF=83=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/utils/talkFile/index.js | 10 ++++++++++ src/renderer/src/views/prepare/index.vue | 15 +++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/renderer/src/utils/talkFile/index.js b/src/renderer/src/utils/talkFile/index.js index 61fe003..23495ce 100644 --- a/src/renderer/src/utils/talkFile/index.js +++ b/src/renderer/src/utils/talkFile/index.js @@ -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] + } +} diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index e03962e..8429c16 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -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] - } } } }