diff --git a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue
index 9ad6322..a680871 100644
--- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue
+++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue
@@ -20,6 +20,7 @@ import { ref, reactive, onMounted, computed } from 'vue';
import { sessionStore } from '@/utils/store'
import { getSmarttalkPage } from '@/api/file'
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js'
+import * as commUtils from '@/utils/comm.js'
const emit = defineEmits(['insertMaterial', 'close'])
@@ -62,12 +63,18 @@ const fileUrl = computed(() => (item) =>{
// 插入
const onInsert = async (item) =>{
+
+ const bolb = commUtils.base64ToBlob(item.fileFullPath)
+
+ const file = commutils.blobToFile(bolb, item.fileShowName)
+
+
+
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
- emit('insertMaterial',{ type: 'video', data: item.fileFullPath })
+ emit('insertMaterial',{ type: 'video', file })
}
else{
- const base64 = await urlToBase64(item.fileFullPath)
- emit('insertMaterial',{ type: 'img', data: base64 })
+ emit('insertMaterial',{ type: 'img', file })
}
}
diff --git a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue
index 879865f..7780a65 100644
--- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue
+++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue
@@ -132,7 +132,7 @@
- { createImageElement(url); imgVisible = false }" />
+
@@ -165,6 +165,7 @@ import { PPTApi } from '../../../api'
import TextCreateImg from '@/components/ai-kolors/index.vue'
import { toPng } from 'html-to-image' // 引入html-to-image库
+
const mainStore = useMainStore()
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
@@ -274,21 +275,30 @@ const toggleNotesPanel = () => {
// 插入素材
interface MaterialParams {
type: string,
- data: string
+ file: any
}
const insertMaterial = (item: MaterialParams) =>{
- const { type, data } = item
- if(type == 'video'){
- createVideoElement(data)
- }
- else{
- createImageElement(data)
- }
+ const { type, file } = item
+ PPTApi.toRousrceUrl(file).then(data=>{
+ if(type == 'video'){
+ createVideoElement(data)
+ }
+ else{
+ createImageElement(data)
+ }
+ })
materiaVisible.value = false
}
// 文生图
const imgVisible = ref(false)
+const insertImg = async (file: any) =>{
+ PPTApi.toRousrceUrl(file).then(data=>{
+ createImageElement(data)
+ imgVisible.value = false
+ })
+}
+