宫格图片插件

This commit is contained in:
朱浩 2024-12-20 16:52:02 +08:00
parent 795c4d82c7
commit 6c7284383a
3 changed files with 25 additions and 6 deletions

View File

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

View File

@ -126,11 +126,17 @@
<span>下载</span>
</el-button>
</div>
<div v-if="item.fileSuffix === 'ppt' || item.fileSuffix === 'pptx'" class="item-popover-item">
<!-- <div v-if="item.fileSuffix === 'ppt' || item.fileSuffix === 'pptx'" class="item-popover-item">
<el-button text @click="adToKj(item)">
<i class="iconfont icon-jiahao"></i>
<span>加入课件</span>
</el-button>
</div>-->
<div v-if="item.fileSuffix === 'ppt' || item.fileSuffix === 'pptx'" class="item-popover-item">
<el-button text @click="importPPT(item)">
<i class="iconfont icon-jiahao"></i>
<span>导入PPT</span>
</el-button>
</div>
<div class="item-popover-item">
<el-button text @click="moveSmarttalkFun(item)">
@ -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)
},

View File

@ -99,6 +99,7 @@
@on-delete="deleteTalk"
@on-set="openSet"
@on-delhomework="delhomework"
@on-importPPT="importPPT"
@on-filearg="isOpenHomework = true"
>
<el-checkbox v-if="!item.uniquekey" label="" :value="item" />
@ -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))