This commit is contained in:
parent
e58cb334e4
commit
5d6c946e08
|
@ -0,0 +1,23 @@
|
||||||
|
/**
|
||||||
|
* 统一处理消息 发送 避免找不到
|
||||||
|
*/
|
||||||
|
|
||||||
|
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
|
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||||
|
|
||||||
|
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 updateClasscourse({ id: classcourse.id, status: 'closed' })
|
||||||
|
return ChatWs.closedCourse(timgroupid)
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
exitCourse,
|
||||||
|
classcourse,
|
||||||
|
groupid: timgroupid,
|
||||||
|
}
|
||||||
|
}
|
|
@ -258,6 +258,7 @@ export class PPTApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Homework{
|
export class Homework{
|
||||||
|
static win: null // 作业弹窗
|
||||||
// 作业弹窗
|
// 作业弹窗
|
||||||
static async showHomework(id: any) {
|
static async showHomework(id: any) {
|
||||||
let result = await getClassWorkList(id)
|
let result = await getClassWorkList(id)
|
||||||
|
@ -265,7 +266,14 @@ export class Homework{
|
||||||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||||
// emit('closeActive')
|
// 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
|
export default PPTApi
|
|
@ -122,4 +122,5 @@ export default () => {
|
||||||
window.close() // 关闭窗口
|
window.close() // 关闭窗口
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
<IconOffScreenOne class="tool-btn" v-tooltip="'退出全屏'" v-if="fullscreenState" @click="manualExitFullscreen()" />
|
<IconOffScreenOne class="tool-btn" v-tooltip="'退出全屏'" v-if="fullscreenState" @click="manualExitFullscreen()" />
|
||||||
<IconFullScreenOne class="tool-btn" v-tooltip="'进入全屏'" v-else @click="enterFullscreen()" />
|
<IconFullScreenOne class="tool-btn" v-tooltip="'进入全屏'" v-else @click="enterFullscreen()" />
|
||||||
<IconPower class="tool-btn" v-tooltip="'结束放映'" @click="exitScreening()" />
|
<IconPower class="tool-btn" v-tooltip="'结束放映'" @click="exitScreening()" />
|
||||||
|
<IconPower class="tool-btn" v-if="chat.groupid" v-tooltip="'结束课堂'" @click="exitCourse()" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,6 +75,7 @@ import WritingBoardTool from './WritingBoardTool.vue'
|
||||||
import CountdownTimer from './CountdownTimer.vue'
|
import CountdownTimer from './CountdownTimer.vue'
|
||||||
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
||||||
import emitter from '@/utils/mitt';
|
import emitter from '@/utils/mitt';
|
||||||
|
import Chat from '../../api/chat' // 聊天
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||||
|
@ -103,6 +105,7 @@ const {
|
||||||
const { slideWidth, slideHeight } = useSlideSize()
|
const { slideWidth, slideHeight } = useSlideSize()
|
||||||
const { exitScreening } = useScreening()
|
const { exitScreening } = useScreening()
|
||||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||||
|
const chat:any = Chat() // 聊天室
|
||||||
|
|
||||||
const rightToolsVisible = ref(false)
|
const rightToolsVisible = ref(false)
|
||||||
const writingBoardToolVisible = ref(false)
|
const writingBoardToolVisible = ref(false)
|
||||||
|
@ -192,6 +195,14 @@ const contextmenus = (): ContextmenuItem[] => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 下课
|
||||||
|
const exitCourse = async () => {
|
||||||
|
// console.log('下课', chat)
|
||||||
|
await chat.exitCourse() // 下课消息
|
||||||
|
exitScreening() // 结束放映
|
||||||
|
}
|
||||||
|
|
||||||
// 打开点赞或者疑问 1点赞 2疑问
|
// 打开点赞或者疑问 1点赞 2疑问
|
||||||
emitter.on('upvoteTrigger', (type) => {
|
emitter.on('upvoteTrigger', (type) => {
|
||||||
upvoteRef.value?.trigger(type)
|
upvoteRef.value?.trigger(type)
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
<Divider class="divider" />
|
<Divider class="divider" />
|
||||||
<div class="tool-btn" @click="exitScreening()"><IconPower class="tool-icon" /><span>结束放映</span></div>
|
<div class="tool-btn" @click="exitScreening()"><IconPower class="tool-icon" /><span>结束放映</span></div>
|
||||||
|
<div class="tool-btn" @click="exitCourse()" v-if="chat.groupid"><IconPower class="tool-icon" /><span>结束课堂</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
@ -94,6 +95,7 @@ import ScreenSlideList from './ScreenSlideList.vue'
|
||||||
import WritingBoardTool from './WritingBoardTool.vue'
|
import WritingBoardTool from './WritingBoardTool.vue'
|
||||||
import CountdownTimer from './CountdownTimer.vue'
|
import CountdownTimer from './CountdownTimer.vue'
|
||||||
import Divider from '../../components/Divider.vue'
|
import Divider from '../../components/Divider.vue'
|
||||||
|
import Chat from '../../api/chat' // 聊天
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||||
|
@ -122,12 +124,20 @@ const { slideWidth, slideHeight } = useSlideSize(slideListWrapRef)
|
||||||
const { exitScreening } = useScreening()
|
const { exitScreening } = useScreening()
|
||||||
const { slidesLoadLimit } = useLoadSlides()
|
const { slidesLoadLimit } = useLoadSlides()
|
||||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||||
|
const chat:any = Chat() // 聊天室
|
||||||
|
|
||||||
const remarkFontSize = ref(16)
|
const remarkFontSize = ref(16)
|
||||||
const currentSlideRemark = computed(() => {
|
const currentSlideRemark = computed(() => {
|
||||||
return parseText2Paragraphs(currentSlide.value.remark || '无备注')
|
return parseText2Paragraphs(currentSlide.value.remark || '无备注')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 下课
|
||||||
|
const exitCourse = async () => {
|
||||||
|
// console.log('下课', chat)
|
||||||
|
await chat.exitCourse() // 下课消息
|
||||||
|
exitScreening() // 结束放映
|
||||||
|
}
|
||||||
|
|
||||||
const handleMousewheelThumbnails = (e: WheelEvent) => {
|
const handleMousewheelThumbnails = (e: WheelEvent) => {
|
||||||
if (!thumbnailsRef.value) return
|
if (!thumbnailsRef.value) return
|
||||||
thumbnailsRef.value.scrollBy(e.deltaY, 0)
|
thumbnailsRef.value.scrollBy(e.deltaY, 0)
|
||||||
|
|
|
@ -167,9 +167,6 @@ export class ChatWs {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.sendMsg('closed', '下课', null, 'group', id)
|
this.sendMsg('closed', '下课', null, 'group', id)
|
||||||
resolve()
|
resolve()
|
||||||
// setTimeout(() => {
|
|
||||||
// this.close() // 关闭链接
|
|
||||||
// }, 1000);
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 延时 ms 毫秒
|
// 延时 ms 毫秒
|
||||||
|
|
|
@ -225,7 +225,7 @@ export const createWindow = async (type, data) => {
|
||||||
.filter(k => typeof data[k] === 'function')
|
.filter(k => typeof data[k] === 'function')
|
||||||
.forEach(k => events[k] = data[k])
|
.forEach(k => events[k] = data[k])
|
||||||
eventHandles(type, win, events) // 事件监听处理
|
eventHandles(type, win, events) // 事件监听处理
|
||||||
break
|
return win
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|
|
@ -163,8 +163,10 @@ import quizStats from '@/views/classTask/container/quizStats.vue'
|
||||||
import ClassOverview from '@/views/classTask/container/classOverview.vue'
|
import ClassOverview from '@/views/classTask/container/classOverview.vue'
|
||||||
import {sessionStore} from '@/utils/store'
|
import {sessionStore} from '@/utils/store'
|
||||||
// import Chat from '@/utils/chat' // im 登录初始化
|
// import Chat from '@/utils/chat' // im 登录初始化
|
||||||
|
import { Homework } from '@/AixPPTist/src/api/index'
|
||||||
import MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
import MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
||||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
|
import { set } from 'lodash'
|
||||||
if (!ChatWs.ws) ChatWs.init()
|
if (!ChatWs.ws) ChatWs.init()
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const emit = defineEmits(['cle-click'])
|
const emit = defineEmits(['cle-click'])
|
||||||
|
@ -719,14 +721,17 @@ const msgHandle = (msg) => {
|
||||||
const { head, content, ...other } = msg
|
const { head, content, ...other } = msg
|
||||||
switch(head) {
|
switch(head) {
|
||||||
case MsgEnum.HEADS.MSG_closed: // 下课:
|
case MsgEnum.HEADS.MSG_closed: // 下课:
|
||||||
|
Homework.win = null
|
||||||
window.close() // 关闭窗口
|
window.close() // 关闭窗口
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业:
|
case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业:
|
||||||
|
console.log('更新作业', head, content)
|
||||||
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
||||||
openDialog(data, false);
|
openDialog(data, false);
|
||||||
break
|
break
|
||||||
case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面
|
case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面
|
||||||
console.log('切换页面-关闭窗口')
|
console.log('切换页面-关闭窗口')
|
||||||
|
Homework.win = null
|
||||||
window.close() // 关闭窗口
|
window.close() // 关闭窗口
|
||||||
break
|
break
|
||||||
// case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[]
|
// case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[]
|
||||||
|
@ -769,7 +774,7 @@ onMounted(() => {
|
||||||
console.log('socket监听消息')
|
console.log('socket监听消息')
|
||||||
ChatWs.watch((msg, e) => {
|
ChatWs.watch((msg, e) => {
|
||||||
try {
|
try {
|
||||||
msgHandle(JSON.parse(msg))
|
msgHandle(JSON.parse(msg)?.msg)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('socket 解析异常 ', error, e)
|
console.error('socket 解析异常 ', error, e)
|
||||||
msgHandle(msg)
|
msgHandle(msg)
|
||||||
|
|
Loading…
Reference in New Issue