From d6d5d13232ea71ae6cb8b3f4fe520082edf88556 Mon Sep 17 00:00:00 2001 From: lyc Date: Tue, 24 Dec 2024 14:32:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?pptList=20=E6=8F=92=E5=85=A5=E7=B4=A0?= =?UTF-8?q?=E6=9D=90=20=E5=A2=9E=E5=8A=A0loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/CanvasTool/MaterialDialog.vue | 63 ++++--------------- .../src/views/Editor/CanvasTool/index.vue | 23 +++---- 2 files changed, 21 insertions(+), 65 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 26c852e..7402fe8 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue @@ -21,6 +21,7 @@ import { sessionStore } from '@/utils/store' import { getSmarttalkPage } from '@/api/file' import * as commUtils from '@/utils/comm.js' import { getFileSuffix } from '@/utils/ruoyi.js' +import { PPTApi } from '../../../api' const emit = defineEmits(['insertMaterial', 'close']) @@ -60,73 +61,31 @@ const fileUrl = computed(() => (item) =>{ } }) - // 插入 const onInsert = async (item) =>{ + loading.value = true 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 }) - } - else{ - emit('insertMaterial',{ type: 'img', file }) - } -} - - - -const GetUrlParameters = (parameters) => { - let resData = ""; - - let url = document.location.toString(); - let arrUrl = url.split("?"); - // 判断是否有参数 - if (arrUrl.length > 1) { - // 拆分参数字符串 - let parametersArr = arrUrl[1].split("&"); - // 循环查找参数 - for (let i = 0; i <= parametersArr.length; i++) { - if (parametersArr[i]) { - // 拆分参数的键和值 - let parameterStr = parametersArr[i].split("="); - if (parameters == parameterStr[0]) { - resData = parameterStr[1]; - break; - } - } + try { + const data = await PPTApi.toRousrceUrl(file) + if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){ + emit('insertMaterial',{ type: 'video', data }) } + else{ + emit('insertMaterial',{ type: 'img', data }) + } + } finally { + loading.value = false } - return resData; } -const proxyToBase64 = (url)=> { - const dourl = GetUrlParameters(url) - console.log(dourl,'dourl') - return - axios({ - url: "/api/logo.png", - method: "get", - responseType: "blob", - }).then((res) => { - const reader = new FileReader(); - reader.readAsDataURL(res.data); - reader.onload = () => { - console.log(reader.result); - }; - }); -} - - - - // 关闭 const onClose = () =>{ emit('close') } - onMounted(() => { let data = sessionStore.get('subject.curNode') Object.assign(curNode, data); 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 ad51dd9..64da59a 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue @@ -281,20 +281,17 @@ const toggleNotesPanel = () => { // 插入素材 interface MaterialParams { type: string, - file: any + data: string } -const insertMaterial = (item: MaterialParams) =>{ - const { type, file } = item - PPTApi.toRousrceUrl(file).then(data=>{ - if(type == 'video'){ - createVideoElement(data) - } - else{ - createImageElement(data) - } - materiaVisible.value = false - }) - +const insertMaterial = async (item: MaterialParams) =>{ + const { type, data } = item + if(type == 'video'){ + createVideoElement(data) + } + else{ + createImageElement(data) + } + materiaVisible.value = false } // 文生图 From 406e581182a8660e0ffb38042dd8cf7a991b6afa Mon Sep 17 00:00:00 2001 From: lyc Date: Tue, 24 Dec 2024 14:47:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?edit=20=E6=A1=86=E6=9E=B6=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/src/views/teachingDesign/container/right.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/views/teachingDesign/container/right.vue b/src/renderer/src/views/teachingDesign/container/right.vue index 67d4dd6..3c91cb6 100644 --- a/src/renderer/src/views/teachingDesign/container/right.vue +++ b/src/renderer/src/views/teachingDesign/container/right.vue @@ -206,7 +206,7 @@ const handleCompleteText = async (answer, index) => { } // 保存模板 -const onSaveTemp = (item) => { +const onSaveTemp = async (item) => { if (item.answer == '') return const data = { @@ -216,7 +216,11 @@ const onSaveTemp = (item) => { content: item.answer, ex1: curNode.id } - tempSave(data).then(res => { }) + const res = await tempSave(data) + + if(!item.resultId){ + item.resultId = res.data + } } const isWordDialog = ref(false)