Compare commits

..

No commits in common. "b4864bc109e7a78cffe79413115b21b316bfe71d" and "ea2a8ebfda436200bb810e404d019e166d931ba3" have entirely different histories.

18 changed files with 153 additions and 235 deletions

View File

@ -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/'
# websocket 地址
VITE_APP_WS_URL = 'wss://prev.ysaix.com:7868'
VITE_APP_WS_URL = 'wss://file.ysaix.com:7868'
# 是否显示开发工具
VITE_SHOW_DEV_TOOLS = 'true'

View File

@ -28,9 +28,8 @@ import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // api
import { PPTApi } from './api'
import { sessionStore } from '@/utils/store' // electron-store
// import './api/watcher' //
import watcher from './api/watcher' //
watcher() //
import './api/watcher' //
const loading = ref(true)
const _isPC = isPC()

View File

@ -8,15 +8,12 @@ import * as useStore from '../store' // pptist-状态管理
import ChatWs from '@/plugins/socket' // 聊天socket
import msgUtils from '@/plugins/modal' // 消息工具
const slidesStore = useStore.useSlidesStore() // 幻灯片-状态管理
const screenStore = useStore.useScreenStore() // 全屏-状态管理
const classcourseStore = useStore.useClasscourseStore() // 课堂信息-状态管理
const classcourse = sessionStore.get('curr.classcourse') // 课堂信息
export class Classcourse {
msgObj:ElMessageBox = null // 提示消息对象
classcourse:any = null // 课堂信息
id: number|string = null // 课堂id
constructor() {
this.load()
@ -25,7 +22,6 @@ export class Classcourse {
* @description
*/
load() {
console.log('classcourse-load', classcourse)
// 打开全屏
screenStore.setScreening(!!classcourse)
// 如果课堂信息有值则连接socket
@ -33,19 +29,14 @@ export class Classcourse {
// 连接socket
if (!ChatWs.ws) ChatWs.init()
ChatWs.id = classcourse.timgroupid // 群组id
this.classcourse = classcourse // 课堂信息
this.id = classcourse.id // 课堂id
// 如果课堂信息有paging则更新当前页码
const isPaging = !!classcourse.paging||classcourse.paging==0
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
// 课堂信息-状态管理
console.log('ws- ', classcourse)
classcourseStore.setClasscourse(classcourse)
// 待上课提示
if (!classcourse.status) {
this.msgObj = {
type: 'success',
title: '系统提示',
message: '公屏课堂已准备完毕,等待老师开启课堂...',
message: '公屏课堂已准备完毕,请等待老师开启课堂!',
center: true,
showClose: false,
showCancelButton: false,

View File

@ -106,8 +106,6 @@ export class MsgEnum {
MSG_anmationclick : 'anmationclick',
/** @desc: 群组创建成功 */
MSG_classcourseopen : 'classcourseopen',
/** @desc: 学生提交作业 */
MSG_finishHomework : 'finishHomework',
/** @desc: 学生的测练结果反馈 */
MSG_classquizfeedback : 'classquizfeedback',
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
@ -122,12 +120,6 @@ export class MsgEnum {
MSG_classWorkOfPresentDataUpdate : 'classWorkOfPresentDataUpdate',
/** @desc: 课堂讲授活动,选择不同的内容 */
MSG_classlecturePagesrc : 'classlecturePagesrc',
/** @desc: 课堂作业|活动 */
MSG_homework : 'HOMEWORK',
/** @desc: 点赞 */
MSG_dz : 'dz',
/** @desc: 疑惑 */
MSG_yh : 'yh',
// === 新定义-消息头 ===
/** @desc: 课程创建-待开课 */
MSG_0000: 0x0000,

View File

@ -10,44 +10,39 @@ import { MsgEnum } from './types' // 消息枚举
import ChatWs from '@/plugins/socket' // 聊天socket
import Classcourse from './classcourse' // 课程相关
import msgUtils from '@/plugins/modal' // 消息工具
import { Homework } from './index' // api-作业相关
import emitter from '@/utils/mitt' //mitt 事件总线
const slidesStore = store.useSlidesStore()
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
const resource = sessionStore.get('curr.resource') // apt 资源
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
/**
* @description
*/
export default () => {
const slidesStore = store.useSlidesStore()
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
const resource = sessionStore.get('curr.resource') // apt 资源
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
// 监听幻灯片内容变化
watch(() => slidesStore.slides, (newVal, oldVal) => {
// 监听幻灯片内容变化
watch(() => slidesStore.slides, (newVal, oldVal) => {
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
},{ deep: true })
},{ deep: true })
// 监听标题变化
watch(() => slidesStore.title, (newVal, oldVal) => {
// 监听标题变化
watch(() => slidesStore.title, (newVal, oldVal) => {
if (oldVal == '未命名演示文稿') return // 初始加载,不需要更新数据
updatePPT({title: newVal})
})
})
// 消息监听ws
// console.log('监听器已开启', ChatWs)
if (!!ChatWs.ws) {
ChatWs.watch((data, e) => {
// 消息监听ws
console.log('监听器已开启', ChatWs)
if (ChatWs.ws) {
ChatWs.watch((msg, e) => {
try {
handleMessage(JSON.parse(data)?.msg)
handleMessage(JSON.parse(msg))
} catch (error) {
console.error('socket 解析异常 ', error, e)
handleMessage(data)
handleMessage(msg)
}
})
}
}
// 更新ppt内容
const updatePPT = async (data) => {
// 更新ppt内容
const updatePPT = async (data) => {
if (!resource) return
data.id = resource.id
await PPTApi.updateSlide(data) // 更新ppt内容
@ -59,11 +54,10 @@ export default () => {
await PPTApi.updateSmarttalk(params) // 更新ppt内容
sessionStore.set('curr.smarttalk.fileShowName', params.fileShowName)
}
}
}
// ws消息处理
const handleMessage = (msg) => {
console.log('ws消息处理', msg)
// ws消息处理
const handleMessage = (msg) => {
if (typeof msg === 'object'){
const { head, content, ...other } = msg
switch (head) {
@ -72,11 +66,10 @@ export default () => {
if (Classcourse.id !== content.id) {
msgUtils.alertError('老师开课信息异常,请重新进入公屏!')
.then(() => { // 点击确定按钮,关闭窗口
close()
window.close()
})
} else { // 正常更新数据
classcourseStore.classcourse.status = 'open'
sessionStore.set('curr.classcourse.status', 'open')
// 更新课堂信息-关闭警告框
Classcourse?.msgObj?.onVanish()
}
@ -85,31 +78,17 @@ export default () => {
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: // 备用
window.close() // 关闭窗口
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)

View File

@ -1,6 +1,5 @@
import { useScreenStore, useSlidesStore, useClasscourseStore } from '../store'
import { enterFullscreen, exitFullscreen, isFullscreen } from '../utils/fullscreen'
import ChatWs from '@/plugins/socket' // 聊天socket
export default () => {
const screenStore = useScreenStore()
@ -24,10 +23,7 @@ export default () => {
const classcourse = classcourseStore.classcourse
if (!!classcourse) { //DOTO 有课堂,执行退相关操作
console.log('退出放映状态')
ChatWs?.close() // 关闭ws
setTimeout(() => {
window.close() // 关闭窗口
}, 1000)
window.close()
} else screenStore.setScreening(false)
if (isFullscreen()) exitFullscreen()
}

View File

@ -19,8 +19,7 @@
import { ref, reactive, onMounted, computed } from 'vue';
import { sessionStore } from '@/utils/store'
import { getSmarttalkPage } from '@/api/file'
import * as commUtils from '@/utils/comm.js'
import { getFileSuffix } from '@/utils/ruoyi.js'
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js'
const emit = defineEmits(['insertMaterial', 'close'])
@ -63,15 +62,12 @@ const fileUrl = computed(() => (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){
emit('insertMaterial',{ type: 'video', file })
emit('insertMaterial',{ type: 'video', data: item.fileFullPath })
}
else{
emit('insertMaterial',{ type: 'img', file })
const base64 = await urlToBase64(item.fileFullPath)
emit('insertMaterial',{ type: 'img', data: base64 })
}
}

View File

@ -132,7 +132,7 @@
<Modal
v-model:visible="imgVisible"
:width="1300">
<TextCreateImg hasPPt @insertImg="insertImg" />
<TextCreateImg hasPPt @insertImg="(url: string) => { createImageElement(url); imgVisible = false }" />
</Modal>
</div>
</template>
@ -165,7 +165,6 @@ import { PPTApi } from '../../../api'
import TextCreateImg from '@/components/ai-kolors/index.vue'
import { toPng } from 'html-to-image' // html-to-image
const mainStore = useMainStore()
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
@ -281,11 +280,10 @@ const toggleNotesPanel = () => {
//
interface MaterialParams {
type: string,
file: any
data: string
}
const insertMaterial = (item: MaterialParams) =>{
const { type, file } = item
PPTApi.toRousrceUrl(file).then(data=>{
const { type, data } = item
if(type == 'video'){
createVideoElement(data)
}
@ -293,19 +291,10 @@ const insertMaterial = (item: MaterialParams) =>{
createImageElement(data)
}
materiaVisible.value = false
})
}
//
const imgVisible = ref(false)
const insertImg = async (file: any) =>{
PPTApi.toRousrceUrl(file).then(data=>{
createImageElement(data)
imgVisible.value = false
})
}
</script>
<style lang="scss" scoped>

View File

@ -482,7 +482,10 @@ export default {
//
async saveImage(resultIndex, index, url, resultItem) {
if(this.hasPPt){
this.$emit('insertImg', url)
return
}
this.buttonStates[resultIndex][index].disabled = true;
this.buttonStates[resultIndex][index].text = "正在保存...";
const numberIndex = url.indexOf('filename=');
@ -492,7 +495,6 @@ export default {
try {
const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`);
const hash = CryptoJS.MD5(blob).toString();
const formData = new FormData();
@ -500,10 +502,7 @@ export default {
let file = new File([blob], `${resultItem}.png`, {
type: 'image/png'
})
if(this.hasPPt){
this.$emit('insertImg', file)
return
}
//
formData.append('md5', hash);
formData.append('file', file);

View File

@ -44,6 +44,7 @@ const breadList = ref([])
watch(
() => router.currentRoute.value,
(newValue) => {
console.log(newValue)
const { showBread } = newValue.meta
if (showBread) {
isShowBack.value = true

View File

@ -80,10 +80,10 @@ export class MsgEnum {
MSG_anmationclick : 'anmationclick',
/** @desc: 群组创建成功 */
MSG_classcourseopen : 'classcourseopen',
/** @desc: 学生提交作业 */
MSG_finishHomework : 'finishHomework',
/** @desc: 学生的测练结果反馈 */
MSG_classquizfeedback : 'classquizfeedback',
/** @desc: 学生提交作业 */
MSG_finishHomework : 'finishHomework',
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
MSG_classtaskfeedback : 'classtaskfeedback',
/** @desc: 老师端学生反馈的消息具体要看其中的feedbackkey类别较繁杂 */
@ -96,12 +96,6 @@ export class MsgEnum {
MSG_classWorkOfPresentDataUpdate : 'classWorkOfPresentDataUpdate',
/** @desc: 课堂讲授活动,选择不同的内容 */
MSG_classlecturePagesrc : 'classlecturePagesrc',
/** @desc: 课堂作业|活动 */
MSG_homework : 'HOMEWORK',
/** @desc: 点赞 */
MSG_dz : 'dz',
/** @desc: 疑惑 */
MSG_yh : 'yh',
// === 新定义-消息头 ===
/** @desc: 课程创建-待开课 */
MSG_0000: 0x0000,
@ -146,4 +140,4 @@ export class MsgEnum {
}
}
export default MsgEnum;
export { MsgEnum as default }

View File

@ -28,7 +28,6 @@ export class ChatWs {
const userStore = useUserStore() // 用户信息
const wsBase = import.meta.env.VITE_APP_WS_URL; // ws地址
this.url = `${wsBase||ChatWs.base}/ws/websocket/${userStore.id}`;
this.closed = false; // 关闭状态 防止重连失败
// this.init(url);
}
ChatWs.instance = this;
@ -39,7 +38,6 @@ export class ChatWs {
// 初始化
init(url) {
!!url && (this.url = url);
this.closed = false; // 关闭状态 防止重连失败
this.ws = null;
const _this = this
this.heartCheck = {
@ -66,11 +64,10 @@ export class ChatWs {
}, this.timeout);
},
};
return this.reconnect();
this.reconnect();
}
// 重连
reconnect() {
return new Promise((resolve, reject) => {
const self = this;
if (!!this.ws) { // 关闭之前的链接
this.ws.close()
@ -80,7 +77,6 @@ export class ChatWs {
this.ws.onopen = function () {
console.log("websocket-连接成功")
self.heartCheck.reset().start();
resolve()
};
this.ws.onmessage = function (e) {
// console.log("websocket-收到消息", e)
@ -101,11 +97,10 @@ export class ChatWs {
console.log("websocket-连接断开", e)
self.connectSocket() // 重连
};
})
}
connectSocket() {
this.heartCheck.reset() // 重置心跳
if (this.closed) return this.ws = null; // 关闭状态不重连
if (self.closed) return; // 关闭状态不重连
// if(self.errCount <= 0) return; // 超过重连次数
// self.errCount--; // 重连次数减1
if (this.errTime) {
@ -162,16 +157,6 @@ export class ChatWs {
this.closed = true;
this.ws.close();
}
// 下课
closedCourse(id) {
return new Promise((resolve, reject) => {
this.sendMsg('closed', '下课', null, 'group', id)
resolve()
// setTimeout(() => {
// this.close() // 关闭链接
// }, 1000);
})
}
// 延时 ms 毫秒
sleep(ms){
return new Promise(resolve => setTimeout(resolve, ms))

View File

@ -15,7 +15,8 @@
</template>
<template v-else-if="item.status === 'open'">
<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 :loading="loading" size="small" type="info" @click="endClassR(item)"
>下课{{ loading?'中...':'' }}</el-button>

View File

@ -714,7 +714,6 @@ const closeDialog = () => {
// im
const msgHandle = (msg) => {
console.log('socket消息回调', msg)
if (typeof msg === 'object'){
const { head, content, ...other } = msg
switch(head) {

View File

@ -146,7 +146,6 @@ const open = async (id, classObj) => {
await getAptInfo(id)
//
getClassList()
console.log('classObj', classObj)
//
if (!!classObj) {
dt.ctCourse = classObj
@ -305,11 +304,11 @@ const classTeachingStart = async () => {
const { classcourseid:id } = teacherForm.form
if (id) { //
// -pptList
if (myClassActive.value.filetype == 'aippt') {
if (myClassActive.value.filetype == 'aptist') {
const msgEl = ElMessage.warning({message:'正在打开公屏,请稍后...',duration: 0})
setTimeout(async () => {
msgEl.close()
const res = await Http_Classcourse.getClasscourse(id)
const res = await Http_Classcourse.getClasscourse(teacherForm.form.classcourseid)
openPublicScreen(res.data)
}, 2000);
}else {
@ -317,8 +316,6 @@ const classTeachingStart = async () => {
toLinkWeb(url) // web-
visible.value = false //
}
} else {
ElMessage.warning('请先创建课程')
}
}
//
@ -357,11 +354,9 @@ const getQrUrl = async() => {
//
const openPublicScreen = (classcourse) => {
console.log('打开公屏', classcourse)
if (!dt.ctCourse) { // -
// app
const data = { id: classcourse.id }
ChatWs.sendMsg(MsgEnum.HEADS.MSG_0000, data, {}, ChatWs.TYPES.single, userStore.id)
}
//
const resource = toRaw(myClassActive.value)
sessionStore.set('curr.resource', resource) //

View File

@ -196,7 +196,7 @@ export default {
}
},*/
clickStartClass(item) {
const isApt = ['apt','aippt'].includes(item.fileFlag)
const isApt = item.fileFlag === 'apt'
this.getOpenCourse(isApt).then(res => {
console.log(res)
if(!res){

View File

@ -380,7 +380,7 @@ export default {
}
case 'close': { //
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
row.ex3 == 'undefined' && (row.ex3 = null)
const timgroupid = isApt ? row.timgroupid : row.ex3 // ex3 ppt Apt
@ -392,13 +392,12 @@ export default {
}
// -
if (!!timgroupid) {
// const msg = { msgKey: head, actor: msgT, classcourseid: row.id }
// Chat.sendMsg(timgroupid, msg)
await ChatWs.closedCourse(timgroupid)
const msg = { msgKey: head, actor: msgT, classcourseid: row.id }
Chat.sendMsg(timgroupid, msg)
}
if (isApt) { // Apt
// -
await updateClasscourse({ id: row.id, status: head })
await updateClasscourse({ id: row.id, status: head, timgroupid: '' })
} else { // PPT
const toolStore = useToolState()
//
@ -411,12 +410,12 @@ export default {
}
//
setTimeout(async() => {
// if (!!timgroupid) await Chat.dismissGroup(timgroupid)
if (!!timgroupid) await Chat.dismissGroup(timgroupid)
if (other.type == 1) { // -
other.instance.confirmButtonLoading = false
other.instance.confirmButtonText = '下课'
other.done()
} else { // -
} else {
other.loading.value = false
row.status = isApt ? head : '已结束'
}

View File

@ -96,6 +96,7 @@ const pgDialog = reactive({ // 弹窗-进度条
}
})
emitter.on('changeMode', (item) => {
console.log(item, 'item')
resultList.value = item.child
// conversation()
getTempResult(item.id)
@ -105,6 +106,7 @@ emitter.on('changeMode', (item) => {
//
const getTempResult = (id) => {
tempResult({ mainModelId: id }).then(res => {
console.log(res, 2000)
let rows = res.rows
if (rows.length > 0) {
resultList.value.forEach(item => {
@ -355,6 +357,7 @@ const toRousrceUrl = async(o) => {
const curNode = reactive({})
onMounted(() => {
let data = sessionStore.get('subject.curNode')
console.log('data', sessionStore)
Object.assign(curNode, data);
courseObj.node = data