From a379176496ae557438d2685308cddffe26b1f1cb Mon Sep 17 00:00:00 2001 From: lyc Date: Fri, 13 Dec 2024 09:47:15 +0800 Subject: [PATCH] =?UTF-8?q?edti=20=E6=8F=92=E5=85=A5=E7=B4=A0=E6=9D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/Editor/CanvasTool/MaterialDialog.vue | 11 ++++------- .../AixPPTist/src/views/Editor/CanvasTool/index.vue | 3 ++- src/renderer/src/components/ai-kolors/index.vue | 11 ++++++----- 3 files changed, 12 insertions(+), 13 deletions(-) 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 a680871..26c852e 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue @@ -19,8 +19,8 @@ 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' +import { getFileSuffix } from '@/utils/ruoyi.js' const emit = defineEmits(['insertMaterial', 'close']) @@ -63,12 +63,9 @@ const fileUrl = computed(() => (item) =>{ // 插入 const onInsert = async (item) =>{ - - const bolb = commUtils.base64ToBlob(item.fileFullPath) - - const file = commutils.blobToFile(bolb, item.fileShowName) - - + const res = await fetch(item.fileFullPath) + const bolb = await res.blob() + const file = commUtils.blobToFile(bolb, item.fileShowName) if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){ emit('insertMaterial',{ type: 'video', 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 2ccd34a..ad51dd9 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue @@ -292,8 +292,9 @@ const insertMaterial = (item: MaterialParams) =>{ else{ createImageElement(data) } + materiaVisible.value = false }) - materiaVisible.value = false + } // 文生图 diff --git a/src/renderer/src/components/ai-kolors/index.vue b/src/renderer/src/components/ai-kolors/index.vue index 2276d95..d9d78c0 100644 --- a/src/renderer/src/components/ai-kolors/index.vue +++ b/src/renderer/src/components/ai-kolors/index.vue @@ -482,10 +482,7 @@ export default { //保存图片到素材库 async saveImage(resultIndex, index, url, resultItem) { - if(this.hasPPt){ - this.$emit('insertImg', url) - return - } + this.buttonStates[resultIndex][index].disabled = true; this.buttonStates[resultIndex][index].text = "正在保存..."; const numberIndex = url.indexOf('filename='); @@ -494,6 +491,7 @@ export default { const finalPath = path.substring(0, pngIndex + 4); try { const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`); + const hash = CryptoJS.MD5(blob).toString(); @@ -502,7 +500,10 @@ export default { let file = new File([blob], `${resultItem}.png`, { type: 'image/png' }) - + if(this.hasPPt){ + this.$emit('insertImg', file) + return + } // 添加参数 formData.append('md5', hash); formData.append('file', file);