diff --git a/package.json b/package.json index 9c9774e..f27fc00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aix-win-ws", - "version": "2.5.8", + "version": "2.5.9", "description": "", "main": "./out/main/index.js", "author": "上海交大重庆人工智能研究院", diff --git a/src/renderer/src/AixPPTist/src/api/gridPic.ts b/src/renderer/src/AixPPTist/src/api/gridPic.ts new file mode 100644 index 0000000..7b4e9cf --- /dev/null +++ b/src/renderer/src/AixPPTist/src/api/gridPic.ts @@ -0,0 +1,47 @@ +export default class gridPic { + private static Instance: gridPic | null = null; + private gridPicRef: any = null; + + constructor(elRef?: any) { + if (elRef) { + this.gridPicRef = elRef; + } + if (!gridPic.Instance) { + gridPic.Instance = this; + } + return gridPic.Instance; + } + + // 初始化 + init(elRef) { + if (elRef) { + this.gridPicRef = elRef; + } + return this; + } + + addPIc(data) { + if (this.gridPicRef && this.gridPicRef.value && typeof this.gridPicRef.value.addPic === 'function') { + this.gridPicRef.value.addPic(data); + } + return this; + } + + // 静态方法 - 初始化 + static init(elRef) { + if (!gridPic.Instance) { + gridPic.Instance = new gridPic(elRef); + } else { + gridPic.Instance.init(elRef); + } + return gridPic.Instance; + } + + // 静态方法 - 打开推图上屏幕 + static addPIc(data) { + if (gridPic.Instance) { + return gridPic.Instance.addPIc(data); + } + return null; + } +} \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/api/index.ts b/src/renderer/src/AixPPTist/src/api/index.ts index 5e5bcb6..8e15fb7 100644 --- a/src/renderer/src/AixPPTist/src/api/index.ts +++ b/src/renderer/src/AixPPTist/src/api/index.ts @@ -274,6 +274,7 @@ export class PPTApi { static toRousrceUrl =async (o:any) => { const formData = new FormData() formData.append('file', o) + formData.append('ral', true) const res = await Api_server.Other.uploadFile(formData) if (res && res.code == 200){ const url = res?.url diff --git a/src/renderer/src/AixPPTist/src/api/types.ts b/src/renderer/src/AixPPTist/src/api/types.ts index 0beb5ef..5cf8c3f 100644 --- a/src/renderer/src/AixPPTist/src/api/types.ts +++ b/src/renderer/src/AixPPTist/src/api/types.ts @@ -132,6 +132,8 @@ export class MsgEnum { MSG_dz : 'dz', /** @desc: 疑惑 */ MSG_yh : 'yh', + /** @desc: 推图片上屏 */ + MSG_pushSreen_ImgList : 'pushSreen_ImgList', // === 新定义-消息头 === /** @desc: 课程创建-待开课 */ MSG_0000: 0x0000, diff --git a/src/renderer/src/AixPPTist/src/api/watcher.ts b/src/renderer/src/AixPPTist/src/api/watcher.ts index 005aef2..29ea2e7 100644 --- a/src/renderer/src/AixPPTist/src/api/watcher.ts +++ b/src/renderer/src/AixPPTist/src/api/watcher.ts @@ -12,9 +12,10 @@ import Classcourse from './classcourse' // 课程相关 import msgUtils from '@/plugins/modal' // 消息工具 import * as dialogUtils from '@/utils/dialog' // 弹窗-函数 import { Homework } from './index' // api-作业相关 -// import emitter from '@/utils/mitt' //mitt 事件总线 +import emitter from '@/utils/mitt' //mitt 事件总线 import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制 import hooksUpvote from './upvote' // 点赞-工具 +import gridPic from './gridPic' // 上屏-工具 /** * @description 监听器 @@ -98,6 +99,7 @@ export default () => { } break case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页 + emitter.emit('closegridPic') const slideIndex = content?.current || 0 const type = content?.animation // 上下动作 const steps = content?.animationSteps // 动画步骤 @@ -128,6 +130,10 @@ export default () => { case MsgEnum.HEADS.MSG_yh: // 疑惑 hooksUpvote.trigger(2) break + case MsgEnum.HEADS.MSG_pushSreen_ImgList: // 推图片上屏 + const imgArray = content.ImgList.map((obj) => obj.url); + emitter.emit('opengridPic',{arr:imgArray}) + break case MsgEnum.HEADS.MSG_0010: // 备用 break default: @@ -142,4 +148,14 @@ export default () => { window.close() // 关闭窗口 }, 1000) } + // setTimeout(async () => { + // emitter.emit('opengridPic',{arr:['https://prev.ysaix.com:7868/src/assets/images/homecard4.jpg']}) + // }, 3000) + + // setTimeout(async () => { + // emitter.emit('closegridPic') + // }, 6000) + // setTimeout(async () => { + // emitter.emit('opengridPic',{arr:['https://prev.ysaix.com:7868/src/assets/images/homecard4.jpg','https://prev.ysaix.com:7868/src/assets/images/homecard4.jpg']}) + // }, 9000) } \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/views/Editor/EditorHeader/index.vue b/src/renderer/src/AixPPTist/src/views/Editor/EditorHeader/index.vue index 8b5365a..83000c8 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/EditorHeader/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/EditorHeader/index.vue @@ -16,7 +16,7 @@ 导入 pptx 文件 导出文件 --> - 重置幻灯片 + 快捷操作 diff --git a/src/renderer/src/AixPPTist/src/views/Editor/Toolbar/ElementStylePanel/ImageStylePanel.vue b/src/renderer/src/AixPPTist/src/views/Editor/Toolbar/ElementStylePanel/ImageStylePanel.vue index 7445f45..02a794f 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/Toolbar/ElementStylePanel/ImageStylePanel.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/Toolbar/ElementStylePanel/ImageStylePanel.vue @@ -88,7 +88,9 @@ import Button from '../../../../components/Button.vue' import ButtonGroup from '../../../../components/ButtonGroup.vue' import Popover from '../../../../components/Popover.vue' import NumberInput from '../../../../components/NumberInput.vue' - +import { PPTApi } from '../../../../api' +import { Console } from 'node:console' +import { x64 } from 'crypto-js' const shapeClipPathOptions = CLIPPATHS const ratioClipOptions = [ { @@ -221,10 +223,14 @@ const presetImageClip = (shape: string, ratio = 0) => { const replaceImage = (files: FileList) => { const imageFile = files[0] if (!imageFile) return - getImageDataURL(imageFile).then(dataURL => { - const props = { src: dataURL } - updateImage(props) + PPTApi.toRousrceUrl(imageFile).then(data=>{ + const props = { src: data } + updateImage(props) }) + // getImageDataURL(imageFile).then(dataURL => { + // const props = { src: dataURL } + // updateImage(props) + // }) } // 重置图片:清除全部样式 diff --git a/src/renderer/src/AixPPTist/src/views/Screen/index.vue b/src/renderer/src/AixPPTist/src/views/Screen/index.vue index d5aa87f..b030a5b 100644 --- a/src/renderer/src/AixPPTist/src/views/Screen/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Screen/index.vue @@ -1,16 +1,26 @@ @@ -46,4 +77,8 @@ onUnmounted(() => document.removeEventListener('keydown', keydownListener)) width: 100%; height: 100%; } + + :deep(.gridPicRefdiv .el-dialog__body){ + height: 100% !important; +} \ No newline at end of file diff --git a/src/renderer/src/components/grid-pic/index.vue b/src/renderer/src/components/grid-pic/index.vue index 9725af6..43cdf90 100644 --- a/src/renderer/src/components/grid-pic/index.vue +++ b/src/renderer/src/components/grid-pic/index.vue @@ -16,15 +16,15 @@ -
- - +
+ + 添加 @@ -53,7 +53,7 @@ const props = defineProps({ showToolbar: { type: Boolean, - default: true + default: false } }) // 获取图片样式 @@ -149,20 +149,26 @@ addPic(src) } // 添加图片 - const addPic = (src) => { - if (gridPicList.value.length >= 9) { + const addPic = (data) => { + let list = Array.isArray(data)?data:[data] + if (gridPicList.value.length + list.length > 9) { console.log("超出九个图片") emits('outIndex') return } - if (!src) { - console.log("图片链接不能为空") - return; + let listArr = []; + for (let i = 0; i < list.length; i++) { + let src = list[i] + if (!src) { + console.log("图片链接不能为空") + return; + } + listArr.push({ + src: src, + backgroundColor: getRandomColor() + }) } - gridPicList.value.push({ - src: src, - backgroundColor: getRandomColor() - }) + gridPicList.value.push(...listArr) inputValue.value = '' } // 清空图片 diff --git a/src/renderer/src/components/grid-pic/viewer-item.vue b/src/renderer/src/components/grid-pic/viewer-item.vue index 0a4d300..d017854 100644 --- a/src/renderer/src/components/grid-pic/viewer-item.vue +++ b/src/renderer/src/components/grid-pic/viewer-item.vue @@ -140,5 +140,8 @@ watch(props.images, (newValue, oldValue) => { .viewer-item-wrap{ width: 100%; height: 100%; + :deep(.viewer-canvas img) { + display: block !important; + } } diff --git a/src/renderer/src/views/prepare/index.vue b/src/renderer/src/views/prepare/index.vue index 0403c15..6ff278e 100644 --- a/src/renderer/src/views/prepare/index.vue +++ b/src/renderer/src/views/prepare/index.vue @@ -10,7 +10,7 @@ 新建文枢课件 AI一键生成 - 打开宫格 + 导入PPT