Merge branch 'main' into lyc-dev

This commit is contained in:
lyc 2024-12-16 09:50:30 +08:00
commit 88869e9a8a
25 changed files with 326 additions and 188 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/' 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 = 'true' VITE_SHOW_DEV_TOOLS = 'false'

View File

@ -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()

View File

@ -7,13 +7,19 @@ import { sessionStore } from '@/utils/store' // electron-store 状态管理
import * as useStore from '../store' // pptist-状态管理 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' // 消息工具
import * as Fullscreen from '../utils/fullscreen' // 全屏
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
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') // 课堂信息
const execPlay = useExecPlay() // 播放控制
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,21 +28,36 @@ export class Classcourse {
* @description * @description
*/ */
load() { load() {
console.log('classcourse-load', classcourse)
// 打开全屏 // 打开全屏
screenStore.setScreening(!!classcourse) const isCourse = !!classcourse
if (isCourse) Fullscreen.enterFullscreen()
screenStore.setScreening(isCourse)
// 如果课堂信息有值则连接socket // 如果课堂信息有值则连接socket
if (!!classcourse) { if (!!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
if (isPaging) slidesStore.updateSlideIndex(classcourse.paging)
// 如果课堂信息有paging则更新动画播放状态
const isAnim = !!classcourse.cartoonTimes
if (isAnim) { // 动画播放
for (let i = 0; i <= classcourse.cartoonTimes; i++) {
execPlay.runAnimation(true) // 异步执行动画
}
}
// 课堂信息-状态管理
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,

View File

@ -55,12 +55,13 @@ export class PPTApi {
// 变量 // 变量
static isUpdate = true // 是否更新数据 static isUpdate = true // 是否更新数据
// 获取所有幻灯片列表 // 获取所有幻灯片列表 isUpdate为true不更新
static getSlideList(parentid: (Number | String)): Promise<Boolean> { static getSlideList(parentid: (Number | String),isUpdate?:Boolean): Promise<Boolean> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const params: object = { parentid, orderByColumn: 'fileidx', isAsc: 'asc', pageSize: 9999 } const params: object = { parentid, orderByColumn: 'fileidx', isAsc: 'asc', pageSize: 9999 }
const res: Result = await API_entpcoursefile.listEntpcoursefileNew(params) const res: Result = await API_entpcoursefile.listEntpcoursefileNew(params)
if (res.code === 200) { if (res.code === 200) {
if(!isUpdate){
const slides = (res.rows || []).map(o => { const slides = (res.rows || []).map(o => {
if (!!o.datacontent) { if (!!o.datacontent) {
const json = JSON.parse(o.datacontent) const json = JSON.parse(o.datacontent)
@ -70,11 +71,12 @@ export class PPTApi {
// 如果没有数据,默认空白页 // 如果没有数据,默认空白页
return {id: o.id,elements:[],background:{type:"solid",color:"#fff"}} return {id: o.id,elements:[],background:{type:"solid",color:"#fff"}}
}) })
// 活动列表处理
const workList = (res.rows || []).map(o => o.activityContent)
const workItem = [...res.rows]
// slidesStore.updateSlideIndex(0) // 下标0 为第一页 // slidesStore.updateSlideIndex(0) // 下标0 为第一页
slidesStore.setSlides(slides) // 写入数据 slidesStore.setSlides(slides) // 写入数据
}
// 活动列表处理
const workList = (res.rows || []).map(o => o.activityContent)
const workItem = res.rows ? [...res.rows] : []
// 写入作业列表数据 // 写入作业列表数据
slidesStore.setWorkList(workList) slidesStore.setWorkList(workList)
// 获取所有的pptlist的数据 // 获取所有的pptlist的数据
@ -111,7 +113,6 @@ export class PPTApi {
data.id = rid data.id = rid
slidesStore.updateSlide(data) slidesStore.updateSlide(data)
// msgUtils.msgSuccess('新增成功') // msgUtils.msgSuccess('新增成功')
PPTApi.getSlideList(resource.id)
this.isUpdate = false // 新增后会触发监听,不再更新数据 this.isUpdate = false // 新增后会触发监听,不再更新数据
resolve(true) resolve(true)
} else msgUtils.msgError('新增失败');resolve(false) } else msgUtils.msgError('新增失败');resolve(false)
@ -134,7 +135,9 @@ export class PPTApi {
const isAdd = !/^\d+$/.test(currentSlide.id) // 是否新增 const isAdd = !/^\d+$/.test(currentSlide.id) // 是否新增
if (isAdd) { // 新增的幻灯片(id 为非数字,说明是新增的幻灯片) if (isAdd) { // 新增的幻灯片(id 为非数字,说明是新增的幻灯片)
const bool = await this.addSlide(currentSlide) const bool = await this.addSlide(currentSlide)
bool && this.batchUpdateSlides(newData, true) // 批量更新-排序 bool && await this.batchUpdateSlides(newData, true) // 批量更新-排序
const resource = sessionStore.get('curr.resource')||{}
await PPTApi.getSlideList(resource.id)
} else { // 防抖-更新 } else { // 防抖-更新
if (!this.isUpdate) return this.isUpdate = true // 下次更新数据 if (!this.isUpdate) return this.isUpdate = true // 下次更新数据
const params = { const params = {

View File

@ -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,

View File

@ -10,13 +10,20 @@ 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' // 消息工具
import { Homework } from './index' // api-作业相关
import emitter from '@/utils/mitt' //mitt 事件总线
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
/**
* @description
*/
export default () => {
const slidesStore = store.useSlidesStore() const slidesStore = store.useSlidesStore()
const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理 const classcourseStore = store.useClasscourseStore() // 课堂信息-状态管理
const resource = sessionStore.get('curr.resource') // apt 资源 const resource = sessionStore.get('curr.resource') // apt 资源
const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源 const smarttalk = sessionStore.get('curr.smarttalk') // 备课资源
/** const execPlay = useExecPlay() // 播放控制
* @description
*/
// 监听幻灯片内容变化 // 监听幻灯片内容变化
watch(() => slidesStore.slides, (newVal, oldVal) => { watch(() => slidesStore.slides, (newVal, oldVal) => {
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容 PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
@ -29,14 +36,14 @@ watch(() => slidesStore.title, (newVal, oldVal) => {
}) })
// 消息监听ws // 消息监听ws
console.log('监听器已开启', ChatWs) // console.log('监听器已开启', ChatWs)
if (ChatWs.ws) { if (!!ChatWs.ws) {
ChatWs.watch((msg, e) => { ChatWs.watch((data, e) => {
try { try {
handleMessage(JSON.parse(msg)) handleMessage(JSON.parse(data)?.msg)
} catch (error) { } catch (error) {
console.error('socket 解析异常 ', error, e) console.error('socket 解析异常 ', error, e)
handleMessage(msg) handleMessage(data)
} }
}) })
} }
@ -58,6 +65,7 @@ const updatePPT = async (data) => {
// ws消息处理 // ws消息处理
const handleMessage = (msg) => { const handleMessage = (msg) => {
console.log('ws消息处理', msg)
if (typeof msg === 'object'){ if (typeof msg === 'object'){
const { head, content, ...other } = msg const { head, content, ...other } = msg
switch (head) { switch (head) {
@ -66,29 +74,47 @@ const handleMessage = (msg) => {
if (Classcourse.id !== content.id) { if (Classcourse.id !== content.id) {
msgUtils.alertError('老师开课信息异常,请重新进入公屏!') msgUtils.alertError('老师开课信息异常,请重新进入公屏!')
.then(() => { // 点击确定按钮,关闭窗口 .then(() => { // 点击确定按钮,关闭窗口
window.close() close()
}) })
} else { // 正常更新数据 } else { // 正常更新数据
classcourseStore.classcourse.status = 'open' classcourseStore.classcourse.status = 'open'
sessionStore.set('curr.classcourse.status', 'open')
// 更新课堂信息-关闭警告框 // 更新课堂信息-关闭警告框
Classcourse?.msgObj?.onVanish() Classcourse?.msgObj?.onVanish()
} }
break break
case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页 case MsgEnum.HEADS.MSG_slideFlapping: // 幻灯片翻页
const slideIndex = content.current const slideIndex = content?.current || 0
slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标 const type = content?.animation
if (type === 'Nextsteps') execPlay.execNext() // 下一步
else if (type === 'Previoustep') execPlay.execPrev() // 上一步
else slidesStore.updateSlideIndex(slideIndex) // 更新幻灯片下标
break
case MsgEnum.HEADS.MSG_homework: // 作业|活动-布置
if (!content.classWorkId) return
Homework.showHomework(content.classWorkId)
break break
case MsgEnum.HEADS.MSG_closed: // 下课: case MsgEnum.HEADS.MSG_closed: // 下课:
window.close() // 关闭窗口 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 break
default: default:
break break
} }
} }
} }
// console.log('监听器已开启', Classcourse) // 关闭窗口
// setTimeout(() => { const close = () => {
// console.log('关闭弹窗') ChatWs?.close() // 关闭ws
// // Classcourse.msgObj?.close() setTimeout(() => {
// Classcourse?.msgObj?.onVanish() window.close() // 关闭窗口
// }, 10 * 1000) }, 1000)
}
}

View File

@ -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()
} }

View File

@ -145,21 +145,16 @@ export const useSlidesStore = defineStore('slides', {
setWorkItem(list: Object[]) { setWorkItem(list: Object[]) {
this.workItem = list this.workItem = list
}, },
addWorkItem(data: any) {
const id = data?.id
if (!id) return
this.workItem.splice(this.slideIndex + 1, 0, data)
this.slideIndex += 1
},
addSlide(slide: Slide | Slide[]) { addSlide(slide: Slide | Slide[]) {
const slides = Array.isArray(slide) ? slide : [slide] const slides = Array.isArray(slide) ? slide : [slide]
for (const slide of slides) { for (const slide of slides) {
if (slide.sectionTag) delete slide.sectionTag if (slide.sectionTag) delete slide.sectionTag
} }
// const addIndex = this.slideIndex + 1
this.slides.splice(this.slideIndex, 0, ...slides) this.slides.splice(this.slideIndex, 0, ...slides)
// this.slideIndex = addIndex
}, },
updateSlide(props: Partial<Slide>, slideId?: string) { updateSlide(props: Partial<Slide>, slideId?: string) {
const slideIndex = slideId ? this.slides.findIndex(item => item.id === slideId) : this.slideIndex const slideIndex = slideId ? this.slides.findIndex(item => item.id === slideId) : this.slideIndex
this.slides[slideIndex] = { ...this.slides[slideIndex], ...props } this.slides[slideIndex] = { ...this.slides[slideIndex], ...props }

View File

@ -168,6 +168,10 @@ const type = ref<WorkType[]>([
label: '常规作业', label: '常规作业',
value: 'primary' value: 'primary'
}, },
{
label: '框架梳理',
value: 'primary'
}
]) ])
const objItem = ref<any>({}) const objItem = ref<any>({})
@ -302,9 +306,9 @@ const getData = async (data: WorkItem) => {
dialogVisible.value = false dialogVisible.value = false
} }
const upDateData = async () => { const upDateData = async () => {
// await PPTApi.updateSlide(paramData.value)
loadingActive.value = true loadingActive.value = true
await updateEntpcoursefileNew(paramData.value) await PPTApi.updateSlide(paramData.value)
// await updateEntpcoursefileNew(paramData.value)
const resource = sessionStore.get('curr.resource') const resource = sessionStore.get('curr.resource')
await PPTApi.getSlideList(resource.id) await PPTApi.getSlideList(resource.id)
const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 }) const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 })

View File

@ -19,10 +19,10 @@ export default () => {
// 最小已播放页面索引 // 最小已播放页面索引
const playedSlidesMinIndex = ref(slideIndex.value) const playedSlidesMinIndex = ref(slideIndex.value)
// 执行元素动画 // 执行元素动画 isAsync 为 true 时,异步执行,否则同步执行
const runAnimation = () => { const runAnimation = (isAsync: boolean) => {
// 正在执行动画时,禁止其他新的动画开始 // 正在执行动画时,禁止其他新的动画开始
if (inAnimation.value) return if (inAnimation.value && !isAsync) return
const { animations, autoNext } = formatedAnimations.value[animationIndex.value] const { animations, autoNext } = formatedAnimations.value[animationIndex.value]
animationIndex.value += 1 animationIndex.value += 1
@ -174,6 +174,7 @@ export default () => {
// 鼠标滚动翻页 // 鼠标滚动翻页
const mousewheelListener = throttle(function(e: WheelEvent) { const mousewheelListener = throttle(function(e: WheelEvent) {
e.preventDefault() // 阻止默认事件
if (e.deltaY < 0) execPrev() if (e.deltaY < 0) execPrev()
else if (e.deltaY > 0) execNext() else if (e.deltaY > 0) execNext()
}, 500, { leading: true, trailing: false }) }, 500, { leading: true, trailing: false })
@ -182,20 +183,20 @@ export default () => {
const touchInfo = ref<{ x: number; y: number; } | null>(null) const touchInfo = ref<{ x: number; y: number; } | null>(null)
const touchStartListener = (e: TouchEvent) => { const touchStartListener = (e: TouchEvent) => {
e.preventDefault() // 阻止默认事件
touchInfo.value = { touchInfo.value = {
x: e.changedTouches[0].pageX, // x: e.changedTouches[0].pageX,
y: e.changedTouches[0].pageY, // y: e.changedTouches[0].pageY,
x: e.changedTouches[0].clientX,
y: e.changedTouches[0].clientY,
} }
} }
const touchEndListener = (e: TouchEvent) => { const touchEndListener = (e: TouchEvent) => {
if (!touchInfo.value) return if (!touchInfo.value) return
const offsetX = Math.abs(touchInfo.value.x - e.changedTouches[0].clientX)
const offsetX = Math.abs(touchInfo.value.x - e.changedTouches[0].pageX) const offsetY = e.changedTouches[0].clientY - touchInfo.value.y
const offsetY = e.changedTouches[0].pageY - touchInfo.value.y
if ( Math.abs(offsetY) > offsetX && Math.abs(offsetY) > 50 ) { if ( Math.abs(offsetY) > offsetX && Math.abs(offsetY) > 50 ) {
touchInfo.value = null touchInfo.value = null
if (offsetY > 0) execPrev() if (offsetY > 0) execPrev()
else execNext() else execNext()
} }
@ -203,6 +204,7 @@ export default () => {
// 快捷键翻页 // 快捷键翻页
const keydownListener = (e: KeyboardEvent) => { const keydownListener = (e: KeyboardEvent) => {
e.preventDefault() // 阻止默认事件
const key = e.key.toUpperCase() const key = e.key.toUpperCase()
if (key === KEYS.UP || key === KEYS.LEFT || key === KEYS.PAGEUP) execPrev() if (key === KEYS.UP || key === KEYS.LEFT || key === KEYS.PAGEUP) execPrev()

View File

@ -71,3 +71,11 @@ export const addFileToKj = (id) => {
method: 'get' method: 'get'
}) })
} }
export const getModelInfo = (params) => {
return request({
url: '/education/llmModel/getModelInfo',
method: 'post',
params
})
}

View File

@ -5,13 +5,13 @@
<el-popover ref="popoverRef" placement="right" trigger="hover" popper-class="popoverStyle" :tabindex="999" > <el-popover ref="popoverRef" placement="right" trigger="hover" popper-class="popoverStyle" :tabindex="999" >
<template #reference> <template #reference>
<div class="user-info"> <div class="user-info">
<el-image class="user-img" :src="dev_api + userStore.user.avatar" /> <el-image class="user-img" :src="userStore.user.avatar ==='/img/avatar-default.jpg' ? defaultUserImg : dev_api + userStore.user.avatar" />
<span>{{ userStore.user.nickName }}</span> <span>{{ userStore.user.nickName }}</span>
</div> </div>
</template> </template>
<div class="head-aside"> <div class="head-aside">
<ul > <ul >
<li v-if="!isStadium" :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" > <li v-if="isStadium() !== true" :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" >
<i class="iconfont icon-renzheng-" :style="computedregistertype==4?'color:green;':''"></i> <i class="iconfont icon-renzheng-" :style="computedregistertype==4?'color:green;':''"></i>
<span class="mlr-5" v-if="computedregistertype!=4">学校认证</span> <span class="mlr-5" v-if="computedregistertype!=4">学校认证</span>
<span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span> <span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span>
@ -19,8 +19,8 @@
</li> </li>
<li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li> <li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li>
<li @click="onUserTo('/profile')">个人中心</li> <li @click="onUserTo('/profile')">个人中心</li>
<li v-if="!isStadium" @click="onUserTo('/schoolManagement')">学校管理</li> <li v-if="isStadium() !== true" @click="onUserTo('/schoolManagement')">学校管理</li>
<li v-if="!isStadium" @click="onUserTo('/class')">班级中心</li> <li v-if="isStadium() !== true" @click="onUserTo('/class')">班级中心</li>
<li @click="logout">退出登录</li> <li @click="logout">退出登录</li>
</ul> </ul>
</div> </div>
@ -59,6 +59,7 @@ import { ElMessageBox, ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { sessionStore } from '@/utils/store' import { sessionStore } from '@/utils/store'
import pkc from "../../../../../package.json" import pkc from "../../../../../package.json"
import defaultUserImg from '@/assets/images/img-avatar.png'
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}

View File

@ -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;

View File

@ -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,10 +66,11 @@ export class ChatWs {
}, this.timeout); }, this.timeout);
}, },
}; };
this.reconnect(); return this.reconnect();
} }
// 重连 // 重连
reconnect() { reconnect() {
return new Promise((resolve, reject) => {
const self = this; const self = this;
if (!!this.ws) { // 关闭之前的链接 if (!!this.ws) { // 关闭之前的链接
this.ws.close() this.ws.close()
@ -77,6 +80,7 @@ export class ChatWs {
this.ws.onopen = function () { this.ws.onopen = function () {
console.log("websocket-连接成功") console.log("websocket-连接成功")
self.heartCheck.reset().start(); self.heartCheck.reset().start();
resolve()
}; };
this.ws.onmessage = function (e) { this.ws.onmessage = function (e) {
// console.log("websocket-收到消息", e) // console.log("websocket-收到消息", e)
@ -97,10 +101,11 @@ export class ChatWs {
console.log("websocket-连接断开", e) console.log("websocket-连接断开", e)
self.connectSocket() // 重连 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))

View File

@ -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>

View File

@ -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) {

View File

@ -9,7 +9,7 @@
<el-icon class="item-icon"><Flag /></el-icon> <el-icon class="item-icon"><Flag /></el-icon>
<div class="content-header-title">{{item.name}}</div> <div class="content-header-title">{{item.name}}</div>
<div class="content-header-body"> <div class="content-header-body">
<div class="content-header-num">6</div> <div class="content-header-num">{{item.num}}</div>
<div class="content-header-text">分析结果</div> <div class="content-header-text">分析结果</div>
</div> </div>
</div> </div>
@ -83,7 +83,7 @@ import useUserStore from '@/store/modules/user' // 用户信息
import ChooseTextbook from '@/components/choose-textbook/index.vue' import ChooseTextbook from '@/components/choose-textbook/index.vue'
import KjListItem from '@/views/prepare/container/kj-list-item.vue' import KjListItem from '@/views/prepare/container/kj-list-item.vue'
import FileImage from '@/components/file-image/index.vue' import FileImage from '@/components/file-image/index.vue'
import {creatAPT, getSmarttalkPage} from '@/api/file' import {creatAPT, getSmarttalkPage, getModelInfo} from '@/api/file'
import {ArrowDown, Flag, Position} from '@element-plus/icons-vue' import {ArrowDown, Flag, Position} from '@element-plus/icons-vue'
import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile"; import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile";
import { dataSetJson } from '@/utils/comm' // id import { dataSetJson } from '@/utils/comm' // id
@ -165,9 +165,6 @@ const uploadData = ref({
fileRoot: '备课' fileRoot: '备课'
}) })
const currentFileList = ref([]) const currentFileList = ref([])
//
onMounted(() => {
})
const gotoRoute = (item) => { const gotoRoute = (item) => {
if (item.path) { if (item.path) {
@ -392,6 +389,35 @@ const changeBook = async(data) => {
uploadData.value.levelSecondId = cata[1] uploadData.value.levelSecondId = cata[1]
uploadData.value.levelThirdId = cata[2] uploadData.value.levelThirdId = cata[2]
uploadData.value.textbookId = data.textBook.curBookId uploadData.value.textbookId = data.textBook.curBookId
getModelInfo({cataid: currentNode.value.id}).then(res=>{
console.log(res)
if (res&&res.data) {
tags.filter(item=>{
switch (item.name) {
case '课标分析':
item.num = res.data.kbs
break;
case '教材分析':
item.num = res.data.jcs
break;
case '考试分析':
item.num = res.data.kss
break;
case '素材设计':
item.num = res.data.scs
break;
case '作业设计':
item.num = res.data.zys
break;
case '框架设计':
item.num = res.data.kjs
break;
default:
break;
}
})
}
})
getSmarttalkPage({ getSmarttalkPage({
...uploadData.value, ...uploadData.value,
orderByColumn: 'createTime', orderByColumn: 'createTime',
@ -469,6 +495,11 @@ const changeClass = async (type, row, other) => {
break break
} }
} }
//
onMounted(() => {
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.model-wrap{ .model-wrap{

View File

@ -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)
if (!dt.ctCourse) { // -
// app // app
const data = { id: classcourse.id } const data = { id: classcourse.id }
ChatWs.sendMsg(MsgEnum.HEADS.MSG_0000, data, {}, ChatWs.TYPES.single, userStore.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) //

View File

@ -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){

View File

@ -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 : '已结束'
} }
@ -1130,6 +1131,7 @@ export default {
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 4px; top: 4px;
z-index: 10;
} }
.prepare-center-jxkj{ .prepare-center-jxkj{
height: 100%; height: 100%;

View File

@ -11,7 +11,7 @@
<!-- 裁剪+效果 --> <!-- 裁剪+效果 -->
<div class="box"> <div class="box">
<div class="box_1"> <div class="box_1">
<img :src="dev_api + filePath" ref="image" /> <img :src="filePath" ref="image" />
</div> </div>
<!--裁剪完的图片--> <!--裁剪完的图片-->
@ -164,7 +164,7 @@ export default {
// //
onMounted(() => { onMounted(() => {
if (props.filePath) { if (props.filePath) {
dataFile.image.src = dev_api.value + props.filePath; dataFile.image.src = props.filePath;
copper(); copper();
} }
}); });

View File

@ -4,7 +4,7 @@
<userAvatar /> <userAvatar />
<div class="info"> <div class="info">
<div class="info-name">{{ state.user.nickName }}</div> <div class="info-name">{{ state.user.nickName }}</div>
<div class="infomation"> <div class="infomation" v-if="isStadium() !== true" >
<selectClass v-if="!isSubject"/> <selectClass v-if="!isSubject"/>
</div> </div>
</div> </div>
@ -35,7 +35,7 @@ import { getUserProfile } from '@/api/system/user'
import pkc from "../../../../../package.json" import pkc from "../../../../../package.json"
// //
import selectClass from './components/selectClass.vue' import selectClass from './components/selectClass.vue'
import useUserStore from '@/store/modules/user'
const version = ref(pkc.version) const version = ref(pkc.version)
const activeTab = ref('userinfo') const activeTab = ref('userinfo')
@ -46,6 +46,12 @@ const state = reactive({
postGroup: {} postGroup: {}
}) })
const isStadium = () => {
let user = useUserStore().user
let roles = user.roles
return roles.some(item => item.roleKey === 'stadium')
}
const isSubject = ref(false) const isSubject = ref(false)
async function getUser() { async function getUser() {
getUserProfile().then((response) => { getUserProfile().then((response) => {

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="user-info-head" @click="editCropper()"> <div class="user-info-head" @click="editCropper()">
<img :src="dev_api + options.img" title="点击上传头像" class="img-circle img-lg" /> <img :src="options.img" title="点击上传头像" class="img-circle img-lg" />
<el-dialog <el-dialog
v-model="open" v-model="open"
append-to-body append-to-body
@ -23,6 +23,7 @@ import { uploadAvatar } from '@/api/system/user'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import CropperImage from './cropperImage.vue' import CropperImage from './cropperImage.vue'
import defaultUserImg from '@/assets/images/img-avatar.png'
const userStore = useUserStore() const userStore = useUserStore()
@ -32,7 +33,7 @@ const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
// //
const options = reactive({ const options = reactive({
img: userStore.user.avatar, // img: userStore.user.avatar ==='/img/avatar-default.jpg' ? defaultUserImg : dev_api.value + userStore.user.avatar, //
autoCrop: true, // autoCrop: true, //
autoCropWidth: 400, // autoCropWidth: 400, //
autoCropHeight: 400, // autoCropHeight: 400, //
@ -40,7 +41,6 @@ const options = reactive({
outputType: 'png', // PNG outputType: 'png', // PNG
previews: {} // previews: {} //
}) })
const cropper = ref(null) const cropper = ref(null)
/** 编辑头像 */ /** 编辑头像 */
@ -69,7 +69,7 @@ function uploadImg(data) {
/** 关闭窗口 */ /** 关闭窗口 */
function closeDialog() { function closeDialog() {
options.img = userStore.user.avatar options.img = userStore.user.avatar ==='/img/avatar-default.jpg' ? defaultUserImg : dev_api.value + userStore.user.avatar
options.visible = false options.visible = false
} }
const cancle = () => { const cancle = () => {

View File

@ -8,7 +8,7 @@
</el-form-item> </el-form-item>
<el-form-item label="所属学校" prop="identity"> <el-form-item label="所属学校" prop="identity">
<div style="display: flex;"> <div style="display: flex;">
<div>{{ userStore.DeptInfo.register.schoolName }}</div> <div>{{ userStore.DeptInfo.register ? userStore.DeptInfo.register.schoolName : '' }}</div>
<div> <div>
<el-button type="primary" link>更改学校</el-button> <el-button type="primary" link>更改学校</el-button>
</div> </div>

View File

@ -432,7 +432,7 @@ const toRousrceUrl = async(o) => {
if (o?.background?.image) await toRousrceUrl(o.background.image) if (o?.background?.image) await toRousrceUrl(o.background.image)
if(o?.elements){ if(o?.elements){
for (let element of o.elements) { for (let element of o.elements) {
await this.toRousrceUrl(element); await toRousrceUrl(element);
} }
} }
} }