Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
a62dde1b93
|
@ -19,7 +19,7 @@ VITE_APP_RES_FILE_PATH = 'https://prev.ysaix.com:7868/src/assets/textbook/booktx
|
||||||
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
VITE_APP_BUILD_BASE_PATH = 'https://prev.ysaix.com:7868/'
|
||||||
|
|
||||||
# websocket 地址
|
# websocket 地址
|
||||||
VITE_APP_WS_URL = 'wss://file.ysaix.com:7868'
|
VITE_APP_WS_URL = 'wss://prev.ysaix.com:7868'
|
||||||
|
|
||||||
# 是否显示开发工具
|
# 是否显示开发工具
|
||||||
VITE_SHOW_DEV_TOOLS = 'false'
|
VITE_SHOW_DEV_TOOLS = 'false'
|
||||||
|
|
|
@ -28,8 +28,9 @@ import msgUtils from '@/plugins/modal' // 消息工具
|
||||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||||
import { PPTApi } from './api'
|
import { PPTApi } from './api'
|
||||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||||
import './api/watcher' // 监听
|
// import './api/watcher' // 监听
|
||||||
|
import watcher from './api/watcher' // 监听
|
||||||
|
watcher() // 监听启动
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const _isPC = isPC()
|
const _isPC = isPC()
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,15 @@ import * as useStore from '../store' // pptist-状态管理
|
||||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
import msgUtils from '@/plugins/modal' // 消息工具
|
import msgUtils from '@/plugins/modal' // 消息工具
|
||||||
|
|
||||||
|
const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理
|
||||||
const screenStore = useStore.useScreenStore() // 全屏-状态管理
|
const screenStore = useStore.useScreenStore() // 全屏-状态管理
|
||||||
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
|
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
|
||||||
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
|
||||||
|
|
||||||
export class Classcourse {
|
export class Classcourse {
|
||||||
msgObj:ElMessageBox = null // 提示消息对象
|
msgObj:ElMessageBox = null // 提示消息对象
|
||||||
|
classcourse:any = null // 课堂信息
|
||||||
|
id: number|string = null // 课堂id
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.load()
|
this.load()
|
||||||
|
@ -22,6 +25,7 @@ export class Classcourse {
|
||||||
* @description 加载
|
* @description 加载
|
||||||
*/
|
*/
|
||||||
load() {
|
load() {
|
||||||
|
console.log('classcourse-load', classcourse)
|
||||||
// 打开全屏
|
// 打开全屏
|
||||||
screenStore.setScreening(!!classcourse)
|
screenStore.setScreening(!!classcourse)
|
||||||
// 如果课堂信息有值,则连接socket
|
// 如果课堂信息有值,则连接socket
|
||||||
|
@ -29,14 +33,19 @@ export class Classcourse {
|
||||||
// 连接socket
|
// 连接socket
|
||||||
if (!ChatWs.ws) ChatWs.init()
|
if (!ChatWs.ws) ChatWs.init()
|
||||||
ChatWs.id = classcourse.timgroupid // 群组id
|
ChatWs.id = classcourse.timgroupid // 群组id
|
||||||
console.log('ws- ', classcourse)
|
this.classcourse = classcourse // 课堂信息
|
||||||
|
this.id = classcourse.id // 课堂id
|
||||||
|
// 如果课堂信息有paging,则更新当前页码
|
||||||
|
const isPaging = !!classcourse.paging||classcourse.paging==0
|
||||||
|
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
|
||||||
|
// 课堂信息-状态管理
|
||||||
classcourseStore.setClasscourse(classcourse)
|
classcourseStore.setClasscourse(classcourse)
|
||||||
// 待上课提示
|
// 待上课提示
|
||||||
if (!classcourse.status) {
|
if (!classcourse.status) {
|
||||||
this.msgObj = {
|
this.msgObj = {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
title: '系统提示',
|
title: '系统提示',
|
||||||
message: '公屏课堂已准备完毕,请等待老师开启课堂!',
|
message: '公屏课堂已准备完毕,等待老师开启课堂...',
|
||||||
center: true,
|
center: true,
|
||||||
showClose: false,
|
showClose: false,
|
||||||
showCancelButton: false,
|
showCancelButton: false,
|
||||||
|
|
|
@ -106,6 +106,8 @@ export class MsgEnum {
|
||||||
MSG_anmationclick : 'anmationclick',
|
MSG_anmationclick : 'anmationclick',
|
||||||
/** @desc: 群组创建成功 */
|
/** @desc: 群组创建成功 */
|
||||||
MSG_classcourseopen : 'classcourseopen',
|
MSG_classcourseopen : 'classcourseopen',
|
||||||
|
/** @desc: 学生提交作业 */
|
||||||
|
MSG_finishHomework : 'finishHomework',
|
||||||
/** @desc: 学生的测练结果反馈 */
|
/** @desc: 学生的测练结果反馈 */
|
||||||
MSG_classquizfeedback : 'classquizfeedback',
|
MSG_classquizfeedback : 'classquizfeedback',
|
||||||
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
|
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
|
||||||
|
@ -120,6 +122,12 @@ export class MsgEnum {
|
||||||
MSG_classWorkOfPresentDataUpdate : 'classWorkOfPresentDataUpdate',
|
MSG_classWorkOfPresentDataUpdate : 'classWorkOfPresentDataUpdate',
|
||||||
/** @desc: 课堂讲授活动,选择不同的内容 */
|
/** @desc: 课堂讲授活动,选择不同的内容 */
|
||||||
MSG_classlecturePagesrc : 'classlecturePagesrc',
|
MSG_classlecturePagesrc : 'classlecturePagesrc',
|
||||||
|
/** @desc: 课堂作业|活动 */
|
||||||
|
MSG_homework : 'HOMEWORK',
|
||||||
|
/** @desc: 点赞 */
|
||||||
|
MSG_dz : 'dz',
|
||||||
|
/** @desc: 疑惑 */
|
||||||
|
MSG_yh : 'yh',
|
||||||
// === 新定义-消息头 ===
|
// === 新定义-消息头 ===
|
||||||
/** @desc: 课程创建-待开课 */
|
/** @desc: 课程创建-待开课 */
|
||||||
MSG_0000: 0x0000,
|
MSG_0000: 0x0000,
|
||||||
|
|
|
@ -10,85 +10,106 @@ import { MsgEnum } from './types' // 消息枚举
|
||||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
import Classcourse from './classcourse' // 课程相关
|
import Classcourse from './classcourse' // 课程相关
|
||||||
import msgUtils from '@/plugins/modal' // 消息工具
|
import msgUtils from '@/plugins/modal' // 消息工具
|
||||||
const slidesStore = store.useSlidesStore()
|
import { Homework } from './index' // api-作业相关
|
||||||
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
|
import emitter from '@/utils/mitt' //mitt 事件总线
|
||||||
const resource = sessionStore.get('curr.resource') // apt 资源
|
|
||||||
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
|
|
||||||
/**
|
/**
|
||||||
* @description 监听器
|
* @description 监听器
|
||||||
*/
|
*/
|
||||||
// 监听幻灯片内容变化
|
export default () => {
|
||||||
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
const slidesStore = store.useSlidesStore()
|
||||||
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
|
||||||
},{ deep: true })
|
const resource = sessionStore.get('curr.resource') // apt 资源
|
||||||
|
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
|
||||||
|
|
||||||
// 监听标题变化
|
// 监听幻灯片内容变化
|
||||||
watch(() => slidesStore.title, (newVal, oldVal) => {
|
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
||||||
if (oldVal == '未命名演示文稿') return // 初始加载,不需要更新数据
|
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
||||||
updatePPT({title: newVal})
|
},{ deep: true })
|
||||||
})
|
|
||||||
|
|
||||||
// 消息监听ws
|
// 监听标题变化
|
||||||
console.log('监听器已开启', ChatWs)
|
watch(() => slidesStore.title, (newVal, oldVal) => {
|
||||||
if (ChatWs.ws) {
|
if (oldVal == '未命名演示文稿') return // 初始加载,不需要更新数据
|
||||||
ChatWs.watch((msg, e) => {
|
updatePPT({title: newVal})
|
||||||
try {
|
|
||||||
handleMessage(JSON.parse(msg))
|
|
||||||
} catch (error) {
|
|
||||||
console.error('socket 解析异常 ', error, e)
|
|
||||||
handleMessage(msg)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
// 更新ppt内容
|
// 消息监听ws
|
||||||
const updatePPT = async (data) => {
|
// console.log('监听器已开启', ChatWs)
|
||||||
if (!resource) return
|
if (!!ChatWs.ws) {
|
||||||
data.id = resource.id
|
ChatWs.watch((data, e) => {
|
||||||
await PPTApi.updateSlide(data) // 更新ppt内容
|
try {
|
||||||
sessionStore.set('curr.resource.title', data.title)
|
handleMessage(JSON.parse(data)?.msg)
|
||||||
// 更新smarttalk内容
|
} catch (error) {
|
||||||
if (!!smarttalk && !!data.title) {
|
console.error('socket 解析异常 ', error, e)
|
||||||
const {id, fileFlag} = smarttalk
|
handleMessage(data)
|
||||||
const params = { id, fileShowName: `${data.title}.${fileFlag}` }
|
}
|
||||||
await PPTApi.updateSmarttalk(params) // 更新ppt内容
|
})
|
||||||
sessionStore.set('curr.smarttalk.fileShowName', params.fileShowName)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ws消息处理
|
// 更新ppt内容
|
||||||
const handleMessage = (msg) => {
|
const updatePPT = async (data) => {
|
||||||
if (typeof msg === 'object'){
|
if (!resource) return
|
||||||
const { head, content, ...other } = msg
|
data.id = resource.id
|
||||||
switch (head) {
|
await PPTApi.updateSlide(data) // 更新ppt内容
|
||||||
case MsgEnum.HEADS.MSG_open: // 开课
|
sessionStore.set('curr.resource.title', data.title)
|
||||||
// 课堂信息不一致
|
// 更新smarttalk内容
|
||||||
if (Classcourse.id !== content.id) {
|
if (!!smarttalk && !!data.title) {
|
||||||
msgUtils.alertError('老师开课信息异常,请重新进入公屏!')
|
const {id, fileFlag} = smarttalk
|
||||||
.then(() => { // 点击确定按钮,关闭窗口
|
const params = { id, fileShowName: `${data.title}.${fileFlag}` }
|
||||||
window.close()
|
await PPTApi.updateSmarttalk(params) // 更新ppt内容
|
||||||
})
|
sessionStore.set('curr.smarttalk.fileShowName', params.fileShowName)
|
||||||
} else { // 正常更新数据
|
|
||||||
classcourseStore.classcourse.status = 'open'
|
|
||||||
// 更新课堂信息-关闭警告框
|
|
||||||
Classcourse?.msgObj?.onVanish()
|
|
||||||
}
|
|
||||||
break
|
|
||||||
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
|
|
||||||
const slideIndex = content.current
|
|
||||||
slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
|
||||||
break
|
|
||||||
case MsgEnum.HEADS.MSG_closed: // 下课:
|
|
||||||
window.close() // 关闭窗口
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ws消息处理
|
||||||
|
const handleMessage = (msg) => {
|
||||||
|
console.log('ws消息处理', msg)
|
||||||
|
if (typeof msg === 'object'){
|
||||||
|
const { head, content, ...other } = msg
|
||||||
|
switch (head) {
|
||||||
|
case MsgEnum.HEADS.MSG_open: // 开课
|
||||||
|
// 课堂信息不一致
|
||||||
|
if (Classcourse.id !== content.id) {
|
||||||
|
msgUtils.alertError('老师开课信息异常,请重新进入公屏!')
|
||||||
|
.then(() => { // 点击确定按钮,关闭窗口
|
||||||
|
close()
|
||||||
|
})
|
||||||
|
} else { // 正常更新数据
|
||||||
|
classcourseStore.classcourse.status = 'open'
|
||||||
|
sessionStore.set('curr.classcourse.status', 'open')
|
||||||
|
// 更新课堂信息-关闭警告框
|
||||||
|
Classcourse?.msgObj?.onVanish()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
|
||||||
|
const slideIndex = content.current
|
||||||
|
slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
|
||||||
|
break
|
||||||
|
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
|
||||||
|
if (!content.classWorkId) return
|
||||||
|
Homework.showHomework(content.classWorkId)
|
||||||
|
break
|
||||||
|
case MsgEnum.HEADS.MSG_closed: // 下课:
|
||||||
|
close()
|
||||||
|
break
|
||||||
|
case MsgEnum.HEADS.MSG_dz: // 点赞
|
||||||
|
emitter.emit('upvoteTrigger', 1)
|
||||||
|
break
|
||||||
|
case MsgEnum.HEADS.MSG_yh: // 疑惑
|
||||||
|
emitter.emit('upvoteTrigger', 2)
|
||||||
|
break
|
||||||
|
case MsgEnum.HEADS.MSG_0010: // 备用
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 关闭窗口
|
||||||
|
const close = () => {
|
||||||
|
ChatWs?.close() // 关闭ws
|
||||||
|
setTimeout(() => {
|
||||||
|
window.close() // 关闭窗口
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// console.log('监听器已开启', Classcourse)
|
|
||||||
// setTimeout(() => {
|
|
||||||
// console.log('关闭弹窗')
|
|
||||||
// // Classcourse.msgObj?.close()
|
|
||||||
// Classcourse?.msgObj?.onVanish()
|
|
||||||
// }, 10 * 1000)
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useScreenStore, useSlidesStore, useClasscourseStore } from '../store'
|
import { useScreenStore, useSlidesStore, useClasscourseStore } from '../store'
|
||||||
import { enterFullscreen, exitFullscreen, isFullscreen } from '../utils/fullscreen'
|
import { enterFullscreen, exitFullscreen, isFullscreen } from '../utils/fullscreen'
|
||||||
|
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const screenStore = useScreenStore()
|
const screenStore = useScreenStore()
|
||||||
|
@ -23,7 +24,10 @@ export default () => {
|
||||||
const classcourse = classcourseStore.classcourse
|
const classcourse = classcourseStore.classcourse
|
||||||
if (!!classcourse) { //DOTO 有课堂,执行退相关操作
|
if (!!classcourse) { //DOTO 有课堂,执行退相关操作
|
||||||
console.log('退出放映状态')
|
console.log('退出放映状态')
|
||||||
window.close()
|
ChatWs?.close() // 关闭ws
|
||||||
|
setTimeout(() => {
|
||||||
|
window.close() // 关闭窗口
|
||||||
|
}, 1000)
|
||||||
} else screenStore.setScreening(false)
|
} else screenStore.setScreening(false)
|
||||||
if (isFullscreen()) exitFullscreen()
|
if (isFullscreen()) exitFullscreen()
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
import { ref, reactive, onMounted, computed } from 'vue';
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import { getSmarttalkPage } from '@/api/file'
|
import { getSmarttalkPage } from '@/api/file'
|
||||||
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js'
|
import * as commUtils from '@/utils/comm.js'
|
||||||
|
import { getFileSuffix } from '@/utils/ruoyi.js'
|
||||||
|
|
||||||
const emit = defineEmits(['insertMaterial', 'close'])
|
const emit = defineEmits(['insertMaterial', 'close'])
|
||||||
|
|
||||||
|
@ -62,12 +63,15 @@ const fileUrl = computed(() => (item) =>{
|
||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
const onInsert = async (item) =>{
|
const onInsert = async (item) =>{
|
||||||
|
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){
|
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
|
||||||
emit('insertMaterial',{ type: 'video', data: item.fileFullPath })
|
emit('insertMaterial',{ type: 'video', file })
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
const base64 = await urlToBase64(item.fileFullPath)
|
emit('insertMaterial',{ type: 'img', file })
|
||||||
emit('insertMaterial',{ type: 'img', data: base64 })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@
|
||||||
<Modal
|
<Modal
|
||||||
v-model:visible="imgVisible"
|
v-model:visible="imgVisible"
|
||||||
:width="1300">
|
:width="1300">
|
||||||
<TextCreateImg hasPPt @insertImg="(url: string) => { createImageElement(url); imgVisible = false }" />
|
<TextCreateImg hasPPt @insertImg="insertImg" />
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -165,6 +165,7 @@ import { PPTApi } from '../../../api'
|
||||||
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
||||||
import { toPng } from 'html-to-image' // 引入html-to-image库
|
import { toPng } from 'html-to-image' // 引入html-to-image库
|
||||||
|
|
||||||
|
|
||||||
const mainStore = useMainStore()
|
const mainStore = useMainStore()
|
||||||
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
||||||
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
|
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
|
||||||
|
@ -280,21 +281,31 @@ const toggleNotesPanel = () => {
|
||||||
// 插入素材
|
// 插入素材
|
||||||
interface MaterialParams {
|
interface MaterialParams {
|
||||||
type: string,
|
type: string,
|
||||||
data: string
|
file: any
|
||||||
}
|
}
|
||||||
const insertMaterial = (item: MaterialParams) =>{
|
const insertMaterial = (item: MaterialParams) =>{
|
||||||
const { type, data } = item
|
const { type, file } = item
|
||||||
if(type == 'video'){
|
PPTApi.toRousrceUrl(file).then(data=>{
|
||||||
createVideoElement(data)
|
if(type == 'video'){
|
||||||
}
|
createVideoElement(data)
|
||||||
else{
|
}
|
||||||
createImageElement(data)
|
else{
|
||||||
}
|
createImageElement(data)
|
||||||
materiaVisible.value = false
|
}
|
||||||
|
materiaVisible.value = false
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文生图
|
// 文生图
|
||||||
const imgVisible = ref(false)
|
const imgVisible = ref(false)
|
||||||
|
const insertImg = async (file: any) =>{
|
||||||
|
PPTApi.toRousrceUrl(file).then(data=>{
|
||||||
|
createImageElement(data)
|
||||||
|
imgVisible.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -482,10 +482,7 @@ export default {
|
||||||
|
|
||||||
//保存图片到素材库
|
//保存图片到素材库
|
||||||
async saveImage(resultIndex, index, url, resultItem) {
|
async saveImage(resultIndex, index, url, resultItem) {
|
||||||
if(this.hasPPt){
|
|
||||||
this.$emit('insertImg', url)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.buttonStates[resultIndex][index].disabled = true;
|
this.buttonStates[resultIndex][index].disabled = true;
|
||||||
this.buttonStates[resultIndex][index].text = "正在保存...";
|
this.buttonStates[resultIndex][index].text = "正在保存...";
|
||||||
const numberIndex = url.indexOf('filename=');
|
const numberIndex = url.indexOf('filename=');
|
||||||
|
@ -495,6 +492,7 @@ export default {
|
||||||
try {
|
try {
|
||||||
const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`);
|
const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`);
|
||||||
|
|
||||||
|
|
||||||
const hash = CryptoJS.MD5(blob).toString();
|
const hash = CryptoJS.MD5(blob).toString();
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
@ -502,7 +500,10 @@ export default {
|
||||||
let file = new File([blob], `${resultItem}.png`, {
|
let file = new File([blob], `${resultItem}.png`, {
|
||||||
type: 'image/png'
|
type: 'image/png'
|
||||||
})
|
})
|
||||||
|
if(this.hasPPt){
|
||||||
|
this.$emit('insertImg', file)
|
||||||
|
return
|
||||||
|
}
|
||||||
// 添加参数
|
// 添加参数
|
||||||
formData.append('md5', hash);
|
formData.append('md5', hash);
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
|
|
|
@ -44,7 +44,6 @@ const breadList = ref([])
|
||||||
watch(
|
watch(
|
||||||
() => router.currentRoute.value,
|
() => router.currentRoute.value,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
console.log(newValue)
|
|
||||||
const { showBread } = newValue.meta
|
const { showBread } = newValue.meta
|
||||||
if (showBread) {
|
if (showBread) {
|
||||||
isShowBack.value = true
|
isShowBack.value = true
|
||||||
|
|
|
@ -80,10 +80,10 @@ export class MsgEnum {
|
||||||
MSG_anmationclick : 'anmationclick',
|
MSG_anmationclick : 'anmationclick',
|
||||||
/** @desc: 群组创建成功 */
|
/** @desc: 群组创建成功 */
|
||||||
MSG_classcourseopen : 'classcourseopen',
|
MSG_classcourseopen : 'classcourseopen',
|
||||||
/** @desc: 学生的测练结果反馈 */
|
|
||||||
MSG_classquizfeedback : 'classquizfeedback',
|
|
||||||
/** @desc: 学生提交作业 */
|
/** @desc: 学生提交作业 */
|
||||||
MSG_finishHomework : 'finishHomework',
|
MSG_finishHomework : 'finishHomework',
|
||||||
|
/** @desc: 学生的测练结果反馈 */
|
||||||
|
MSG_classquizfeedback : 'classquizfeedback',
|
||||||
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
|
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
|
||||||
MSG_classtaskfeedback : 'classtaskfeedback',
|
MSG_classtaskfeedback : 'classtaskfeedback',
|
||||||
/** @desc: 老师端:学生反馈的消息,具体要看其中的feedbackkey,类别较繁杂 */
|
/** @desc: 老师端:学生反馈的消息,具体要看其中的feedbackkey,类别较繁杂 */
|
||||||
|
@ -96,6 +96,12 @@ export class MsgEnum {
|
||||||
MSG_classWorkOfPresentDataUpdate : 'classWorkOfPresentDataUpdate',
|
MSG_classWorkOfPresentDataUpdate : 'classWorkOfPresentDataUpdate',
|
||||||
/** @desc: 课堂讲授活动,选择不同的内容 */
|
/** @desc: 课堂讲授活动,选择不同的内容 */
|
||||||
MSG_classlecturePagesrc : 'classlecturePagesrc',
|
MSG_classlecturePagesrc : 'classlecturePagesrc',
|
||||||
|
/** @desc: 课堂作业|活动 */
|
||||||
|
MSG_homework : 'HOMEWORK',
|
||||||
|
/** @desc: 点赞 */
|
||||||
|
MSG_dz : 'dz',
|
||||||
|
/** @desc: 疑惑 */
|
||||||
|
MSG_yh : 'yh',
|
||||||
// === 新定义-消息头 ===
|
// === 新定义-消息头 ===
|
||||||
/** @desc: 课程创建-待开课 */
|
/** @desc: 课程创建-待开课 */
|
||||||
MSG_0000: 0x0000,
|
MSG_0000: 0x0000,
|
||||||
|
@ -140,4 +146,4 @@ export class MsgEnum {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { MsgEnum as default }
|
export default MsgEnum;
|
|
@ -28,6 +28,7 @@ export class ChatWs {
|
||||||
const userStore = useUserStore() // 用户信息
|
const userStore = useUserStore() // 用户信息
|
||||||
const wsBase = import.meta.env.VITE_APP_WS_URL; // ws地址
|
const wsBase = import.meta.env.VITE_APP_WS_URL; // ws地址
|
||||||
this.url = `${wsBase||ChatWs.base}/ws/websocket/${userStore.id}`;
|
this.url = `${wsBase||ChatWs.base}/ws/websocket/${userStore.id}`;
|
||||||
|
this.closed = false; // 关闭状态 防止重连失败
|
||||||
// this.init(url);
|
// this.init(url);
|
||||||
}
|
}
|
||||||
ChatWs.instance = this;
|
ChatWs.instance = this;
|
||||||
|
@ -38,6 +39,7 @@ export class ChatWs {
|
||||||
// 初始化
|
// 初始化
|
||||||
init(url) {
|
init(url) {
|
||||||
!!url && (this.url = url);
|
!!url && (this.url = url);
|
||||||
|
this.closed = false; // 关闭状态 防止重连失败
|
||||||
this.ws = null;
|
this.ws = null;
|
||||||
const _this = this
|
const _this = this
|
||||||
this.heartCheck = {
|
this.heartCheck = {
|
||||||
|
@ -64,43 +66,46 @@ export class ChatWs {
|
||||||
}, this.timeout);
|
}, this.timeout);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.reconnect();
|
return this.reconnect();
|
||||||
}
|
}
|
||||||
// 重连
|
// 重连
|
||||||
reconnect() {
|
reconnect() {
|
||||||
const self = this;
|
return new Promise((resolve, reject) => {
|
||||||
if (!!this.ws) { // 关闭之前的链接
|
const self = this;
|
||||||
this.ws.close()
|
if (!!this.ws) { // 关闭之前的链接
|
||||||
this.ws = null
|
this.ws.close()
|
||||||
}
|
this.ws = null
|
||||||
this.ws = new WebSocket(this.url);
|
}
|
||||||
this.ws.onopen = function () {
|
this.ws = new WebSocket(this.url);
|
||||||
console.log("websocket-连接成功")
|
this.ws.onopen = function () {
|
||||||
self.heartCheck.reset().start();
|
console.log("websocket-连接成功")
|
||||||
};
|
self.heartCheck.reset().start();
|
||||||
this.ws.onmessage = function (e) {
|
resolve()
|
||||||
// console.log("websocket-收到消息", e)
|
};
|
||||||
// 拿到任何消息都说明当前连接是正常的
|
this.ws.onmessage = function (e) {
|
||||||
const isBeat = e.data == 'pong'
|
// console.log("websocket-收到消息", e)
|
||||||
isBeat && self.heartCheck.reset().start();
|
// 拿到任何消息都说明当前连接是正常的
|
||||||
const isEmpty = !e.data
|
const isBeat = e.data == 'pong'
|
||||||
const isExts = e.data.includes('sessionId') || e.data == ('pong')
|
isBeat && self.heartCheck.reset().start();
|
||||||
if (isEmpty || isExts) return;
|
const isEmpty = !e.data
|
||||||
// 自定义处理
|
const isExts = e.data.includes('sessionId') || e.data == ('pong')
|
||||||
self.onmessage && self.onmessage(e.data, e);
|
if (isEmpty || isExts) return;
|
||||||
};
|
// 自定义处理
|
||||||
this.ws.onerror = function (e) {
|
self.onmessage && self.onmessage(e.data, e);
|
||||||
console.log("websocket-连接异常", e)
|
};
|
||||||
self.connectSocket() // 重连
|
this.ws.onerror = function (e) {
|
||||||
};
|
console.log("websocket-连接异常", e)
|
||||||
this.ws.onclose = function (e) {
|
self.connectSocket() // 重连
|
||||||
console.log("websocket-连接断开", e)
|
};
|
||||||
self.connectSocket() // 重连
|
this.ws.onclose = function (e) {
|
||||||
};
|
console.log("websocket-连接断开", e)
|
||||||
|
self.connectSocket() // 重连
|
||||||
|
};
|
||||||
|
})
|
||||||
}
|
}
|
||||||
connectSocket() {
|
connectSocket() {
|
||||||
this.heartCheck.reset() // 重置心跳
|
this.heartCheck.reset() // 重置心跳
|
||||||
if (self.closed) return; // 关闭状态不重连
|
if (this.closed) return this.ws = null; // 关闭状态不重连
|
||||||
// if(self.errCount <= 0) return; // 超过重连次数
|
// if(self.errCount <= 0) return; // 超过重连次数
|
||||||
// self.errCount--; // 重连次数减1
|
// self.errCount--; // 重连次数减1
|
||||||
if (this.errTime) {
|
if (this.errTime) {
|
||||||
|
@ -157,6 +162,16 @@ export class ChatWs {
|
||||||
this.closed = true;
|
this.closed = true;
|
||||||
this.ws.close();
|
this.ws.close();
|
||||||
}
|
}
|
||||||
|
// 下课
|
||||||
|
closedCourse(id) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.sendMsg('closed', '下课', null, 'group', id)
|
||||||
|
resolve()
|
||||||
|
// setTimeout(() => {
|
||||||
|
// this.close() // 关闭链接
|
||||||
|
// }, 1000);
|
||||||
|
})
|
||||||
|
}
|
||||||
// 延时 ms 毫秒
|
// 延时 ms 毫秒
|
||||||
sleep(ms){
|
sleep(ms){
|
||||||
return new Promise(resolve => setTimeout(resolve, ms))
|
return new Promise(resolve => setTimeout(resolve, ms))
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.status === 'open'">
|
<template v-else-if="item.status === 'open'">
|
||||||
<el-button :disabled="toolStore.isToolWin" size="small" type="primary" @click="startClassR(item)"
|
<el-button :disabled="toolStore.isToolWin" size="small" type="primary" @click="startClassR(item)"
|
||||||
>继续上课</el-button
|
>继续上课</el-button>
|
||||||
>
|
|
||||||
<!--<el-button v-if="item.status === '未开始'" @click="openEdit">编辑</el-button>-->
|
<!--<el-button v-if="item.status === '未开始'" @click="openEdit">编辑</el-button>-->
|
||||||
<el-button :loading="loading" size="small" type="info" @click="endClassR(item)"
|
<el-button :loading="loading" size="small" type="info" @click="endClassR(item)"
|
||||||
>下课{{ loading?'中...':'' }}</el-button>
|
>下课{{ loading?'中...':'' }}</el-button>
|
||||||
|
|
|
@ -714,6 +714,7 @@ const closeDialog = () => {
|
||||||
|
|
||||||
// im监听消息回调
|
// im监听消息回调
|
||||||
const msgHandle = (msg) => {
|
const msgHandle = (msg) => {
|
||||||
|
console.log('socket消息回调', msg)
|
||||||
if (typeof msg === 'object'){
|
if (typeof msg === 'object'){
|
||||||
const { head, content, ...other } = msg
|
const { head, content, ...other } = msg
|
||||||
switch(head) {
|
switch(head) {
|
||||||
|
|
|
@ -146,6 +146,7 @@ const open = async (id, classObj) => {
|
||||||
await getAptInfo(id)
|
await getAptInfo(id)
|
||||||
// 获取班级列表
|
// 获取班级列表
|
||||||
getClassList()
|
getClassList()
|
||||||
|
console.log('classObj', classObj)
|
||||||
// 继续上课
|
// 继续上课
|
||||||
if (!!classObj) {
|
if (!!classObj) {
|
||||||
dt.ctCourse = classObj
|
dt.ctCourse = classObj
|
||||||
|
@ -304,11 +305,11 @@ const classTeachingStart = async () => {
|
||||||
const { classcourseid:id } = teacherForm.form
|
const { classcourseid:id } = teacherForm.form
|
||||||
if (id) { // 开始上课
|
if (id) { // 开始上课
|
||||||
// 新版-pptList 打开公屏
|
// 新版-pptList 打开公屏
|
||||||
if (myClassActive.value.filetype == 'aptist') {
|
if (myClassActive.value.filetype == 'aippt') {
|
||||||
const msgEl = ElMessage.warning({message:'正在打开公屏,请稍后...',duration: 0})
|
const msgEl = ElMessage.warning({message:'正在打开公屏,请稍后...',duration: 0})
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
msgEl.close()
|
msgEl.close()
|
||||||
const res = await Http_Classcourse.getClasscourse(teacherForm.form.classcourseid)
|
const res = await Http_Classcourse.getClasscourse(id)
|
||||||
openPublicScreen(res.data)
|
openPublicScreen(res.data)
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}else {
|
}else {
|
||||||
|
@ -316,6 +317,8 @@ const classTeachingStart = async () => {
|
||||||
toLinkWeb(url) // 跳转web-公屏
|
toLinkWeb(url) // 跳转web-公屏
|
||||||
visible.value = false // 关闭弹窗
|
visible.value = false // 关闭弹窗
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ElMessage.warning('请先创建课程')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 获取二维码地址
|
// 获取二维码地址
|
||||||
|
@ -354,9 +357,11 @@ const getQrUrl = async() => {
|
||||||
// 打开公屏
|
// 打开公屏
|
||||||
const openPublicScreen = (classcourse) => {
|
const openPublicScreen = (classcourse) => {
|
||||||
console.log('打开公屏', classcourse)
|
console.log('打开公屏', classcourse)
|
||||||
// 发送app端待开课消息
|
if (!dt.ctCourse) { // 新开课需要发送消息-继续上课不需要直接打开
|
||||||
const data = { id: classcourse.id }
|
// 发送app端待开课消息
|
||||||
ChatWs.sendMsg(MsgEnum.HEADS.MSG_0000, data, {}, ChatWs.TYPES.single, userStore.id)
|
const data = { id: classcourse.id }
|
||||||
|
ChatWs.sendMsg(MsgEnum.HEADS.MSG_0000, data, {}, ChatWs.TYPES.single, userStore.id)
|
||||||
|
}
|
||||||
// 缓存当前资源信息
|
// 缓存当前资源信息
|
||||||
const resource = toRaw(myClassActive.value)
|
const resource = toRaw(myClassActive.value)
|
||||||
sessionStore.set('curr.resource', resource) // 缓存当前资源信息
|
sessionStore.set('curr.resource', resource) // 缓存当前资源信息
|
||||||
|
|
|
@ -196,7 +196,7 @@ export default {
|
||||||
}
|
}
|
||||||
},*/
|
},*/
|
||||||
clickStartClass(item) {
|
clickStartClass(item) {
|
||||||
const isApt = item.fileFlag === 'apt'
|
const isApt = ['apt','aippt'].includes(item.fileFlag)
|
||||||
this.getOpenCourse(isApt).then(res => {
|
this.getOpenCourse(isApt).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if(!res){
|
if(!res){
|
||||||
|
|
|
@ -380,7 +380,7 @@ export default {
|
||||||
}
|
}
|
||||||
case 'close': { // 关闭上课
|
case 'close': { // 关闭上课
|
||||||
const head = MsgEnum.HEADS.MSG_closed // closed
|
const head = MsgEnum.HEADS.MSG_closed // closed
|
||||||
const msgT = MsgEnum.TYPES.TEACHER // teacher
|
// const msgT = MsgEnum.TYPES.TEACHER // teacher
|
||||||
const isApt = !row.bookImg // bookImg ppt 否则Apt
|
const isApt = !row.bookImg // bookImg ppt 否则Apt
|
||||||
row.ex3 == 'undefined' && (row.ex3 = null)
|
row.ex3 == 'undefined' && (row.ex3 = null)
|
||||||
const timgroupid = isApt ? row.timgroupid : row.ex3 // ex3 ppt 否则Apt
|
const timgroupid = isApt ? row.timgroupid : row.ex3 // ex3 ppt 否则Apt
|
||||||
|
@ -392,12 +392,13 @@ export default {
|
||||||
}
|
}
|
||||||
// 发送-下课消息
|
// 发送-下课消息
|
||||||
if (!!timgroupid) {
|
if (!!timgroupid) {
|
||||||
const msg = { msgKey: head, actor: msgT, classcourseid: row.id }
|
// const msg = { msgKey: head, actor: msgT, classcourseid: row.id }
|
||||||
Chat.sendMsg(timgroupid, msg)
|
// Chat.sendMsg(timgroupid, msg)
|
||||||
|
await ChatWs.closedCourse(timgroupid)
|
||||||
}
|
}
|
||||||
if (isApt) { // Apt
|
if (isApt) { // Apt
|
||||||
// 接口-修改状态
|
// 接口-修改状态
|
||||||
await updateClasscourse({ id: row.id, status: head, timgroupid: '' })
|
await updateClasscourse({ id: row.id, status: head })
|
||||||
} else { // PPT
|
} else { // PPT
|
||||||
const toolStore = useToolState()
|
const toolStore = useToolState()
|
||||||
// 窗口已打开,直接关闭
|
// 窗口已打开,直接关闭
|
||||||
|
@ -410,12 +411,12 @@ export default {
|
||||||
}
|
}
|
||||||
// 解散群
|
// 解散群
|
||||||
setTimeout(async() => {
|
setTimeout(async() => {
|
||||||
if (!!timgroupid) await Chat.dismissGroup(timgroupid)
|
// if (!!timgroupid) await Chat.dismissGroup(timgroupid)
|
||||||
if (other.type == 1) { // 弹窗-下课
|
if (other.type == 1) { // 弹窗-下课
|
||||||
other.instance.confirmButtonLoading = false
|
other.instance.confirmButtonLoading = false
|
||||||
other.instance.confirmButtonText = '下课'
|
other.instance.confirmButtonText = '下课'
|
||||||
other.done()
|
other.done()
|
||||||
} else {
|
} else { // 列表-下课
|
||||||
other.loading.value = false
|
other.loading.value = false
|
||||||
row.status = isApt ? head : '已结束'
|
row.status = isApt ? head : '已结束'
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ const pgDialog = reactive({ // 弹窗-进度条
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
emitter.on('changeMode', (item) => {
|
emitter.on('changeMode', (item) => {
|
||||||
console.log(item, 'item')
|
|
||||||
resultList.value = item.child
|
resultList.value = item.child
|
||||||
// conversation()
|
// conversation()
|
||||||
getTempResult(item.id)
|
getTempResult(item.id)
|
||||||
|
@ -106,7 +105,6 @@ emitter.on('changeMode', (item) => {
|
||||||
// 查询模板结果
|
// 查询模板结果
|
||||||
const getTempResult = (id) => {
|
const getTempResult = (id) => {
|
||||||
tempResult({ mainModelId: id }).then(res => {
|
tempResult({ mainModelId: id }).then(res => {
|
||||||
console.log(res, 2000)
|
|
||||||
let rows = res.rows
|
let rows = res.rows
|
||||||
if (rows.length > 0) {
|
if (rows.length > 0) {
|
||||||
resultList.value.forEach(item => {
|
resultList.value.forEach(item => {
|
||||||
|
@ -357,7 +355,6 @@ const toRousrceUrl = async(o) => {
|
||||||
const curNode = reactive({})
|
const curNode = reactive({})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
console.log('data', sessionStore)
|
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
courseObj.node = data
|
courseObj.node = data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue