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

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: '', //
quizlist: [], //
chooseWorkLists: [],// list
fileHomeworkList: [],// list
})
// -
const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
@ -487,13 +488,15 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
if (listCourseWork.length > 0) {
classtaskObj.id= row.id; //
classtaskObj.bookObj = courseObj; //
classtaskObj.bookName = row.evaltitle? row.evalparenttitle+'/'+row.evaltitle: row.evalparenttitle// :/
classtaskObj.uniquekey= row.uniquekey; //
classtaskObj.title= row.title; //
classtaskObj.worktype= row.worktype; //
classtaskObj.quizlist= []; //
classtaskObj.chooseWorkLists = []; // list
classtaskObj.bookObj = courseObj; //
classtaskObj.fileHomeworkList = []; // list
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 jsonString = JSON.stringify(workcodes.json);
@ -559,11 +562,18 @@ const newHandleWorkEdit2ClassWorkQuizAdd = async (row, index) =>{
// this.isShowBoard = true
// this.whiteboardObj = jsonString;
}
else if (this.classWorkForm.worktype == '常规作业') {
// this.fileHomeworkList = [];
// if(isJson(this.currentTask.workcodes)){
// this.fileHomeworkList = JSON.parse(this.currentTask.workcodes);
// }
else if (row.worktype == '常规作业') {
if(isJson(row.workcodes)){
classtaskObj.fileHomeworkList = JSON.parse(row.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 v-if="classWorkForm.worktype =='常规作业'">
<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>
</template>
</div>
@ -363,7 +363,8 @@ let classWorkForm = reactive({
worktype: props.propsformobj.worktype?cloneDeep(props.propsformobj.worktype): '习题训练', //
title: props.propsformobj.title?cloneDeep(props.propsformobj.title):'',//
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(''); // -
// ---------------------------------------------------
@ -381,7 +382,6 @@ const prevReadMsg = reactive({
const flowData = ref({})//
//----------
const fileLoading = ref(false); // loading
const fileHomeworkList = ref([]);//
/***
* 作业类型切换
@ -752,7 +752,7 @@ const handleClassWorkSave = async () => {
}
else if(classWorkForm.worktype === "常规作业"){
fileLoading.value = true
cform.workcodes = JSON.stringify(fileHomeworkList.value);
cform.workcodes = JSON.stringify(classWorkForm.fileHomeworkList);
cform.entpcourseworklist = JSON.stringify([{'id':-2, 'score': '10'}]);
try {
addClassworkReturnId(cform).then(() => {
@ -766,7 +766,7 @@ const handleClassWorkSave = async () => {
//
classWorkForm.chooseWorkLists = []; // list
whiteboardObj.value = ''; // ? //
fileHomeworkList.value = []; // list
classWorkForm.fileHomeworkList.value = []; // list
// refresh the list
//
// this.getClassWorkAllList();
@ -933,10 +933,11 @@ const editWork = async (cform) =>{
// }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.
let res = await updateClasswork(cform);

View File

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