diff --git a/src/renderer/src/AixPPTist/src/api/chat.ts b/src/renderer/src/AixPPTist/src/api/chat.ts
new file mode 100644
index 0000000..6cf016e
--- /dev/null
+++ b/src/renderer/src/AixPPTist/src/api/chat.ts
@@ -0,0 +1,24 @@
+/**
+ * 统一处理消息 发送 避免找不到
+ */
+
+import ChatWs from '@/plugins/socket' // 聊天socket
+import { sessionStore } from '@/utils/store' // electron-store 状态管理
+import * as API_classcourse from '@/api/teaching/classcourse' // 后端api
+
+export default () => {
+ const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
+ const timgroupid = classcourse?.timgroupid // 群组id
+ if (!ChatWs.ws) ChatWs.init()
+ // 下课消息
+ const exitCourse = async() => {
+ if(!timgroupid) throw new Error('未获取到群组ID')
+ await API_classcourse.updateClasscourse({ id: classcourse.id, status: 'closed' })
+ return ChatWs.closedCourse(timgroupid)
+ }
+ return {
+ exitCourse,
+ classcourse,
+ groupid: timgroupid,
+ }
+}
\ No newline at end of file
diff --git a/src/renderer/src/AixPPTist/src/api/classcourse.ts b/src/renderer/src/AixPPTist/src/api/classcourse.ts
index e513f3c..b41091e 100644
--- a/src/renderer/src/AixPPTist/src/api/classcourse.ts
+++ b/src/renderer/src/AixPPTist/src/api/classcourse.ts
@@ -7,13 +7,13 @@ import { sessionStore } from '@/utils/store' // electron-store 状态管理
import * as useStore from '../store' // pptist-状态管理
import ChatWs from '@/plugins/socket' // 聊天socket
import msgUtils from '@/plugins/modal' // 消息工具
-import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
+import emitter from '@/utils/mitt' //mitt 事件总线
+import { nextTick } from 'vue'
const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理
const screenStore = useStore.useScreenStore() // 全屏-状态管理
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
-const execPlay = useExecPlay() // 播放控制
export class Classcourse {
msgObj:ElMessageBox = null // 提示消息对象
@@ -23,10 +23,12 @@ export class Classcourse {
constructor() {
this.load()
}
+ // 延时
+ sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
/**
* @description 加载
*/
- load() {
+ async load() {
console.log('classcourse-load', classcourse)
// 打开全屏
const isCourse = !!classcourse
@@ -39,13 +41,19 @@ export class Classcourse {
this.classcourse = classcourse // 课堂信息
this.id = classcourse.id // 课堂id
// 如果课堂信息有paging,则更新当前页码
- const isPaging = !!classcourse.paging
- if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
+ const { paging } = classcourse
+ const isPaging = !!paging || paging === 0
+ if (isPaging) {
+ await this.sleep(200)
+ emitter.emit('useExecPlay', {key:'turnSlideToIndex', paging})
+ await this.sleep(1000)
// 如果课堂信息有paging,则更新动画播放状态
- const isAnim = !!classcourse.cartoonTimes
- if (isAnim) { // 动画播放
- for (let i = 0; i <= classcourse.cartoonTimes; i++) {
- execPlay.runAnimation(true) // 异步执行动画
+ const isAnim = !!classcourse.cartoonTimes
+ if (isAnim) { // 动画播放
+ for (let i = 0; i < classcourse.cartoonTimes; i++) {
+ // 异步执行动画
+ emitter.emit('useExecPlay', {key:'execNext', isAsync:true})
+ }
}
}
// 课堂信息-状态管理
diff --git a/src/renderer/src/AixPPTist/src/api/index.ts b/src/renderer/src/AixPPTist/src/api/index.ts
index 685c367..203ba3e 100644
--- a/src/renderer/src/AixPPTist/src/api/index.ts
+++ b/src/renderer/src/AixPPTist/src/api/index.ts
@@ -258,6 +258,7 @@ export class PPTApi {
}
export class Homework{
+ static win: null // 作业弹窗
// 作业弹窗
static async showHomework(id: any) {
let result = await getClassWorkList(id)
@@ -265,7 +266,14 @@ export class Homework{
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
toolStore.isTaskWin=true; // 设置打开批改窗口
// emit('closeActive')
- createWindow('open-taskwin',{url:'/teachClassTask'});
+ // 重复打开,先关闭弹窗
+ // if (this.win) this.win?.close?.()
+ this.win = await createWindow('open-taskwin',{url:'/teachClassTask'})
+ return this.win;
+ }
+ static closeHomework() {
+ if (this.win) this.win?.close?.()
+ this.win = null
}
}
export default PPTApi
\ No newline at end of file
diff --git a/src/renderer/src/AixPPTist/src/api/watcher.ts b/src/renderer/src/AixPPTist/src/api/watcher.ts
index f5d91cb..35d8454 100644
--- a/src/renderer/src/AixPPTist/src/api/watcher.ts
+++ b/src/renderer/src/AixPPTist/src/api/watcher.ts
@@ -23,7 +23,6 @@ export default () => {
const resource = sessionStore.get('curr.resource') // apt 资源
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
const execPlay = useExecPlay() // 播放控制
-
// 监听幻灯片内容变化
watch(() => slidesStore.slides, (newVal, oldVal) => {
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
@@ -37,9 +36,17 @@ export default () => {
// 监听幻灯片下标变化
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
- PPTApi.updateWorkList()
+ if (!!Classcourse.id) return // 上课状态,不更新右侧作业列表
+ PPTApi.updateWorkList() // 更新作业列表
})
-
+ // 监听幻灯片下画布尺寸比例变化
+ watch(() => slidesStore.viewportRatio, (newVal, oldVal) => {
+ const width = slidesStore.viewportSize
+ const widthandration={width, ratio:newVal}
+ const data = { id: resource.id, parentContent: JSON.stringify(widthandration)}
+ PPTApi.updateSlide(data)
+ })
+
// 消息监听ws
// console.log('监听器已开启', ChatWs)
if (!!ChatWs.ws) {
@@ -91,7 +98,8 @@ export default () => {
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
const slideIndex = content?.current || 0
const type = content?.animation
- if (type === 'Nextsteps') emitter.emit('useExecPlay', 'execNext') // 下一步
+ // if (type === 'Nextsteps') emitter.emit('useExecPlay', 'execNext') // 下一步
+ if (type === 'Nextsteps') emitter.emit('useExecPlay', {key:'execNext', isAsync:true}) // 下一步
else if (type === 'Previoustep') emitter.emit('useExecPlay', 'turnPrevSlide') // 上一步清空-动画
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
break
diff --git a/src/renderer/src/AixPPTist/src/views/Screen/BaseView.vue b/src/renderer/src/AixPPTist/src/views/Screen/BaseView.vue
index ae2add1..fc4940a 100644
--- a/src/renderer/src/AixPPTist/src/views/Screen/BaseView.vue
+++ b/src/renderer/src/AixPPTist/src/views/Screen/BaseView.vue
@@ -52,6 +52,7 @@
+
@@ -60,7 +61,7 @@