This commit is contained in:
白了个白 2024-09-29 16:11:33 +08:00
parent cc26ea4780
commit 2e27d3e7fb
3 changed files with 35 additions and 25 deletions

View File

@ -159,7 +159,7 @@ import { useRouter } from 'vue-router'
import ChooseTextbook from '@/components/choose-textbook/index.vue'
import { homeworklist, delClasswork } from '@/api/teaching/classwork'
import { listEntpcoursework, listClassworkeval,updateClasswork } from '@/api/classTask'
import { listEntpcoursework, listClassworkeval,updateClasswork,getEvaluationclue } from '@/api/classTask'
import { useGetHomework } from '@/hooks/useGetHomework'
import { processList } from '@/hooks/useProcessList'
@ -459,9 +459,10 @@ let classtaskObj = reactive({
title: '', //
worktype: '', //
quizlist: [], //
chooseWorkLists: [],// list
})
// -
const newHandleWorkEdit2ClassWorkQuizAdd =(row, index) =>{
const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
// this.newWorkSpace = true;
// this.newWorkSpaceEdit = true;
// this.currentTask = row;
@ -491,6 +492,8 @@ const newHandleWorkEdit2ClassWorkQuizAdd =(row, index) =>{
classtaskObj.title= row.title; //
classtaskObj.worktype= row.worktype; //
classtaskObj.quizlist= []; //
classtaskObj.chooseWorkLists = []; // list
classtaskObj.bookObj = courseObj; //
if (row.worktype == '框架梳理') {
@ -500,14 +503,22 @@ const newHandleWorkEdit2ClassWorkQuizAdd =(row, index) =>{
// queryParams.ppttype = '';
// queryParams.title = '';
// queryParams.filetype = 'draw';
// const res = await getEvaluationclue(listCourseWork[0].id);
// if ( res.data==null || res.data==undefined ) {
// return;
// }
const res = await getEvaluationclue(listCourseWork[0].id);
if ( res.data==null || res.data==undefined ) {
return;
}
console.log('res.data', res.data);
// this.chooseWorkLists = [];
// res.data.worktype = '';
// res.data.score = listCourseWork[0].score;
// this.chooseWorkLists.push(res.data);
res.data.worktype = '框架梳理';
res.data.score = listCourseWork[0].score;
classtaskObj.chooseWorkLists.push(res.data);
// TODO
router.push({
path: '/newClassTask',
query: {
classtaskObj: JSON.stringify(classtaskObj),
}
})
}
else if (row.worktype == '习题训练') {
const ids = listCourseWork.map(item => item.id).join(",");
@ -515,7 +526,6 @@ const newHandleWorkEdit2ClassWorkQuizAdd =(row, index) =>{
// for (var i=0; i<idres.rows.length; i++) {
// idres.rows[i].titletext = idres.rows[i].title.replace(/<[^>]+>/g, '');
// }
//
if(idres.rows&&idres.rows.length > 0){
processList(idres.rows);
@ -529,8 +539,7 @@ const newHandleWorkEdit2ClassWorkQuizAdd =(row, index) =>{
});
classtaskObj.quizlist = idres.rows;
//
classtaskObj.bookObj = courseObj; //
// TODO
router.push({
path: '/newClassTask',
query: {

View File

@ -180,7 +180,7 @@
<div v-if="classWorkForm.worktype!='习题训练'" :style="{'overflow': 'auto', 'border':'1px dotted blue','border-radius':'5px', 'background-color': '#f7f7f7'}">
<div style="margin: 5px; background-color: white">
<template v-for="(item) in chooseWorkLists" :key="item.id">
<template v-for="(item) in classWorkForm.chooseWorkLists" :key="item.id">
<div v-if="item.worktype==classWorkForm.worktype">
<div class="choose-work">
<div class="choose-work-title">{{ item.worktype }}</div>
@ -367,9 +367,9 @@ let classWorkForm = reactive({
uniquekey: props.propsformobj.uniquekey?cloneDeep(props.propsformobj.uniquekey):'', //
worktype: props.propsformobj.worktype?cloneDeep(props.propsformobj.worktype): '习题训练', //
title: props.propsformobj.title?cloneDeep(props.propsformobj.title):'',//
quizlist: props.propsformobj.quizlist?cloneDeep(props.propsformobj.quizlist):[] //
quizlist: props.propsformobj.quizlist?cloneDeep(props.propsformobj.quizlist):[], //
chooseWorkLists: props.propsformobj.chooseWorkLists?cloneDeep(props.propsformobj.chooseWorkLists):[] // list
}); //
const chooseWorkLists = ref([]); //
const whiteboardObj = ref(''); // -
// -------
const boardLoading = ref(false);
@ -632,7 +632,7 @@ const prevRead = async (item) => {
//
const handleClassWorkAddOfResource = (work) => {
//
let arrSole = chooseWorkLists.value.filter((item) => {
let arrSole = classWorkForm.chooseWorkLists.filter((item) => {
return item.worktype === classWorkForm.worktype
})
//
@ -641,21 +641,21 @@ const handleClassWorkAddOfResource = (work) => {
return;
}
//
let arr = chooseWorkLists.value.filter((item) => {
let arr = classWorkForm.chooseWorkLists.filter((item) => {
return item.id === work.id
})
if (arr.length===0) {
work.score = 1;
chooseWorkLists.value.push(work);
classWorkForm.chooseWorkLists.push(work);
}
};
/**
* 删除作业
*/
const deleteClassWorkAddOfResource = (work) => {
chooseWorkLists.value.filter((item, index) => {
classWorkForm.chooseWorkLists.filter((item, index) => {
if (item.id === work.id) {
chooseWorkLists.value.splice(index, 1);
classWorkForm.chooseWorkLists.splice(index, 1);
return;
}
})
@ -731,7 +731,7 @@ const handleClassWorkSave = async () => {
classWorkForm.quizlist = [], //
//
chooseWorkLists.value = [];
classWorkForm.chooseWorkLists = []; // list
whiteboardObj.value = ''; // ? //
// refresh the list
//
@ -763,7 +763,7 @@ const handleClassWorkSave = async () => {
classWorkForm.quizlist = [], //
//
chooseWorkLists.value = [];
classWorkForm.chooseWorkLists = []; // list
whiteboardObj.value = ''; // ? //
fileHomeworkList.value = []; // list
// refresh the list
@ -792,7 +792,7 @@ const handleClassWorkSave = async () => {
ll.push({'id': classWorkForm.quizlist[i].id, 'score': classWorkForm.quizlist[i].score});
}
}else if( classWorkForm.worktype === "框架梳理") {
chooseWorkLists.value.filter((item) => {
classWorkForm.chooseWorkLists.filter((item) => {
if (item.worktype === classWorkForm.worktype) {
ll.push({'id':item.id, 'score': item.score});
}
@ -816,7 +816,7 @@ const handleClassWorkSave = async () => {
classWorkForm.quizlist = [], //
//
chooseWorkLists.value = [];
classWorkForm.chooseWorkLists = [];
whiteboardObj.value = ''; // ? //
// refresh the list
//
@ -848,7 +848,7 @@ const editWork = async (cform) =>{
//
}else {
if (chooseWorkLists.value.length == 0) {
if (classWorkForm.chooseWorkLists.length == 0) {
//
ElMessage.error('请先添加作业资源!');
return;

View File

@ -62,6 +62,7 @@ const classWorkForm = reactive({
title: classtaskObj? JSON.parse(classtaskObj).title : '', //
worktype: classtaskObj? JSON.parse(classtaskObj).worktype : '', //
quizlist: classtaskObj? JSON.parse(classtaskObj).quizlist : [], //
chooseWorkLists: classtaskObj? JSON.parse(classtaskObj).chooseWorkLists : [],// list
})