Compare commits
No commits in common. "75ddbf6f26824cf9788450bcfb7e26d11bcebc31" and "de9235751f649a2e0f8df70f9f11e9cede07b08b" have entirely different histories.
75ddbf6f26
...
de9235751f
|
@ -1,24 +0,0 @@
|
|||
/**
|
||||
* 统一处理消息 发送 避免找不到
|
||||
*/
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
|
@ -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 emitter from '@/utils/mitt' //mitt 事件总线
|
||||
import { nextTick } from 'vue'
|
||||
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
|
||||
|
||||
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,12 +23,10 @@ export class Classcourse {
|
|||
constructor() {
|
||||
this.load()
|
||||
}
|
||||
// 延时
|
||||
sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
||||
/**
|
||||
* @description 加载
|
||||
*/
|
||||
async load() {
|
||||
load() {
|
||||
console.log('classcourse-load', classcourse)
|
||||
// 打开全屏
|
||||
const isCourse = !!classcourse
|
||||
|
@ -41,19 +39,13 @@ export class Classcourse {
|
|||
this.classcourse = classcourse // 课堂信息
|
||||
this.id = classcourse.id // 课堂id
|
||||
// 如果课堂信息有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)
|
||||
const isPaging = !!classcourse.paging
|
||||
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
|
||||
// 如果课堂信息有paging,则更新动画播放状态
|
||||
const isAnim = !!classcourse.cartoonTimes
|
||||
if (isAnim) { // 动画播放
|
||||
for (let i = 0; i < classcourse.cartoonTimes; i++) {
|
||||
// 异步执行动画
|
||||
emitter.emit('useExecPlay', {key:'execNext', isAsync:true})
|
||||
}
|
||||
const isAnim = !!classcourse.cartoonTimes
|
||||
if (isAnim) { // 动画播放
|
||||
for (let i = 0; i <= classcourse.cartoonTimes; i++) {
|
||||
execPlay.runAnimation(true) // 异步执行动画
|
||||
}
|
||||
}
|
||||
// 课堂信息-状态管理
|
||||
|
|
|
@ -258,7 +258,6 @@ export class PPTApi {
|
|||
}
|
||||
|
||||
export class Homework{
|
||||
static win: null // 作业弹窗
|
||||
// 作业弹窗
|
||||
static async showHomework(id: any) {
|
||||
let result = await getClassWorkList(id)
|
||||
|
@ -266,14 +265,7 @@ export class Homework{
|
|||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||
// emit('closeActive')
|
||||
// 重复打开,先关闭弹窗
|
||||
// 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
|
||||
createWindow('open-taskwin',{url:'/teachClassTask'});
|
||||
}
|
||||
}
|
||||
export default PPTApi
|
|
@ -36,8 +36,7 @@ export default () => {
|
|||
|
||||
// 监听幻灯片下标变化
|
||||
watch(() => slidesStore.slideIndex, (newVal, oldVal) => {
|
||||
if (!!Classcourse.id) return // 上课状态,不更新右侧作业列表
|
||||
PPTApi.updateWorkList() // 更新作业列表
|
||||
PPTApi.updateWorkList()
|
||||
})
|
||||
// 监听幻灯片下画布尺寸比例变化
|
||||
watch(() => slidesStore.viewportRatio, (newVal, oldVal) => {
|
||||
|
@ -98,8 +97,7 @@ 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', {key:'execNext', isAsync:true}) // 下一步
|
||||
if (type === 'Nextsteps') emitter.emit('useExecPlay', 'execNext') // 下一步
|
||||
else if (type === 'Previoustep') emitter.emit('useExecPlay', 'turnPrevSlide') // 上一步清空-动画
|
||||
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
||||
break
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
<IconOffScreenOne class="tool-btn" v-tooltip="'退出全屏'" v-if="fullscreenState" @click="manualExitFullscreen()" />
|
||||
<IconFullScreenOne class="tool-btn" v-tooltip="'进入全屏'" v-else @click="enterFullscreen()" />
|
||||
<IconPower class="tool-btn" v-tooltip="'结束放映'" @click="exitScreening()" />
|
||||
<IconPower class="tool-btn close" v-if="chat.groupid" v-tooltip="'结束课堂'" @click="exitCourse()" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -61,7 +60,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref , watchEffect} from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore ,useScreenStore, useClasscourseStore} from '../../store'
|
||||
import { useSlidesStore ,useScreenStore} from '../../store'
|
||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||
import { enterFullscreen } from '../../utils/fullscreen'
|
||||
import useScreening from '../../hooks/useScreening'
|
||||
|
@ -75,16 +74,12 @@ import WritingBoardTool from './WritingBoardTool.vue'
|
|||
import CountdownTimer from './CountdownTimer.vue'
|
||||
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
||||
import emitter from '@/utils/mitt';
|
||||
import Chat from '../../api/chat' // 聊天
|
||||
// import * as emits from './hooks/emitter'
|
||||
// emits.init() // 初始化事件
|
||||
|
||||
const props = defineProps<{
|
||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||
}>()
|
||||
|
||||
const { slides, slideIndex } = storeToRefs(useSlidesStore())
|
||||
const { classcourse } = storeToRefs(useClasscourseStore()) // 课堂信息
|
||||
|
||||
const {
|
||||
autoPlayTimer,
|
||||
|
@ -105,30 +100,9 @@ const {
|
|||
execNext,
|
||||
animationIndex,
|
||||
} = useExecPlay()
|
||||
// zdg: 使用方法才生效
|
||||
const execPlay = {
|
||||
autoPlayTimer,
|
||||
autoPlay,
|
||||
closeAutoPlay,
|
||||
autoPlayInterval,
|
||||
setAutoPlayInterval,
|
||||
loopPlay,
|
||||
setLoopPlay,
|
||||
mousewheelListener,
|
||||
touchStartListener,
|
||||
touchEndListener,
|
||||
turnPrevSlide,
|
||||
turnNextSlide,
|
||||
turnSlideToIndex,
|
||||
turnSlideToId,
|
||||
execPrev,
|
||||
execNext,
|
||||
animationIndex,
|
||||
}
|
||||
const { slideWidth, slideHeight } = useSlideSize()
|
||||
const { exitScreening } = useScreening()
|
||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||
const chat:any = Chat() // 聊天室
|
||||
|
||||
const rightToolsVisible = ref(false)
|
||||
const writingBoardToolVisible = ref(false)
|
||||
|
@ -218,33 +192,43 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
},
|
||||
]
|
||||
}
|
||||
|
||||
// 下课
|
||||
const exitCourse = async () => {
|
||||
// console.log('下课', chat)
|
||||
await chat.exitCourse() // 下课消息
|
||||
exitScreening() // 结束放映
|
||||
}
|
||||
|
||||
// 打开点赞或者疑问 1点赞 2疑问
|
||||
emitter.on('upvoteTrigger', (type) => {
|
||||
upvoteRef.value?.trigger(type)
|
||||
});
|
||||
|
||||
// 监听
|
||||
// zdg: 使用方法才生效
|
||||
const execPlay = {
|
||||
autoPlayTimer,
|
||||
autoPlay,
|
||||
closeAutoPlay,
|
||||
autoPlayInterval,
|
||||
setAutoPlayInterval,
|
||||
loopPlay,
|
||||
setLoopPlay,
|
||||
mousewheelListener,
|
||||
touchStartListener,
|
||||
touchEndListener,
|
||||
turnPrevSlide,
|
||||
turnNextSlide,
|
||||
turnSlideToIndex,
|
||||
turnSlideToId,
|
||||
execPrev,
|
||||
execNext,
|
||||
animationIndex,
|
||||
}
|
||||
emitter.on('useExecPlay', (data: string|any) => {
|
||||
console.log('useExecPlay', data)
|
||||
if (!data) throw new Error('参数错误')
|
||||
if (typeof data === 'string') { // 字符串
|
||||
if (execPlay[data]) execPlay[data]()
|
||||
else throw new Error('方法不存在')
|
||||
} else { // 对象
|
||||
const { key, ...params } = data || {}
|
||||
const paramsArray = Object.values(params)
|
||||
if (execPlay[key]) execPlay[key](...paramsArray)
|
||||
const { method, ...params } = data || {}
|
||||
if (execPlay[method]) execPlay[method](...params)
|
||||
else throw new Error('方法不存在')
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -325,9 +309,6 @@ emitter.on('useExecPlay', (data: string|any) => {
|
|||
& + .tool-btn {
|
||||
margin-left: 15px;
|
||||
}
|
||||
&.close{
|
||||
color: #d14424;
|
||||
}
|
||||
}
|
||||
.page-number {
|
||||
font-size: 13px;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
</div>
|
||||
<Divider class="divider" />
|
||||
<div class="tool-btn" @click="exitScreening()"><IconPower class="tool-icon" /><span>结束放映</span></div>
|
||||
<div class="tool-btn close" @click="exitCourse()" v-if="chat.groupid"><IconPower class="tool-icon" /><span>结束课堂</span></div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
|
@ -56,7 +55,7 @@
|
|||
:class="{ 'active': index === slideIndex }"
|
||||
v-for="(slide, index) in slides"
|
||||
:key="slide.id"
|
||||
@click="turnSlideTo(index, $event)"
|
||||
@click="turnSlideToIndex(index)"
|
||||
>
|
||||
<ThumbnailSlide :slide="slide" :size="120 / viewportRatio" :visible="index < slidesLoadLimit" />
|
||||
</div>
|
||||
|
@ -80,7 +79,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { computed, nextTick, ref, watch } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore, useClasscourseStore } from '../../store'
|
||||
import { useSlidesStore } from '../../store'
|
||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||
import { enterFullscreen } from '../../utils/fullscreen'
|
||||
import { parseText2Paragraphs } from '../../utils/textParser'
|
||||
|
@ -95,14 +94,12 @@ import ScreenSlideList from './ScreenSlideList.vue'
|
|||
import WritingBoardTool from './WritingBoardTool.vue'
|
||||
import CountdownTimer from './CountdownTimer.vue'
|
||||
import Divider from '../../components/Divider.vue'
|
||||
import Chat from '../../api/chat' // 聊天
|
||||
|
||||
const props = defineProps<{
|
||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||
}>()
|
||||
|
||||
const { slides, slideIndex, viewportRatio, currentSlide } = storeToRefs(useSlidesStore())
|
||||
const { classcourse } = storeToRefs(useClasscourseStore()) // 课堂信息
|
||||
|
||||
const slideListWrapRef = ref<HTMLElement>()
|
||||
const thumbnailsRef = ref<HTMLElement>()
|
||||
|
@ -125,27 +122,12 @@ const { slideWidth, slideHeight } = useSlideSize(slideListWrapRef)
|
|||
const { exitScreening } = useScreening()
|
||||
const { slidesLoadLimit } = useLoadSlides()
|
||||
const { fullscreenState, manualExitFullscreen } = useFullscreen()
|
||||
const chat:any = Chat() // 聊天室
|
||||
|
||||
const remarkFontSize = ref(16)
|
||||
const currentSlideRemark = computed(() => {
|
||||
return parseText2Paragraphs(currentSlide.value.remark || '无备注')
|
||||
})
|
||||
|
||||
// 切换到指定的幻灯片
|
||||
const turnSlideTo = (index: number, e: PointerEvent) => {
|
||||
// 课堂信息存在时,不允许翻页
|
||||
console.log('课堂信息', classcourse, index)
|
||||
if (!!classcourse.value) return
|
||||
turnSlideToIndex(index)
|
||||
}
|
||||
// 下课
|
||||
const exitCourse = async () => {
|
||||
// console.log('下课', chat)
|
||||
await chat.exitCourse() // 下课消息
|
||||
exitScreening() // 结束放映
|
||||
}
|
||||
|
||||
const handleMousewheelThumbnails = (e: WheelEvent) => {
|
||||
if (!thumbnailsRef.value) return
|
||||
thumbnailsRef.value.scrollBy(e.deltaY, 0)
|
||||
|
@ -226,7 +208,7 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
background-color: #fff;
|
||||
border-right: solid 1px #eee;
|
||||
font-size: 12px;
|
||||
padding: 20px 0;
|
||||
margin: 20px 0;
|
||||
|
||||
.tool-btn {
|
||||
display: flex;
|
||||
|
@ -242,9 +224,6 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
&:hover, &.active {
|
||||
color: $themeColor;
|
||||
}
|
||||
&.close{
|
||||
color: #d14424;
|
||||
}
|
||||
}
|
||||
|
||||
.divider {
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import { onMounted, onUnmounted, ref } from 'vue'
|
||||
import { throttle } from 'lodash'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore, useClasscourseStore } from '../../../store'
|
||||
import { useSlidesStore } from '../../../store'
|
||||
import { KEYS } from '../../../configs/hotkey'
|
||||
import { ANIMATION_CLASS_PREFIX } from '../../../configs/animation'
|
||||
import message from '../../../utils/message'
|
||||
|
||||
export default () => {
|
||||
const slidesStore = useSlidesStore()
|
||||
const classcourseStore = useClasscourseStore() // 课堂信息-状态管理
|
||||
const { slides, slideIndex, formatedAnimations } = storeToRefs(slidesStore)
|
||||
|
||||
// 当前页的元素动画执行到的位置
|
||||
|
@ -122,9 +121,9 @@ export default () => {
|
|||
// 遇到元素动画时,优先执行动画播放,无动画则执行翻页
|
||||
// 向上播放遇到动画时,仅撤销到动画执行前的状态,不需要反向播放动画
|
||||
// 撤回到上一页时,若该页从未播放过(意味着不存在动画状态),需要将动画索引置为最小值(初始状态),否则置为最大值(最终状态)
|
||||
const execPrev = (isAsync: boolean) => {
|
||||
const execPrev = () => {
|
||||
if (formatedAnimations.value.length && animationIndex.value > 0) {
|
||||
revokeAnimation(isAsync)
|
||||
revokeAnimation()
|
||||
}
|
||||
else if (slideIndex.value > 0) {
|
||||
slidesStore.updateSlideIndex(slideIndex.value - 1)
|
||||
|
@ -140,10 +139,9 @@ export default () => {
|
|||
}
|
||||
inAnimation.value = false
|
||||
}
|
||||
const execNext = (isAsync: boolean) => {
|
||||
console.log('execNext', isAsync)
|
||||
const execNext = () => {
|
||||
if (formatedAnimations.value.length && animationIndex.value < formatedAnimations.value.length) {
|
||||
runAnimation(isAsync)
|
||||
runAnimation()
|
||||
}
|
||||
else if (slideIndex.value < slides.value.length - 1) {
|
||||
slidesStore.updateSlideIndex(slideIndex.value + 1)
|
||||
|
@ -175,13 +173,7 @@ export default () => {
|
|||
}
|
||||
|
||||
// 鼠标滚动翻页
|
||||
const mousewheelListener = (e: WheelEvent) => {
|
||||
// console.log('mousewheel', e)
|
||||
// 课堂信息存在时,不允许翻页
|
||||
if (!!classcourseStore.classcourse) e.preventDefault()
|
||||
mousewheelListenerThrottle(e)
|
||||
}
|
||||
const mousewheelListenerThrottle = throttle(function(e: WheelEvent) {
|
||||
const mousewheelListener = throttle(function(e: WheelEvent) {
|
||||
if (e.deltaY < 0) turning(e, 'prev')
|
||||
else if (e.deltaY > 0) turning(e, 'next')
|
||||
}, 500, { leading: true, trailing: false })
|
||||
|
@ -211,8 +203,6 @@ export default () => {
|
|||
// 向上翻页/向下翻页
|
||||
const turning = (e, type) => {
|
||||
e.preventDefault() // 阻止默认事件
|
||||
// 课堂信息存在时,不允许翻页
|
||||
if (!!classcourseStore.classcourse) return
|
||||
if (type === 'prev') execPrev()
|
||||
else if (type === 'next') execNext()
|
||||
}
|
||||
|
|
|
@ -167,6 +167,9 @@ export class ChatWs {
|
|||
return new Promise((resolve, reject) => {
|
||||
this.sendMsg('closed', '下课', null, 'group', id)
|
||||
resolve()
|
||||
// setTimeout(() => {
|
||||
// this.close() // 关闭链接
|
||||
// }, 1000);
|
||||
})
|
||||
}
|
||||
// 延时 ms 毫秒
|
||||
|
|
|
@ -225,7 +225,7 @@ export const createWindow = async (type, data) => {
|
|||
.filter(k => typeof data[k] === 'function')
|
||||
.forEach(k => events[k] = data[k])
|
||||
eventHandles(type, win, events) // 事件监听处理
|
||||
return win
|
||||
break
|
||||
}
|
||||
default:
|
||||
break
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
</div>
|
||||
<div class="class-reserv-item-tool" style="width: 50px;">
|
||||
<!-- <el-button v-if="item.status!='open'" size="small" type="danger" @click="deleteReserv">删除</el-button>-->
|
||||
<!-- <el-tag>APT</el-tag> -->
|
||||
<el-tag>AIPPT</el-tag>
|
||||
<el-tag>APT</el-tag>
|
||||
</div>
|
||||
<div style="min-width: 150px;"><span> 浏览:25955 点赞:26605</span></div>
|
||||
</div>
|
||||
|
@ -86,7 +85,6 @@ const chatSend = () => {
|
|||
<style scoped lang="scss">
|
||||
.class-reserv-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
padding: 5px;
|
||||
|
@ -112,7 +110,7 @@ const chatSend = () => {
|
|||
}
|
||||
}
|
||||
.class-reserv-item-tool {
|
||||
margin: 0 7px;
|
||||
margin-left: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
|
|
@ -163,10 +163,8 @@ import quizStats from '@/views/classTask/container/quizStats.vue'
|
|||
import ClassOverview from '@/views/classTask/container/classOverview.vue'
|
||||
import {sessionStore} from '@/utils/store'
|
||||
// import Chat from '@/utils/chat' // im 登录初始化
|
||||
import { Homework } from '@/AixPPTist/src/api/index'
|
||||
import MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||
import { set } from 'lodash'
|
||||
if (!ChatWs.ws) ChatWs.init()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emit = defineEmits(['cle-click'])
|
||||
|
@ -721,17 +719,14 @@ const msgHandle = (msg) => {
|
|||
const { head, content, ...other } = msg
|
||||
switch(head) {
|
||||
case MsgEnum.HEADS.MSG_closed: // 下课:
|
||||
Homework.win = null
|
||||
window.close() // 关闭窗口
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业:
|
||||
console.log('更新作业', head, content)
|
||||
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
||||
openDialog(data, false);
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面
|
||||
console.log('切换页面-关闭窗口')
|
||||
Homework.win = null
|
||||
window.close() // 关闭窗口
|
||||
break
|
||||
// case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[]
|
||||
|
@ -774,7 +769,7 @@ onMounted(() => {
|
|||
console.log('socket监听消息')
|
||||
ChatWs.watch((msg, e) => {
|
||||
try {
|
||||
msgHandle(JSON.parse(msg)?.msg)
|
||||
msgHandle(JSON.parse(msg))
|
||||
} catch (error) {
|
||||
console.error('socket 解析异常 ', error, e)
|
||||
msgHandle(msg)
|
||||
|
|
Loading…
Reference in New Issue