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