From 6c7284383a31606c259566eb33667dfa2646d20f Mon Sep 17 00:00:00 2001
From: zhuhao <979263092@qq.com>
Date: Fri, 20 Dec 2024 16:52:02 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=AB=E6=A0=BC=E5=9B=BE=E7=89=87=E6=8F=92?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/renderer/src/utils/talkFile/index.js | 2 +-
.../views/prepare/container/file-list-item.vue | 13 +++++++++++--
src/renderer/src/views/prepare/index.vue | 16 +++++++++++++---
3 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/src/renderer/src/utils/talkFile/index.js b/src/renderer/src/utils/talkFile/index.js
index ae5dfbb..fa56bb2 100644
--- a/src/renderer/src/utils/talkFile/index.js
+++ b/src/renderer/src/utils/talkFile/index.js
@@ -9,7 +9,7 @@ export const asyncLocalFile = (item) => {
if (isAsync === true) {
item.async = 'on'
if (type === 'down') {
- console.log(item)
+ // console.log(item)
ipcRenderer.send('download-file-default', {
url: item.fileFullPath,
fileName: item.fileNewName
diff --git a/src/renderer/src/views/prepare/container/file-list-item.vue b/src/renderer/src/views/prepare/container/file-list-item.vue
index c2e3e90..7f28cdb 100644
--- a/src/renderer/src/views/prepare/container/file-list-item.vue
+++ b/src/renderer/src/views/prepare/container/file-list-item.vue
@@ -126,11 +126,17 @@
下载
-
+
+
+
+
+ 导入PPT
+
@@ -181,7 +187,7 @@ export default {
}
}
},
- emits: { 'on-move': null, 'on-delete': null, 'on-set': null, 'on-reSet': null, 'on-delhomework': null,'on-filearg': null },
+ emits: { 'on-move': null, 'on-delete': null, 'on-set': null, 'on-reSet': null, 'on-delhomework': null,'on-filearg': null,'on-importPPT': null },
data() {
return {
listenList: [],
@@ -217,6 +223,9 @@ export default {
})
.catch(() => {})
},
+ importPPT(item) {
+ this.$emit('on-importPPT', item)
+ },
downloadFile(item) {
ipcRenderer.send('save-as', item.fileFullPath, item.fileShowName)
},
diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue
index 8091696..3413602 100644
--- a/src/renderer/src/views/prepare/index.vue
+++ b/src/renderer/src/views/prepare/index.vue
@@ -99,6 +99,7 @@
@on-delete="deleteTalk"
@on-set="openSet"
@on-delhomework="delhomework"
+ @on-importPPT="importPPT"
@on-filearg="isOpenHomework = true"
>
@@ -554,6 +555,15 @@ export default {
progDownFile(e, num) {
this.downloadNum = num
},
+ importPPT(item) {
+ let _this = this;
+ fetch(item.fileFullPath)
+ .then(res => res.arrayBuffer())
+ .then(buffer => {
+ let name = item.fileShowName.substring(0, item.fileShowName.lastIndexOf('.')) + '.aippt'
+ _this.createAIPPTByFile(buffer, name)
+ })
+ },
createFile() {
creatPPT(this.currentNode.itemtitle + '.pptx', this.uploadData).then((res) => {
this.currentFileList.unshift(res.resData)
@@ -572,7 +582,7 @@ export default {
console.log('文件名:', file.name);
console.log('文件类型:', file.type);
console.log('文件大小:', file.size);
- this.createAIPPTByFile(file)
+ this.createAIPPTByFile(file, this.currentNode.itemtitle + '.aippt')
}
},
async toRousrceUrl(o) {
@@ -618,7 +628,7 @@ export default {
}
}
},
- async createAIPPTByFile(file) {
+ async createAIPPTByFile(file,fileShowName) {
this.pgDialog.visible = true
this.pgDialog.pg.percentage = 0
const resPptJson = await PPTXFileToJson(file)
@@ -664,7 +674,7 @@ export default {
...this.uploadData,
fileId: slideid,
fileFlag: 'aippt',
- fileShowName: this.currentNode.itemtitle + '.aippt'
+ fileShowName: fileShowName
}).then(async (res) => {
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))