diff --git a/WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp b/WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp index b2dd878..2818672 100644 --- a/WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp +++ b/WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp @@ -19,6 +19,9 @@ +
- +
+
+

+ 一、单选 +

+ +
+
+
+ 1、 +
    +
  • 请输入答案
  • +
+
+
+ 2、 +
    +
  • 请输入答案
  • +
+
+
+ 3、 +
    +
  • 请输入答案
  • +
+
+
+ 4、 +
    +
  • 请输入答案
  • +
+
+
+
@@ -102,7 +139,7 @@
@@ -201,8 +239,8 @@ $("title").html(title); } $(document).ready(function(){ - var _height = $(".page-header").height(); - $(".content").css("padding-top",_height); + var _height = $(".page-header").outerHeight(); + $(".content").css("padding-top",_height+80); }); @@ -211,8 +249,8 @@ //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"单选","option_num":"","option_content":"","answer":"","difficulty":"","analysis":"","question_from":"","score":1,"part_score":"","remark":"","rank":"1","no_name":"一、","questions":[{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"A","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.1"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"B","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.2"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"C","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.3"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"D","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.4"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"A","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.5"}]}]}; //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[]}; - + \ No newline at end of file diff --git a/WebRoot/static/js/control-604.js b/WebRoot/static/js/control-604.js index 1a31e59..fbb975a 100644 --- a/WebRoot/static/js/control-604.js +++ b/WebRoot/static/js/control-604.js @@ -226,6 +226,7 @@ $(function() { total_score += ((index_e_2 - index_s_2 + 1) * fraction2); $("#score_all").text(total_score); break; + case 6: break; } // $(".section-"+answer_index_b).attr("data-score",$(".section-"+answer_index_b).find(".question").length*fraction2); $(".section0").attr("data-score", @@ -261,8 +262,8 @@ $(function() { /* 添加试题的确定按钮 */ $("#addQuestion_submit").click(function() { - // $("#fast").attr("disabled","disabled"); - var type_2 = 5;// parseInt($("#type").val()) + $("#fast").attr("disabled","disabled"); + var type_2 = parseInt($("#type").val()); var index_s_2 = 1;// parseInt($("#index_s_2").val()) var index_e_2 = parseInt($("#index_s_2").val()); // var answer_2=$("#answer_2").val(); @@ -407,7 +408,7 @@ $(function() { "json" : data }; console.log(data); - ajax_submit(url, dataJson); + //ajax_submit(url, dataJson); } else alert("请添加试题"); }); @@ -706,4 +707,57 @@ $(function() { } } } + + $(".content").on("focus",".number .on",function(){ + if($(this).text()=="请输入答案") + $(this).text(""); + + + }) + $(".content").on("blur",".number .on",function(){ + if($(this).text()==""){ + $(this).text("请输入答案"); + } + + }) + }) + +/** + * 数字校验 + * @param e + */ +function keydown2(e){ + var reg= /^[0-9]*$/; + console.log(reg.test(e.text())); + console.log(e.text()) + if(!reg.test(e.text())){ + e.text(""); + } + } + +function NumberCheck(num) { + var str = num; + var len1 = str.substr(0, 1); + var len2 = str.substr(1, 1); + //如果第一位是0,第二位不是点,就用数字把点替换掉 + if (str.length > 1 && len1 == 0 && len2 != ".") { + str = str.substr(1, 1); + } + //第一位不能是. + if (len1 == ".") { + str = ""; + } + //限制只能输入一个小数点 + if (str.indexOf(".") != -1) { + var str_ = str.substr(str.indexOf(".") + 1); + if (str_.indexOf(".") != -1) { + str = str.substr(0, str.indexOf(".") + str_.indexOf(".") + 1); + } + } + //正则替换,保留数字和小数点 + str = str.replace(/[^\d^\.]+/g,'') + //如果需要保留小数点后两位,则用下面公式 + //str = str.replace(/\.\d\d$/,'') + return str; +}