Compare commits
No commits in common. "cccf109499a4bd5d40508340f4ccecb0d1a264ef" and "4a0e9b0b84c2f3526d85579e218c872d29e770a6" have entirely different histories.
cccf109499
...
4a0e9b0b84
|
@ -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 = 'false'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "aix-win-ws",
|
||||
"version": "2.5.5",
|
||||
"version": "2.5.4",
|
||||
"description": "",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "上海交大重庆人工智能研究院",
|
||||
|
|
|
@ -13097,15 +13097,15 @@ const PDFViewerApplication = {
|
|||
}
|
||||
if (isValidSpreadMode(spread)) {
|
||||
//默认双页
|
||||
this.pdfViewer.spreadMode = spread;
|
||||
// this.pdfViewer.spreadMode = 1;
|
||||
// this.pdfViewer.spreadMode = spread;
|
||||
this.pdfViewer.spreadMode = 1;
|
||||
}
|
||||
};
|
||||
this.isInitialViewSet = true;
|
||||
this.pdfSidebar?.setInitialView(sidebarView);
|
||||
//默认双页
|
||||
setViewerModes(scrollMode, spreadMode);
|
||||
// setViewerModes(scrollMode, 1);
|
||||
// setViewerModes(scrollMode, spreadMode);
|
||||
setViewerModes(scrollMode, 1);
|
||||
if (this.initialBookmark) {
|
||||
setRotation(this.initialRotation);
|
||||
delete this.initialRotation;
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
@ -40,8 +39,8 @@ const slidesStore = useSlidesStore()
|
|||
const { databaseId } = storeToRefs(mainStore)
|
||||
const { screening } = storeToRefs(useScreenStore())
|
||||
|
||||
if (import.meta.env.MODE === 'development') {
|
||||
// window.onbeforeunload = () => false
|
||||
if (import.meta.env.MODE !== 'development') {
|
||||
window.onbeforeunload = () => false
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
* @author zdg
|
||||
* @date 2024-11-26
|
||||
*/
|
||||
import { toRaw } from 'vue'
|
||||
import { toRaw, nextTick } from 'vue'
|
||||
import type { Result } from './types' // 接口类型
|
||||
import msgUtils from '@/plugins/modal' // 消息工具
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
import * as API_smarttalk from '@/api/file' // 相关api
|
||||
import * as Api_server from '@/api/apiService' // 相关api
|
||||
import * as CreateHomework from '@/views/tool/createHomework' // 统计相关
|
||||
import * as useStore from '../store' // pptist-状态管理
|
||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
||||
import * as Api_server from '@/api/apiService' // 相关api
|
||||
import * as commUtils from '@/utils/comm.js'
|
||||
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
|
||||
// import * as commUtils from '@/utils/comm.js'
|
||||
import { createWindow } from '@/utils/tool'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
const slidesStore = useStore.useSlidesStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
import { getClassWorkList,getStudentClassWorkData } from '@/views/tool/createHomework'
|
||||
import {createWindow} from '@/utils/tool'
|
||||
import { useToolState } from '@/store/modules/tool'
|
||||
const toolStore = useToolState()
|
||||
/** 工具类 */
|
||||
export class Utils {
|
||||
|
@ -73,6 +73,7 @@ export class PPTApi {
|
|||
// 活动列表处理
|
||||
const workList = (res.rows || []).map(o => o.activityContent)
|
||||
const workItem = [...res.rows]
|
||||
// 加入活动后刷新ppt数据内容,不跟换为第一页
|
||||
// slidesStore.updateSlideIndex(0) // 下标0 为第一页
|
||||
slidesStore.setSlides(slides) // 写入数据
|
||||
// 写入作业列表数据
|
||||
|
@ -111,7 +112,6 @@ export class PPTApi {
|
|||
data.id = rid
|
||||
slidesStore.updateSlide(data)
|
||||
// msgUtils.msgSuccess('新增成功')
|
||||
PPTApi.getSlideList(resource.id)
|
||||
this.isUpdate = false // 新增后会触发监听,不再更新数据
|
||||
resolve(true)
|
||||
} else msgUtils.msgError('新增失败');resolve(false)
|
||||
|
@ -147,7 +147,11 @@ export class PPTApi {
|
|||
// 更新幻灯片
|
||||
static updateSlide(data: object): Promise<Boolean> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const thumUrl = await this.getSlideThumUrl()
|
||||
data.base64Code = thumUrl // 更新缩略图
|
||||
const res: Result = await API_entpcoursefile.updateEntpcoursefileNew(data)
|
||||
console.log(data,'data');
|
||||
console.log(res,'dresata');
|
||||
if (res.code === 200) {
|
||||
resolve(true)
|
||||
} else msgUtils.msgError(res.msg || '更新失败');resolve(false)
|
||||
|
@ -189,30 +193,40 @@ export class PPTApi {
|
|||
else msgUtils.msgError(res.msg || '更新失败');return false
|
||||
})
|
||||
}
|
||||
// thumbnail-slide thumbnail
|
||||
static getSlideThumUrl(): Promise<Boolean> {
|
||||
return nextTick().then(async() => {
|
||||
const slideIndex = slidesStore.slideIndex
|
||||
const elements = document.querySelectorAll('.thumbnail-slide')
|
||||
if (elements.length && slideIndex >= 0) {
|
||||
const element = elements[slideIndex]
|
||||
return await toPng(element)
|
||||
}
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
||||
// 图片|音频|视频 转换为在线地址
|
||||
static toRousrceUrl =async (o:any) => {
|
||||
const formData = new FormData()
|
||||
formData.append('file', o)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200){
|
||||
const url = res?.url
|
||||
url &&(o.src = url)
|
||||
return url
|
||||
}
|
||||
|
||||
}
|
||||
static toRousrceUrl =async (file: File|any) => {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200){
|
||||
const url = res?.url
|
||||
url &&(o.src = url)
|
||||
return url
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Homework{
|
||||
// 作业弹窗
|
||||
static async showHomework(id: any) {
|
||||
let result = await getClassWorkList(id)
|
||||
result = await getStudentClassWorkData()
|
||||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||
// emit('closeActive')
|
||||
createWindow('open-taskwin',{url:'/teachClassTask'});
|
||||
let result = await CreateHomework.getClassWorkList(id)
|
||||
result = await CreateHomework.getStudentClassWorkData()
|
||||
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||
createWindow('open-taskwin',{url:'/teachClassTask'});
|
||||
}
|
||||
}
|
||||
export default PPTApi
|
|
@ -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,
|
||||
|
|
|
@ -10,106 +10,85 @@ 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) => {
|
||||
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
||||
},{ deep: true })
|
||||
|
||||
// 监听标题变化
|
||||
watch(() => slidesStore.title, (newVal, oldVal) => {
|
||||
if (oldVal == '未命名演示文稿') return // 初始加载,不需要更新数据
|
||||
updatePPT({title: newVal})
|
||||
// 监听幻灯片内容变化
|
||||
watch(() => slidesStore.slides, (newVal, oldVal) => {
|
||||
PPTApi.updateSlides(newVal, oldVal) // 更新幻灯片内容
|
||||
},{ deep: true })
|
||||
|
||||
// 监听标题变化
|
||||
watch(() => slidesStore.title, (newVal, oldVal) => {
|
||||
if (oldVal == '未命名演示文稿') return // 初始加载,不需要更新数据
|
||||
updatePPT({title: newVal})
|
||||
})
|
||||
|
||||
// 消息监听ws
|
||||
console.log('监听器已开启', ChatWs)
|
||||
if (ChatWs.ws) {
|
||||
ChatWs.watch((msg, e) => {
|
||||
try {
|
||||
handleMessage(JSON.parse(msg))
|
||||
} catch (error) {
|
||||
console.error('socket 解析异常 ', error, e)
|
||||
handleMessage(msg)
|
||||
}
|
||||
})
|
||||
|
||||
// 消息监听ws
|
||||
// console.log('监听器已开启', ChatWs)
|
||||
if (!!ChatWs.ws) {
|
||||
ChatWs.watch((data, e) => {
|
||||
try {
|
||||
handleMessage(JSON.parse(data)?.msg)
|
||||
} catch (error) {
|
||||
console.error('socket 解析异常 ', error, e)
|
||||
handleMessage(data)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 更新ppt内容
|
||||
const updatePPT = async (data) => {
|
||||
if (!resource) return
|
||||
data.id = resource.id
|
||||
await PPTApi.updateSlide(data) // 更新ppt内容
|
||||
sessionStore.set('curr.resource.title', data.title)
|
||||
// 更新smarttalk内容
|
||||
if (!!smarttalk && !!data.title) {
|
||||
const {id, fileFlag} = smarttalk
|
||||
const params = { id, fileShowName: `${data.title}.${fileFlag}` }
|
||||
await PPTApi.updateSmarttalk(params) // 更新ppt内容
|
||||
sessionStore.set('curr.smarttalk.fileShowName', params.fileShowName)
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 更新ppt内容
|
||||
const updatePPT = async (data) => {
|
||||
if (!resource) return
|
||||
data.id = resource.id
|
||||
await PPTApi.updateSlide(data) // 更新ppt内容
|
||||
sessionStore.set('curr.resource.title', data.title)
|
||||
// 更新smarttalk内容
|
||||
if (!!smarttalk && !!data.title) {
|
||||
const {id, fileFlag} = smarttalk
|
||||
const params = { id, fileShowName: `${data.title}.${fileFlag}` }
|
||||
await PPTApi.updateSmarttalk(params) // 更新ppt内容
|
||||
sessionStore.set('curr.smarttalk.fileShowName', params.fileShowName)
|
||||
}
|
||||
}
|
||||
|
||||
// ws消息处理
|
||||
const handleMessage = (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(() => { // 点击确定按钮,关闭窗口
|
||||
window.close()
|
||||
})
|
||||
} 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
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log('监听器已开启', Classcourse)
|
||||
// setTimeout(() => {
|
||||
// console.log('关闭弹窗')
|
||||
// // Classcourse.msgObj?.close()
|
||||
// Classcourse?.msgObj?.onVanish()
|
||||
// }, 10 * 1000)
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -1,26 +1,17 @@
|
|||
import { defineStore } from 'pinia'
|
||||
|
||||
export interface ScreenState {
|
||||
screening: boolean,
|
||||
like: number,
|
||||
doubt: number,
|
||||
screening: boolean
|
||||
}
|
||||
|
||||
export const useScreenStore = defineStore('screen', {
|
||||
state: (): ScreenState => ({
|
||||
screening: false, // 是否进入放映状态
|
||||
like:0, // 点赞数量
|
||||
doubt:0, // 疑问数量
|
||||
}),
|
||||
|
||||
actions: {
|
||||
setScreening(screening: boolean) {
|
||||
this.screening = screening
|
||||
},
|
||||
// 打开点赞或疑问
|
||||
openUpvote(type: 'like' | 'doubt'){
|
||||
if (type === 'like') this.like++
|
||||
else this.doubt++
|
||||
}
|
||||
},
|
||||
})
|
|
@ -5,12 +5,9 @@ import type { Slide, SlideTheme, PPTElement, PPTAnimation } from '../types/slide
|
|||
import { slides } from '../mocks/slides'
|
||||
import { theme } from '../mocks/theme'
|
||||
import { layouts } from '../mocks/layout'
|
||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
||||
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
|
||||
|
||||
import PPTApi from '../api/store'
|
||||
const userStore = useUserStore()
|
||||
|
||||
interface RemovePropData {
|
||||
id: string
|
||||
propName: string | string[]
|
||||
|
@ -145,19 +142,16 @@ export const useSlidesStore = defineStore('slides', {
|
|||
setWorkItem(list: Object[]) {
|
||||
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[]) {
|
||||
const slides = Array.isArray(slide) ? slide : [slide]
|
||||
for (const slide of slides) {
|
||||
if (slide.sectionTag) delete slide.sectionTag
|
||||
}
|
||||
this.slides.splice(this.slideIndex, 0, ...slides)
|
||||
|
||||
const addIndex = this.slideIndex + 1
|
||||
this.slides.splice(addIndex, 0, ...slides)
|
||||
this.slideIndex = addIndex
|
||||
},
|
||||
|
||||
updateSlide(props: Partial<Slide>, slideId?: string) {
|
||||
|
@ -194,7 +188,6 @@ export const useSlidesStore = defineStore('slides', {
|
|||
const isDel = await PPTApi.delSlide(deletedId)
|
||||
if (isDel) {
|
||||
// 后端删除成功,更新页面数据
|
||||
this.workItem.splice(index, 1)
|
||||
deleteSlidesIndex.push(index)
|
||||
slides.splice(index, 1)
|
||||
}
|
||||
|
|
|
@ -72,55 +72,4 @@ export const isSVGString = (text: string): boolean => {
|
|||
export const svg2File = (svg: string): File => {
|
||||
const blob = new Blob([svg], { type: 'image/svg+xml' })
|
||||
return new File([blob], `${Date.now()}.svg`, { type: 'image/svg+xml' })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前的时间
|
||||
* @returns
|
||||
*/
|
||||
export const getTime=()=>{
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = ('0' + (now.getMonth() + 1)).slice(-2);
|
||||
const day = ('0' + now.getDate()).slice(-2);
|
||||
const hours = ('0' + now.getHours()).slice(-2);
|
||||
const minutes = ('0' + now.getMinutes()).slice(-2);
|
||||
const seconds = ('0' + now.getSeconds()).slice(-2);
|
||||
return `${year}-${month}-${day}_${hours}:${minutes}:${seconds}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* base64转图片File
|
||||
* @param {String} base64 图片base64
|
||||
* @param {String} fileName 图片名称| 默认 → myimg
|
||||
* @returns File 返回转换后的file数据类型
|
||||
*/
|
||||
export const base64ToFile = (base64: string, fileName = '试题图片') => {
|
||||
// 将base64按照 , 进行分割 将前缀 与后续内容分隔开
|
||||
let data = base64.split(','),
|
||||
// 利用正则表达式 从前缀中获取图片的类型信息(image/png、image/jpeg、image/webp等)
|
||||
type = data[0].match(/:(.*?);/)[1],
|
||||
// 从图片的类型信息中 获取具体的文件格式后缀(png、jpeg、webp)
|
||||
suffix = type.split('/')[1],
|
||||
// 使用atob()对base64数据进行解码 结果是一个文件数据流 以字符串的格式输出
|
||||
bstr = window.atob(data[1]),
|
||||
// 获取解码结果字符串的长度
|
||||
n = bstr.length,
|
||||
// 根据解码结果字符串的长度创建一个等长的整形数字数组
|
||||
// 但在创建时 所有元素初始值都为 0
|
||||
u8arr = new Uint8Array(n)
|
||||
|
||||
// 将整形数组的每个元素填充为解码结果字符串对应位置字符的UTF-16 编码单元
|
||||
while (n--) {
|
||||
// charCodeAt():获取给定索引处字符对应的 UTF-16 代码单元
|
||||
u8arr[n] = bstr.charCodeAt(n)
|
||||
}
|
||||
const filename = fileName+getTime()
|
||||
// 利用构造函数创建File文件对象
|
||||
// new File(bits, name, options)
|
||||
const file = new File([u8arr], `${filename}.${suffix}`, {
|
||||
type: type
|
||||
})
|
||||
// 返回file
|
||||
return 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 })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
/>
|
||||
</Modal>
|
||||
|
||||
<!--插入试题-->
|
||||
|
||||
<el-dialog v-model="classWorkTaskVisible" append-to-body :show-close="false" width="70%">
|
||||
<QuestToPPTist
|
||||
class="class-work-task-modal"
|
||||
|
@ -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>
|
||||
|
@ -141,7 +141,7 @@
|
|||
import { ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useMainStore, useSnapshotStore } from '../../../store'
|
||||
import { getImageDataURL, base64ToFile } from '../../../utils/image'
|
||||
import { getImageDataURL } from '../../../utils/image'
|
||||
import type { ShapePoolItem } from '../../../configs/shapes'
|
||||
import type { LinePoolItem } from '../../../configs/lines'
|
||||
import useScaleCanvas from '../../../hooks/useScaleCanvas'
|
||||
|
@ -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())
|
||||
|
@ -210,14 +209,8 @@ const insertImageElement = (files: FileList) => {
|
|||
}
|
||||
|
||||
const onhtml2canvas = async (html: HTMLElement) => {
|
||||
const base64Dta = await toPng(html);
|
||||
// base64转图片File
|
||||
const toFile = base64ToFile(base64Dta)
|
||||
// 上传图片转为线上地址
|
||||
PPTApi.toRousrceUrl(toFile).then(data=>{
|
||||
createImageElement(data)
|
||||
})
|
||||
// createImageElement(ele);
|
||||
const ele = await toPng(html);
|
||||
createImageElement(ele);
|
||||
}
|
||||
|
||||
const shapePoolVisible = ref(false)
|
||||
|
@ -281,31 +274,21 @@ const toggleNotesPanel = () => {
|
|||
// 插入素材
|
||||
interface MaterialParams {
|
||||
type: string,
|
||||
file: any
|
||||
data: string
|
||||
}
|
||||
const insertMaterial = (item: MaterialParams) =>{
|
||||
const { type, file } = item
|
||||
PPTApi.toRousrceUrl(file).then(data=>{
|
||||
if(type == 'video'){
|
||||
createVideoElement(data)
|
||||
}
|
||||
else{
|
||||
createImageElement(data)
|
||||
}
|
||||
materiaVisible.value = false
|
||||
})
|
||||
|
||||
const { type, data } = item
|
||||
if(type == 'video'){
|
||||
createVideoElement(data)
|
||||
}
|
||||
else{
|
||||
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>
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
<div class="item">
|
||||
<div class="item-title">
|
||||
<el-tag :type="getTagType(item.worktype) || 'primary'">{{item.worktype}}</el-tag>
|
||||
<el-tooltip :content="item.uniquekey" placement="top">
|
||||
<div class="tt">{{item.uniquekey}}</div>
|
||||
<el-tooltip :content="item.evaltitle" placement="top">
|
||||
<div class="tt">{{item.evaltitle}}</div>
|
||||
</el-tooltip>
|
||||
<el-button class="btn-del" type="danger" link @click="handleRemoveDemoActivityClassWork(item)">删除</el-button>
|
||||
</div>
|
||||
|
@ -62,7 +62,7 @@
|
|||
>
|
||||
<el-table :data="taskList" style="width: 100%" height="500" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" :selectable="selectable"/>
|
||||
<el-table-column prop="uniquekey" label="活动名称" width="150" />
|
||||
<el-table-column prop="evaltitle" label="活动名称" width="150" />
|
||||
<el-table-column prop="worktype" label="活动类型" width="120" sortable>
|
||||
<template #default="scope">
|
||||
<el-tag :type="getTagType(scope.row.worktype) || 'primary'">{{ scope.row.worktype }}</el-tag>
|
||||
|
@ -90,8 +90,7 @@ import { sessionStore } from '@/utils/store'
|
|||
import { useGetHomework } from '@/hooks/useGetHomework'
|
||||
import { PPTApi } from '../../../../../api/index'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import {useSlidesStore} from '../../../../../store'
|
||||
import { updateEntpcoursefileNew } from '@/api/education/entpcoursefile'
|
||||
import {useSlidesStore} from '../../../../../store'
|
||||
const slidesStore = useSlidesStore()
|
||||
const { slides, slideIndex, currentSlide, workItem } = storeToRefs(slidesStore)
|
||||
|
||||
|
@ -132,7 +131,7 @@ interface WorkItem {
|
|||
base64?: string;
|
||||
prevData?: any;
|
||||
id: number;
|
||||
uniquekey?: string; // 添加 evaltitle 属性
|
||||
evaltitle?: string; // 添加 evaltitle 属性
|
||||
}
|
||||
|
||||
const currentCourse = reactive<CurrentCourse>({
|
||||
|
@ -278,7 +277,6 @@ const getCurrentPPtData = async () => {
|
|||
workList.value = []
|
||||
objItem.value = workItem.value[slideIndex.value]
|
||||
paramData.value.id = objItem.value.id
|
||||
|
||||
paramData.value.activityContent = objItem.value?.activityContent
|
||||
if (objItem.value?.activityContent) {
|
||||
loadingActive.value = true
|
||||
|
@ -302,23 +300,12 @@ const getData = async (data: WorkItem) => {
|
|||
dialogVisible.value = false
|
||||
}
|
||||
const upDateData = async () => {
|
||||
// await PPTApi.updateSlide(paramData.value)
|
||||
await PPTApi.updateSlide(paramData.value)
|
||||
loadingActive.value = true
|
||||
await updateEntpcoursefileNew(paramData.value)
|
||||
const resource = sessionStore.get('curr.resource')
|
||||
await PPTApi.getSlideList(resource.id)
|
||||
const res = await homeworklist({ ids: paramData.value.activityContent, pageSize: 100 })
|
||||
await formatClassWorkFile(res.rows)
|
||||
}
|
||||
// 判断是否做操作
|
||||
const objectsAreEqual = (obj1: Record<string, any>, obj2: Record<string, any>) => {
|
||||
const keys1 = Object.keys(obj1);
|
||||
const keys2 = Object.keys(obj2);
|
||||
if (keys1.length !== keys2.length) return false;
|
||||
for (const key of keys1) {
|
||||
if (obj1[key] !== obj2[key]) return false;
|
||||
}
|
||||
return true;
|
||||
const resource = sessionStore.get('curr.resource')
|
||||
await PPTApi.getSlideList(resource.id)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -331,13 +318,9 @@ onMounted(() => {
|
|||
objItem.value = workItem.value[slideIndex.value]
|
||||
getCurrentPPtData()
|
||||
})
|
||||
watch(() => [workItem.value.length,slideIndex.value], (newVal,oldVal) => {
|
||||
if(!objectsAreEqual(newVal,oldVal))
|
||||
getCurrentPPtData()
|
||||
watch(() => slideIndex.value, () => {
|
||||
getCurrentPPtData()
|
||||
})
|
||||
// watch(() => workItem.value.length, () => {
|
||||
// getCurrentPPtData()
|
||||
// })
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.buttonDiv{
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</div>
|
||||
<!-- 点赞组件 -->
|
||||
<div style="z-index: 999;position: absolute;top:10px">
|
||||
<upvote-vue ref="upvoteRef" type="2"></upvote-vue>
|
||||
<upvote-vue ref="upvoteRef" :test='true' type="2"></upvote-vue>
|
||||
</div>
|
||||
<div
|
||||
class="tools-right" :class="{ 'visible': rightToolsVisible }"
|
||||
|
@ -58,9 +58,9 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref , watchEffect} from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSlidesStore ,useScreenStore} from '../../store'
|
||||
import { useSlidesStore } from '../../store'
|
||||
import type { ContextmenuItem } from '../../components/Contextmenu/types'
|
||||
import { enterFullscreen } from '../../utils/fullscreen'
|
||||
import useScreening from '../../hooks/useScreening'
|
||||
|
@ -73,8 +73,6 @@ import SlideThumbnails from './SlideThumbnails.vue'
|
|||
import WritingBoardTool from './WritingBoardTool.vue'
|
||||
import CountdownTimer from './CountdownTimer.vue'
|
||||
import upvoteVue from '@/views/tool/components/upvote.vue' // 点赞-子组件
|
||||
import emitter from '@/utils/mitt';
|
||||
|
||||
const props = defineProps<{
|
||||
changeViewMode: (mode: 'base' | 'presenter') => void
|
||||
}>()
|
||||
|
@ -110,8 +108,7 @@ const writingBoardToolVisible = ref(false)
|
|||
const timerlVisible = ref(false)
|
||||
const slideThumbnailModelVisible = ref(false)
|
||||
const laserPen = ref(false)
|
||||
const upvoteRef = ref(null)
|
||||
const screenStore =useScreenStore()
|
||||
|
||||
const contextmenus = (): ContextmenuItem[] => {
|
||||
return [
|
||||
{
|
||||
|
@ -193,12 +190,6 @@ const contextmenus = (): ContextmenuItem[] => {
|
|||
},
|
||||
]
|
||||
}
|
||||
// 打开点赞或者疑问 1点赞 2疑问
|
||||
emitter.on('upvoteTrigger', (type) => {
|
||||
upvoteRef.value?.trigger(type)
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -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=');
|
||||
|
@ -491,7 +494,6 @@ export default {
|
|||
const finalPath = path.substring(0, pngIndex + 4);
|
||||
try {
|
||||
const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`);
|
||||
|
||||
|
||||
const hash = CryptoJS.MD5(blob).toString();
|
||||
|
||||
|
@ -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);
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<template>
|
||||
<div class="book-wrap">
|
||||
<el-scrollbar height="100%">
|
||||
<div class="book-name flex" v-if="isStadium() === true"> {{userStore.user.deptName}}</div>
|
||||
<div v-else class="book-name flex" @click="dialogVisible = true">
|
||||
<div class="book-name flex" @click="dialogVisible = true">
|
||||
<span>{{ curBook.data.itemtitle }}</span>
|
||||
<i class="iconfont icon-xiangyou"></i>
|
||||
</div>
|
||||
|
@ -47,14 +46,8 @@ import { onMounted, ref, nextTick, toRaw, reactive } from 'vue';
|
|||
import { cloneDeep } from 'lodash'
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { useGetSubject } from '@/hooks/useGetSubject'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
const userStore = useUserStore()
|
||||
|
||||
const BaseUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
|
||||
const isStadium = () => {
|
||||
let roles = userStore.user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
// 定义要发送的emit事件
|
||||
const emit = defineEmits(['nodeClick', 'changeBook'])
|
||||
let useSubject = null
|
||||
|
@ -146,7 +139,7 @@ const handleNodeClick = (data) => {
|
|||
* data : 当前节点数据
|
||||
*/
|
||||
let nodeData = cloneDeep(toRaw(data));
|
||||
|
||||
|
||||
//增加一个label 之前取的label
|
||||
nodeData.label = nodeData.itemtitle
|
||||
let parentNode
|
||||
|
@ -188,17 +181,13 @@ onMounted( async () => {
|
|||
curBook.data = sessionStore.get('subject.curBook')
|
||||
}
|
||||
else{
|
||||
if (subjectList.value) {
|
||||
curBook.data = subjectList.value[0]
|
||||
}else {
|
||||
curBook.data = {}
|
||||
}
|
||||
curBook.data = subjectList.value[0]
|
||||
}
|
||||
|
||||
// 章节"树"
|
||||
treeData.value = useSubject.getTreeData(curBook.data.id)
|
||||
sessionStore.set('subject.subjectTree',useSubject.getTreeData(curBook.data.id))
|
||||
|
||||
|
||||
nextTick(() =>{
|
||||
// 默认展开 选中
|
||||
if(sessionStore.get('subject.curNode')){
|
||||
|
@ -210,7 +199,7 @@ onMounted( async () => {
|
|||
}
|
||||
handleNodeClick(curNode.data)
|
||||
})
|
||||
|
||||
|
||||
} finally{
|
||||
treeLoading.value = false
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ const handleNodeClick = (data) => {
|
|||
id: nodeData.parentid,
|
||||
label: nodeData.parenttitle,
|
||||
itemtitle: nodeData.parenttitle
|
||||
}
|
||||
}
|
||||
const parentNode = nodeData.parentid ? parent : null
|
||||
nodeData.parentNode = parentNode
|
||||
|
||||
|
@ -204,11 +204,7 @@ onMounted(async () => {
|
|||
curBook.data = sessionStore.get('subject.curBook')
|
||||
}
|
||||
else{
|
||||
if (subjectList.value) {
|
||||
curBook.data = subjectList.value[0]
|
||||
}else {
|
||||
curBook.data = {}
|
||||
}
|
||||
curBook.data = subjectList.value[0]
|
||||
}
|
||||
|
||||
// 章节"树"
|
||||
|
@ -224,7 +220,7 @@ onMounted(async () => {
|
|||
}
|
||||
handleNodeClick(curNode.data)
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -15,40 +15,24 @@ export const useGetSubject = async () =>{
|
|||
// 单元章节树结构
|
||||
let treeData = null
|
||||
|
||||
// 根据学科 + 学段 获取所有单元章节
|
||||
// 根据学科 + 学段 获取所有单元章节
|
||||
const getSubjectUnit = async () =>{
|
||||
if(isStadium(userStore.user)) {
|
||||
//如果是基地人员,直接拿treeData
|
||||
if(sessionStore.get('subject.unitList')){
|
||||
unitList.value = sessionStore.get('subject.unitList')
|
||||
}
|
||||
else{
|
||||
const unitParams = {
|
||||
itemgroup: '基地课程',
|
||||
edusubject,
|
||||
edustage,
|
||||
itemgroup: 'textbook',
|
||||
orderby: 'orderidx asc',
|
||||
entpid: userStore.user.deptId,
|
||||
pageSize: 10000
|
||||
}
|
||||
const { rows } = await listEvaluation(unitParams)
|
||||
unitList.value = rows
|
||||
}else{
|
||||
if(sessionStore.get('subject.unitList')){
|
||||
unitList.value = sessionStore.get('subject.unitList')
|
||||
}
|
||||
else{
|
||||
const unitParams = {
|
||||
edusubject,
|
||||
edustage,
|
||||
itemgroup: 'textbook',
|
||||
orderby: 'orderidx asc',
|
||||
pageSize: 10000
|
||||
}
|
||||
const { rows } = await listEvaluation(unitParams)
|
||||
unitList.value = rows
|
||||
sessionStore.set('subject.unitList', rows)
|
||||
}
|
||||
await getSubject()
|
||||
sessionStore.set('subject.unitList', rows)
|
||||
}
|
||||
}
|
||||
const isStadium = (user) => {
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
await getSubject()
|
||||
}
|
||||
|
||||
// 根据学科 + 学段 获取教材
|
||||
|
@ -58,7 +42,7 @@ export const useGetSubject = async () =>{
|
|||
subjectList = sessionStore.get('subject.bookList')
|
||||
}
|
||||
else{
|
||||
const subjectParams = {
|
||||
const subjectParams = {
|
||||
itemkey: "version",
|
||||
edusubject,
|
||||
edustage,
|
||||
|
@ -84,14 +68,11 @@ export const useGetSubject = async () =>{
|
|||
|
||||
// 单元章节数据转为“树”结构
|
||||
const getTreeData = (bookId) =>{
|
||||
if (!bookId) {
|
||||
return unitList.value
|
||||
}
|
||||
// 根据当前教材的id 查找出对应的章节
|
||||
let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1)
|
||||
// 根据当前教材的id 查找出对应的章节
|
||||
let data = unitList.value.filter(item => item.rootid == bookId && item.level == 1)
|
||||
data.forEach( item => {
|
||||
item.children = unitList.value.filter( item2 => item2.parentid == item.id && item2.level == 2)
|
||||
})
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
|
@ -99,4 +80,4 @@ export const useGetSubject = async () =>{
|
|||
|
||||
return { subjectList, treeData, getTreeData }
|
||||
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
</template>
|
||||
<div class="head-aside">
|
||||
<ul >
|
||||
<li v-if="isStadium() !== true" :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" >
|
||||
<li :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>
|
||||
<span class="mlr-5" v-if="computedregistertype!=4">学校认证</span>
|
||||
<span class="mlr-5" v-else>{{ userStore.DeptInfo.register.schoolName }}</span>
|
||||
|
@ -19,8 +19,8 @@
|
|||
</li>
|
||||
<li v-if="computedregistertype!=4" :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li>
|
||||
<li @click="onUserTo('/profile')">个人中心</li>
|
||||
<li v-if="isStadium() !== true" @click="onUserTo('/schoolManagement')">学校管理</li>
|
||||
<li v-if="isStadium() !== true" @click="onUserTo('/class')">班级中心</li>
|
||||
<li @click="onUserTo('/schoolManagement')">学校管理</li>
|
||||
<li @click="onUserTo('/class')">班级中心</li>
|
||||
<li @click="logout">退出登录</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -53,7 +53,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch , reactive, onMounted, onBeforeMount, computed} from 'vue'
|
||||
import { ref, watch , reactive, onMounted,computed} from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ElMessageBox, ElMessage } from 'element-plus'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
@ -64,7 +64,6 @@ import pkc from "../../../../../package.json"
|
|||
const { ipcRenderer } = window.electron || {}
|
||||
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
|
||||
const userStore = useUserStore()
|
||||
console.log(userStore)
|
||||
const router = useRouter()
|
||||
const currentRoute = ref('')
|
||||
const activeId = ref('/home')
|
||||
|
@ -75,19 +74,7 @@ const version = ref(pkc.version)
|
|||
|
||||
const popoverRef = ref('')
|
||||
|
||||
//是否是基地人员
|
||||
const isStadium = () => {
|
||||
let user = userStore.user
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
const headerMenus = isStadium() ?[{
|
||||
name: '教学实践',
|
||||
id: 4,
|
||||
icon: 'icon-jiaoxueshijian',
|
||||
path: '/prepare'
|
||||
},]:[
|
||||
const headerMenus = [
|
||||
{
|
||||
name: '教学大模型',
|
||||
id: 1,
|
||||
|
|
|
@ -44,6 +44,7 @@ const breadList = ref([])
|
|||
watch(
|
||||
() => router.currentRoute.value,
|
||||
(newValue) => {
|
||||
console.log(newValue)
|
||||
const { showBread } = newValue.meta
|
||||
if (showBread) {
|
||||
isShowBack.value = true
|
||||
|
|
|
@ -16,7 +16,6 @@ import router from './router'
|
|||
import log from 'electron-log/renderer' // 渲染进程日志-文件记录
|
||||
import customComponent from '@/components/common' // 自定义组件
|
||||
import plugins from './plugins' // plugins插件
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
if(process.env.NODE_ENV != 'development') { // 非开发环境,将日志打印到日志文件
|
||||
Object.assign(console, log.functions) // 渲染进程日志-控制台替换
|
||||
|
@ -48,16 +47,3 @@ app.use(router)
|
|||
.use(Icon)
|
||||
.use(Directive)
|
||||
.mount('#app')
|
||||
|
||||
const isStadium = (user) => {
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.path === '/model/index') {
|
||||
isStadium(useUserStore().user) === true ? next('/prepare') :next()
|
||||
}else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
|
|
@ -80,8 +80,6 @@ export class MsgEnum {
|
|||
MSG_anmationclick : 'anmationclick',
|
||||
/** @desc: 群组创建成功 */
|
||||
MSG_classcourseopen : 'classcourseopen',
|
||||
/** @desc: 学生提交作业 */
|
||||
MSG_finishHomework : 'finishHomework',
|
||||
/** @desc: 学生的测练结果反馈 */
|
||||
MSG_classquizfeedback : 'classquizfeedback',
|
||||
/** @desc: 老师端:接收到学生反馈消息-课堂测练中的其他任务 */
|
||||
|
@ -96,12 +94,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 +138,4 @@ export class MsgEnum {
|
|||
}
|
||||
}
|
||||
|
||||
export default MsgEnum;
|
||||
export { MsgEnum as default }
|
|
@ -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,46 +64,43 @@ 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()
|
||||
this.ws = null
|
||||
}
|
||||
this.ws = new WebSocket(this.url);
|
||||
this.ws.onopen = function () {
|
||||
console.log("websocket-连接成功")
|
||||
self.heartCheck.reset().start();
|
||||
resolve()
|
||||
};
|
||||
this.ws.onmessage = function (e) {
|
||||
// console.log("websocket-收到消息", e)
|
||||
// 拿到任何消息都说明当前连接是正常的
|
||||
const isBeat = e.data == 'pong'
|
||||
isBeat && self.heartCheck.reset().start();
|
||||
const isEmpty = !e.data
|
||||
const isExts = e.data.includes('sessionId') || e.data == ('pong')
|
||||
if (isEmpty || isExts) return;
|
||||
// 自定义处理
|
||||
self.onmessage && self.onmessage(e.data, e);
|
||||
};
|
||||
this.ws.onerror = function (e) {
|
||||
console.log("websocket-连接异常", e)
|
||||
self.connectSocket() // 重连
|
||||
};
|
||||
this.ws.onclose = function (e) {
|
||||
console.log("websocket-连接断开", e)
|
||||
self.connectSocket() // 重连
|
||||
};
|
||||
})
|
||||
const self = this;
|
||||
if (!!this.ws) { // 关闭之前的链接
|
||||
this.ws.close()
|
||||
this.ws = null
|
||||
}
|
||||
this.ws = new WebSocket(this.url);
|
||||
this.ws.onopen = function () {
|
||||
console.log("websocket-连接成功")
|
||||
self.heartCheck.reset().start();
|
||||
};
|
||||
this.ws.onmessage = function (e) {
|
||||
// console.log("websocket-收到消息", e)
|
||||
// 拿到任何消息都说明当前连接是正常的
|
||||
const isBeat = e.data == 'pong'
|
||||
isBeat && self.heartCheck.reset().start();
|
||||
const isEmpty = !e.data
|
||||
const isExts = e.data.includes('sessionId') || e.data == ('pong')
|
||||
if (isEmpty || isExts) return;
|
||||
// 自定义处理
|
||||
self.onmessage && self.onmessage(e.data, e);
|
||||
};
|
||||
this.ws.onerror = function (e) {
|
||||
console.log("websocket-连接异常", e)
|
||||
self.connectSocket() // 重连
|
||||
};
|
||||
this.ws.onclose = function (e) {
|
||||
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))
|
||||
|
|
|
@ -101,7 +101,7 @@ const dynamicRoutes = [
|
|||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect: '/model/index',
|
||||
redirect: '/desktop',
|
||||
meta: { title: '教学工作台' },
|
||||
children: [
|
||||
{
|
||||
|
|
|
@ -395,6 +395,6 @@ export const dataSetJson = {
|
|||
"课标-高中-英语": "e889fcac9fd011efb22a0242ac140006",
|
||||
"课标-高中-数学": "e03aa4fe9fd011ef91270242ac140006",
|
||||
"课标-高中-地理": "270516829fd111efb13c0242ac140006",
|
||||
"课标-高中-政治": "a2f0b247b85d11ef84290242ac140005",
|
||||
"课标-高中-政治": "a7df2b01aafd11ef8bb40242ac140002",
|
||||
"鉴权": "ragflow-IwMDI1MGU2YTU3NjExZWZiNWEzMDI0Mm"
|
||||
}
|
|
@ -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>
|
||||
|
|
|
@ -162,10 +162,9 @@ import ItemDialogScore from '@/views/classTask/container/classTask/item-dialog-s
|
|||
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 MsgEnum from '@/plugins/imChat/msgEnum' // im 消息枚举
|
||||
import ChatWs from '@/plugins/socket' // 聊天socket
|
||||
if (!ChatWs.ws) ChatWs.init()
|
||||
import Chat from '@/utils/chat' // im 登录初始化
|
||||
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emit = defineEmits(['cle-click'])
|
||||
const props = defineProps({
|
||||
|
@ -714,40 +713,27 @@ const closeDialog = () => {
|
|||
|
||||
// im监听消息回调
|
||||
const msgHandle = (msg) => {
|
||||
console.log('socket消息回调', msg)
|
||||
if (typeof msg === 'object'){
|
||||
const { head, content, ...other } = msg
|
||||
switch(head) {
|
||||
case MsgEnum.HEADS.MSG_closed: // 下课:
|
||||
window.close() // 关闭窗口
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_finishHomework: // 跟新作业:
|
||||
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
||||
openDialog(data, false);
|
||||
const { type, data } = msg
|
||||
switch(type) {
|
||||
case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[]
|
||||
{
|
||||
(data||[]).forEach(o => {
|
||||
const msgArr = o?.message_elem_array||[]
|
||||
msgArr.forEach(info => {
|
||||
const msgType = info?.elem_type // 消息类型 TIMElemType
|
||||
const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : ''
|
||||
// 处理学生端反馈得消息
|
||||
//console.log('msgData->', msgData);
|
||||
if (msgData.msgKey == "finishHomework"){
|
||||
// 刷新
|
||||
const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
||||
//console.log('data->', data);
|
||||
openDialog(data, false);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
break
|
||||
case MsgEnum.HEADS.MSG_slideFlapping: // 切换页面
|
||||
window.close() // 关闭窗口
|
||||
break
|
||||
// case 'TIMAddRecvNewMsgCallback': // 收到新消息 data=[]
|
||||
// {
|
||||
// (data||[]).forEach(o => {
|
||||
// const msgArr = o?.message_elem_array||[]
|
||||
// msgArr.forEach(info => {
|
||||
// const msgType = info?.elem_type // 消息类型 TIMElemType
|
||||
// const msgData = !!info.text_elem_content ? JSON.parse(info.text_elem_content)||'' : ''
|
||||
// // 处理学生端反馈得消息
|
||||
// //console.log('msgData->', msgData);
|
||||
// if (msgData.msgKey == "finishHomework"){
|
||||
// // 刷新
|
||||
// const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
|
||||
// //console.log('data->', data);
|
||||
// openDialog(data, false);
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -764,21 +750,11 @@ onMounted(() => {
|
|||
isReloadTimer();
|
||||
|
||||
// im监听消息
|
||||
if (ChatWs.ws) {
|
||||
ChatWs.watch((msg, e) => {
|
||||
try {
|
||||
msgHandle(JSON.parse(msg))
|
||||
} catch (error) {
|
||||
console.error('socket 解析异常 ', error, e)
|
||||
msgHandle(msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
// if (!Chat.imChat) {
|
||||
// Chat.init(true, true, msgHandle);
|
||||
// } else {
|
||||
// Chat.listenMsg(msgHandle);
|
||||
// }
|
||||
if (!Chat.imChat) {
|
||||
Chat.init(true, true, msgHandle);
|
||||
} else {
|
||||
Chat.listenMsg(msgHandle);
|
||||
}
|
||||
})
|
||||
const isReloadTimer = () =>{
|
||||
clearInterval(reloadTimer.value) // 关闭定时器
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<el-form-item label="密码" prop="password" >
|
||||
<el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button class="btn" type="primary" @click="RegisterForm(ruleFormRef)">立即注册</el-button>
|
||||
</el-form-item>
|
||||
|
@ -77,8 +77,8 @@
|
|||
<SelectSubject v-model="isSubject" :login-data="loginForm" />
|
||||
<!--注册弹框-->
|
||||
<Register ref="RegModel"></Register>
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
|
@ -118,7 +118,7 @@ const loginForm = reactive({
|
|||
})
|
||||
// 注册表单
|
||||
const ruleForm = reactive({
|
||||
|
||||
|
||||
})
|
||||
//表单规则
|
||||
const rules = reactive({
|
||||
|
@ -175,7 +175,7 @@ const sendyzm=()=>{
|
|||
if(ruleForm.username){
|
||||
const pattern = /^1[3-9]\d{9}$/;
|
||||
if( pattern.test(ruleForm.username) ){
|
||||
|
||||
|
||||
getCodeImg().then(res=>{
|
||||
if(res.code==200){
|
||||
ruleForm.imgCode=null
|
||||
|
@ -231,7 +231,7 @@ const submitForm = async (formEl) => {
|
|||
try {
|
||||
await userStore.login(loginForm)
|
||||
await userStore.getInfo()
|
||||
if (userStore.user.edustage || userStore.user.edusubject || isStadium(userStore.user)) {
|
||||
if (userStore.user.edustage || userStore.user.edusubject) {
|
||||
ElMessage.success('登录成功')
|
||||
ipcRenderer && ipcRenderer.send('openMainWindow')
|
||||
} else {
|
||||
|
@ -244,11 +244,6 @@ const submitForm = async (formEl) => {
|
|||
})
|
||||
}
|
||||
|
||||
const isStadium = (user) => {
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
const getCookie = async () => {
|
||||
const username = (await getCookieDetail('username'))[0]
|
||||
const password = (await getCookieDetail('password'))[0]
|
||||
|
@ -303,12 +298,12 @@ const RegisterForm = async (formEl) => {
|
|||
}
|
||||
onMounted(() => {
|
||||
localStorage.clear()
|
||||
sessionStore.set('subject', {
|
||||
bookList: null,
|
||||
curBook: null,
|
||||
curNode: null,
|
||||
defaultExpandedKeys: [],
|
||||
subjectTree: []
|
||||
sessionStore.set('subject', {
|
||||
bookList: null,
|
||||
curBook: null,
|
||||
curNode: null,
|
||||
defaultExpandedKeys: [],
|
||||
subjectTree: []
|
||||
})
|
||||
getCookie()
|
||||
})
|
||||
|
|
|
@ -18,20 +18,7 @@
|
|||
<div class="content-body-left">
|
||||
<div class="content-body-left-title">
|
||||
文枢课件
|
||||
<!-- <el-button class="add-btn" size="small" type="primary" @click="createAIPPT">新建</el-button>-->
|
||||
<el-dropdown class="prepare-center-dropdown add-btn">
|
||||
<el-button type="primary">
|
||||
新建<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="createAIPPT">新建文枢课件</el-dropdown-item>
|
||||
<el-dropdown-item @click="router.push({path: '/model/design'})">AI一键生成</el-dropdown-item>
|
||||
<el-dropdown-item @click="openFilePicker">导入PPT</el-dropdown-item>
|
||||
<input type="file" ref="fileInput" style="display: none;" @change="handleFileChange" accept="application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation">
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-button class="add-btn" size="small" type="primary" @click="createAIPPT">新建</el-button>
|
||||
</div>
|
||||
<div class="content-body-left-body">
|
||||
<kj-list-item
|
||||
|
@ -72,7 +59,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</el-row>
|
||||
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
@ -84,20 +70,14 @@ import ChooseTextbook from '@/components/choose-textbook/index.vue'
|
|||
import KjListItem from '@/views/prepare/container/kj-list-item.vue'
|
||||
import FileImage from '@/components/file-image/index.vue'
|
||||
import {creatAPT, getSmarttalkPage} from '@/api/file'
|
||||
import {ArrowDown, Flag, Position} from '@element-plus/icons-vue'
|
||||
import {Flag, Position} from '@element-plus/icons-vue'
|
||||
import {asyncLocalFile, parseCataByNode} from "@/utils/talkFile";
|
||||
import { dataSetJson } from '@/utils/comm' // 数据集id文生图
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import {listEntpcourse} from "@/api/teaching/classwork";
|
||||
import {addEntpcoursefileReturnId, getEntpcoursefile} from "@/api/education/entpcoursefile";
|
||||
import {createWindow, ipcMsgSend} from "@/utils/tool";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {PPTXFileToJson} from "@/AixPPTist/src/hooks/useImport";
|
||||
import * as API_entpcoursefile from "@/api/education/entpcoursefile";
|
||||
import progressDialog from '@/views/teachingDesign/container/progress-dialog.vue'
|
||||
import msgUtils from "@/plugins/modal";
|
||||
import * as commUtils from "@/utils/comm";
|
||||
import * as Api_server from "@/api/apiService"; // 学科名字文生图
|
||||
import {ElMessage} from "element-plus"; // 学科名字文生图
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore().user // 用户信息
|
||||
const currentNode = ref({})
|
||||
|
@ -232,153 +212,6 @@ const createAIPPT = () => {
|
|||
})
|
||||
}
|
||||
|
||||
const pgDialog = ref({ // 弹窗-进度条
|
||||
visible: false,
|
||||
title: 'PPT解析中...',
|
||||
width: 300,
|
||||
showClose: false,
|
||||
draggable: true,
|
||||
beforeClose: done => {}, // 阻止-弹窗事件
|
||||
pg: { // 进度条-参数
|
||||
percentage: 0, // 百分比
|
||||
color: [
|
||||
{ color: '#1989fa', percentage: 50 }, // 蓝色
|
||||
{ color: '#e6a23c', percentage: 80 }, // 橙色
|
||||
{ color: '#5cb87a', percentage: 100 }, // 绿色
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
const fileInput = ref(null)
|
||||
|
||||
const openFilePicker = () =>{
|
||||
fileInput.value.click();
|
||||
}
|
||||
|
||||
const handleFileChange = ()=> {
|
||||
const file = event.target.files[0];
|
||||
if (file) {
|
||||
console.log(file);
|
||||
createAIPPTByFile(file)
|
||||
}
|
||||
}
|
||||
|
||||
const createAIPPTByFile = async (file)=> {
|
||||
pgDialog.value.visible = true
|
||||
pgDialog.value.pg.percentage = 0
|
||||
const resPptJson = await PPTXFileToJson(file)
|
||||
const { def, slides, ...content } = resPptJson
|
||||
// 转换图片|音频|视频 为线上地址
|
||||
let completed = 0
|
||||
const total = slides.length
|
||||
for( let o of slides ) {
|
||||
completed++
|
||||
await toRousrceUrl(o)
|
||||
// 设置进度条
|
||||
pgDialog.value.pg.percentage = Math.floor(completed / total * 100)
|
||||
}
|
||||
pgDialog.value.pg.percentage = 0
|
||||
pgDialog.value.visible = false
|
||||
listEntpcourse({
|
||||
evalid: currentNode.value.id,
|
||||
edituserid: userStore.userId,
|
||||
pageSize: 500
|
||||
}).then((response) => {
|
||||
if (response.rows.length <= 0) return
|
||||
let resCourse = response.rows[0]
|
||||
// 添加
|
||||
let form = {
|
||||
parentid: 0,
|
||||
entpid: userStore.deptId,
|
||||
entpcourseid: resCourse.id,
|
||||
ppttype: 'file',
|
||||
title: resCourse.coursetitle,
|
||||
fileurl: '',
|
||||
filetype: 'aippt',
|
||||
datacontent: '',
|
||||
parentContent: JSON.stringify(content),
|
||||
filekey: '',
|
||||
filetag: '',
|
||||
fileidx: 0,
|
||||
dflag: 0,
|
||||
status: '',
|
||||
edituserid: userStore.userId
|
||||
}
|
||||
addEntpcoursefileReturnId(form).then((slideid) => {
|
||||
creatAPT({
|
||||
...uploadData.value,
|
||||
fileId: slideid,
|
||||
fileFlag: 'aippt',
|
||||
fileShowName: currentNode.value.itemtitle + '.aippt'
|
||||
}).then(async (res) => {
|
||||
|
||||
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))
|
||||
let params = {
|
||||
parentid: slideid,
|
||||
entpid: resCourse.entpid,
|
||||
entpcourseid: resCourse.id,
|
||||
title: '',
|
||||
filetype: 'slide',
|
||||
slides: resSlides,
|
||||
edituserid: userStore.userId
|
||||
}
|
||||
const res_3 = await API_entpcoursefile.batchAddNew(params)
|
||||
if (res_3 && res_3.code == 200) {
|
||||
msgUtils.msgSuccess('导入PPT课件成功')
|
||||
currentFileList.value.unshift(res.resData)
|
||||
await nextTick();
|
||||
refs.value['kjItemRef'+res.resData.id].openFileWin(res.resData);
|
||||
} else {
|
||||
msgUtils.msgWarning('导入PPT课件失败')
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const toRousrceUrl = async (o) => {
|
||||
if (!!o.src) { // 如果有src就转换
|
||||
const isBase64 = /^data:image\/(\w+);base64,/.test(o.src)
|
||||
const isBlobUrl = /^blob:/.test(o.src)
|
||||
// console.log('isBase64', o, isBase64)
|
||||
if (isBase64) {
|
||||
const bolb = commUtils.base64ToBlob(o.src)
|
||||
const fileName = Date.now() + '.png'
|
||||
const file = commUtils.blobToFile(bolb, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const res = await Api_server.Other.uploadFile(formData)
|
||||
if (res && res.code == 200){
|
||||
const url = res?.url
|
||||
url &&(o.src = url)
|
||||
}
|
||||
} else if (isBlobUrl) { // 视频和音频
|
||||
const res = await fetch(o.src)
|
||||
const blob = await res.blob()
|
||||
const fileName = o.type=='video'? Date.now() + '.mp4':Date.now() + '.mp3'
|
||||
const file = commUtils.blobToFile(blob, fileName)
|
||||
// o.src = fileName
|
||||
// console.log('file', file)
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
const ress = await Api_server.Other.uploadFile(formData)
|
||||
if (ress && ress.code == 200){
|
||||
const url = ress?.url
|
||||
url &&(o.src = url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (o?.background?.image) await toRousrceUrl(o.background.image)
|
||||
if(o?.elements){
|
||||
for (let element of o.elements) {
|
||||
await toRousrceUrl(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const deleteTalk = (item) => {
|
||||
let index = currentFileList.value.indexOf(item)
|
||||
currentFileList.value.splice(index, 1)
|
||||
|
@ -386,6 +219,7 @@ const deleteTalk = (item) => {
|
|||
|
||||
// 教材选中
|
||||
const changeBook = async(data) => {
|
||||
console.log(data)
|
||||
let cata = parseCataByNode(data.node)
|
||||
currentNode.value = data.node
|
||||
uploadData.value.levelFirstId = cata[0]
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
// 发送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) // 缓存当前资源信息
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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,15 +410,15 @@ 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 : '已结束'
|
||||
}
|
||||
}
|
||||
ElMessage({ type: 'success', message: `下课成功!` })
|
||||
}, 1000)
|
||||
break
|
||||
|
@ -604,6 +603,8 @@ export default {
|
|||
// 设置进度条
|
||||
this.pgDialog.pg.percentage = Math.floor(completed / total * 100)
|
||||
}
|
||||
console.log('结束', slides)
|
||||
return
|
||||
this.pgDialog.pg.percentage = 0
|
||||
this.pgDialog.visible = false
|
||||
listEntpcourse({
|
||||
|
@ -640,6 +641,8 @@ export default {
|
|||
}).then(async (res) => {
|
||||
|
||||
const resSlides = slides.map(({id, ...slide}) => JSON.stringify(slide))
|
||||
console.log(resSlides)
|
||||
return
|
||||
let params = {
|
||||
parentid: slideid,
|
||||
entpid: resCourse.entpid,
|
||||
|
@ -1128,6 +1131,7 @@ export default {
|
|||
background-color: white;
|
||||
position: relative;
|
||||
.prepare-center-dropdown{
|
||||
z-index: 9999;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 4px;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<userAvatar />
|
||||
<div class="info">
|
||||
<div class="info-name">{{ state.user.nickName }}</div>
|
||||
<div class="infomation" v-if="isStadium() !== true" >
|
||||
<div class="infomation">
|
||||
<selectClass v-if="!isSubject"/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -35,7 +35,7 @@ import { getUserProfile } from '@/api/system/user'
|
|||
import pkc from "../../../../../package.json"
|
||||
//选择学校和班级
|
||||
import selectClass from './components/selectClass.vue'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
|
||||
const version = ref(pkc.version)
|
||||
const activeTab = ref('userinfo')
|
||||
|
@ -46,12 +46,6 @@ const state = reactive({
|
|||
postGroup: {}
|
||||
})
|
||||
|
||||
const isStadium = () => {
|
||||
let user = useUserStore().user
|
||||
let roles = user.roles
|
||||
return roles.some(item => item.roleKey === 'stadium')
|
||||
}
|
||||
|
||||
const isSubject = ref(false)
|
||||
async function getUser() {
|
||||
getUserProfile().then((response) => {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue