Merge branch 'main' into zouyf_dev

# Conflicts:
#	src/renderer/src/components/set-homework/index.vue
This commit is contained in:
“zouyf” 2024-09-19 14:05:16 +08:00
commit 7f9afedef9
9 changed files with 116 additions and 137 deletions

View File

@ -244,7 +244,7 @@ const onSubmit = (formEl) => {
teachername: userInfo.nickName, teachername: userInfo.nickName,
unixstamp: new Date().getTime(), unixstamp: new Date().getTime(),
worktype: props.row.worktype, worktype: props.row.worktype,
status: '1', //1 status: '1'
} }
ary.push(obj) ary.push(obj)
} }

View File

@ -66,9 +66,10 @@ function stateSyncWatch(storeName, newState) {
const keyArr = key.split('.') || [] const keyArr = key.split('.') || []
keyArr.reduce((o,c,i)=>{o[c] = i === keyArr.length-1 ? value : {};return o[c]}, newValue) keyArr.reduce((o,c,i)=>{o[c] = i === keyArr.length-1 ? value : {};return o[c]}, newValue)
const jsonStr = JSON.stringify(newValue) // 从新组装-json数据 const jsonStr = JSON.stringify(newValue) // 从新组装-json数据
// // 更新本地数据-session // 更新本地数据-session
// console.log('state-change-update:', key, value)
sessionStore.set(key, value) sessionStore.set(key, value)
// // 通知主线程更新 // 通知主线程更新
ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr) ipcRenderer?.invoke('pinia-state-change', storeName, jsonStr)
// console.log('======',key, value, jsonStr ) // console.log('======',key, value, jsonStr )
} }

View File

