diff --git a/src/renderer/src/components/set-homework/index.vue b/src/renderer/src/components/set-homework/index.vue index 854ade1..17127b8 100644 --- a/src/renderer/src/components/set-homework/index.vue +++ b/src/renderer/src/components/set-homework/index.vue @@ -62,8 +62,8 @@ const props = defineProps({ entpcourseid: { default: '' }, - row: { - default: '' + rows: { + default: [] }, title: { type: String, @@ -225,32 +225,34 @@ const onSubmit = (formEl) => { let ary = [] for (const value in gradeObj) { //这些参数 参照AIx web端 作业推送 - let obj = { - id: 0, - parentid: props.row.id, - classid: value, - classcourseid: 0, // 课堂id-ppt为字符串不能使用 - classReservId: classRoomId, // 课堂id - entpcourseid: props.entpcourseid, - studentlist: JSON.stringify(gradeObj[value]), - feedback: form.feedback, - workkey: '', - timelength: form.timelength, - weights: 1, - deaddate: form.deaddate, - workdate: getCurrentTime('YYYY-MM-DD'), - uniquekey: props.row.uniquekey, - entpcourseworklist: '[' + props.row.entpcourseworklist + ']', - needMsgNotifine: 'false', - msgkey: 'newclasswork', - title: '作业任务', - msgcontent: '', - teachername: userInfo.nickName, - unixstamp: new Date().getTime(), - worktype: props.row.worktype, - status: '1' + for (var i = 0; i < props.rows.length; i++) { + let obj = { + id: 0, + parentid: props.rows[i].id, + classid: value, + classcourseid: 0, // 课堂id-ppt为字符串不能使用 + classReservId: classRoomId, // 课堂id + entpcourseid: props.entpcourseid, + studentlist: JSON.stringify(gradeObj[value]), + feedback: form.feedback, + workkey: '', + timelength: form.timelength, + weights: 1, + deaddate: form.deaddate, + workdate: getCurrentTime('YYYY-MM-DD'), + uniquekey: props.rows[i].uniquekey, + entpcourseworklist: '[' + props.rows[i].entpcourseworklist + ']', + needMsgNotifine: 'false', + msgkey: 'newclasswork', + title: '作业任务', + msgcontent: '', + teachername: userInfo.nickName, + unixstamp: new Date().getTime(), + worktype: props.rows[i].worktype, + status: '1' + } + ary.push(obj) } - ary.push(obj) } setLoading.value = true saveByClassWorkArray({ @@ -284,8 +286,9 @@ const cloneDialog = (formEl) => { } onMounted(() => { - // 默认当前 - form.deaddate = getCurrentTime('YYYY-MM-DD HH:mm') + // 默认当前 改为 延后3小时后截止 + // form.deaddate = getCurrentTime('YYYY-MM-DD HH:mm') + form.deaddate = `${getCurrentTime('YYYY-MM-DD')} ${getCurrentTime('HH+3')}:${getCurrentTime('mm')}`; }) diff --git a/src/renderer/src/hooks/useClassTask.js b/src/renderer/src/hooks/useClassTask.js new file mode 100644 index 0000000..85966bb --- /dev/null +++ b/src/renderer/src/hooks/useClassTask.js @@ -0,0 +1,117 @@ +import { listEntpcoursework,getEvaluationclue } from '@/api/classTask'; +import { processList } from '@/hooks/useProcessList'; + +const isJson = (str) => { + if (typeof str == 'string') { + try { + let obj = JSON.parse(str) + if (typeof obj == 'object' && obj) { + return true + } else { + return false + } + } catch (e) { + return false + } + } +} + + +/** + * @description 编辑作业配置 + * @param {*} row + */ +export const editListItem = (row, courseObj) => { + return new Promise((resolve, reject) => { + // 作业内容编辑-跳转到设计界面-传参 + let classtaskObj = { + id: '', // + bookName: '', // 课程名称 + uniquekey: '', // 设计中的标题 + title: '', // 设计中的说明 + worktype: '', // 设计中的作业类型 + quizlist: [], // 设计中的试题列表 + chooseWorkLists: [],// 设计中的框架梳理list + fileHomeworkList: [],// 设计中的常规作业list + whiteboardObj: '',// 设计中的课堂展示对象 + }; + console.log('编辑的行', row); + + //重新更新[新任务]中右侧列表数据 + var listCourseWork = []; + for (var i=0; i < row.entpcourseworklistarray.length; i++) { + listCourseWork.push(row.entpcourseworklistarray[i]); + } + + if (listCourseWork.length > 0) { + classtaskObj.id= row.id; // + classtaskObj.bookObj = courseObj; // 教材对象 + classtaskObj.bookName = row.evaltitle? row.evalparenttitle? row.evalparenttitle+'/'+row.evaltitle : row.evaltitle: row.evalparenttitle// 课程名称:单元/章节: 单元 + classtaskObj.uniquekey= row.uniquekey; // 设计中的标题 + classtaskObj.title= row.title; // 设计中的说明 + classtaskObj.worktype= row.worktype; // 设计中的作业类型 + classtaskObj.quizlist= []; // 设计中的试题列表 + classtaskObj.chooseWorkLists = []; //设计中的 框架梳理list + classtaskObj.fileHomeworkList = []; //设计中的 常规作业list + classtaskObj.whiteboardObj = ''; //设计中的 课堂展示对象 + + + if (row.worktype == '框架梳理') { + // 框架梳理对应只有一个内容 + getEvaluationclue(listCourseWork[0].id).then(res => { + if ( res.data==null || res.data==undefined ) { + return ; + } + res.data.worktype = '框架梳理'; + res.data.score = listCourseWork[0].score; + classtaskObj.chooseWorkLists.push(res.data); + // + // console.log('框架梳理', classtaskObj); + return resolve(classtaskObj); + }); + } + else if (row.worktype == '习题训练') { + const ids = listCourseWork.map(item => item.id).join(","); + listEntpcoursework({ids: ids, pageSize: 50}).then(idres => { + // for (var i=0; i]+>/g, ''); + // } + // 格式化试题 + if(idres.rows&&idres.rows.length > 0){ + processList(idres.rows); + //重新将task中的分值更新 + row.entpcourseworklistarray.forEach(item => { + const quizItem = idres.rows.find(quiz => quiz.id === item.id); + if (quizItem) { + quizItem.score = item.score; + quizItem.scoreOrigin = item.score; + } + }); + + classtaskObj.quizlist = idres.rows; + // + // console.log('习题训练', classtaskObj); + return resolve(classtaskObj); + } + }) + } + else if (row.worktype == '课堂展示') { + console.log('row.课堂展示', row.workcodes); + const workcodes = JSON.parse(row.workcodes); + classtaskObj.whiteboardObj = JSON.stringify(workcodes.json); + // + // console.log('课堂展示', classtaskObj); + return resolve(classtaskObj); + } + else if (row.worktype == '常规作业') { + if(isJson(row.workcodes)){ + classtaskObj.fileHomeworkList = JSON.parse(row.workcodes); + // + // console.log('常规作业', classtaskObj); + return resolve(classtaskObj); + } + } + } + }); +} + diff --git a/src/renderer/src/hooks/useGetHomework.js b/src/renderer/src/hooks/useGetHomework.js index c122d9f..e07a2de 100644 --- a/src/renderer/src/hooks/useGetHomework.js +++ b/src/renderer/src/hooks/useGetHomework.js @@ -71,6 +71,7 @@ const getHomeWorkList = async () => { return await homeworklist({ entpcourseid: chapterId, edituserid: userStore.user.userId, + orderby: "timestamp DESC", pageSize: 100, status: '10' }).then((res) => { @@ -79,7 +80,25 @@ const getHomeWorkList = async () => { for (var i = 0; i < res.rows.length; i++) { res.rows[i].taskconfig = [] - // 找child + // 处理任务类型的UI + // if (res.rows[i].worktype == '学习目标定位') { + // res.rows[i].workclass = 'success'; + // res.rows[i].workcodesList = JSON.parse(res.rows[i].workcodes); + // } else + // 课标研读 目标设定 教材研读 框架梳理 学科定位 TODO 后续接入在添加 + if (res.rows[i].worktype == '课堂展示') { + res.rows[i].workclass = 'primary'; + } else if (res.rows[i].worktype == '框架梳理') { + res.rows[i].workclass = 'warning'; + } else if (res.rows[i].worktype == '常规作业') { + res.rows[i].workclass = 'info'; + } else if (res.rows[i].worktype == '习题训练') { + res.rows[i].workclass = 'danger'; + } else { + res.rows[i].workclass = 'primary'; + } + + // 找child for (var j = 0; j < res.rows.length; j++) { if (res.rows[j].parentid == res.rows[i].id) { var ss = [] diff --git a/src/renderer/src/views/classTask/classTask.vue b/src/renderer/src/views/classTask/classTask.vue index b682c68..46e22c0 100644 --- a/src/renderer/src/views/classTask/classTask.vue +++ b/src/renderer/src/views/classTask/classTask.vue @@ -58,17 +58,17 @@ @@ -1278,3 +934,4 @@ watch(() => courseObj.node, (newVal) => { } } + \ No newline at end of file diff --git a/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue b/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue index 4ba8db2..5447495 100644 --- a/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue +++ b/src/renderer/src/views/classTask/container/classOverview/distribution/echarts.vue @@ -74,8 +74,8 @@ function initChart() { position: 'top', formatter: params => { const value = dataList.value[params.dataIndex].value; - const percentage = ((value / total) * 100).toFixed(2); // 计算百分比并保留两位小数 - return `${percentage}%`; // 显示为百分比形式 + const percentage = value ? ((value / total) * 100).toFixed() : 0; // 计算百分比并保留两位小数 + return `${value}人 ${percentage}%`; // 显示为百分比形式 }, color: '#333', fontSize: 12 diff --git a/src/renderer/src/views/classTask/container/newTask/prevReadMsg-Dialog.vue b/src/renderer/src/views/classTask/container/newTask/prevReadMsg-Dialog.vue index a96cd04..953e677 100644 --- a/src/renderer/src/views/classTask/container/newTask/prevReadMsg-Dialog.vue +++ b/src/renderer/src/views/classTask/container/newTask/prevReadMsg-Dialog.vue @@ -125,7 +125,7 @@ onMounted(() => { watch(() => props.bookobj.levelSecondId, (newVal) => { - console.log(props.bookobj,'课程选择') + // console.log(props.bookobj,'课程选择') }) diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index 022bc4d..8a3efe0 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -266,6 +266,10 @@ const props = defineProps({ isedit: { type: Boolean, default: false + }, + isback:{ + type: Boolean, + default: false } }) @@ -737,14 +741,16 @@ const handleClassWorkSave = async () => { //这里分离了,所以不需要更新表单数据了 // this.getClassWorkAllList(); - // TODO 后续看是否跳转到 作业布置页面 - - //TODO 下面3个后续看是啥 - // this.newWorkSpace = false; - // this.newWorkSpaceEdit = false; - // this.workEdit = false; }) } + + if(props.isback){ + // 其他页面进入的 返回上一页 + router.back(); + }else{ + // 首页进入的,跳转到作业布置页面 + router.push({ path: '/classTaskAssign' }); + } } }); }; @@ -976,3 +982,4 @@ watch(() => props.bookobj.levelSecondId, (newVal) => { } + diff --git a/src/renderer/src/views/classTask/newClassTask.vue b/src/renderer/src/views/classTask/newClassTask.vue index 16e2df2..b1d8236 100644 --- a/src/renderer/src/views/classTask/newClassTask.vue +++ b/src/renderer/src/views/classTask/newClassTask.vue @@ -16,6 +16,7 @@
+ 返回上页 课程目录 @@ -35,7 +36,7 @@ - +
@@ -53,6 +54,7 @@ const route = useRoute(); const router = useRouter() const { proxy } = getCurrentInstance() +const isback = ref(route.query.isBack?true:false); const classtaskObj = route.query.classtaskObj;//作业布置的内容对象 const bookTitle = ref(classtaskObj? JSON.parse(classtaskObj).bookName: '');// 课程名称 const isOpenLeftBook = ref(classtaskObj? JSON.parse(classtaskObj).id ? true : false: false ); // 是否打开左侧目录 @@ -183,3 +185,4 @@ onMounted(() => { } } + diff --git a/src/renderer/src/views/desktop/container/work-trend.vue b/src/renderer/src/views/desktop/container/work-trend.vue index 957c59d..79a9bcd 100644 --- a/src/renderer/src/views/desktop/container/work-trend.vue +++ b/src/renderer/src/views/desktop/container/work-trend.vue @@ -16,6 +16,7 @@ {{ item.uniquekey }} {{ getCurrentTime('YYYY-MM-DD HH:mm') > item.deaddate ? '已结束' : '进行中' }} + {{ item.worktype }}
{{ item.classcaption }} | 截止时间:{{ item.deaddate }}
@@ -50,11 +51,27 @@ const getHomework = async () => { loading.value = true const { edustage, edusubject } = user try { - const { rows } = await homeworklist({ edituserid: user.userId, edustage, edusubject, deaddate: getTomorrow(), status: '1', orderby: 'uniquekey DESC', pageSize: 500 }) + const { rows } = await homeworklist({ edituserid: user.userId, edustage, edusubject, deaddate: getTomorrow(), status: '1', orderby: 'deaddate DESC', pageSize: 500 }) // 只展示进行中的 - // homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate) - homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getTomorrow() <= item.deaddate) //大于今天的才算进行中 + homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getCurrentTime('YYYY-MM-DD HH:mm') < item.deaddate) // 当前日期的时分与截止日期进行判断 + // homeworkList.value = rows.filter(item => item.deaddate && item.uniquekey && getTomorrow() <= item.deaddate) //大于今天的才算进行中 弃用 homeworkList.value.forEach((item) => { + // 处理任务类型的UI + if (item.worktype == '学习目标定位') { + item.workclass = 'success' + item.workcodesList = JSON.parse(item.workcodes) + } else if (item.worktype == '教材研读') { + item.workclass = 'primary' + } else if (item.worktype == '框架梳理') { + item.workclass = 'warning' + } else if (item.worktype == '学科定位') { + item.workclass = 'info' + } else if (item.worktype == '习题训练') { + item.workclass = 'danger' + } else { + item.workclass = '' + } + item.workdatacount = JSON.parse('[' + item.classworkdatastudentids + ']').length // 如果是习题训练任务,则检查一共有多少道 if (item.entpcourseworklist != '') { diff --git a/src/renderer/src/views/desktop/index.vue b/src/renderer/src/views/desktop/index.vue index 065ea02..8352c8b 100644 --- a/src/renderer/src/views/desktop/index.vue +++ b/src/renderer/src/views/desktop/index.vue @@ -113,17 +113,17 @@ const menuList = [{ { name: '作业设计', icon: '#icon-zuoyesheji', - isOuter: true, - path: '/teaching/classtaskassign?titleName=作业布置&openDialog=newClassTask', - // path: '/newClassTask', + // isOuter: true, + // path: '/teaching/classtaskassign?titleName=作业布置&openDialog=newClassTask', + path: '/newClassTask', id: '2-1' }, { name: '作业布置', icon: '#icon-zuoyebuzhi', - isOuter: true, - path: '/teaching/classtaskassign?titleName=作业布置', - // path: '/classTaskAssign', + // isOuter: true, + // path: '/teaching/classtaskassign?titleName=作业布置', + path: '/classTaskAssign', id: '2-2' }, { diff --git a/src/renderer/src/views/prepare/container/file-list-item.vue b/src/renderer/src/views/prepare/container/file-list-item.vue index f617afb..eeb77d0 100644 --- a/src/renderer/src/views/prepare/container/file-list-item.vue +++ b/src/renderer/src/views/prepare/container/file-list-item.vue @@ -22,7 +22,8 @@