Merge remote-tracking branch 'origin/main'

This commit is contained in:
朱浩 2024-12-21 21:40:07 +08:00
commit a601a9f8dd
9 changed files with 132 additions and 40 deletions

View File

@ -74,8 +74,6 @@ const initLoad: Function = () => {
!!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)// !!(opt.ratio??null) && slidesStore.setViewportRatio(opt.ratio)//
} }
return PPTApi.getSlideList(resource.id) return PPTApi.getSlideList(resource.id)
// PPTApi.updateWorkList()
// return Promise.resolve()
} }
return Promise.resolve() return Promise.resolve()
} }

View File

@ -50,6 +50,8 @@ export class Utils {
}, delay) }, delay)
} }
} }
// 延时
static sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
} }
/** ppt相关后端接口处理 */ /** ppt相关后端接口处理 */
@ -84,6 +86,12 @@ export class PPTApi {
slidesStore.setWorkItem(workItem) slidesStore.setWorkItem(workItem)
// 没有上课时调用-作业列表 // 没有上课时调用-作业列表
if(!classcourse) this.updateWorkList() if(!classcourse) this.updateWorkList()
// 没有上课时调用-批量更新缩略图
if(!classcourse) {
Utils.sleep(1500).then(() => {
this.batchUpdateThumUrl()
})
}
resolve(true) resolve(true)
} else msgUtils.msgError(res.msg || '获取数据失败');resolve(false) } else msgUtils.msgError(res.msg || '获取数据失败');resolve(false)
}) })
@ -233,13 +241,20 @@ export class PPTApi {
// 批量更新缩略图-异步 // 批量更新缩略图-异步
static batchUpdateThumUrl() { static batchUpdateThumUrl() {
return new Promise(async resolve => { return nextTick().then(async () => {
const list = slidesStore.workItem || [] const list = slidesStore.workItem || []
if (!list.length) return resolve() if (!list.length) return
const upList = [] const upList = []
for (const [ind,o] of list.entries()) { for (const [ind,o] of list.entries()) {
const thumUrl = await this.getSlideThumUrl(ind) const isCreate = !o.fileurl // 是否创建
if (isCreate) {
const thumUrl = await this.getSlideThumUrl(ind)
upList.push({ id: o.id, fileurl: thumUrl })
}
} }
if (!upList.length) return
// 批量更新
return await API_entpcoursefile.batchUpdateNew(upList)
}) })
} }

View File

@ -126,6 +126,8 @@ export class MsgEnum {
MSG_homework : 'HOMEWORK', MSG_homework : 'HOMEWORK',
/** @desc: 公屏 - 课堂作业|活动 */ /** @desc: 公屏 - 课堂作业|活动 */
MSG_pushSreen_work : 'pushSreen_work', MSG_pushSreen_work : 'pushSreen_work',
/** @desc: 公屏 - 实验 */
MSG_pushSreen_experiment : 'pushSreen_experiment',
/** @desc: 点赞 */ /** @desc: 点赞 */
MSG_dz : 'dz', MSG_dz : 'dz',
/** @desc: 疑惑 */ /** @desc: 疑惑 */

View File

@ -10,6 +10,7 @@ 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 * as dialogUtils from '@/utils/dialog' // 弹窗-函数
import { Homework } from './index' // api-作业相关 import { Homework } from './index' // api-作业相关
// import emitter from '@/utils/mitt' //mitt 事件总线 // import emitter from '@/utils/mitt' //mitt 事件总线
import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制 import useExecPlay from '../views/Screen/hooks/useExecPlay' // 播放控制
@ -114,6 +115,10 @@ export default () => {
if (!content.id) return if (!content.id) return
Homework.showHomework(content.id) Homework.showHomework(content.id)
break break
case MsgEnum.HEADS.MSG_pushSreen_experiment: // 打开实验:
if (!content.url) return
dialogUtils.openLink(content.url)
break
case MsgEnum.HEADS.MSG_closed: // 下课: case MsgEnum.HEADS.MSG_closed: // 下课:
close() close()
break break

View File

@ -100,6 +100,8 @@ export class MsgEnum {
MSG_homework : 'HOMEWORK', MSG_homework : 'HOMEWORK',
/** @desc: 公屏 - 课堂作业|活动 */ /** @desc: 公屏 - 课堂作业|活动 */
MSG_pushSreen_work : 'pushSreen_work', MSG_pushSreen_work : 'pushSreen_work',
/** @desc: 公屏 - 实验 */
MSG_pushSreen_experiment : 'pushSreen_experiment',
/** @desc: 点赞 */ /** @desc: 点赞 */
MSG_dz : 'dz', MSG_dz : 'dz',
/** @desc: 疑惑 */ /** @desc: 疑惑 */

View File

@ -0,0 +1,49 @@
/**
* 弹窗-函数
*/
import { h, render } from 'vue'
import { ElDialog } from 'element-plus'
// 打开弹窗-函数
export const openDialog = (option, content) => {
let vNode
const body = document.body
const dOpts = {
modelValue: true,
width: 800,
height: 600,
title: '添加-超连接',
draggable: true,
'onUpdate:modelValue': val => {
if (vNode && !val) render(null, body)
},
...option
}
vNode = h(ElDialog, dOpts, {
default: typeof content == 'function' ? content(h) : content
})
render(vNode, body)
}
// 打开链接
export const openLink = (option, title) => {
// https://phet.colorado.edu/sims/html/number-play/latest/number-play_zh_CN.html
const isStr = typeof option == 'string'
const opt = isStr ? {} : option
const url = isStr ? option : option?.url || option?.src || option?.href
const titleNew = isStr? title||'实验室' : option?.title || '添加-超连接'
openDialog({
title: titleNew,
...opt
}, (h) => {
return h('iframe', {
src: url,
width: '100%',
style: {
height: 'calc(80vh - 75px)',
},
scrolling: 'no',
frameborder: '0',
})
})
}

View File

@ -709,29 +709,33 @@ const acceptParams = async (params) => {
} else { } else {
// //
if (params.studentObj.worktype == '常规作业' || params.studentObj.worktype == '科学实验') { if (params.studentObj.worktype == '常规作业' || params.studentObj.worktype == '科学实验') {
try { if(params.studentObj.worktype == '常规作业'){
// datacontent TODO try {
const res = await getClassworkdata(params.studentObj.id); // datacontent TODO
if(res.data.datacontent != ''){ const res = await getClassworkdata(params.studentObj.id);
const teachWorkFileList = JSON.parse(res.data.datacontent); if(res.data.datacontent != ''){
console.log(teachWorkFileList, '老师filelist-------------') const teachWorkFileList = JSON.parse(res.data.datacontent);
teachWorkFileList && console.log(teachWorkFileList, '老师filelist-------------')
teachWorkFileList.forEach((item) => { teachWorkFileList &&
if ( teachWorkFileList.forEach((item) => {
item.name.indexOf('jpg') > -1 || if (
item.name.indexOf('jpeg') > -1 || item.name.indexOf('jpg') > -1 ||
item.name.indexOf('png') > -1 item.name.indexOf('jpeg') > -1 ||
) { item.name.indexOf('png') > -1
teachImageList.value.push(item) ) {
} else { teachImageList.value.push(item)
teachFileList.value.push(item) } else {
} teachFileList.value.push(item)
}) }
teacherFeedContentList.value.push(teachWorkFileList) })
} teacherFeedContentList.value.push(teachWorkFileList)
}
} catch (error) { } catch (error) {
console.error('Invalid JSON:', error) console.error('Invalid JSON:', error)
}
}else{
// TODO 2024-12-20
} }
params.studentQuizAllList.forEach((item) => { params.studentQuizAllList.forEach((item) => {

View File

@ -61,14 +61,27 @@ const checkList = ref([])// 当前年级对应学科的课程,
// //
const getSubject = () => { const getSubject = () => {
// //
if(!userStore.subject) return // if(!userStore.subject) return
listEvaluation({ itemkey: 'subject', pageSize: 500 }).then((res) => { // listEvaluation({ itemkey: 'subject', pageSize: 500 }).then((res) => {
const arr = userStore.subject.split(',') // const arr = userStore.subject.split(',')
subjectList.value = res.rows.filter(item => arr.includes(String(item.id))).map(items => items) // subjectList.value = res.rows.filter(item => arr.includes(String(item.id))).map(items => items)
// console.log(subjectList,'subjectList');
// })
// list
const edustageList = ['小学','初中','高中'];
const subList = ['数学','物理','化学','生物','科学'];
edustageList.forEach((item) => {
subList.forEach((subItems) => {
subjectList.value.push({
edustage: item,
edusubject: subItems,
itemtitle: subItems
})
})
})
console.log(subjectList,'subjectList'); console.log(subjectList,'subjectList');
}) //
// handleUserEduStage(useClassTaskStore().experimentObj.edustage)
handleUserEduStage(useClassTaskStore().experimentObj.edustage)
} }
// //
const isExpList = (edusubject) => { const isExpList = (edusubject) => {

View File

@ -721,19 +721,23 @@ const msgHandle = (msg) => {
const { head, content, ...other } = msg const { head, content, ...other } = msg
switch(head) { switch(head) {
case MsgEnum.HEADS.MSG_closed: // : case MsgEnum.HEADS.MSG_closed: // :
Homework.win = null Homework.win = null
window.close() // window.close() //
break break
case MsgEnum.HEADS.MSG_finishHomework: // : case MsgEnum.HEADS.MSG_finishHomework: // :
console.log('更新作业', head, content) console.log('更新作业', head, content)
const data = JSON.parse(localStorage.getItem('teachClassWorkItem')); const data = JSON.parse(localStorage.getItem('teachClassWorkItem'));
openDialog(data, false); openDialog(data, false);
break break
case MsgEnum.HEADS.MSG_slideFlapping: // case MsgEnum.HEADS.MSG_slideFlapping: //
console.log('切换页面-关闭窗口') console.log('切换页面-关闭窗口')
Homework.win = null Homework.win = null
window.close() // window.close() //
break break
case MsgEnum.HEADS.MSG_pushSreen_experiment: // :
Homework.win = null
window.close() //
break
// case 'TIMAddRecvNewMsgCallback': // data=[] // case 'TIMAddRecvNewMsgCallback': // data=[]
// { // {
// (data||[]).forEach(o => { // (data||[]).forEach(o => {