@ -220,7 +220,7 @@ const getStudentClassWorkData = () => {
}).then((res) => { }).then((res) => {
for (var t = 0; t < classWorkList.value.length; t++) { for (var t = 0; t < classWorkList.value.length; t++) {
for (var i = 0; i < res.rows.length; i++) { for (var i = 0; i < res.rows.length; i++) {
if (res.rows[i].classworkid == classWorkList.value[t].id && res.rows[i].resultcount > 0) { if (res.rows[i].classworkid == classWorkList.value[t].id && res.rows[i].finishtimelength != '0') {
console.log('==================') console.log('==================')
// / // /
// resultcount0 // resultcount0

View File

@ -79,60 +79,17 @@
<template #footer> <template #footer>
<el-row> <el-row>
<el-col :span="6" style="padding: 10px"> <el-col :span="6" style="padding: 10px">
<span <span>参考答案
>参考答案
<span v-if="quItem.workanswerFormat != ''"> <span v-if="quItem.workanswerFormat != ''">
<sapn <sapn style="background-color: #0ed116; color: white; padding: 0 5px; border-radius: 5px;">{{ formatWorkAnswer(quItem) }}</sapn>
style="
background-color: #0ed116;
color: white;
padding: 0 5px;
border-radius: 5px;
"
>{{ quItem.workanswerFormat.replace(/<[^>]+>/g, '') }}</sapn
>
</span> </span>
</span> </span>
</el-col> </el-col>
<el-col :span="6" style="padding: 10px"> <el-col :span="6" style="padding: 10px">
<!-- <span>学生答案{{ stuItem.feedcontent }}</span> --> <!-- <span>学生答案{{ stuItem.feedcontent }}</span> -->
<span <span>学生答案
>学生答案 <span v-if="stuItem.feedcontent !=''" style="background-color: red; color: white; padding: 0 5px; border-radius: 5px;">
<span v-if="quItem.workdesc == ''|| quItem.workdesc == '[]' "> {{ formatFeedContent(stuItem, quItem) }}
<!-- quItem.workdesc 没值说明是非选择题 -->
<span
v-if="stuItem.feedcontent != ''"
style="
background-color: red;
color: white;
padding: 0 5px;
border-radius: 5px;
"
>
{{ stuItem.feedcontent.replace('#', '、') }}
</span>
</span>
<span v-else>
<!-- 选择题类型学生答题转换为 ABCD格式 -->
<span
v-if="stuItem.feedcontent != ''"
style="
background-color: red;
color: white;
padding: 0 5px;
border-radius: 5px;
"
>
{{
JSON.parse(quItem.workdesc)
.map((item, index) => {
if (item == stuItem.feedcontent) {
return String.fromCharCode(65 + Number(index))
}
})
.filter(Boolean)[0]
}}
</span>
</span> </span>
</span> </span>
</el-col> </el-col>
@ -499,6 +456,7 @@ import { ElMessageBox, ElMessage } from 'element-plus'
import { updateClassworkeval, updateClassworkdata } from '@/api/classTask' import { updateClassworkeval, updateClassworkdata } from '@/api/classTask'
import { getTimeDate } from '@/utils/date' import { getTimeDate } from '@/utils/date'
import ReFilePreview from '@/components/refile-preview/index.vue' import ReFilePreview from '@/components/refile-preview/index.vue'
import { quizStrToList } from '@/utils/comm';
const userStore = useUserStore() const userStore = useUserStore()
@ -842,6 +800,47 @@ const acceptParams = (params) => {
analysisScoreOpen.value = true analysisScoreOpen.value = true
} }
const formatWorkAnswer = (quItem) => {
let format = '';
if (!Array.isArray(quItem.workanswerFormat)) {
format = quItem.workanswerFormat.replace(/<[^>]+>/g, '')
} else {
format = quItem.workanswerFormat.map(item => item.replace(/<[^>]+>/g, '')).join('、');
}
return format;
}
//
const formatFeedContent = (stuItem, quItem) => {
let format = '';
if (quItem.workdesc == '' || quItem.workdesc == '[]') {
//
const arr = stuItem.feedcontent.split('#');
return arr.map(item => {
if (item == '') {
item = '空';
}
return item;
}).join('、');
}else {
const list = quizStrToList(quItem.workdesc);
format = list.map((item,index) =>{
if (quItem.worktype == '单选题') {
const workdesc = item.replace(/<[^>]*>/g,'');
const feedcontent = stuItem.feedcontent.replace(/<[^>]*>/g,'');
if(workdesc == feedcontent){
return (String.fromCharCode(65+Number(index)))
}
} else if (quItem.worktype == '多选题') {
const arr = stuItem.feedcontent.split(',');
return arr.map(item => String.fromCharCode(65+Number(item))).join('');
}
}).filter(Boolean)[0];
}
return format;
}
// //
const onClassWorkFormScoreSave = () => { const onClassWorkFormScoreSave = () => {
console.log(classWorkFormScore) console.log(classWorkFormScore)

View File

@ -383,7 +383,7 @@ const getClassWorkStudentList = (rowId) => {
// //
tableRadio.list = tableRadio.list =
classWorkAnalysis.classworkdata && classWorkAnalysis.classworkdata &&
classWorkAnalysis.classworkdata.filter((item) => item.resultcount > 0) classWorkAnalysis.classworkdata.filter((item) => item.finishtimelength != '0')
tableRadio.value = '1' tableRadio.value = '1'
tableRadio.num0 = classWorkAnalysis.classworkdata.length - tableRadio.list.length tableRadio.num0 = classWorkAnalysis.classworkdata.length - tableRadio.list.length
tableRadio.num1 = tableRadio.list.length tableRadio.num1 = tableRadio.list.length
@ -506,12 +506,12 @@ const tableRadioChange = (e) => {
console.log(e,'??????') console.log(e,'??????')
console.log("学生列表:", classWorkAnalysis.classworkdata) console.log("学生列表:", classWorkAnalysis.classworkdata)
if(e=='1'){ if(e=='1'){
tableRadio.list = classWorkAnalysis.classworkdata.filter(item => item.resultcount > 0) tableRadio.list = classWorkAnalysis.classworkdata.filter(item => item.finishtimelength != '0')
tableRadio.value = '1'; tableRadio.value = '1';
tableRadio.num0 = classWorkAnalysis.classworkdata.length - tableRadio.list.length; tableRadio.num0 = classWorkAnalysis.classworkdata.length - tableRadio.list.length;
tableRadio.num1 = tableRadio.list.length; tableRadio.num1 = tableRadio.list.length;
}else if(e=='0'){ }else if(e=='0'){
tableRadio.list = classWorkAnalysis.classworkdata.filter(item => item.resultcount == 0) tableRadio.list = classWorkAnalysis.classworkdata.filter(item => item.finishtimelength == '0')
tableRadio.value = '0'; tableRadio.value = '0';
tableRadio.num0 = tableRadio.list.length; tableRadio.num0 = tableRadio.list.length;
tableRadio.num1 = classWorkAnalysis.classworkdata.length - tableRadio.list.length; tableRadio.num1 = classWorkAnalysis.classworkdata.length - tableRadio.list.length;

View File

@ -119,71 +119,22 @@ onMounted(() => {
*/ */
const open = async (id) => { const open = async (id) => {
visible.value = true visible.value = true
// apt if (id) {
if (id) await getAptInfo(id) //
// reset()
// myClassActive.value = { // apt
// "createBy": null, await getAptInfo(id)
// "createTime": null, //
// "updateBy": null, getClassList()
// "updateTime": null, // im-chat
// "remark": null, nextTick(async() => {
// "id": 14740, chat = await imChatRef.value?.initImChat()
// "idarray": null, })
// "jsonarray": null, }
// "entpid": 255,
// "parentid": 14741,
// "linkids": "",
// "linklist": "",
// "entpcourseid": 7300,
// "entpcourseidarray": null,
// "evalid": 39952,
// "evaltitle": " ",
// "coursetitle": " ",
// "classid": 0,
// "ppttype": "file",
// "title": " ",
// "fileidx": 0,
// "fileurl": "",
// "pathfile": null,
// "filetype": "ppt",
// "filesize": null,
// "datacontent": "",
// "filekey": "",
// "filetag": "",
// "dflag": 0,
// "status": "",
// "edituserid": 2781,
// "editusername": "",
// "edituserheadimgurl": "/profile/avatar/2024/08/12/blob_20240812152930A001.jpeg",
// "edituserentpname": "AIx",
// "editstudentid": null,
// "editstudentname": null,
// "timestamp": "2024-09-10 15:07:20",
// "token": null,
// "base64Code": null,
// "orderby": null,
// "childcount": 4,
// "commentlikecount": 0,
// "commenttextcount": 0,
// "commentusecount": 0,
// "commentvisitcount": 90,
// "unixstamp": null,
// "classworkcount": 0,
// "classworklist": "",
// "authjson": "",
// "defaultslide": null
// }
//
getClassList()
// im-chat
// nextTick(async() => {
// chat = await imChatRef.value?.initImChat()
// })
} }
// //
const handleClose = async () => { const handleClose = async () => {
reset() //
await chat?.logout() await chat?.logout()
chat = null chat = null
} }
@ -204,6 +155,15 @@ const initData = () => {
{ label: '故障备用', prop: 'backup', show: false }, { label: '故障备用', prop: 'backup', show: false },
] ]
} }
//
const reset = () => {
// -
classForm.form = {}
teacherForm.form = { classcourseid: 0 }
dt.isCreate = false
dt.isHistory = false
dt.atCourse = {}
}
// APT // APT
const getAptInfo = async (id) => { const getAptInfo = async (id) => {
const res = await Http_Entpcoursefile.getEntpcoursefile(id) const res = await Http_Entpcoursefile.getEntpcoursefile(id)

View File

@ -52,7 +52,8 @@
</div> </div>
</div> </div>
<div class="prepare-body-main-item-btn"> <div class="prepare-body-main-item-btn">
<el-button type="primary" @click="clickStartClass(item)">上课</el-button> <el-button v-if="activeClassId==item.id" type="success" @click="clickStartClass(item)">上课中</el-button>
<el-button v-else type="primary" @click="clickStartClass(item)">上课</el-button>
</div> </div>
<div class="prepare-body-main-item-tool"> <div class="prepare-body-main-item-tool">
<el-popover <el-popover
@ -65,18 +66,20 @@
<template #default> <template #default>
<div style="width: 100%"> <div style="width: 100%">
<div class="item-popover" @click="closePopver(index)"> <div class="item-popover" @click="closePopver(index)">
<div v-if="userInfo.userId === Number(item.createUserId)" class="item-popover-item"> <template v-if="userInfo.userId === Number(item.createUserId)">
<el-button text @click="editTalk(item, index)"> <div class="item-popover-item">
<i class="iconfont icon-bianji"></i> <el-button text @click="editTalk(item, index)">
<span>标签</span> <i class="iconfont icon-bianji"></i>
</el-button> <span>标签</span>
</div> </el-button>
<div v-if="userInfo.userId === Number(item.createUserId)" class="item-popover-item"> </div>
<el-button text @click="deleteTalk(item)"> <div class="item-popover-item">
<i class="iconfont icon-shanchu"></i> <el-button text @click="deleteTalk(item)" :disabled="activeClassId==item.id">
<span>删除</span> <i class="iconfont icon-shanchu"></i>
</el-button> <span>删除</span>
</div> </el-button>
</div>
</template>
</div> </div>
</div> </div>
</template> </template>
@ -98,6 +101,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { deleteSmarttalk, updateSmarttalk, getPrepareById } from '@/api/file' import { deleteSmarttalk, updateSmarttalk, getPrepareById } from '@/api/file'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import outLink from '@/utils/linkConfig' import outLink from '@/utils/linkConfig'
import { sessionStore } from '@/utils/store'
const { ipcRenderer } = window.electron || {} const { ipcRenderer } = window.electron || {}
export default { export default {
@ -115,6 +119,10 @@ export default {
default: function () { default: function () {
return 0 return 0
} }
},
activeClassId: { // id
type: String,
default: ''
} }
}, },
emits: { 'on-start-class': null, 'on-delete': null, 'on-set': null, 'on-delhomework': null,'on-filearg': null }, emits: { 'on-start-class': null, 'on-delete': null, 'on-set': null, 'on-delhomework': null,'on-filearg': null },

View File

@ -20,6 +20,7 @@
:key="index" :key="index"
:item="item" :item="item"
:index="index" :index="index"
:activeClassId="activeClass?.id"
@on-delete="deleteTalk" @on-delete="deleteTalk"
@on-start-class="startClass" @on-start-class="startClass"
> >
@ -192,7 +193,7 @@ import { getClassInfo, getSelfReserv } from '@/api/classManage'
import { useGetHomework } from '@/hooks/useGetHomework' import { useGetHomework } from '@/hooks/useGetHomework'
import { addEntpcoursefileReturnId } from '@/api/education/entpcoursefile' import { addEntpcoursefileReturnId } from '@/api/education/entpcoursefile'
import ClassReserv from '@/views/classManage/classReserv.vue' import ClassReserv from '@/views/classManage/classReserv.vue'
import classStart from '@/views/desktop/container/class-start.vue' // import classStart from './container/class-start.vue' //
const toolStore = useToolState() const toolStore = useToolState()
const fs = require('fs') const fs = require('fs')
@ -246,7 +247,9 @@ export default {
// //
setDialog: false, setDialog: false,
row: '', row: '',
isOpenHomework: false isOpenHomework: false,
//
activeClass: null,
} }
}, },
computed: { computed: {
@ -272,6 +275,9 @@ export default {
}) })
this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime') this.lastAsyncAllTime = localStorage.getItem('lastAsyncAllTime')
// this.initReserv() // this.initReserv()
// zdg:
this.activeClass = sessionStore.get('activeClass') || null
}, },
mounted() { mounted() {
this.$watch( this.$watch(
@ -298,15 +304,20 @@ export default {
// }, // },
methods: { methods: {
startClass(item) { startClass(item) {
console.log(item) // console.log(item, sessionStore)
if(item.fileFlag === '课件') { if(item.fileFlag === '课件') {
// ()
const id = sessionStore.has('activeClass.id') ? sessionStore.get('activeClass.id') : null
if (id && id == item.id) return ElMessage.warning('当前正在上课,请勿重复操作')
this.openReserv() this.openReserv()
} }
if(item.fileFlag === 'apt') { if(item.fileFlag === 'apt') {
//TODO apt //TODO apt - fileId: aptId
const { fileId: aptId } = item this.$refs.calssRef.open(item.fileId)
this.$refs.calssRef.open(aptId)
} }
// -store
sessionStore.set('activeClass', item)
this.activeClass = item
}, },
initReserv(id) { initReserv(id) {
getClassInfo(id).then((res) => { getClassInfo(id).then((res) => {

View File

@ -10,7 +10,7 @@
<upvote-vue ref="upvoteRef" type="2"></upvote-vue> <upvote-vue ref="upvoteRef" type="2"></upvote-vue>
<!-- im-chat 聊天组件 --> <!-- im-chat 聊天组件 -->
<im-chat ref="imChatRef" @change="chatChange" isGroup /> <im-chat ref="imChatRef" @change="chatChange" group />
<!-- 底部工具栏 --> <!-- 底部工具栏 -->
<div class="tool-bottom-all" @mouseenter="mouseChange(0)" @mouseleave="mouseChange(1)"> <div class="tool-bottom-all" @mouseenter="mouseChange(0)" @mouseleave="mouseChange(1)">