diff --git a/.env.development b/.env.development index 422cd04..b20e6ac 100644 --- a/.env.development +++ b/.env.development @@ -17,6 +17,7 @@ VITE_APP_RES_FILE_PATH = 'https://file.ysaix.com:7868/src/assets/textbook/booktx VITE_APP_BUILD_BASE_PATH = 'https://file.ysaix.com:7868/' # websocket 地址 +# VITE_APP_WS_URL = 'wss://prev.ysaix.com:7868' VITE_APP_WS_URL = 'wss://file.ysaix.com:7868' # VITE_APP_WS_URL = 'ws://192.168.2.16:7865' 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/chat.ts b/src/renderer/src/AixPPTist/src/api/chat.ts index 70574e2..9987c7d 100644 --- a/src/renderer/src/AixPPTist/src/api/chat.ts +++ b/src/renderer/src/AixPPTist/src/api/chat.ts @@ -14,7 +14,8 @@ export default () => { const courseId = classcourse?.id // 课堂id const timgroupid = classcourse?.timgroupid // 群组id const classcourseStore = useClasscourseStore() // 课堂信息-状态管理 - if (!ChatWs.ws) ChatWs.init() + // 上课状态才-初始化socket + if (!ChatWs.ws && !!courseId) ChatWs.init() // 开课消息 const startCourse = async() => { // await API_classcourse.updateClasscourse({ id: classcourse.id, status: 'open' }) 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/hooks/useScreening.ts b/src/renderer/src/AixPPTist/src/hooks/useScreening.ts index 979b8c4..4a35762 100644 --- a/src/renderer/src/AixPPTist/src/hooks/useScreening.ts +++ b/src/renderer/src/AixPPTist/src/hooks/useScreening.ts @@ -1,5 +1,6 @@ import { useScreenStore, useSlidesStore, useClasscourseStore } from '../store' import { enterFullscreen, exitFullscreen, isFullscreen } from '../utils/fullscreen' +import { sessionStore } from '@/utils/store' // electron-store 状态管理 import ChatWs from '@/plugins/socket' // 聊天socket export default () => { @@ -25,6 +26,9 @@ export default () => { if (!!classcourse) { //DOTO 有课堂,执行退相关操作 console.log('退出放映状态') ChatWs?.close() // 关闭ws + sessionStore.delete('curr.classcourse') // 清除课堂信息 + sessionStore.delete('curr.resource') // 清除课件信息 + sessionStore.delete('curr.isPublic') // 清除公屏状态 setTimeout(() => { window.close() // 关闭窗口 }, 1000) 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 } // 文生图 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 29d7ca5..83000c8 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/EditorHeader/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/EditorHeader/index.vue @@ -3,7 +3,7 @@