From 1c27a881d1adf5be0d5263fbde6602e2c0634ccf Mon Sep 17 00:00:00 2001 From: yangdj <18302547071@163> Date: Wed, 22 Mar 2023 00:47:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=81=E8=BE=85=E5=AF=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/GeneralQuestionSettingController.java | 2 +- .../jlw/courseInfo/examInfoList.html | 36 +++++++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/web/src/main/java/com/ibeetl/jlw/web/GeneralQuestionSettingController.java b/web/src/main/java/com/ibeetl/jlw/web/GeneralQuestionSettingController.java index 2f582096..1389a793 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/GeneralQuestionSettingController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/GeneralQuestionSettingController.java @@ -279,7 +279,7 @@ public class GeneralQuestionSettingController{ @PostMapping(MODEL + "/edit.json") @Function("generalQuestionSetting.edit") - public JsonResult update(@Validated(ValidateConfig.UPDATE.class) GeneralQuestionSettingQuery generalQuestionSettingQuery, BindingResult result) { + public JsonResult update(@Validated(ValidateConfig.UPDATE.class) @RequestBody GeneralQuestionSettingQuery generalQuestionSettingQuery, BindingResult result) { if(result.hasErrors()){ return JsonResult.failMessage(result); }else { diff --git a/web/src/main/resources/templates/jlw/courseInfo/examInfoList.html b/web/src/main/resources/templates/jlw/courseInfo/examInfoList.html index df3eded3..69486508 100644 --- a/web/src/main/resources/templates/jlw/courseInfo/examInfoList.html +++ b/web/src/main/resources/templates/jlw/courseInfo/examInfoList.html @@ -146,7 +146,7 @@ data: [], initValue:[xmSeInitValue], on: function(data){ - getQuestionTypeGroupInfo(Common.concatBatchId(data.arr,'id')); + getQuestionTypeGroupInfo(Common.concatBatchId(data.arr,'id'),{}); } }); @@ -306,7 +306,7 @@ //添加考试信息 function addGeneral(data){ - getQuestionTypeGroupInfo($.isEmpty(data.generalQuestionSettingId)?xmSeInitValue:data.sourceCourseInfoIds); + getQuestionTypeGroupInfo($.isEmpty(data.generalQuestionSettingId)?xmSeInitValue:data.sourceCourseInfoIds,data); if (courseInfoList.length <= 0){ var ret = Common.getAjax("/jlw/courseInfo/getValues.json",{"courseLabelType":"考证课程类","courseInfoStatus":1,courseInfoType:1}); if (ret.code == 0){ @@ -324,7 +324,7 @@ }else{ demo1.update({ data: courseInfoList, - initValue: [data.sourceCourseInfoIds] + initValue: $.isEmpty(data.sourceCourseInfoIds)?[]:data.sourceCourseInfoIds.split(",") }); } layer.open({ @@ -407,7 +407,12 @@ param.generalQuestionSettingEndShowTrueFalse = generalQuestionSettingEndShowTrueFalse; param.generalQuestionSettingName = generalQuestionSettingName; param.generalQuestionSettingDoCount = generalQuestionSettingDoCount; - var ret = Common.postJSON("/api/generalQuestionSetting/addQuestionByType.do",JSON.stringify(param)); + param.generalQuestionSettingId = data.generalQuestionSettingId; + var url = "/api/generalQuestionSetting/addQuestionByType.do"; + if (!$.isEmpty(param.generalQuestionSettingId)){ + url = "/jlw/generalQuestionSetting/edit.json"; + } + var ret = Common.postJSON(url,JSON.stringify(param)); layer.msg(ret.code == 0 ? "保存成功!" : ret.msg, { offset: ['50%'], icon: ret.code == 0 ? 1 : 2, @@ -426,12 +431,31 @@ } //根据课程ID获取相应的题目数量及类型 - function getQuestionTypeGroupInfo(ids){ + function getQuestionTypeGroupInfo(ids,item){ + var map = {}; + if (!$.isEmpty(item.questionSettingOptions)){ + item.questionSettingOptions.forEach(function (it,i){ + map[it.questionType] = it; + }) + } var ret = Common.postAjax("/api/resourcesQuestion/questionTypeGroupInfo.do",{courseInfoIdPlural:ids,courseLabelTypePlural:"考证课程类"}); if(ret.code == 0){ + var ctNum = "",hjNum = ""; + if (!$.isEmpty(ret.data)){ + ctNum = 0,hjNum = 0; + ret.data.forEach(function (it,i){ + if (!$.isEmpty(map[it.questionType])){ + ctNum = ctNum + map[it.questionType].selectCount; + hjNum = hjNum + map[it.questionType].singleTypeTotalScore; + it.selectCount = map[it.questionType].selectCount; + it.singleScore = map[it.questionType].singleScore; + it.singleTypeTotalScore = map[it.questionType].singleTypeTotalScore; + } + }); + } var getTpl = question_demo.innerHTML ,view = document.getElementById('question_view'); - laytpl(getTpl).render({list:ret.data}, function(html){ + laytpl(getTpl).render({list:ret.data,ctNum:ctNum,hjNum:hjNum}, function(html){ view.innerHTML = html; $("input[name='tnum'],input[name='tfnum']").unbind(); $("input[name='tnum'],input[name='tfnum']").change(function (){