作业布置:新增常规作业编辑

This commit is contained in:
白了个白 2024-10-09 14:20:30 +08:00
parent aea10a5bba
commit 7a878fc5b0
3 changed files with 41 additions and 16 deletions

View File

@ -460,6 +460,7 @@ let classtaskObj = reactive({
worktype: '', // worktype: '', //
quizlist: [], // quizlist: [], //
chooseWorkLists: [],// list chooseWorkLists: [],// list
fileHomeworkList: [],// list
}) })
// - // -
const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
@ -487,13 +488,15 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
if (listCourseWork.length > 0) { if (listCourseWork.length > 0) {
classtaskObj.id= row.id; // classtaskObj.id= row.id; //
classtaskObj.bookObj = courseObj; //
classtaskObj.bookName = row.evaltitle? row.evalparenttitle+'/'+row.evaltitle: row.evalparenttitle// :/ classtaskObj.bookName = row.evaltitle? row.evalparenttitle+'/'+row.evaltitle: row.evalparenttitle// :/
classtaskObj.uniquekey= row.uniquekey; // classtaskObj.uniquekey= row.uniquekey; //
classtaskObj.title= row.title; // classtaskObj.title= row.title; //
classtaskObj.worktype= row.worktype; // classtaskObj.worktype= row.worktype; //
classtaskObj.quizlist= []; // classtaskObj.quizlist= []; //
classtaskObj.chooseWorkLists = []; // list classtaskObj.chooseWorkLists = []; // list
classtaskObj.bookObj = courseObj; // classtaskObj.fileHomeworkList = []; // list
if (row.worktype == '框架梳理') { if (row.worktype == '框架梳理') {
@ -550,7 +553,7 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
} }
}) })
} }
else if (this.classWorkForm.worktype == '课堂展示') { else if (row.worktype == '课堂展示') {
// const workcodes = JSON.parse(this.currentTask.workcodes); // const workcodes = JSON.parse(this.currentTask.workcodes);
// const jsonString = JSON.stringify(workcodes.json); // const jsonString = JSON.stringify(workcodes.json);
@ -559,11 +562,18 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
// this.isShowBoard = true // this.isShowBoard = true
// this.whiteboardObj = jsonString; // this.whiteboardObj = jsonString;
} }
else if (this.classWorkForm.worktype == '常规作业') { else if (row.worktype == '常规作业') {
// this.fileHomeworkList = []; if(isJson(row.workcodes)){
// if(isJson(this.currentTask.workcodes)){ classtaskObj.fileHomeworkList = JSON.parse(row.workcodes);
// this.fileHomeworkList = JSON.parse(this.currentTask.workcodes);
// } // TODO
router.push({
path: '/newClassTask',
query: {
classtaskObj: JSON.stringify(classtaskObj),
}
})
}
} }
@ -574,7 +584,20 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
} }
}; };
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
}
}
}
// - // -

View File

@ -154,7 +154,7 @@
</template> </template>
<template v-if="classWorkForm.worktype =='常规作业'"> <template v-if="classWorkForm.worktype =='常规作业'">
<div v-loading="fileLoading" class="upload-homework"> <div v-loading="fileLoading" class="upload-homework">
<FileUpload v-model="fileHomeworkList" :fileSize="800" :fileType="['mp3','mp4','doc','docx','xlsx','xls','pdf','ppt','pptx','jpg','jpeg','gif','png','txt']"/> <FileUpload v-model="classWorkForm.fileHomeworkList" :fileSize="800" :fileType="['mp3','mp4','doc','docx','xlsx','xls','pdf','ppt','pptx','jpg','jpeg','gif','png','txt']"/>
</div> </div>
</template> </template>
</div> </div>
@ -363,7 +363,8 @@ let classWorkForm = reactive({
worktype: props.propsformobj.worktype?cloneDeep(props.propsformobj.worktype): '习题训练', // worktype: props.propsformobj.worktype?cloneDeep(props.propsformobj.worktype): '习题训练', //
title: props.propsformobj.title?cloneDeep(props.propsformobj.title):'',// 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 chooseWorkLists: props.propsformobj.chooseWorkLists?cloneDeep(props.propsformobj.chooseWorkLists):[], // list
fileHomeworkList: props.propsformobj.fileHomeworkList?cloneDeep(props.propsformobj.fileHomeworkList):[] //
}); // }); //
const whiteboardObj = ref(''); // - const whiteboardObj = ref(''); // -
// --------------------------------------------------- // ---------------------------------------------------
@ -381,7 +382,6 @@ const prevReadMsg = reactive({
const flowData = ref({})// const flowData = ref({})//
//---------- //----------
const fileLoading = ref(false); // loading const fileLoading = ref(false); // loading
const fileHomeworkList = ref([]);//
/*** /***
* 作业类型切换 * 作业类型切换
@ -752,7 +752,7 @@ const handleClassWorkSave = async () => {
} }
else if(classWorkForm.worktype === "常规作业"){ else if(classWorkForm.worktype === "常规作业"){
fileLoading.value = true fileLoading.value = true
cform.workcodes = JSON.stringify(fileHomeworkList.value); cform.workcodes = JSON.stringify(classWorkForm.fileHomeworkList);
cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]); cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
try { try {
addClassworkReturnId(cform).then(() => { addClassworkReturnId(cform).then(() => {
@ -766,7 +766,7 @@ const handleClassWorkSave = async () => {
// //
classWorkForm.chooseWorkLists = []; // list classWorkForm.chooseWorkLists = []; // list
whiteboardObj.value = ''; // ? // whiteboardObj.value = ''; // ? //
fileHomeworkList.value = []; // list classWorkForm.fileHomeworkList.value = []; // list
// refresh the list // refresh the list
// //
// this.getClassWorkAllList(); // this.getClassWorkAllList();
@ -933,10 +933,11 @@ const editWork = async (cform) =>{
// }else if (classWorkForm.worktype=='') { // }else if (classWorkForm.worktype=='') {
// }else if (classWorkForm.worktype=='') {
// // 1. (, )
// classWorkParams.workcodes = JSON.stringify(this.fileHomeworkList);
// } // }
else if (classWorkForm.worktype=='常规作业') {
// 1. (, )
cform.workcodes = JSON.stringify(classWorkForm.fileHomeworkList);
}
// 3. // 3.
let res = await updateClasswork(cform); let res = await updateClasswork(cform);

View File

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