This commit is contained in:
白了个白 2024-10-17 10:42:10 +08:00
parent e57e643f67
commit f18d0c0e5e
1 changed files with 100 additions and 107 deletions

View File

@ -402,15 +402,16 @@ const getData = (data) => {
}
/**
* 获取 entpcourseid
* 获取 entpcourseid 获取作业列表
*/
const initHomeWork = async()=> {
loading.value = true;
const { res, chapterId } = await useGetHomework(courseObj.node);
console.log('entpcourseid', chapterId);
console.log('res', res);
entpcourseid.value = chapterId;
taskList.value = res;
loading.value = false;
}
/**
* 查看推送历史
@ -494,7 +495,7 @@ const handleDelete =() => {
return delClasswork(ids.join(','));
}).then(() => {
setTimeout(() => {
getTaskList();
initHomeWork();
}, 1500);
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {})
@ -507,105 +508,105 @@ const handleDelete =() => {
/**
* 1.获取作业列表
*/
const getTaskList = async () => {
//
taskList.value = [];
loading.value = true;
homeworklist({entpcourseid: entpcourseid.value, orderby: "deaddate DESC" , edituserid: userStore.userId, pageSize: 500}).then(res => {
let model = [];
let mission = [];
// const getTaskList = async () => {
// //
// taskList.value = [];
// loading.value = true;
// homeworklist({entpcourseid: entpcourseid.value, orderby: "deaddate DESC" , edituserid: userStore.userId, pageSize: 500}).then(res => {
// let model = [];
// let mission = [];
if(res.rows&&res.rows.length > 0){
//
res.rows.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
}
for (let item of res.rows){
item.taskconfig = [];
// if(res.rows&&res.rows.length > 0){
// //
// res.rows.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp));
// }
// for (let item of res.rows){
// item.taskconfig = [];
//
if (item.timelength == null) {
item.timelength = 1;
}
if (item.weights == null) {
item.weights = 1;
}
// //
// if (item.timelength == null) {
// item.timelength = 1;
// }
// if (item.weights == null) {
// item.weights = 1;
// }
// 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 = 'primary';
}
//
if (item.entpcourseworklist != '') {
item.entpcourseworklistarray = JSON.parse('['+item.entpcourseworklist+']');
} else {
item.entpcourseworklistarray = [];
}
// // 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 = 'primary';
// }
// //
// if (item.entpcourseworklist != '') {
// item.entpcourseworklistarray = JSON.parse('['+item.entpcourseworklist+']');
// } else {
// item.entpcourseworklistarray = [];
// }
//
if (item.status == '10') {
// ,
model.push(item);
continue;
}
else if (item.status == '1') {
// ,
let ss = [];
if (item.classworkdatastudentids != null) {
ss = JSON.parse('['+ item.classworkdatastudentids+']');
}
const js = {
id: item.id,
classid: item.classid,
classcaption: item.classcaption,
parentid: 0,
worktype: '',
workkey: item.workkey,
worktag: '',
entpcourseid: 0,
evalid: 0,
edusubject: '',
edudegree: '',
workdate: '',
title: '',
workcodes: '',
studentlist: ss,
deaddate: item.deaddate,
timelength: item.timelength,
weights: item.weights,
feedtype: item.feedtype
}
item.taskconfig.push(js);
mission.push(item);
}
}
// //
// if (item.status == '10') {
// // ,
// model.push(item);
// continue;
// }
// else if (item.status == '1') {
// // ,
// let ss = [];
// if (item.classworkdatastudentids != null) {
// ss = JSON.parse('['+ item.classworkdatastudentids+']');
// }
// const js = {
// id: item.id,
// classid: item.classid,
// classcaption: item.classcaption,
// parentid: 0,
// worktype: '',
// workkey: item.workkey,
// worktag: '',
// entpcourseid: 0,
// evalid: 0,
// edusubject: '',
// edudegree: '',
// workdate: '',
// title: '',
// workcodes: '',
// studentlist: ss,
// deaddate: item.deaddate,
// timelength: item.timelength,
// weights: item.weights,
// feedtype: item.feedtype
// }
// item.taskconfig.push(js);
// mission.push(item);
// }
// }
//
let list = [];
for (let item of model){
item.children = [];
for (let child of mission) {
if (item.id == child.parentid) {
item.children.push(child);
}
}
list.push(item);
}
//
taskList.value = list;
loading.value = false;
})
}
// //
// let list = [];
// for (let item of model){
// item.children = [];
// for (let child of mission) {
// if (item.id == child.parentid) {
// item.children.push(child);
// }
// }
// list.push(item);
// }
// //
// taskList.value = list;
// loading.value = false;
// })
// }
// /
@ -753,7 +754,7 @@ const successHomework = () => {
setDialog.value = false;
//
nextTick(() => {
getTaskList();
initHomeWork();
})
}
@ -811,7 +812,7 @@ const submitWorkTitle = () => {
proxy.$modal.msgSuccess("修改成功");
currentWorkEdit.workTitleEdit = false;
//
getTaskList();
initHomeWork();
});
};
@ -869,14 +870,6 @@ onMounted(() => {
watch(() => courseObj.node, (newVal,oldVal) => {
console.log(courseObj,'课程选择')
if(newVal&&oldVal){
console.log(newVal.id,'newVal')
console.log(oldVal.id,'oldVal')
if(newVal.id != oldVal.id){
//
// getTaskList();
}
}
})
</script>