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))