diff --git a/.env.development b/.env.development index f3b45f2..b3a7114 100644 --- a/.env.development +++ b/.env.development @@ -16,4 +16,9 @@ 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://file.ysaix.com:7868' +VITE_APP_WS_URL = 'ws://192.168.2.16:7865' + +# 是否显示开发工具 VITE_SHOW_DEV_TOOLS = 'true' diff --git a/.env.production b/.env.production index e103054..0919367 100644 --- a/.env.production +++ b/.env.production @@ -18,4 +18,8 @@ VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktx VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/' +# websocket 地址 +VITE_APP_WS_URL = 'wss://file.ysaix.com:7868' + +# 是否显示开发工具 VITE_SHOW_DEV_TOOLS = 'false' diff --git a/env.d.ts b/env.d.ts new file mode 100644 index 0000000..32b911d --- /dev/null +++ b/env.d.ts @@ -0,0 +1,5 @@ +declare module '*.vue' { + import { ComponentOptions } from 'vue' + const componentOptions: ComponentOptions + export default componentOptions +} \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/App.vue b/src/renderer/src/AixPPTist/src/App.vue index 7cb504f..77b800d 100644 --- a/src/renderer/src/AixPPTist/src/App.vue +++ b/src/renderer/src/AixPPTist/src/App.vue @@ -28,6 +28,7 @@ import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关ap import { PPTApi } from './api' import { sessionStore } from '@/utils/store' // electron-store 状态管理 import './api/watcher' // 监听 +import './api/classcourse' // 课程相关 const loading = ref(true) const _isPC = isPC() diff --git a/src/renderer/src/AixPPTist/src/api/classcourse.ts b/src/renderer/src/AixPPTist/src/api/classcourse.ts new file mode 100644 index 0000000..ca162e1 --- /dev/null +++ b/src/renderer/src/AixPPTist/src/api/classcourse.ts @@ -0,0 +1,22 @@ +/** + * @author zdg + * @description 上课相关内容 + */ +import type { Classcourse } from './types' +import { sessionStore } from '@/utils/store' // electron-store 状态管理 +import * as useStore from '../store' // pptist-状态管理 +import { ChatWs } from '@/plugins/socket' // 聊天socket +const screenStore = useStore.useScreenStore() // 全屏-状态管理 +const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理 +const classcourse: Classcourse = sessionStore.get('curr.classcourse') // 课堂信息 + +// 如果课堂信息有值,则连接socket +if (!!classcourse) { + // 连接socket + const ws = new ChatWs() + console.log('ws- ',ws) + // ChatWs.connect(classcourse.id) + classcourseStore.setClasscourse(classcourse) +} +// 打开全屏 +screenStore.setScreening(!!classcourse) \ 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 32bb25a..c893a00 100644 --- a/src/renderer/src/AixPPTist/src/api/index.ts +++ b/src/renderer/src/AixPPTist/src/api/index.ts @@ -136,13 +136,15 @@ export class PPTApi { id: currentSlide.id, datacontent: JSON.stringify(currentSlide), } - Utils.mxThrottle(() => {this.updateSlide(params)}, 1000, 2) + Utils.mxThrottle(() => {this.updateSlide(params)}, 200, 2) } } // 更新幻灯片 static updateSlide(data: object): Promise { return new Promise(async (resolve, reject) => { const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data) + console.log(data,'data'); + console.log(res,'dresata'); if (res.code === 200) { resolve(true) } else msgUtils.msgError(res.msg || '更新失败');resolve(false) diff --git a/src/renderer/src/AixPPTist/src/api/types.ts b/src/renderer/src/AixPPTist/src/api/types.ts index 8321031..8d4f81c 100644 --- a/src/renderer/src/AixPPTist/src/api/types.ts +++ b/src/renderer/src/AixPPTist/src/api/types.ts @@ -5,4 +5,20 @@ export interface Result { data?: any rows?: Array, total?: number +} + +/** 课程信息 */ +export interface Classcourse { + id?: number|string, // 课程id + coursetitle?: string, // 课程名称 + coursetype?: string, // 课程类型 + courseverid?: string, // 课程版本id + coursedesc?: string, // 课程描述 + status?: number, // 课程状态 + teacherid?: number|string, // 教师id + entpcoursefileid?: number|string, // 课程文件id + classid?: number|string, // 班级id + entpcourseid?: number|string, // 章节中间表id + plandate?: string, // 计划时间 + opendate?: string, // 开课时间 } \ 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 dd7d66b..e8cc32a 100644 --- a/src/renderer/src/AixPPTist/src/hooks/useScreening.ts +++ b/src/renderer/src/AixPPTist/src/hooks/useScreening.ts @@ -1,9 +1,10 @@ -import { useScreenStore, useSlidesStore } from '../store' +import { useScreenStore, useSlidesStore, useClasscourseStore } from '../store' import { enterFullscreen, exitFullscreen, isFullscreen } from '../utils/fullscreen' export default () => { const screenStore = useScreenStore() const slidesStore = useSlidesStore() + const classcourseStore = useClasscourseStore() // 课堂信息 // 进入放映状态(从当前页开始) const enterScreening = () => { @@ -19,7 +20,11 @@ export default () => { // 退出放映状态 const exitScreening = () => { - screenStore.setScreening(false) + const classcourse = classcourseStore.classcourse + if (!!classcourse) { //DOTO 有课堂,执行退相关操作 + console.log('退出放映状态') + window.close() + } else screenStore.setScreening(false) if (isFullscreen()) exitFullscreen() } diff --git a/src/renderer/src/AixPPTist/src/plugins/icon.ts b/src/renderer/src/AixPPTist/src/plugins/icon.ts index 2bffc0e..bc6e035 100644 --- a/src/renderer/src/AixPPTist/src/plugins/icon.ts +++ b/src/renderer/src/AixPPTist/src/plugins/icon.ts @@ -125,7 +125,8 @@ import { User, Switch, More, - Material + Material, + AddPicture } from '@icon-park/vue-next' export interface Icons { @@ -256,7 +257,8 @@ export const icons: Icons = { IconUser: User, IconSwitch: Switch, IconMore: More, - IconMaterial: Material + IconMaterial: Material, + IconAddPicture: AddPicture } export default { diff --git a/src/renderer/src/AixPPTist/src/store/classcourse.ts b/src/renderer/src/AixPPTist/src/store/classcourse.ts new file mode 100644 index 0000000..7abd3fe --- /dev/null +++ b/src/renderer/src/AixPPTist/src/store/classcourse.ts @@ -0,0 +1,18 @@ +import { defineStore } from 'pinia' +import type { Classcourse } from '../api/types' + +export interface ClasscourseState { + classcourse: Classcourse +} + +export const useClasscourseStore = defineStore('classcourse', { + state: (): ClasscourseState => ({ + classcourse: null, // 课堂信息 + }), + + actions: { + setClasscourse(classcourse: Classcourse) { + this.classcourse = classcourse + }, + }, +}) \ No newline at end of file diff --git a/src/renderer/src/AixPPTist/src/store/index.ts b/src/renderer/src/AixPPTist/src/store/index.ts index 1ed4f2f..fe0cf22 100644 --- a/src/renderer/src/AixPPTist/src/store/index.ts +++ b/src/renderer/src/AixPPTist/src/store/index.ts @@ -3,6 +3,7 @@ import { useSlidesStore } from './slides' import { useSnapshotStore } from './snapshot' import { useKeyboardStore } from './keyboard' import { useScreenStore } from './screen' +import { useClasscourseStore } from './classcourse' export { useMainStore, @@ -10,4 +11,5 @@ export { useSnapshotStore, useKeyboardStore, useScreenStore, + useClasscourseStore, } \ No newline at end of file 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 8295fe0..dd648a3 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/MaterialDialog.vue @@ -11,6 +11,7 @@ 插入 + @@ -93,11 +94,9 @@ const GetUrlParameters = (parameters) => { } } } - return resData; } - const proxyToBase64 = (url)=> { const dourl = GetUrlParameters(url) console.log(dourl,'dourl') 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 1334688..d7de64d 100644 --- a/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue +++ b/src/renderer/src/AixPPTist/src/views/Editor/CanvasTool/index.vue @@ -83,6 +83,7 @@ +
@@ -121,14 +122,18 @@ @update="data => { onhtml2canvas(data); classWorkTaskVisible = false }" /> - + - - + + + +
@@ -156,6 +161,8 @@ import Popover from '../../../components/Popover.vue' import PopoverMenuItem from '../../../components/PopoverMenuItem.vue' import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue' import MaterialDialog from './MaterialDialog.vue' +import TextCreateImg from '@/components/ai-kolors/index.vue' +import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库 const mainStore = useMainStore() const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore) @@ -193,8 +200,10 @@ const insertImageElement = (files: FileList) => { getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL)) } -const onhtml2canvas = (imgbs64: string) => { - createImageElement(imgbs64) +const onhtml2canvas = async (html: HTMLElement) => { + //createImageElement(imgbs64); + const ele = await toPng(html) + createImageElement(ele); } const shapePoolVisible = ref(false) @@ -269,8 +278,10 @@ const insertMaterial = (item: MaterialParams) =>{ createImageElement(data) } materiaVisible.value = false - } + +// 文生图 +const imgVisible = ref(false)