From 7a878fc5b0f06df2f202b3c7eafbb5335dd7d370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E4=BA=86=E4=B8=AA=E7=99=BD?= <543593352@qq.com> Date: Wed, 9 Oct 2024 14:20:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=B8=83=E7=BD=AE=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B8=B8=E8=A7=84=E4=BD=9C=E4=B8=9A=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/classTask/classTaskAssign.vue | 39 +++++++++++++++---- .../container/newTask/taskTypeView.vue | 17 ++++---- .../src/views/classTask/newClassTask.vue | 1 + 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/renderer/src/views/classTask/classTaskAssign.vue b/src/renderer/src/views/classTask/classTaskAssign.vue index a4b713f..e701289 100644 --- a/src/renderer/src/views/classTask/classTaskAssign.vue +++ b/src/renderer/src/views/classTask/classTaskAssign.vue @@ -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 + } + } +} // 作业说明编辑-确认 diff --git a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue index cd26ea2..c750456 100644 --- a/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue +++ b/src/renderer/src/views/classTask/container/newTask/taskTypeView.vue @@ -154,7 +154,7 @@ @@ -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); diff --git a/src/renderer/src/views/classTask/newClassTask.vue b/src/renderer/src/views/classTask/newClassTask.vue index 3e5c5bd..042090b 100644 --- a/src/renderer/src/views/classTask/newClassTask.vue +++ b/src/renderer/src/views/classTask/newClassTask.vue @@ -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 })