diff --git a/WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view.jsp b/WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view.jsp index a0b1201..58de136 100644 --- a/WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view.jsp +++ b/WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view.jsp @@ -46,230 +46,18 @@
- +
- - + diff --git a/WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view1.jsp b/WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view1.jsp index 9d37ac2..2c0fad8 100644 --- a/WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view1.jsp +++ b/WebRoot/WEB-INF/jsp/sunvote/teacher/paper_view1.jsp @@ -17,7 +17,7 @@ - + @@ -115,7 +115,7 @@ '); + } + } + } + }) + }) + function star(index,num){ //难度星级 + $(".star").eq(index).append(''); + var li_html=""; + for(var i=1;i<=num;i++){ + li_html +='
  • '; + } + for(var j=num;j<5;j++){ + li_html += '
  • '; + } + + $(".star").eq(index).find("ul").html(li_html); + } + $(document).on("click",".round_n_orange",function(){ //显示错误学生名单 + var question_id = $(this).closest("li").attr("data-id"); + var student_html=""; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/qstudentinfo", + async:false, + type:"post", + data:{question_id:question_id,test_id:testpaperId}, + success:function(data){ + console.log(data); + for(var i=0;i'+data.data[i].NAME+''+data.data[i].ANSWER+''+data.data[i].PRESS_TIME+'秒'; + } + $(".student_list").html(student_html); + } + }); + $('#myModal').modal('show'); + }) \ No newline at end of file diff --git a/WebRoot/static/js/paper_view2.js b/WebRoot/static/js/paper_view2.js new file mode 100644 index 0000000..601f869 --- /dev/null +++ b/WebRoot/static/js/paper_view2.js @@ -0,0 +1,73 @@ +var url=""; + var question_box=[]; + function slide(obj){ //查看解析 + obj.closest(".star_box").siblings(".resolve").slideToggle(function(){ + if($(".resolve").css("display") == "none") + obj.text("查看解析"); + else + obj.text("收起解析"); + }); + } + +function getQueryString(name) { + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); + var r = window.location.search.substr(1).match(reg); + if (r != null) return unescape(r[2]); return null; + } + var PAPER_ID=getQueryString("PAPER_ID"); + var classId=getQueryString("classId"); + var userid=getQueryString("userid"); + + var _html=""; + $(document).ready(function(){ + window.top.loading.remove(); + $.ajax({ + url:url+"/SunvoteEducation/api/v1/paperinfo", + async:false, + type:"post", + data:{PAPER_ID:PAPER_ID}, + success:function(data){ + console.log(data); + $("#paper_title").html(data.data.title); + $("#time").html(data.data.exam_time); + if(data.data.questions.length>0){ + for(var i=0;i

      【答案】 '+data.data.questions[i].answer+'

      【解析】'+data.data.questions[i].analysis+'

      '; + } + console.log(_html); + $(".analysis ul").html(_html); + for(var j=0;j'+(j+1)+'、'+data.data.questions[j].content); + var arry_option=data.data.questions[j].option_content; + arry_option=arry_option.replace("[",""); + arry_option=arry_option.replace("]",""); + arry_option=arry_option.split(","); + + for(var x=0;x'+arry_option[x]+''; + } + $(".option").eq(j).html(option_html); + star(j,parseInt(data.data.questions[j].difficulty)); + } + } + window.top.loading.remove(); + } + }) + }) + function star(index,num){ //难度星级 + $(".star").eq(index).append('
        '); + var li_html=""; + for(var i=1;i<=num;i++){ + li_html +='
      • '; + } + for(var j=num;j<5;j++){ + li_html += '
      • '; + } + + $(".star").eq(index).find("ul").html(li_html); + } + \ No newline at end of file diff --git a/WebRoot/static/js/set_question.js b/WebRoot/static/js/set_question.js new file mode 100644 index 0000000..f239a36 --- /dev/null +++ b/WebRoot/static/js/set_question.js @@ -0,0 +1,385 @@ +var url=""; + var temp_tag; + var temp_data; + var TEXTBOOK_ID=""; + var question_box=[]; + var question_num=0; + var pageNum=1; + var end=0; + var flag=0; + + + $(document).ready(function(){ + getPoint(); + }); + + function getQueryString(name) { + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); + var r = window.location.search.substr(1).match(reg); + if (r != null) return unescape(r[2]); return null; + } + + var subject_id=getQueryString("subject_id"); + var class_id=getQueryString("class_id"); + var user_id=getQueryString("user_id"); + + + function getPoint(){ //获取知识点 + $.ajax({ + url:url+"/SunvoteEducation/api/v1/point", + async:false, + type:"post", + data:{depth:"",subject_id:subject_id,p_id:"",knowledge_from:101}, + success:function(data){ + var point_html=""; + for(var i=0;i'+(i+1)+data.data[i].NAME+''; + } + $(".section").children("ul").html(point_html); + getQuestion($(".section li").eq(0)); + } + }) + } + function getChapter(TEXTBOOK_ID){ //获取章节 + $(".section").children("ul").html(""); + $.ajax({ + url:url+"/SunvoteEducation/api/v1/chapter", + async:false, + type:"post", + data:{TEXTBOOK_ID:TEXTBOOK_ID}, + success:function(data){ + for(var i=0;i'+data.data[i].NAME+''); + if(data.data[i].CHILDREN.length>0){ + $(".section").children("ul").children("li").eq(i).append("
          "); + for(var j=0;j'+data.data[i].CHILDREN[j].NAME+''); + } + } + } + getQuestion($(".section li").eq(0)); + } + }) + } + function getMenu(id,obj){ //获取知识点下级内容 + var _html=""; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/point", + async:false, + type:"post", + data:{depth:"",subject_id:subject_id,p_id:id,knowledge_from:101}, + success:function(data){ + obj.append('
            '); + for(var i=0;i'+(i+1)+data.data[i].NAME+''; + else + _html +='
          • '+(i+1)+data.data[i].NAME+'
          • '; + } + obj.children('ul').html(_html); + } + }) + } + function slide(obj){ //查看解析 + obj.closest(".star_box").siblings(".resolve").slideToggle(function(){ + if($(".resolve").css("display") == "none") + obj.text("查看解析"); + else + obj.text("收起解析"); + }); + + } + function getQuestion(obj){ //获取题目 + + var knowledge_id="",chapter_id=""; + if($(".tab .active").attr("data-index")==1){ + knowledge_id=obj.attr("data-id"); + }else{ + chapter_id=obj.attr("data-id"); + } + + var _html=""; + + $.ajax({ + url:url+"/SunvoteEducation/api/v1/questions", + async:true, + type:"post", + data:{chapter_id:chapter_id,teachingmaterial_id:"",knowledge_id:knowledge_id,question_from:101,user_id:"",problem_type:"",subject_id:subject_id,count:"5",pageNum:pageNum}, + success:function(data){ + window.top.loading.remove(); + console.log(data); + if(data.data.length>0){ + for(var i=0;i

              【答案】 '+data.data[i].ANSWER+'

              【解析】'+data.data[i].ANALYSIS+'

              '; + } + $(".question_box").children("ul").append(_html); + console.log(5*(pageNum-1)); + for(var j=5*(pageNum-1);j<(data.data.length+5*(pageNum-1));j++){ + var option_html=""; + $(".question_box li .content").eq(j).append(''+(j+1)+'、'+data.data[j-5*(pageNum-1)].CONTENT); + var arry_option=data.data[j-5*(pageNum-1)].OPTION_CONTENT; + if(question_box.indexOf(data.data[j-5*(pageNum-1)].QUESTION_ID)>=0){ + $(".check_box").eq(j).addClass("checked"); + } + for(var x=0;x'+arry_option[x]+''; + } + $(".option").eq(j).find("ul").html(option_html); + + star(j,parseInt(data.data[j-5*(pageNum-1)].DIFFICULTY)); + + } + $(".view_more").css("display","block"); + end=0; + }else{ + $(".view_more").css("display","none"); + // $(".question_box").children("ul").html(""); + pageNum-=1; + if(pageNum<1) + pageNum=1; + end=1; + } + flag=0; + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + // 状态码 + console.log(XMLHttpRequest.status); + // 状态 + console.log(XMLHttpRequest.readyState); + // 错误信息 + console.log(textStatus); + flag=0; + pageNum-=1; + if(pageNum<1) + pageNum=1; + window.top.loading.remove(); + } + }) + } + function getTeachingMaterial(){ //获取教材版本 + + $.ajax({ + url:url+"/SunvoteEducation/api/v1/teachingmaterial", + async:true, + type:"post", + data:{subject_id:subject_id}, + success:function(data){ + console.log(data); + if(data.data.length>0){ + var teach_html=""; + + + for(var i=0;i

              '+data.data[i].NAME+'

              '; + } + $(".book_box ul").html(teach_html); + var li_length=$(".book_box ul li").length; + for(var k=0;k0){ + + books=textBook($(".book_box ul li").eq(k).attr("data-id")); + $(".book_box ul li").eq(k).append('
              '); + + for(var j=0;j'+books[j].name+''; + } + $(".float_box").eq(k).children("ul").find(".clearfix").before(book_html); + TEXTBOOK_ID=books[0].id; + } + + } + getChapter(TEXTBOOK_ID); + $("#book_name").text($(".name").eq(0).text()+"/"+$(".float_box").eq(0).find('li').eq(0).text()); + } + + } + }) + + } + function textBook(id){ //获取教材 + var textBookName=[]; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/textbook", + async:false, + type:"post", + data:{teaching_material_id:id,subject_id:subject_id,grade_id:""}, + success:function(data){ + if(data.data.length>0){ + for(var i=0;i'); + var li_html=""; + for(var i=1;i<=num;i++){ + li_html +='
            • '; + } + for(var j=num;j<5;j++){ + li_html += '
            • '; + } + + $(".star").eq(index).find("ul").html(li_html); + } + + $(".section").on("click",".add",function(event){ //展开菜单 + event.stopPropagation(); + var that=$(this).closest("li"); + if($(".tab .active").attr("data-index")==1){ + if(that.attr("data-img-click")==0){ + getMenu(that.attr("data-id"),that); + } + that.attr("data-img-click",1); + }else{ + that.attr("data-img-click",1); + } + + if(that.children('ul').length>0) + that.children('ul').slideToggle(function(){ + if(that.children('ul').css("display")=="block") + that.children('img').attr("src","../static/images/reduce.png"); + else + that.children('img').attr("src","../static/images/add.png"); + }); + }); + $(".section").on("click","span",function(event){ //点击菜单获取题目 + window.top.loading.show(); + event.stopPropagation(); + pageNum=1; + $(".question_box ul").html(""); + var that=$(this).closest("li"); + if($(".tab .active").attr("data-index")==1){ + getQuestion(that); + $(".menu_active").removeClass(); + that.addClass("menu_active"); + }else{ + getQuestion(that); + $(".menu_active").removeClass(); + that.addClass("menu_active"); + } + + }); + $(".book_box").children("ul").on("mouseover","li",function(event){ //教材版本交互 + event.stopPropagation(); + $(this).children(".float_box").css("display","block"); + }); + $(".book_box").children("ul").on("mouseleave","li",function(event){ //教材版本交互 + event.stopPropagation(); + $(this).children(".float_box").css("display","none"); + }); + $(".float_box").on("mouseleave",function(event){ //教材版本交互 + event.stopPropagation(); + $(this).css("display","none"); + }); + $(document).on("click",".float_box li",function(event){ //教材版本交互 + event.stopPropagation(); + var id=$(this).attr("data-id"); + $("#book_name").text($(this).closest(".li_name").children(".name").text()+"/"+$(this).text()); + $(".float_box").css("display","none"); + $(".book_box").slideToggle(); + getChapter(id); + }); + $(".book").click(function(){ //教材版本下拉框交互 + $(".book_box").slideToggle(); + }) + $(document).on("click",".check_box",function(){ //选中题目 + + if($(this).hasClass("checked")){ + var id=$(this).closest("li").attr("data-id"); + var que_index=question_box.indexOf(id); + $(this).removeClass("checked"); + question_box.splice(que_index,1); + question_num--; + }else{ + question_box[question_num]=$(this).closest("li").attr("data-id"); + question_num++; + $(this).addClass("checked"); + } + $("#all_que_num").html(question_num); + }); + $(".clear_que").click(function(){ //清空 + question_num=0; + question_box=[]; + $(".checked").removeClass("checked"); + $("#all_que_num").html(question_num); + }); + $(".tab li").click(function(){ //教材与知识点选择 + window.top.loading.show(); + pageNum=1; + $(this).siblings().removeClass("active"); + $(this).addClass("active"); + if($(this).index()==0){ + getTeachingMaterial(); + $(".choose_book").css("display","block"); + //getChapter(TEXTBOOK_ID); + }else{ + $(".choose_book").css("display","none"); + getPoint(); + } + }); + $(".topic").click(function(){ + if(parseInt($("#all_que_num").text())>0) + $('#myModal').modal('show'); + else + alert("请先选择题目") + }); + $(".view_more").click(function(){ //加载更多 + flag++; + if(end>0){ + $(".view_more p").html("没有更多了"); + return; + } + if(flag==1){ + window.top.loading.show(); + pageNum++; + getQuestion($(".menu_active")); + } + }) + $("#submit").click(function(){ + var question_arry=[]; + for(var i=0;i0){ + for(var i=0;i'+data.data.classInfoList[i].CLASS_NAME+''; + option_html += '' + } + $(".classList").html(class_html+'
              '); + $(".classList li").eq(0).addClass("active"); + $("#dealer_id_2").html(option_html); + } + } + }) + + //日期框 + $('.date-picker').datepicker({ + autoclose: true, + todayHighlight: true + }); + window.top.loading.remove(); + }) + + function getList(start_date,end_date,class_id){ //获取试卷列表 + var tab_html=""; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/paper", + async:false, + type:"post", + data:{ + paper_type:"101", + user_id:user_id, + subject_id:subject_id, + class_id:class_id, + currentpage:"1", + showcount:"", + start_date:start_date, + end_date:end_date + }, + success:function(data){ + console.log(data); + for(var i=0;i'+(i+1)+''+data.data[i].TITLE+''+getClassName(data.data[i].CLASS_ID)+''+getSubjectName(data.data[i].SUBJECT_ID)+''+data.data[i].EXAM_TIME+'分钟'+data.data[i].CREATE_DATE+'查看'; + } + $("#tab_body").html(tab_html); + window.top.loading.remove(); + } + }); + } + $('#ids').on('click', function(){ + var th_checked = $("#ids").prop('checked');//checkbox inside "TH" table header + + $(".table_box .table").find('tbody > tr').each(function(){ + var row = this; + if(th_checked) $(row).find('input[type=checkbox]').eq(0).prop('checked', true); + else $(row).find('input[type=checkbox]').eq(0).prop('checked', false); + }); + }); + function jump(obj){ //预览试卷 + window.top.loading.show(); + var id=obj.closest("tr").attr("data-id"); + var classid=obj.closest("tr").attr("data-classid"); + location.href="paper_view2.do?PAPER_ID="+id+"&classID="+classid+"&userid="+user_id; + } + $(".classList").on("click","li",function(){ + $(this).siblings().removeClass("active"); + $(this).addClass("active"); + + }); + $("#creatPaper").click(function(){ //新建试卷 + $('#myModal').modal('show'); + }); + function setQUestion(){ //新建试卷-选择班级 + if($(".classList .active").length>0){ + class_id=$(".classList .active").attr("data-classid"); + location.href="set_question.do?subject_id="+subject_id+"&class_id="+class_id+"&user_id="+user_id; + }else{ + alert("请先选择班级"); + } + window.top.loading.show(); + console.log($(".classList .active").length); + //location.href=""; + } + function getSubjectName(id){ //获取科目中文名 + var subjectName=""; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/subjectcname", + async:false, + type:"post", + data:{id:id}, + success:function(data){ + subjectName=data.data; + } + }) + return subjectName; + } + function getClassName(id){ //获取班级中文名 + var className=""; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/classname", + async:false, + type:"post", + data:{id:id}, + success:function(data){ + className=data.data; + } + }) + return className; + } + function getday(month){ //获取日期 + var time=[]; + var d= new Date(); + d.setMonth(month-1); + d.setDate(1); + var day=d.getDate(); + var month=d.getMonth()+1; + if((d.getMonth()+1)<10){ + var month="0"+(d.getMonth()+1); + } + var year=d.getFullYear(); + var startTime=year+"-"+month+"-"+day; + d.setMonth(month); + var end_day=d.getDate(); + var end_month=d.getMonth()+1; + if((d.getMonth()+1)<10){ + var end_month="0"+(d.getMonth()+1); + } + var end_year=d.getFullYear(); + var endTime=end_year+"-"+end_month+"-"+end_day; + time[0]=startTime; + time[1]=endTime; + return time; + } + function timeList(){ //渲染时间列表 + var time = new Date(); + var now_month=time.getMonth()+1; + time.setMonth(now_month-1) + if(time.getMonth()!= 0 ){ + var preceding_month = time.getMonth(); + }else + var preceding_month = 12; + time.setMonth(now_month-2) + if(time.getMonth()!= 0 ){ + var last_month = time.getMonth(); + }else + var last_month = 12; + var option_html=""; + option_html += ''; + $("#dealer_id_1").html(option_html); + } + function tosearch(){ //搜索 + //var timeBox=getday($("#dealer_id_1").val()); + var start_date=$("#lastStart").val(); + var end_date=$("#lastEnd").val(); + var class_id=$("#dealer_id_2").val(); + getList(start_date,end_date,class_id); + } + + function del(obj){ //删除 + //var remove = new remove(); + var id=obj.closest("tr").attr("data-id"); + window.top.remove.init({"title":"删除","func":function(success){ + if(success){ + var url = "/SunvoteEducation/paper/delete.do?PAPER_ID="+id+"&tm="+new Date().getTime(); + window.top.loading.show(); + $.get(url,function(data){ + tosearch(); + }); + } + else{ + console.log("false"); + } + }}); + window.top.remove.show(); + } + function deleteAll(){ //批量删除 + window.top.remove.init({"title":"删除","func":function(success){ + if(success){ + var str = ''; + for(var i=0;i < document.getElementsByName('ids').length;i++){ + if(document.getElementsByName('ids')[i].checked){ + if(str=='') str += document.getElementsByName('ids')[i].value; + else str += ',' + document.getElementsByName('ids')[i].value; + } + } + if(str==''){ + + }else{ + $.ajax({ + type: "POST", + url: '/SunvoteEducation/paper/deleteAll.do?tm='+new Date().getTime(), + data: {DATA_IDS:str}, + dataType:'json', + //beforeSend: validateData, + cache: false, + success: function(data){ + $.each(data.list, function(i, list){ + tosearch(); + }); + } + }); + } + } + else{ + console.log("false"); + } + }}); + window.top.remove.show(); + } \ No newline at end of file diff --git a/WebRoot/static/js/test_list.js b/WebRoot/static/js/test_list.js new file mode 100644 index 0000000..d875d39 --- /dev/null +++ b/WebRoot/static/js/test_list.js @@ -0,0 +1,97 @@ +var url=""; + + var option_html=""; + var user_id= "8dbef15bb6d043ec94b719ede583b033", + subject_id=""; + + function getQueryString(name) { + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); + var r = window.location.search.substr(1).match(reg); + if (r != null) return unescape(r[2]); return null; + } + var class_id=getQueryString("classid"); + $(document).ready(function(){ + getList(); + $.ajax({ + url:url+"/SunvoteEducation/teacher/info", + async:false, + type:"post", + success:function(data){ + subject_id=data.data.subjectList[0].SUBJECT_ID; + user_id=data.data.ID; + if(data.data.classInfoList.length>0){ + for(var i=0;i'+data.data.classInfoList[i].CLASS_NAME+'' + } + $("#dealer_id_2").html(option_html); + } + } + }) + //日期框 + $('.date-picker').datepicker({ + autoclose: true, + todayHighlight: true + }); + window.top.loading.remove(); + }) + function getList(start_date,end_date,class_id){ //获取测验列表 + var tab_html=""; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/testpaper", + async:false, + type:"post", + data:{ + paper_type:"101", + user_id:user_id, + subject_id:subject_id, + class_id:class_id, + currentpage:"1", + showcount:"", + start_date:start_date, + end_date:end_date + }, + success:function(data){ + console.log(data); + for(var i=0;i'+data.data[i].createDate+''+getClassName(data.data[i].classId)+''+data.data[i].name+'查看' + } + $("#tab_body").html(tab_html); + } + }); + } + function jump(obj){ //预览测验详情 + var id=obj.attr("data-id"); + location.href="paper_view1.do?testpaperId="+id; + } + function getSubjectName(id){ //获取科目中文名 + var subjectName=""; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/subjectcname", + async:false, + type:"post", + data:{id:id}, + success:function(data){ + subjectName=data.data; + } + }) + return subjectName; + } + function getClassName(id){ //获取班级中文名 + var className=""; + $.ajax({ + url:url+"/SunvoteEducation/api/v1/classname", + async:false, + type:"post", + data:{id:id}, + success:function(data){ + className=data.data; + } + }) + return className; + } + function tosearch(){ //搜索 + var start_date=$("#lastStart").val(); + var end_date=$("#lastEnd").val(); + var class_id=$("#dealer_id_2").val(); + getList(start_date,end_date,class_id); + } \ No newline at end of file diff --git a/resources/mybatis1/sunvote/TestPaperMapper.xml b/resources/mybatis1/sunvote/TestPaperMapper.xml index 721ea29..aad7ec1 100644 --- a/resources/mybatis1/sunvote/TestPaperMapper.xml +++ b/resources/mybatis1/sunvote/TestPaperMapper.xml @@ -143,10 +143,10 @@ and (NAME = #{NAME}) - + and (TEST_TYPE = #{TEST_TYPE} or TEST_TYPE IS NULL) - + and (TEST_TYPE = #{TEST_TYPE}) diff --git a/src/com/fh/controller/api/V1.java b/src/com/fh/controller/api/V1.java index 75805e7..7c1520c 100644 --- a/src/com/fh/controller/api/V1.java +++ b/src/com/fh/controller/api/V1.java @@ -496,7 +496,7 @@ public class V1 extends BaseController { int currentPage = Integer.parseInt(CURRENTPAGE); int showcount = Integer.parseInt(SHOWCOUNT); currentPage = (currentPage > 0 ? currentPage -1 : 0) * showcount; - pd.put("CURRENTPAGE", currentPage); + pd.put("CURRENTPAGE", "" + currentPage); } List pageList = paperService.listAllByType(pd); res.setData(pageList); diff --git a/src/com/fh/controller/sunvote/report/ReportController.java b/src/com/fh/controller/sunvote/report/ReportController.java index e03c838..1c36398 100644 --- a/src/com/fh/controller/sunvote/report/ReportController.java +++ b/src/com/fh/controller/sunvote/report/ReportController.java @@ -60,6 +60,7 @@ public class ReportController extends BaseController { pd.put("CLASS_ID", pd.get("CLASSID")); List studentList = studentService.listAllClass(pd); // 2查询班级考试 + pd.put("TEST_TYPE", "1"); List testpaperList = testpaperService.listAll(pd); mv.addObject("testpaperList", testpaperList); info.put("testsize", testpaperList != null ? testpaperList.size() : 0);