ppt缩略图生成

This commit is contained in:
zdg 2024-12-24 11:32:52 +08:00
parent c152a3d3ee
commit db86299523
1 changed files with 7 additions and 4 deletions

View File

@ -205,13 +205,12 @@ import TreeLog from '@/views/prepare/components/treeLog.vue'
import classStart from './container/class-start.vue' // import classStart from './container/class-start.vue' //
import MsgEnum from '@/plugins/imChat/msgEnum' // im import MsgEnum from '@/plugins/imChat/msgEnum' // im
import * as commUtils from "@/utils/comm"; import * as commUtils from "@/utils/comm";
import * as Api_server from "@/api/apiService";
import msgUtils from "@/plugins/modal"; import msgUtils from "@/plugins/modal";
import * as Api_server from "@/api/apiService";
import * as API_entpcoursefile from "@/api/education/entpcoursefile"; import * as API_entpcoursefile from "@/api/education/entpcoursefile";
import { slidesToImg } from '@/utils/ppt' // ppt
import ChatWs from '@/plugins/socket' // socket import ChatWs from '@/plugins/socket' // socket
if (!ChatWs.ws) ChatWs.init() if (!ChatWs.ws) ChatWs.init()
// import Chat from '@/utils/chat' // im
// if (!Chat.imChat) Chat.init()
const toolStore = useToolState() const toolStore = useToolState()
const fs = require('fs') const fs = require('fs')
@ -573,8 +572,9 @@ export default {
},500) },500)
}) })
}, },
openFilePicker(){ async openFilePicker(){
this.$refs.fileInput.click(); this.$refs.fileInput.click();
// const files = await commUtils.getFiles()
}, },
handleFileChange(){ handleFileChange(){
const file = event.target.files[0]; const file = event.target.files[0];
@ -634,6 +634,8 @@ export default {
this.pgDialog.pg.percentage = 0 this.pgDialog.pg.percentage = 0
const resPptJson = await PPTXFileToJson(file) const resPptJson = await PPTXFileToJson(file)
const { def, slides, ...content } = resPptJson const { def, slides, ...content } = resPptJson
//
const thumbnails = await slidesToImg(slides, content.width)
// || 线 // || 线
let completed = 0 let completed = 0
const total = slides.length const total = slides.length
@ -686,6 +688,7 @@ export default {
title: '', title: '',
filetype: 'slide', filetype: 'slide',
slides: resSlides, slides: resSlides,
thumbnails, //
edituserid: this.userStore.userId edituserid: this.userStore.userId
} }
const res_3 = await API_entpcoursefile.batchAddNew(params) const res_3 = await API_entpcoursefile.batchAddNew(params)