Commit 83b5ddebff6baaef2ccc4383f41271b2dfcd567f
1 parent
eca4feb5
模板添加
Showing
13 changed files
with
1660 additions
and
394 deletions
WebRoot/WEB-INF/jsp/sunvote/admin/admin_main.jsp
| ... | ... | @@ -212,6 +212,18 @@ |
| 212 | 212 | </div> |
| 213 | 213 | <div class="clearfix"></div> |
| 214 | 214 | </div> |
| 215 | + <div class="form-group"> | |
| 216 | + <label for="enter_time" class="col-sm-4 control-label">模板</label> | |
| 217 | + <div class="col-sm-6"> | |
| 218 | + <select class="chosen-select form-control" name="TEMPLATE_ID" id="TEMPLATE_ID" data-placeholder="这里输入所属学校"> | |
| 219 | + <option value="">自定义</option> | |
| 220 | + <c:forEach items="${templateInfos}" var="var" varStatus="vs"> | |
| 221 | + <option value="${var.PAGETEMPLATE_ID}">${var.NAME}</option> | |
| 222 | + </c:forEach> | |
| 223 | + </select> | |
| 224 | + </div> | |
| 225 | + <div class="clearfix"></div> | |
| 226 | + </div> | |
| 215 | 227 | </div> |
| 216 | 228 | <div class="modal-footer"> |
| 217 | 229 | <button type="button" class="btn btn-primary" id="time_submit">确定</button> | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/pagetemplate/pagetemplate_edit.jsp
0 → 100644
| 1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | |
| 2 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | |
| 3 | +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> | |
| 4 | +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | |
| 5 | +<% | |
| 6 | + String path = request.getContextPath(); | |
| 7 | + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; | |
| 8 | +%> | |
| 9 | +<!DOCTYPE html> | |
| 10 | +<html lang="en"> | |
| 11 | + <head> | |
| 12 | + <base href="<%=basePath%>"> | |
| 13 | + <!-- 下拉框 --> | |
| 14 | + <link rel="stylesheet" href="static/ace/css/chosen.css" /> | |
| 15 | + <!-- jsp文件头和头部 --> | |
| 16 | + <%@ include file="../../system/index/top.jsp"%> | |
| 17 | + <!-- 日期框 --> | |
| 18 | + <link rel="stylesheet" href="static/ace/css/datepicker.css" /> | |
| 19 | +</head> | |
| 20 | +<body class="no-skin"> | |
| 21 | +<!-- /section:basics/navbar.layout --> | |
| 22 | +<div class="main-container" id="main-container"> | |
| 23 | + <!-- /section:basics/sidebar --> | |
| 24 | + <div class="main-content"> | |
| 25 | + <div class="main-content-inner"> | |
| 26 | + <div class="page-content"> | |
| 27 | + <div class="row"> | |
| 28 | + <div class="col-xs-12"> | |
| 29 | + | |
| 30 | + <form action="pagetemplate/${msg }.do" name="Form" id="Form" method="post"> | |
| 31 | + <input type="hidden" name="PAGETEMPLATE_ID" id="PAGETEMPLATE_ID" value="${pd.PAGETEMPLATE_ID}"/> | |
| 32 | + <div id="zhongxin" style="padding-top: 13px;"> | |
| 33 | + <table id="table_report" class="table table-striped table-bordered table-hover"> | |
| 34 | + <tr> | |
| 35 | + <td style="width:75px;text-align: right;padding-top: 13px;">模板名称:</td> | |
| 36 | + <td><input type="text" name="NAME" id="NAME" value="${pd.NAME}" maxlength="255" placeholder="这里输入模板名称" title="模板名称" style="width:98%;"/></td> | |
| 37 | + </tr> | |
| 38 | + <tr> | |
| 39 | + <td style="width:75px;text-align: right;padding-top: 13px;">学校:</td> | |
| 40 | + <td><input type="text" name="SCHOOL_ID" id="SCHOOL_ID" value="${pd.SCHOOL_ID}" maxlength="100" placeholder="这里输入学校" title="学校" style="width:98%;"/></td> | |
| 41 | + </tr> | |
| 42 | + <tr> | |
| 43 | + <td style="width:75px;text-align: right;padding-top: 13px;">科目:</td> | |
| 44 | + <td><input type="text" name="SUBJECT_ID" id="SUBJECT_ID" value="${pd.SUBJECT_ID}" maxlength="100" placeholder="这里输入科目" title="科目" style="width:98%;"/></td> | |
| 45 | + </tr> | |
| 46 | + <tr> | |
| 47 | + <td style="width:75px;text-align: right;padding-top: 13px;">年级:</td> | |
| 48 | + <td><input type="text" name="GRADE_ID" id="GRADE_ID" value="${pd.GRADE_ID}" maxlength="255" placeholder="这里输入年级" title="年级" style="width:98%;"/></td> | |
| 49 | + </tr> | |
| 50 | + <tr> | |
| 51 | + <td style="width:75px;text-align: right;padding-top: 13px;">用户ID:</td> | |
| 52 | + <td><input type="text" name="USER_ID" id="USER_ID" value="${pd.USER_ID}" maxlength="100" placeholder="这里输入用户ID" title="用户ID" style="width:98%;"/></td> | |
| 53 | + </tr> | |
| 54 | + <tr> | |
| 55 | + <td style="width:75px;text-align: right;padding-top: 13px;">试卷总分:</td> | |
| 56 | + <td><input type="text" name="PAGE_SCORE" id="PAGE_SCORE" value="${pd.PAGE_SCORE}" maxlength="255" placeholder="这里输入试卷总分" title="试卷总分" style="width:98%;"/></td> | |
| 57 | + </tr> | |
| 58 | + <tr> | |
| 59 | + <td style="width:75px;text-align: right;padding-top: 13px;">模板内容:</td> | |
| 60 | + <td><input type="text" name="CONTENT" id="CONTENT" value="${pd.CONTENT}" maxlength="1000" placeholder="这里输入模板内容" title="模板内容" style="width:98%;"/></td> | |
| 61 | + </tr> | |
| 62 | + <tr> | |
| 63 | + <td style="text-align: center;" colspan="10"> | |
| 64 | + <a class="btn btn-mini btn-primary" onclick="save();">保存</a> | |
| 65 | + <a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a> | |
| 66 | + </td> | |
| 67 | + </tr> | |
| 68 | + </table> | |
| 69 | + </div> | |
| 70 | + <div id="zhongxin2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="static/images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div> | |
| 71 | + </form> | |
| 72 | + </div> | |
| 73 | + <!-- /.col --> | |
| 74 | + </div> | |
| 75 | + <!-- /.row --> | |
| 76 | + </div> | |
| 77 | + <!-- /.page-content --> | |
| 78 | + </div> | |
| 79 | + </div> | |
| 80 | + <!-- /.main-content --> | |
| 81 | +</div> | |
| 82 | +<!-- /.main-container --> | |
| 83 | + | |
| 84 | + | |
| 85 | + <!-- 页面底部js¨ --> | |
| 86 | + <%@ include file="../../system/index/foot.jsp"%> | |
| 87 | + <!-- 下拉框 --> | |
| 88 | + <script src="static/ace/js/chosen.jquery.js"></script> | |
| 89 | + <!-- 日期框 --> | |
| 90 | + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script> | |
| 91 | + <!--提示框--> | |
| 92 | + <script type="text/javascript" src="static/js/jquery.tips.js"></script> | |
| 93 | + <script type="text/javascript"> | |
| 94 | + $(top.hangge()); | |
| 95 | + //保存 | |
| 96 | + function save(){ | |
| 97 | + if($("#NAME").val()==""){ | |
| 98 | + $("#NAME").tips({ | |
| 99 | + side:3, | |
| 100 | + msg:'请输入模板名称', | |
| 101 | + bg:'#AE81FF', | |
| 102 | + time:2 | |
| 103 | + }); | |
| 104 | + $("#NAME").focus(); | |
| 105 | + return false; | |
| 106 | + } | |
| 107 | + if($("#SCHOOL_ID").val()==""){ | |
| 108 | + $("#SCHOOL_ID").tips({ | |
| 109 | + side:3, | |
| 110 | + msg:'请输入学校', | |
| 111 | + bg:'#AE81FF', | |
| 112 | + time:2 | |
| 113 | + }); | |
| 114 | + $("#SCHOOL_ID").focus(); | |
| 115 | + return false; | |
| 116 | + } | |
| 117 | + if($("#SUBJECT_ID").val()==""){ | |
| 118 | + $("#SUBJECT_ID").tips({ | |
| 119 | + side:3, | |
| 120 | + msg:'请输入科目', | |
| 121 | + bg:'#AE81FF', | |
| 122 | + time:2 | |
| 123 | + }); | |
| 124 | + $("#SUBJECT_ID").focus(); | |
| 125 | + return false; | |
| 126 | + } | |
| 127 | + if($("#GRADE_ID").val()==""){ | |
| 128 | + $("#GRADE_ID").tips({ | |
| 129 | + side:3, | |
| 130 | + msg:'请输入年级', | |
| 131 | + bg:'#AE81FF', | |
| 132 | + time:2 | |
| 133 | + }); | |
| 134 | + $("#GRADE_ID").focus(); | |
| 135 | + return false; | |
| 136 | + } | |
| 137 | + if($("#USER_ID").val()==""){ | |
| 138 | + $("#USER_ID").tips({ | |
| 139 | + side:3, | |
| 140 | + msg:'请输入用户ID', | |
| 141 | + bg:'#AE81FF', | |
| 142 | + time:2 | |
| 143 | + }); | |
| 144 | + $("#USER_ID").focus(); | |
| 145 | + return false; | |
| 146 | + } | |
| 147 | + if($("#PAGE_SCORE").val()==""){ | |
| 148 | + $("#PAGE_SCORE").tips({ | |
| 149 | + side:3, | |
| 150 | + msg:'请输入试卷总分', | |
| 151 | + bg:'#AE81FF', | |
| 152 | + time:2 | |
| 153 | + }); | |
| 154 | + $("#PAGE_SCORE").focus(); | |
| 155 | + return false; | |
| 156 | + } | |
| 157 | + if($("#CONTENT").val()==""){ | |
| 158 | + $("#CONTENT").tips({ | |
| 159 | + side:3, | |
| 160 | + msg:'请输入模板内容', | |
| 161 | + bg:'#AE81FF', | |
| 162 | + time:2 | |
| 163 | + }); | |
| 164 | + $("#CONTENT").focus(); | |
| 165 | + return false; | |
| 166 | + } | |
| 167 | + $("#Form").submit(); | |
| 168 | + $("#zhongxin").hide(); | |
| 169 | + $("#zhongxin2").show(); | |
| 170 | + } | |
| 171 | + | |
| 172 | + $(function() { | |
| 173 | + //日期框 | |
| 174 | + $('.date-picker').datepicker({autoclose: true,todayHighlight: true}); | |
| 175 | + }); | |
| 176 | + </script> | |
| 177 | +</body> | |
| 178 | +</html> | |
| 0 | 179 | \ No newline at end of file | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/pagetemplate/pagetemplate_list.jsp
0 → 100644
| 1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | |
| 2 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | |
| 3 | +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> | |
| 4 | +<% | |
| 5 | + String path = request.getContextPath(); | |
| 6 | + String basePath = request.getScheme() + "://" | |
| 7 | + + request.getServerName() + ":" + request.getServerPort() | |
| 8 | + + path + "/"; | |
| 9 | +%> | |
| 10 | +<!DOCTYPE html> | |
| 11 | +<html lang="en"> | |
| 12 | +<head> | |
| 13 | +<base href="<%=basePath%>"> | |
| 14 | +<!-- 下拉框 --> | |
| 15 | +<link rel="stylesheet" href="static/ace/css/chosen.css" /> | |
| 16 | +<!-- jsp文件头和头部 --> | |
| 17 | +<%@ include file="../../system/index/top.jsp"%> | |
| 18 | +<!-- 日期框 --> | |
| 19 | +<link rel="stylesheet" href="static/ace/css/datepicker.css" /> | |
| 20 | +</head> | |
| 21 | +<body class="no-skin"> | |
| 22 | + | |
| 23 | + <!-- /section:basics/navbar.layout --> | |
| 24 | + <div class="main-container" id="main-container"> | |
| 25 | + <!-- /section:basics/sidebar --> | |
| 26 | + <div class="main-content"> | |
| 27 | + <div class="main-content-inner"> | |
| 28 | + <div class="page-content"> | |
| 29 | + <div class="row"> | |
| 30 | + <div class="col-xs-12"> | |
| 31 | + | |
| 32 | + <!-- 检索 --> | |
| 33 | + <form action="pagetemplate/list.do" method="post" name="Form" id="Form"> | |
| 34 | + <table style="margin-top:5px;"> | |
| 35 | + <tr> | |
| 36 | + <td> | |
| 37 | + <div class="nav-search"> | |
| 38 | + <span class="input-icon"> | |
| 39 | + <input type="text" placeholder="这里输入关键词" class="nav-search-input" id="nav-search-input" autocomplete="off" name="keywords" value="${pd.keywords }" placeholder="这里输入关键词"/> | |
| 40 | + <i class="ace-icon fa fa-search nav-search-icon"></i> | |
| 41 | + </span> | |
| 42 | + </div> | |
| 43 | + </td> | |
| 44 | + <td style="padding-left:2px;"><input class="span10 date-picker" name="lastStart" id="lastStart" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="开始日期" title="开始日期"/></td> | |
| 45 | + <td style="padding-left:2px;"><input class="span10 date-picker" name="lastEnd" name="lastEnd" value="" type="text" data-date-format="yyyy-mm-dd" readonly="readonly" style="width:88px;" placeholder="结束日期" title="结束日期"/></td> | |
| 46 | + <td style="vertical-align:top;padding-left:2px;"> | |
| 47 | + <select class="chosen-select form-control" name="name" id="id" data-placeholder="请选择" style="vertical-align:top;width: 120px;"> | |
| 48 | + <option value=""></option> | |
| 49 | + <option value="">全部</option> | |
| 50 | + <option value="">1</option> | |
| 51 | + <option value="">2</option> | |
| 52 | + </select> | |
| 53 | + </td> | |
| 54 | + <c:if test="${QX.cha == 1 }"> | |
| 55 | + <td style="vertical-align:top;padding-left:2px"><a class="btn btn-light btn-xs" onclick="tosearch();" title="检索"><i id="nav-search-icon" class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a></td> | |
| 56 | + </c:if> | |
| 57 | + <c:if test="${QX.toExcel == 1 }"><td style="vertical-align:top;padding-left:2px;"><a class="btn btn-light btn-xs" onclick="toExcel();" title="导出到EXCEL"><i id="nav-search-icon" class="ace-icon fa fa-download bigger-110 nav-search-icon blue"></i></a></td></c:if> | |
| 58 | + </tr> | |
| 59 | + </table> | |
| 60 | + <!-- 检索 --> | |
| 61 | + | |
| 62 | + <table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-top:5px;"> | |
| 63 | + <thead> | |
| 64 | + <tr> | |
| 65 | + <th class="center" style="width:35px;"> | |
| 66 | + <label class="pos-rel"><input type="checkbox" class="ace" id="zcheckbox" /><span class="lbl"></span></label> | |
| 67 | + </th> | |
| 68 | + <th class="center" style="width:50px;">序号</th> | |
| 69 | + <th class="center">模板名称</th> | |
| 70 | + <th class="center">学校</th> | |
| 71 | + <th class="center">科目</th> | |
| 72 | + <th class="center">年级</th> | |
| 73 | + <th class="center">用户ID</th> | |
| 74 | + <th class="center">试卷总分</th> | |
| 75 | + <th class="center">模板内容</th> | |
| 76 | + <th class="center">操作</th> | |
| 77 | + </tr> | |
| 78 | + </thead> | |
| 79 | + | |
| 80 | + <tbody> | |
| 81 | + <!-- 开始循环 --> | |
| 82 | + <c:choose> | |
| 83 | + <c:when test="${not empty varList}"> | |
| 84 | + <c:if test="${QX.cha == 1 }"> | |
| 85 | + <c:forEach items="${varList}" var="var" varStatus="vs"> | |
| 86 | + <tr> | |
| 87 | + <td class='center'> | |
| 88 | + <label class="pos-rel"><input type='checkbox' name='ids' value="${var.PAGETEMPLATE_ID}" class="ace" /><span class="lbl"></span></label> | |
| 89 | + </td> | |
| 90 | + <td class='center' style="width: 30px;">${vs.index+1}</td> | |
| 91 | + <td class='center'>${var.NAME}</td> | |
| 92 | + <td class='center'>${var.SCHOOL_ID}</td> | |
| 93 | + <td class='center'>${var.SUBJECT_ID}</td> | |
| 94 | + <td class='center'>${var.GRADE_ID}</td> | |
| 95 | + <td class='center'>${var.USER_ID}</td> | |
| 96 | + <td class='center'>${var.PAGE_SCORE}</td> | |
| 97 | + <td class='center'>${var.CONTENT}</td> | |
| 98 | + <td class="center"> | |
| 99 | + <c:if test="${QX.edit != 1 && QX.del != 1 }"> | |
| 100 | + <span class="label label-large label-grey arrowed-in-right arrowed-in"><i class="ace-icon fa fa-lock" title="无权限"></i></span> | |
| 101 | + </c:if> | |
| 102 | + <div class="hidden-sm hidden-xs btn-group"> | |
| 103 | + <c:if test="${QX.edit == 1 }"> | |
| 104 | + <a class="btn btn-xs btn-success" title="编辑" onclick="edit('${var.PAGETEMPLATE_ID}');"> | |
| 105 | + <i class="ace-icon fa fa-pencil-square-o bigger-120" title="编辑"></i> | |
| 106 | + </a> | |
| 107 | + </c:if> | |
| 108 | + <c:if test="${QX.del == 1 }"> | |
| 109 | + <a class="btn btn-xs btn-danger" onclick="del('${var.PAGETEMPLATE_ID}');"> | |
| 110 | + <i class="ace-icon fa fa-trash-o bigger-120" title="删除"></i> | |
| 111 | + </a> | |
| 112 | + </c:if> | |
| 113 | + </div> | |
| 114 | + <div class="hidden-md hidden-lg"> | |
| 115 | + <div class="inline pos-rel"> | |
| 116 | + <button class="btn btn-minier btn-primary dropdown-toggle" data-toggle="dropdown" data-position="auto"> | |
| 117 | + <i class="ace-icon fa fa-cog icon-only bigger-110"></i> | |
| 118 | + </button> | |
| 119 | + | |
| 120 | + <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close"> | |
| 121 | + <c:if test="${QX.edit == 1 }"> | |
| 122 | + <li> | |
| 123 | + <a style="cursor:pointer;" onclick="edit('${var.PAGETEMPLATE_ID}');" class="tooltip-success" data-rel="tooltip" title="修改"> | |
| 124 | + <span class="green"> | |
| 125 | + <i class="ace-icon fa fa-pencil-square-o bigger-120"></i> | |
| 126 | + </span> | |
| 127 | + </a> | |
| 128 | + </li> | |
| 129 | + </c:if> | |
| 130 | + <c:if test="${QX.del == 1 }"> | |
| 131 | + <li> | |
| 132 | + <a style="cursor:pointer;" onclick="del('${var.PAGETEMPLATE_ID}');" class="tooltip-error" data-rel="tooltip" title="删除"> | |
| 133 | + <span class="red"> | |
| 134 | + <i class="ace-icon fa fa-trash-o bigger-120"></i> | |
| 135 | + </span> | |
| 136 | + </a> | |
| 137 | + </li> | |
| 138 | + </c:if> | |
| 139 | + </ul> | |
| 140 | + </div> | |
| 141 | + </div> | |
| 142 | + </td> | |
| 143 | + </tr> | |
| 144 | + | |
| 145 | + </c:forEach> | |
| 146 | + </c:if> | |
| 147 | + <c:if test="${QX.cha == 0 }"> | |
| 148 | + <tr> | |
| 149 | + <td colspan="100" class="center">您无权查看</td> | |
| 150 | + </tr> | |
| 151 | + </c:if> | |
| 152 | + </c:when> | |
| 153 | + <c:otherwise> | |
| 154 | + <tr class="main_info"> | |
| 155 | + <td colspan="100" class="center" >没有相关数据</td> | |
| 156 | + </tr> | |
| 157 | + </c:otherwise> | |
| 158 | + </c:choose> | |
| 159 | + </tbody> | |
| 160 | + </table> | |
| 161 | + <div class="page-header position-relative"> | |
| 162 | + <table style="width:100%;"> | |
| 163 | + <tr> | |
| 164 | + <td style="vertical-align:top;"> | |
| 165 | + <c:if test="${QX.add == 1 }"> | |
| 166 | + <a class="btn btn-mini btn-success" onclick="add();">新增</a> | |
| 167 | + </c:if> | |
| 168 | + <c:if test="${QX.del == 1 }"> | |
| 169 | + <a class="btn btn-mini btn-danger" onclick="makeAll('确定要删除选中的数据吗?');" title="批量删除" ><i class='ace-icon fa fa-trash-o bigger-120'></i></a> | |
| 170 | + </c:if> | |
| 171 | + </td> | |
| 172 | + <td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td> | |
| 173 | + </tr> | |
| 174 | + </table> | |
| 175 | + </div> | |
| 176 | + </form> | |
| 177 | + | |
| 178 | + </div> | |
| 179 | + <!-- /.col --> | |
| 180 | + </div> | |
| 181 | + <!-- /.row --> | |
| 182 | + </div> | |
| 183 | + <!-- /.page-content --> | |
| 184 | + </div> | |
| 185 | + </div> | |
| 186 | + <!-- /.main-content --> | |
| 187 | + | |
| 188 | + <!-- 返回顶部 --> | |
| 189 | + <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse"> | |
| 190 | + <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i> | |
| 191 | + </a> | |
| 192 | + | |
| 193 | + </div> | |
| 194 | + <!-- /.main-container --> | |
| 195 | + | |
| 196 | + <!-- basic scripts --> | |
| 197 | + <!-- 页面底部js¨ --> | |
| 198 | + <%@ include file="../../system/index/foot.jsp"%> | |
| 199 | + <!-- 删除时确认窗口 --> | |
| 200 | + <script src="static/ace/js/bootbox.js"></script> | |
| 201 | + <!-- ace scripts --> | |
| 202 | + <script src="static/ace/js/ace/ace.js"></script> | |
| 203 | + <!-- 下拉框 --> | |
| 204 | + <script src="static/ace/js/chosen.jquery.js"></script> | |
| 205 | + <!-- 日期框 --> | |
| 206 | + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script> | |
| 207 | + <!--提示框--> | |
| 208 | + <script type="text/javascript" src="static/js/jquery.tips.js"></script> | |
| 209 | + <script type="text/javascript"> | |
| 210 | + $(top.hangge());//关闭加载状态 | |
| 211 | + //检索 | |
| 212 | + function tosearch(){ | |
| 213 | + top.jzts(); | |
| 214 | + $("#Form").submit(); | |
| 215 | + } | |
| 216 | + $(function() { | |
| 217 | + | |
| 218 | + //日期框 | |
| 219 | + $('.date-picker').datepicker({ | |
| 220 | + autoclose: true, | |
| 221 | + todayHighlight: true | |
| 222 | + }); | |
| 223 | + | |
| 224 | + //下拉框 | |
| 225 | + if(!ace.vars['touch']) { | |
| 226 | + $('.chosen-select').chosen({allow_single_deselect:true}); | |
| 227 | + $(window) | |
| 228 | + .off('resize.chosen') | |
| 229 | + .on('resize.chosen', function() { | |
| 230 | + $('.chosen-select').each(function() { | |
| 231 | + var $this = $(this); | |
| 232 | + $this.next().css({'width': $this.parent().width()}); | |
| 233 | + }); | |
| 234 | + }).trigger('resize.chosen'); | |
| 235 | + $(document).on('settings.ace.chosen', function(e, event_name, event_val) { | |
| 236 | + if(event_name != 'sidebar_collapsed') return; | |
| 237 | + $('.chosen-select').each(function() { | |
| 238 | + var $this = $(this); | |
| 239 | + $this.next().css({'width': $this.parent().width()}); | |
| 240 | + }); | |
| 241 | + }); | |
| 242 | + $('#chosen-multiple-style .btn').on('click', function(e){ | |
| 243 | + var target = $(this).find('input[type=radio]'); | |
| 244 | + var which = parseInt(target.val()); | |
| 245 | + if(which == 2) $('#form-field-select-4').addClass('tag-input-style'); | |
| 246 | + else $('#form-field-select-4').removeClass('tag-input-style'); | |
| 247 | + }); | |
| 248 | + } | |
| 249 | + | |
| 250 | + | |
| 251 | + //复选框全选控制 | |
| 252 | + var active_class = 'active'; | |
| 253 | + $('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){ | |
| 254 | + var th_checked = this.checked;//checkbox inside "TH" table header | |
| 255 | + $(this).closest('table').find('tbody > tr').each(function(){ | |
| 256 | + var row = this; | |
| 257 | + if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true); | |
| 258 | + else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false); | |
| 259 | + }); | |
| 260 | + }); | |
| 261 | + }); | |
| 262 | + | |
| 263 | + //新增 | |
| 264 | + function add(){ | |
| 265 | + top.jzts(); | |
| 266 | + var diag = new top.Dialog(); | |
| 267 | + diag.Drag=true; | |
| 268 | + diag.Title ="新增"; | |
| 269 | + diag.URL = '<%=basePath%>pagetemplate/goAdd.do'; | |
| 270 | + diag.Width = 450; | |
| 271 | + diag.Height = 355; | |
| 272 | + diag.Modal = true; //有无遮罩窗口 | |
| 273 | + diag. ShowMaxButton = true; //最大化按钮 | |
| 274 | + diag.ShowMinButton = true; //最小化按钮 | |
| 275 | + diag.CancelEvent = function(){ //关闭事件 | |
| 276 | + if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){ | |
| 277 | + if('${page.currentPage}' == '0'){ | |
| 278 | + tosearch(); | |
| 279 | + }else{ | |
| 280 | + tosearch(); | |
| 281 | + } | |
| 282 | + } | |
| 283 | + diag.close(); | |
| 284 | + }; | |
| 285 | + diag.show(); | |
| 286 | + } | |
| 287 | + | |
| 288 | + //删除 | |
| 289 | + function del(Id){ | |
| 290 | + bootbox.confirm("确定要删除吗?", function(result) { | |
| 291 | + if(result) { | |
| 292 | + top.jzts(); | |
| 293 | + var url = "<%=basePath%>pagetemplate/delete.do?PAGETEMPLATE_ID="+Id+"&tm="+new Date().getTime(); | |
| 294 | + $.get(url,function(data){ | |
| 295 | + tosearch(); | |
| 296 | + }); | |
| 297 | + } | |
| 298 | + }); | |
| 299 | + } | |
| 300 | + | |
| 301 | + //修改 | |
| 302 | + function edit(Id){ | |
| 303 | + top.jzts(); | |
| 304 | + var diag = new top.Dialog(); | |
| 305 | + diag.Drag=true; | |
| 306 | + diag.Title ="编辑"; | |
| 307 | + diag.URL = '<%=basePath%>pagetemplate/goEdit.do?PAGETEMPLATE_ID='+Id; | |
| 308 | + diag.Width = 450; | |
| 309 | + diag.Height = 355; | |
| 310 | + diag.Modal = true; //有无遮罩窗口 | |
| 311 | + diag. ShowMaxButton = true; //最大化按钮 | |
| 312 | + diag.ShowMinButton = true; //最小化按钮 | |
| 313 | + diag.CancelEvent = function(){ //关闭事件 | |
| 314 | + if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){ | |
| 315 | + tosearch(); | |
| 316 | + } | |
| 317 | + diag.close(); | |
| 318 | + }; | |
| 319 | + diag.show(); | |
| 320 | + } | |
| 321 | + | |
| 322 | + //批量操作 | |
| 323 | + function makeAll(msg){ | |
| 324 | + bootbox.confirm(msg, function(result) { | |
| 325 | + if(result) { | |
| 326 | + var str = ''; | |
| 327 | + for(var i=0;i < document.getElementsByName('ids').length;i++){ | |
| 328 | + if(document.getElementsByName('ids')[i].checked){ | |
| 329 | + if(str=='') str += document.getElementsByName('ids')[i].value; | |
| 330 | + else str += ',' + document.getElementsByName('ids')[i].value; | |
| 331 | + } | |
| 332 | + } | |
| 333 | + if(str==''){ | |
| 334 | + bootbox.dialog({ | |
| 335 | + message: "<span class='bigger-110'>您没有选择任何内容!</span>", | |
| 336 | + buttons: | |
| 337 | + { "button":{ "label":"确定", "className":"btn-sm btn-success"}} | |
| 338 | + }); | |
| 339 | + $("#zcheckbox").tips({ | |
| 340 | + side:1, | |
| 341 | + msg:'点这里全选', | |
| 342 | + bg:'#AE81FF', | |
| 343 | + time:8 | |
| 344 | + }); | |
| 345 | + return; | |
| 346 | + }else{ | |
| 347 | + if(msg == '确定要删除选中的数据吗?'){ | |
| 348 | + top.jzts(); | |
| 349 | + $.ajax({ | |
| 350 | + type: "POST", | |
| 351 | + url: '<%=basePath%>pagetemplate/deleteAll.do?tm='+new Date().getTime(), | |
| 352 | + data: {DATA_IDS:str}, | |
| 353 | + dataType:'json', | |
| 354 | + //beforeSend: validateData, | |
| 355 | + cache: false, | |
| 356 | + success: function(data){ | |
| 357 | + $.each(data.list, function(i, list){ | |
| 358 | + tosearch(); | |
| 359 | + }); | |
| 360 | + } | |
| 361 | + }); | |
| 362 | + } | |
| 363 | + } | |
| 364 | + } | |
| 365 | + }); | |
| 366 | + }; | |
| 367 | + | |
| 368 | + //导出excel | |
| 369 | + function toExcel(){ | |
| 370 | + window.location.href='<%=basePath%>pagetemplate/excel.do'; | |
| 371 | + } | |
| 372 | + </script> | |
| 373 | + | |
| 374 | + | |
| 375 | +</body> | |
| 376 | +</html> | |
| 0 | 377 | \ No newline at end of file | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/creat_question.jsp
| ... | ... | @@ -190,6 +190,7 @@ |
| 190 | 190 | </div> |
| 191 | 191 | <script> |
| 192 | 192 | var testData = ${pd.JSON}; |
| 193 | + var template = ${TEMPLEATE == null ? "[]" : TEMPLEATE.CONTENT}; | |
| 193 | 194 | var URL = "<%=basePath%>api/v1/uploadpaper"; |
| 194 | 195 | var JUMP_URL = "<%=basePath%>/${JUMP_URL}"; |
| 195 | 196 | if(testData.questions.length>0){ |
| ... | ... | @@ -203,7 +204,9 @@ |
| 203 | 204 | var _height = $(".page-header").height(); |
| 204 | 205 | $(".content").css("padding-top",_height); |
| 205 | 206 | |
| 206 | - }) | |
| 207 | + }); | |
| 208 | + | |
| 209 | + | |
| 207 | 210 | |
| 208 | 211 | //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"}]}]}; |
| 209 | 212 | //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[]}; | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
| ... | ... | @@ -145,6 +145,19 @@ |
| 145 | 145 | <div class="clearfix"></div> |
| 146 | 146 | </div> |
| 147 | 147 | |
| 148 | + <div class="form-group"> | |
| 149 | + <label for="enter_time" class="col-sm-4 control-label">模板</label> | |
| 150 | + <div class="col-sm-6"> | |
| 151 | + <select class="chosen-select form-control" name="TEMPLATE_ID" id="TEMPLATE_ID" data-placeholder="这里输入所属学校"> | |
| 152 | + <option value="">自定义</option> | |
| 153 | + <c:forEach items="${templateInfos}" var="var" varStatus="vs"> | |
| 154 | + <option value="${var.PAGETEMPLATE_ID}">${var.NAME}</option> | |
| 155 | + </c:forEach> | |
| 156 | + </select> | |
| 157 | + </div> | |
| 158 | + <div class="clearfix"></div> | |
| 159 | + </div> | |
| 160 | + | |
| 148 | 161 | </div> |
| 149 | 162 | <div class="modal-footer"> |
| 150 | 163 | <button type="button" class="btn btn-primary" id="time_submit">确定</button> |
| ... | ... | @@ -188,10 +201,11 @@ |
| 188 | 201 | $("#time_submit").click(function(){ |
| 189 | 202 | var name = $("#enter_title").val(); |
| 190 | 203 | var time = $("#enter_time").val(); |
| 204 | + var TEMPLATE_ID = $("#TEMPLATE_ID").val(); | |
| 191 | 205 | if(name != null&& name != '' && time != null && time != ''){ |
| 192 | 206 | var itime = parseInt(time); |
| 193 | 207 | if(itime > 0 && itime <= 300){ |
| 194 | - self.location.href = "<%=basePath%>" + "paper/npaper.do?" + "name=" + name + "&time=" + time ; | |
| 208 | + self.location.href = "<%=basePath%>" + "paper/npaper.do?" + "name=" + name + "&time=" + time +"&TEMPLATE_ID=" + TEMPLATE_ID; | |
| 195 | 209 | $(".title_time").modal("hide"); |
| 196 | 210 | }else{ |
| 197 | 211 | alert("请输入正确的时间,时间不能超过300分钟"); | ... | ... |
WebRoot/static/js/control-604.js
| 1 | - var questionNUm = 0 ; | |
| 2 | -$(function(){ | |
| 3 | - /*快速创建答案列表*/ | |
| 4 | - var score=0; | |
| 5 | - var total_score = 0; | |
| 1 | +var questionNUm = 0; | |
| 2 | +/*数字转汉字数字*/ | |
| 3 | +var chnNumChar = [ "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" ]; | |
| 4 | +var chnUnitSection = [ "", "万", "亿", "万亿", "亿亿" ]; | |
| 5 | +var chnUnitChar = [ "", "十", "百", "千" ]; | |
| 6 | +/* 快速创建答案列表 */ | |
| 7 | +var score = 0; | |
| 8 | +var total_score = 0; | |
| 9 | +var answerLen = 0; | |
| 10 | + | |
| 6 | 11 | |
| 7 | - function creat(str_ans,a_num,fraction){ | |
| 8 | -// $(".section").remove(); | |
| 9 | - answer_index_b=$(".section").length+1; | |
| 10 | - /*$(".content").append('<div class="section section-1 single" data-fraction="'+fraction+'" data-score=""> <div class="title"> <h3><span class="que_num">一、</span><span class="que_name">单选</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>')*/ | |
| 11 | - var str=str_ans.split(''); | |
| 12 | +$(function() { | |
| 13 | + | |
| 14 | + | |
| 15 | + function creat(str_ans, a_num, fraction) { | |
| 16 | + // $(".section").remove(); | |
| 17 | + answer_index_b = $(".section").length + 1; | |
| 18 | + /* | |
| 19 | + * $(".content").append('<div class="section section-1 single" | |
| 20 | + * data-fraction="'+fraction+'" data-score=""> <div class="title"> <h3><span | |
| 21 | + * class="que_num">一、</span><span class="que_name">单选</span></h3> | |
| 22 | + * <input type="button" class="btn btn-danger pull-right remove" | |
| 23 | + * name="remove" value="删除" /> </div> <div class="question_list"></div></div>') | |
| 24 | + */ | |
| 25 | + var str = str_ans.split(''); | |
| 12 | 26 | console.log(str); |
| 13 | - for(i=0;i<str.length;i++){ | |
| 14 | - if(str[i] == " "){ | |
| 15 | - str.splice(i,1); | |
| 16 | - i= i-1; | |
| 27 | + for (i = 0; i < str.length; i++) { | |
| 28 | + if (str[i] == " ") { | |
| 29 | + str.splice(i, 1); | |
| 30 | + i = i - 1; | |
| 17 | 31 | } |
| 18 | 32 | } |
| 19 | - q_num=str.length; | |
| 20 | - $(".content").append('<div class="section section-' + answer_index_b +' single" data-fraction="'+fraction+'" data-score="'+(q_num * fraction)+'"><div class="title"><h3>第' +answer_index_b +'大题总分: ' + q_num + ' X ' + fraction + ' = ' + (q_num * fraction)+' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); | |
| 21 | - for(var i=0;i<q_num;i++){ | |
| 22 | - str_temp=str[i]; | |
| 23 | - str_temp=str_temp.toUpperCase() | |
| 24 | - code = str_temp.charCodeAt(); | |
| 25 | - on_index=code-65; | |
| 33 | + q_num = str.length; | |
| 34 | + $(".content").append('<div class="section section-' + answer_index_b+ ' single" data-fraction="'+ fraction+ '" data-score="' | |
| 35 | + + (q_num * fraction) + '"><div class="title"><h3>第' + answer_index_b+ '大题(单选)总分: ' | |
| 36 | + + q_num + ' X ' + fraction + ' = ' + (q_num * fraction) | |
| 37 | + + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); | |
| 38 | + for (var i = 0; i < q_num; i++) { | |
| 39 | + str_temp = str[i]; | |
| 40 | + str_temp = str_temp.toUpperCase() | |
| 41 | + code = str_temp.charCodeAt(); | |
| 42 | + on_index = code - 65; | |
| 26 | 43 | questionNUm++; |
| 27 | - if(code<(65+a_num)){ | |
| 44 | + if (code < (65 + a_num)) { | |
| 28 | 45 | console.log(str_temp); |
| 29 | - $(".section-" +answer_index_b +" .question_list").append('<div class="question question'+(questionNUm)+'"><span>'+(questionNUm)+'、</span><ul></ul></div>'); | |
| 30 | - for(var j=0;j<a_num;j++){ | |
| 31 | - option=String.fromCharCode(0x41+j); | |
| 32 | - if(on_index==j){ | |
| 33 | - console.log(on_index+"---"+j); | |
| 34 | - $(".question"+(questionNUm)+' ul').append('<li class="btn btn-default on">'+option+'</li>'); | |
| 35 | - }else | |
| 36 | - $(".question"+(questionNUm)+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
| 37 | - } | |
| 38 | - }else{ | |
| 39 | - alert("题目"+(i+1)+":"+String.fromCharCode(code)+"答案错误,超出选项数"); | |
| 40 | - //return; | |
| 46 | + $(".section-" + answer_index_b + " .question_list").append( | |
| 47 | + '<div class="question question' + (questionNUm) | |
| 48 | + + '"><span>' + (questionNUm) | |
| 49 | + + '、</span><ul></ul></div>'); | |
| 50 | + for (var j = 0; j < a_num; j++) { | |
| 51 | + option = String.fromCharCode(0x41 + j); | |
| 52 | + if (on_index == j) { | |
| 53 | + console.log(on_index + "---" + j); | |
| 54 | + $(".question" + (questionNUm) + ' ul').append( | |
| 55 | + '<li class="btn btn-default on">' + option | |
| 56 | + + '</li>'); | |
| 57 | + } else | |
| 58 | + $(".question" + (questionNUm) + ' ul').append( | |
| 59 | + '<li class="btn btn-default">' + option | |
| 60 | + + '</li>'); | |
| 61 | + } | |
| 62 | + } else { | |
| 63 | + alert("题目" + (i + 1) + ":" + String.fromCharCode(code) | |
| 64 | + + "答案错误,超出选项数"); | |
| 65 | + // return; | |
| 41 | 66 | } |
| 42 | 67 | } |
| 43 | - $(".section-" +answer_index_b).attr("data-score",$(".section-1").find(".question").length*fraction); | |
| 68 | + $(".section-" + answer_index_b).attr("data-score", | |
| 69 | + $(".section-1").find(".question").length * fraction); | |
| 44 | 70 | total_score += q_num * fraction; |
| 45 | 71 | $("#score_all").text(total_score); |
| 46 | 72 | } |
| 47 | 73 | |
| 48 | - /*********** | |
| 49 | - *1、单选题 | |
| 50 | - *2、完形填空 | |
| 51 | - *3、阅读理解 | |
| 52 | - *4、判断题 | |
| 53 | - *5、多选题 | |
| 54 | - ***********/ | |
| 74 | + /*************************************************************************** | |
| 75 | + * 1、单选题 2、完形填空 3、阅读理解 4、判断题 5、多选题 | |
| 76 | + **************************************************************************/ | |
| 55 | 77 | |
| 56 | - function addQuestion(type,a_num,index_s_2,index_e_2,fraction2){ | |
| 78 | + function addQuestion(type, a_num, index_s_2, index_e_2, fraction2) { | |
| 57 | 79 | console.log(type); |
| 58 | - answer_index_b=$(".section").length+1; | |
| 59 | - var question_num=SectionToChinese($(".section").length+1); | |
| 60 | - switch(type){ | |
| 61 | - case 1: //单选题 | |
| 62 | - //alert(typeof(index_s_2)); | |
| 63 | - $(".content").append('<div class="section section-'+answer_index_b+' single" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</span>'+'<span class="que_name">单选</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 64 | - for(i=index_s_2;i<=index_e_2;i++){ | |
| 65 | - $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
| 66 | - for(var j=0;j<a_num;j++){ | |
| 67 | - option=String.fromCharCode(0x41+j); | |
| 68 | - $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
| 69 | - } | |
| 80 | + answer_index_b = $(".section").length + 1; | |
| 81 | + var question_num = SectionToChinese($(".section").length + 1); | |
| 82 | + switch (type) { | |
| 83 | + case 1: // 单选题 | |
| 84 | + // alert(typeof(index_s_2)); | |
| 85 | + $(".content") | |
| 86 | + .append( | |
| 87 | + '<div class="section section-' | |
| 88 | + + answer_index_b | |
| 89 | + + ' single" data-fraction="' | |
| 90 | + + fraction2 | |
| 91 | + + '" data-score=""> <div class="title"> <h3><span class="que_num">' | |
| 92 | + + question_num | |
| 93 | + + '、</span>' | |
| 94 | + + '<span class="que_name">单选</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 95 | + for (i = index_s_2; i <= index_e_2; i++) { | |
| 96 | + $(".section-" + answer_index_b + " .question_list").append( | |
| 97 | + '<div class="question question' + i + '"><span>' + i | |
| 98 | + + '、</span><ul></ul></div>'); | |
| 99 | + for (var j = 0; j < a_num; j++) { | |
| 100 | + option = String.fromCharCode(0x41 + j); | |
| 101 | + $(".section-" + answer_index_b + " .question" + i + ' ul') | |
| 102 | + .append( | |
| 103 | + '<li class="btn btn-default">' + option | |
| 104 | + + '</li>'); | |
| 70 | 105 | } |
| 106 | + } | |
| 71 | 107 | break; |
| 72 | - case 2: //完形填空 | |
| 73 | - $(".content").append('<div class="section section-'+answer_index_b+' single" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</span><span class="que_name">完形填空</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 74 | - for(var i=index_s_2;i<=index_e_2;i++){ | |
| 75 | - $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
| 76 | - for(var j=0;j<a_num;j++){ | |
| 77 | - option=String.fromCharCode(0x41+j); | |
| 78 | - $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
| 79 | - } | |
| 108 | + case 2: // 完形填空 | |
| 109 | + $(".content") | |
| 110 | + .append( | |
| 111 | + '<div class="section section-' | |
| 112 | + + answer_index_b | |
| 113 | + + ' single" data-fraction="' | |
| 114 | + + fraction2 | |
| 115 | + + '" data-score=""> <div class="title"> <h3><span class="que_num">' | |
| 116 | + + question_num | |
| 117 | + + '、</span><span class="que_name">完形填空</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 118 | + for (var i = index_s_2; i <= index_e_2; i++) { | |
| 119 | + $(".section-" + answer_index_b + " .question_list").append( | |
| 120 | + '<div class="question question' + i + '"><span>' + i | |
| 121 | + + '、</span><ul></ul></div>'); | |
| 122 | + for (var j = 0; j < a_num; j++) { | |
| 123 | + option = String.fromCharCode(0x41 + j); | |
| 124 | + $(".section-" + answer_index_b + " .question" + i + ' ul') | |
| 125 | + .append( | |
| 126 | + '<li class="btn btn-default">' + option | |
| 127 | + + '</li>'); | |
| 80 | 128 | } |
| 129 | + } | |
| 81 | 130 | break; |
| 82 | - case 3: //阅读理解 | |
| 83 | - $(".content").append('<div class="section section-'+answer_index_b+' single" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</span><span class="que_name">阅读理解</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 84 | - for(var i=index_s_2;i<=index_e_2;i++){ | |
| 85 | - $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
| 86 | - for(var j=0;j<a_num;j++){ | |
| 87 | - option=String.fromCharCode(0x41+j); | |
| 88 | - $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
| 89 | - } | |
| 131 | + case 3: // 阅读理解 | |
| 132 | + $(".content") | |
| 133 | + .append( | |
| 134 | + '<div class="section section-' | |
| 135 | + + answer_index_b | |
| 136 | + + ' single" data-fraction="' | |
| 137 | + + fraction2 | |
| 138 | + + '" data-score=""> <div class="title"> <h3><span class="que_num">' | |
| 139 | + + question_num | |
| 140 | + + '、</span><span class="que_name">阅读理解</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 141 | + for (var i = index_s_2; i <= index_e_2; i++) { | |
| 142 | + $(".section-" + answer_index_b + " .question_list").append( | |
| 143 | + '<div class="question question' + i + '"><span>' + i | |
| 144 | + + '、</span><ul></ul></div>'); | |
| 145 | + for (var j = 0; j < a_num; j++) { | |
| 146 | + option = String.fromCharCode(0x41 + j); | |
| 147 | + $(".section-" + answer_index_b + " .question" + i + ' ul') | |
| 148 | + .append( | |
| 149 | + '<li class="btn btn-default">' + option | |
| 150 | + + '</li>'); | |
| 90 | 151 | } |
| 152 | + } | |
| 91 | 153 | break; |
| 92 | - case 4: //判断题 | |
| 93 | - $(".content").append('<div class="section section-'+answer_index_b+' single" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</span><span class="que_name">判断题</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 94 | - for(var i=index_s_2;i<=index_e_2;i++){ | |
| 95 | - $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
| 96 | - for(var j=0;j<a_num;j++){ | |
| 97 | - if(j%2==0) | |
| 98 | - option="√"; | |
| 99 | - else | |
| 100 | - option="×"; | |
| 101 | - $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
| 102 | - } | |
| 154 | + case 4: // 判断题 | |
| 155 | + $(".content") | |
| 156 | + .append( | |
| 157 | + '<div class="section section-' | |
| 158 | + + answer_index_b | |
| 159 | + + ' single" data-fraction="' | |
| 160 | + + fraction2 | |
| 161 | + + '" data-score=""> <div class="title"> <h3><span class="que_num">' | |
| 162 | + + question_num | |
| 163 | + + '、</span><span class="que_name">判断题</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 164 | + for (var i = index_s_2; i <= index_e_2; i++) { | |
| 165 | + $(".section-" + answer_index_b + " .question_list").append( | |
| 166 | + '<div class="question question' + i + '"><span>' + i | |
| 167 | + + '、</span><ul></ul></div>'); | |
| 168 | + for (var j = 0; j < a_num; j++) { | |
| 169 | + if (j % 2 == 0) | |
| 170 | + option = "√"; | |
| 171 | + else | |
| 172 | + option = "×"; | |
| 173 | + $(".section-" + answer_index_b + " .question" + i + ' ul') | |
| 174 | + .append( | |
| 175 | + '<li class="btn btn-default">' + option | |
| 176 | + + '</li>'); | |
| 103 | 177 | } |
| 178 | + } | |
| 104 | 179 | break; |
| 105 | - /*case 5: //多选题 | |
| 106 | - $(".content").append('<div class="section section-'+answer_index_b+' check" data-fraction="'+fraction2+'" data-score=""> <div class="title"> <h3><span class="que_num">'+question_num+'、</span><span class="que_name">多选题</span></h3> <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 107 | - for(var i=index_s_2;i<=index_e_2;i++){ | |
| 108 | - $(".section-"+answer_index_b+" .question_list").append('<div class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
| 109 | - for(var j=0;j<a_num;j++){ | |
| 110 | - option=String.fromCharCode(0x41+j); | |
| 111 | - $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
| 112 | - } | |
| 113 | - }*/ | |
| 114 | - case 5: //多选题 | |
| 115 | -// $(".content").html(""); | |
| 116 | - $(".content").append('<div class="section section-'+ answer_index_b +' check" data-fraction="'+fraction2+'" data-score="' + ((index_e_2- index_s_2 + 1 )* fraction2)+ '"> <div class="title"><h3>第' +answer_index_b +'大题总分: ' + (index_e_2- index_s_2 + 1 ) + ' X ' + fraction2 + ' = ' + ((index_e_2- index_s_2 + 1 )* fraction2)+' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | |
| 117 | - for(var i=index_s_2;i<=index_e_2;i++){ | |
| 118 | - questionNUm++; | |
| 119 | - $(".section-" + answer_index_b +" .question_list").append('<div class="question question'+questionNUm+'"><span>'+questionNUm+'、</span><ul></ul></div>'); | |
| 120 | - for(var j=0;j<a_num;j++){ | |
| 121 | - option=String.fromCharCode(0x41+j); | |
| 122 | - $(".section-" + answer_index_b +" .question"+questionNUm+' ul').append('<li class="btn btn-default">'+option+'</li>'); | |
| 123 | - } | |
| 180 | + /* | |
| 181 | + * case 5: //多选题 $(".content").append('<div class="section | |
| 182 | + * section-'+answer_index_b+' check" data-fraction="'+fraction2+'" | |
| 183 | + * data-score=""> <div class="title"> <h3><span | |
| 184 | + * class="que_num">'+question_num+'、</span><span class="que_name">多选题</span></h3> | |
| 185 | + * <input type="button" class="btn btn-danger pull-right remove" | |
| 186 | + * name="remove" value="删除" /> </div> <div class="question_list"></div></div>'); | |
| 187 | + * for(var i=index_s_2;i<=index_e_2;i++){ | |
| 188 | + * $(".section-"+answer_index_b+" .question_list").append('<div | |
| 189 | + * class="question question'+i+'"><span>'+i+'、</span><ul></ul></div>'); | |
| 190 | + * for(var j=0;j<a_num;j++){ option=String.fromCharCode(0x41+j); | |
| 191 | + * $(".section-"+answer_index_b+" .question"+i+' ul').append('<li class="btn btn-default">'+option+'</li>'); } } | |
| 192 | + */ | |
| 193 | + case 5: // 多选题 | |
| 194 | + // $(".content").html(""); | |
| 195 | + $(".content") | |
| 196 | + .append( | |
| 197 | + '<div class="section section-' | |
| 198 | + + answer_index_b | |
| 199 | + + ' check" data-fraction="' | |
| 200 | + + fraction2 | |
| 201 | + + '" data-score="' | |
| 202 | + + ((index_e_2 - index_s_2 + 1) * fraction2) | |
| 203 | + + '"> <div class="title"><h3>第' | |
| 204 | + + answer_index_b | |
| 205 | + + '大题(多选)总分: ' | |
| 206 | + + (index_e_2 - index_s_2 + 1) | |
| 207 | + + ' X ' | |
| 208 | + + fraction2 | |
| 209 | + + ' = ' | |
| 210 | + + ((index_e_2 - index_s_2 + 1) * fraction2) | |
| 211 | + + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | |
| 212 | + for (var i = index_s_2; i <= index_e_2; i++) { | |
| 213 | + questionNUm++; | |
| 214 | + $(".section-" + answer_index_b + " .question_list").append( | |
| 215 | + '<div class="question question' + questionNUm | |
| 216 | + + '"><span>' + questionNUm | |
| 217 | + + '、</span><ul></ul></div>'); | |
| 218 | + for (var j = 0; j < a_num; j++) { | |
| 219 | + option = String.fromCharCode(0x41 + j); | |
| 220 | + $( | |
| 221 | + ".section-" + answer_index_b + " .question" | |
| 222 | + + questionNUm + ' ul').append( | |
| 223 | + '<li class="btn btn-default">' + option + '</li>'); | |
| 124 | 224 | } |
| 125 | - total_score +=((index_e_2- index_s_2 + 1 )* fraction2); | |
| 126 | - $("#score_all").text(total_score); | |
| 225 | + } | |
| 226 | + total_score += ((index_e_2 - index_s_2 + 1) * fraction2); | |
| 227 | + $("#score_all").text(total_score); | |
| 127 | 228 | break; |
| 128 | 229 | } |
| 129 | -// $(".section-"+answer_index_b).attr("data-score",$(".section-"+answer_index_b).find(".question").length*fraction2); | |
| 130 | - $(".section0").attr("data-score",$(".section0").find(".question").length*fraction2); | |
| 230 | + // $(".section-"+answer_index_b).attr("data-score",$(".section-"+answer_index_b).find(".question").length*fraction2); | |
| 231 | + $(".section0").attr("data-score", | |
| 232 | + $(".section0").find(".question").length * fraction2); | |
| 131 | 233 | } |
| 132 | 234 | |
| 133 | - $(document).on('click','.remove',function(){ //删除按钮 | |
| 235 | + $(document).on('click', '.remove', function() { // 删除按钮 | |
| 134 | 236 | $(this).parent().parent(".section").remove(); |
| 135 | 237 | }) |
| 136 | - | |
| 137 | - $("#fast_submit").click(function(){ //点击确定,创建答案列表 | |
| 138 | -// $("#addQuestion").attr("disabled","disabled"); | |
| 139 | - var answer=$("#answer").val(); | |
| 140 | - var num_ans=$("#num_ans").val(); | |
| 141 | - var fraction=$("#fraction").val(); | |
| 142 | - if(answer==''){ | |
| 238 | + | |
| 239 | + $("#fast_submit").click(function() { // 点击确定,创建答案列表 | |
| 240 | + // $("#addQuestion").attr("disabled","disabled"); | |
| 241 | + var answer = $("#answer").val(); | |
| 242 | + var num_ans = $("#num_ans").val(); | |
| 243 | + var fraction = $("#fraction").val(); | |
| 244 | + if (answer == '') { | |
| 143 | 245 | alert("请输入题目答案"); |
| 144 | 246 | return; |
| 145 | - }else if(fraction==''){ | |
| 247 | + } else if (fraction == '') { | |
| 146 | 248 | alert("请输入题目分数"); |
| 147 | 249 | return; |
| 148 | 250 | } |
| 149 | 251 | var frac = parseFloat(fraction); |
| 150 | - if(frac > 0){ | |
| 252 | + if (frac > 0) { | |
| 253 | + // score += parseInt(fraction)*answer.split(",").length; | |
| 254 | + creat(answer, num_ans, fraction); | |
| 151 | 255 | $('.fast').modal('hide'); |
| 152 | - //score += parseInt(fraction)*answer.split(",").length; | |
| 153 | - creat(answer,num_ans,fraction); | |
| 154 | - }else{ | |
| 256 | + } else { | |
| 155 | 257 | alert("请输入正确分数"); |
| 156 | 258 | return; |
| 157 | 259 | } |
| 158 | - }) | |
| 260 | + }) | |
| 159 | 261 | |
| 160 | - /*添加试题的确定按钮*/ | |
| 161 | - $("#addQuestion_submit").click(function(){ | |
| 162 | -// $("#fast").attr("disabled","disabled"); | |
| 163 | - var type_2=5;//parseInt($("#type").val()) | |
| 164 | - var index_s_2=1;//parseInt($("#index_s_2").val()) | |
| 165 | - var index_e_2=parseInt($("#index_s_2").val()); | |
| 166 | - //var answer_2=$("#answer_2").val(); | |
| 167 | - var num_ans_2=$("#num_ans_2").val(); | |
| 168 | - var fraction2=parseFloat($("#fraction2").val()); | |
| 169 | - if(isNaN(index_s_2)){ | |
| 262 | + /* 添加试题的确定按钮 */ | |
| 263 | + $("#addQuestion_submit").click(function() { | |
| 264 | + // $("#fast").attr("disabled","disabled"); | |
| 265 | + var type_2 = 5;// parseInt($("#type").val()) | |
| 266 | + var index_s_2 = 1;// parseInt($("#index_s_2").val()) | |
| 267 | + var index_e_2 = parseInt($("#index_s_2").val()); | |
| 268 | + // var answer_2=$("#answer_2").val(); | |
| 269 | + var num_ans_2 = $("#num_ans_2").val(); | |
| 270 | + var fraction2 = parseFloat($("#fraction2").val()); | |
| 271 | + if (isNaN(index_s_2)) { | |
| 170 | 272 | alert("请输入题目开始序号"); |
| 171 | 273 | return; |
| 172 | - }else if(isNaN(index_e_2)){ | |
| 173 | - alert("请输入题目个数");//alert("请输入题目结束序号"); | |
| 274 | + } else if (isNaN(index_e_2)) { | |
| 275 | + alert("请输入题目个数");// alert("请输入题目结束序号"); | |
| 174 | 276 | return; |
| 175 | - }else if(isNaN(fraction2)){ | |
| 277 | + } else if (isNaN(fraction2)) { | |
| 176 | 278 | alert("请输入题目分数"); |
| 177 | 279 | return; |
| 178 | 280 | } |
| 179 | 281 | var iindex_e_2 = parseInt(index_e_2); |
| 180 | - if(iindex_e_2 < 1 || iindex_e_2 > 100){ | |
| 282 | + if (iindex_e_2 < 1 || iindex_e_2 > 100) { | |
| 181 | 283 | alert("题目个数不合法"); |
| 182 | 284 | return; |
| 183 | 285 | } |
| 184 | - //console.log(typeof(type_2)); | |
| 185 | - addQuestion(type_2,num_ans_2,index_s_2,index_e_2,fraction2); | |
| 286 | + // console.log(typeof(type_2)); | |
| 287 | + addQuestion(type_2, num_ans_2, index_s_2, index_e_2, fraction2); | |
| 186 | 288 | $('.addQuestion').modal('hide'); |
| 187 | 289 | }) |
| 188 | - $("#type").change(function(){ | |
| 189 | - if($("#type").val()==4){ | |
| 290 | + $("#type").change(function() { | |
| 291 | + if ($("#type").val() == 4) { | |
| 190 | 292 | $("#num_ans_2").val(2); |
| 191 | - $("#num_ans_2").attr("disabled","disabled"); | |
| 192 | - }else{ | |
| 293 | + $("#num_ans_2").attr("disabled", "disabled"); | |
| 294 | + } else { | |
| 193 | 295 | $("#num_ans_2").removeAttr("disabled"); |
| 194 | 296 | $("#num_ans_2").val(4); |
| 195 | - | |
| 297 | + | |
| 196 | 298 | } |
| 197 | 299 | }) |
| 198 | - /*更改考试时长*/ | |
| 199 | - $("#time_submit").click(function(){ | |
| 200 | - var test_time=$("#enter_time").val(); | |
| 201 | - if(test_time==''){ | |
| 300 | + /* 更改考试时长 */ | |
| 301 | + $("#time_submit").click(function() { | |
| 302 | + var test_time = $("#enter_time").val(); | |
| 303 | + if (test_time == '') { | |
| 202 | 304 | alert("请输入考试时间"); |
| 203 | 305 | return; |
| 204 | 306 | } |
| 205 | 307 | $("#time").html(test_time); |
| 206 | 308 | $('.test_time').modal('hide'); |
| 207 | 309 | }) |
| 208 | - /*更改单选答案*/ | |
| 209 | - $(document).on('click','.single li',function(){ | |
| 310 | + /* 更改单选答案 */ | |
| 311 | + $(document).on('click', '.single li', function() { | |
| 210 | 312 | $(this).siblings().removeClass("on"); |
| 211 | 313 | $(this).addClass("on"); |
| 212 | 314 | }) |
| 213 | - /*更改多选答案*/ | |
| 214 | - $(document).on('click','.check li',function(){ | |
| 215 | - //$(this).siblings().removeClass("on"); | |
| 216 | - if($(this).hasClass('on')){ | |
| 315 | + /* 更改多选答案 */ | |
| 316 | + $(document).on('click', '.check li', function() { | |
| 317 | + // $(this).siblings().removeClass("on"); | |
| 318 | + if ($(this).hasClass('on')) { | |
| 217 | 319 | $(this).removeClass("on"); |
| 218 | - }else{ | |
| 320 | + } else { | |
| 219 | 321 | $(this).addClass("on"); |
| 220 | 322 | } |
| 221 | 323 | }) |
| 222 | - /*提交保存数据*/ | |
| 223 | - $("#save").click(function(){ | |
| 224 | - var url=URL; | |
| 225 | - | |
| 226 | - var data={ | |
| 227 | - title: $(".header_box h1").text(), | |
| 228 | - exam_time: parseInt($("#time").text()), | |
| 229 | - paper_type: testData.paper_type, | |
| 230 | - subject_id: testData.subject_id, | |
| 231 | - grade_id: testData.grade_id, | |
| 232 | - user_id: testData.user_id, | |
| 233 | - school_id: testData.school_id, | |
| 234 | - score:total_score, | |
| 235 | - questions:[] | |
| 236 | - } | |
| 237 | - | |
| 238 | - if($(".section").length>0){ | |
| 239 | - var rank=0 | |
| 240 | - for(i=0;i<$(".section").length;i++){ | |
| 241 | - //rank++; | |
| 242 | - data.questions[i]={ | |
| 243 | - chapter_id: "0", | |
| 244 | - problem_type_id: "0", | |
| 245 | - knowledge_id: "0", | |
| 246 | - // content: $(".section").eq(i).find(".que_name").text(), | |
| 247 | - option_num: "", | |
| 248 | - option_content: "", | |
| 249 | - answer: "", | |
| 250 | - difficulty: "", | |
| 251 | - analysis: "", | |
| 252 | - question_from: "", | |
| 253 | - score:parseFloat($(".section").eq(i).attr("data-score")), | |
| 254 | - part_score: "", | |
| 255 | - remark: "", | |
| 256 | - rank: rank, | |
| 257 | - no_name: $(".section").eq(i).find(".que_num").text(), | |
| 258 | - questions:[] | |
| 259 | - } | |
| 260 | - for(j=0;j<$(".section").eq(i).find(".question_list").children(".question").length;j++){ | |
| 261 | - rank++; | |
| 262 | - var on_num=$(".section").eq(i).find(".question").eq(j).find(".on").length; | |
| 263 | - var answer=""; | |
| 264 | - for(k=0;k<on_num;k++){ | |
| 265 | - answer+=$(".section").eq(i).find(".question").eq(j).find(".on").eq(k).text(); | |
| 266 | - //console.log(answer); | |
| 267 | - } | |
| 268 | - if(answer == ''){ | |
| 269 | - alert("还有试题未编辑答案。"); | |
| 270 | - return; | |
| 271 | - } | |
| 272 | - data.questions[i].questions[j]={ | |
| 273 | - chapter_id: "0", | |
| 274 | - problem_type_id: "0", | |
| 275 | - knowledge_id: "0", | |
| 276 | - content: "", | |
| 277 | - option_num: $(".section").eq(i).find(".question").eq(j).find("li").length, | |
| 278 | - option_content: "", | |
| 279 | - answer: answer, | |
| 280 | - difficulty: "0", | |
| 281 | - analysis: "", | |
| 282 | - question_from: "1", | |
| 283 | - score: parseFloat($(".section").eq(i).attr("data-fraction")), | |
| 284 | - part_score: "0", | |
| 285 | - remark: "", | |
| 286 | - rank: rank, | |
| 287 | - no_name: rank, | |
| 288 | - } | |
| 289 | - } | |
| 290 | - } | |
| 291 | - } | |
| 292 | - | |
| 293 | - if(data.questions.length>0){ | |
| 294 | - data=JSON.stringify(data); | |
| 295 | - dataJson={"json":data}; | |
| 296 | - console.log(data); | |
| 297 | - ajax_submit(url,dataJson); | |
| 298 | - } | |
| 299 | - else | |
| 300 | - alert("请添加试题"); | |
| 301 | - }) | |
| 302 | -}) | |
| 324 | + /* 提交保存数据 */ | |
| 325 | + $("#save").click(function() { | |
| 326 | + var url = URL; | |
| 303 | 327 | |
| 304 | - | |
| 328 | + var data = { | |
| 329 | + title : $(".header_box h1").text(), | |
| 330 | + exam_time : parseInt($("#time").text()), | |
| 331 | + paper_type : testData.paper_type, | |
| 332 | + subject_id : testData.subject_id, | |
| 333 | + grade_id : testData.grade_id, | |
| 334 | + user_id : testData.user_id, | |
| 335 | + school_id : testData.school_id, | |
| 336 | + score : total_score, | |
| 337 | + questions : [] | |
| 338 | + } | |
| 305 | 339 | |
| 340 | + if ($(".section").length > 0) { | |
| 341 | + var rank = 0 | |
| 342 | + for (i = 0; i < $(".section").length; i++) { | |
| 343 | + // rank++; | |
| 344 | + data.questions[i] = { | |
| 345 | + chapter_id : "0", | |
| 346 | + problem_type_id : "0", | |
| 347 | + knowledge_id : "0", | |
| 348 | + // content: | |
| 349 | + // $(".section").eq(i).find(".que_name").text(), | |
| 350 | + option_num : "", | |
| 351 | + option_content : "", | |
| 352 | + answer : "", | |
| 353 | + difficulty : "", | |
| 354 | + analysis : "", | |
| 355 | + question_from : "", | |
| 356 | + score : parseFloat($(".section").eq(i) | |
| 357 | + .attr("data-score")), | |
| 358 | + part_score : "", | |
| 359 | + remark : "", | |
| 360 | + rank : rank, | |
| 361 | + no_name : $(".section").eq(i).find( | |
| 362 | + ".que_num").text(), | |
| 363 | + questions : [] | |
| 364 | + } | |
| 365 | + for (j = 0; j < $(".section").eq(i).find( | |
| 366 | + ".question_list").children(".question").length; j++) { | |
| 367 | + rank++; | |
| 368 | + var on_num = $(".section").eq(i).find( | |
| 369 | + ".question").eq(j).find(".on").length; | |
| 370 | + var answer = ""; | |
| 371 | + for (k = 0; k < on_num; k++) { | |
| 372 | + answer += $(".section").eq(i).find( | |
| 373 | + ".question").eq(j).find(".on") | |
| 374 | + .eq(k).text(); | |
| 375 | + // console.log(answer); | |
| 376 | + } | |
| 377 | + if (answer == '') { | |
| 378 | + alert("还有试题未编辑答案。"); | |
| 379 | + return; | |
| 380 | + } | |
| 381 | + data.questions[i].questions[j] = { | |
| 382 | + chapter_id : "0", | |
| 383 | + problem_type_id : "0", | |
| 384 | + knowledge_id : "0", | |
| 385 | + content : "", | |
| 386 | + option_num : $(".section").eq(i).find( | |
| 387 | + ".question").eq(j).find("li").length, | |
| 388 | + option_content : "", | |
| 389 | + answer : answer, | |
| 390 | + difficulty : "0", | |
| 391 | + analysis : "", | |
| 392 | + question_from : "1", | |
| 393 | + score : parseFloat($(".section").eq(i) | |
| 394 | + .attr("data-fraction")), | |
| 395 | + part_score : "0", | |
| 396 | + remark : "", | |
| 397 | + rank : rank, | |
| 398 | + no_name : rank, | |
| 399 | + } | |
| 400 | + } | |
| 401 | + } | |
| 402 | + } | |
| 403 | + | |
| 404 | + if (data.questions.length > 0) { | |
| 405 | + data = JSON.stringify(data); | |
| 406 | + dataJson = { | |
| 407 | + "json" : data | |
| 408 | + }; | |
| 409 | + console.log(data); | |
| 410 | + ajax_submit(url, dataJson); | |
| 411 | + } else | |
| 412 | + alert("请添加试题"); | |
| 413 | + }); | |
| 306 | 414 | |
| 307 | -/*ajax封装函数*/ | |
| 308 | -function ajax_submit(url,data){ | |
| 309 | - $(".loading").css("display","block"); | |
| 310 | - console.log(data); | |
| 311 | - $.ajax({ | |
| 312 | - url:url, | |
| 313 | - type:"POST", | |
| 314 | - data:data, | |
| 315 | - dataType:"json", | |
| 316 | - contentType:"application/x-www-form-urlencoded; charset=utf-8", | |
| 317 | - success:function(data){ | |
| 318 | - $(".loading").css("display","none"); | |
| 319 | - window.location.href = JUMP_URL ; | |
| 415 | + /* ajax封装函数 */ | |
| 416 | + function ajax_submit(url, data) { | |
| 417 | + $(".loading").css("display", "block"); | |
| 418 | + console.log(data); | |
| 419 | + $.ajax({ | |
| 420 | + url : url, | |
| 421 | + type : "POST", | |
| 422 | + data : data, | |
| 423 | + dataType : "json", | |
| 424 | + contentType : "application/x-www-form-urlencoded; charset=utf-8", | |
| 425 | + success : function(data) { | |
| 426 | + $(".loading").css("display", "none"); | |
| 427 | + window.location.href = JUMP_URL; | |
| 428 | + } | |
| 429 | + }) | |
| 430 | + } | |
| 431 | + function fastSort(array, head, tail) { | |
| 432 | + // 考虑到给每个分区操作的时候都是在原有的数组中进行操作的,所以这里head,tail来确定分片的位置 | |
| 433 | + /* 生成随机项 */ | |
| 434 | + var randomnum = parseInt((head + tail) / 2); | |
| 435 | + var random = array[randomnum]; | |
| 436 | + /* 将小于random的项放置在其左边 策略就是通过一个临时的数组来储存分好区的结果,再到原数组中替换 */ | |
| 437 | + var arrayTemp = []; | |
| 438 | + var unshiftHead = 0; | |
| 439 | + for (var i = head; i <= tail; i++) { | |
| 440 | + if (parseInt(array[i].rank) < parseInt(random.rank)) { | |
| 441 | + arrayTemp.unshift(array[i]); | |
| 442 | + unshiftHead++; | |
| 443 | + } else if (parseInt(array[i].rank) > parseInt(random.rank)) { | |
| 444 | + arrayTemp.push(array[i]); | |
| 445 | + } | |
| 446 | + /* 当它等于的时候放哪,这里我想选择放到队列的前面,也就是从unshift后的第一个位置放置 */ | |
| 447 | + if (parseInt(array[i].rank) === parseInt(random.rank)) { | |
| 448 | + arrayTemp.splice(unshiftHead, 0, array[i]); | |
| 449 | + } | |
| 320 | 450 | } |
| 321 | - }) | |
| 322 | -} | |
| 323 | -function fastSort(array,head,tail){ | |
| 324 | - //考虑到给每个分区操作的时候都是在原有的数组中进行操作的,所以这里head,tail来确定分片的位置 | |
| 325 | - /*生成随机项*/ | |
| 326 | - var randomnum = parseInt((head + tail) / 2 ); | |
| 327 | - var random = array[randomnum]; | |
| 328 | - /*将小于random的项放置在其左边 策略就是通过一个临时的数组来储存分好区的结果,再到原数组中替换*/ | |
| 329 | - var arrayTemp = []; | |
| 330 | - var unshiftHead = 0; | |
| 331 | - for(var i = head;i <= tail;i++){ | |
| 332 | - if(parseInt(array[i].rank)<parseInt(random.rank)){ | |
| 333 | - arrayTemp.unshift(array[i]); | |
| 334 | - unshiftHead++; | |
| 335 | - }else if(parseInt(array[i].rank)>parseInt(random.rank)){ | |
| 336 | - arrayTemp.push(array[i]); | |
| 337 | - } | |
| 338 | - /*当它等于的时候放哪,这里我想选择放到队列的前面,也就是从unshift后的第一个位置放置*/ | |
| 339 | - if(parseInt(array[i].rank)===parseInt(random.rank)){ | |
| 340 | - arrayTemp.splice(unshiftHead,0,array[i]); | |
| 341 | - } | |
| 342 | - } | |
| 343 | - /*将对应项覆盖原来的记录*/ | |
| 344 | - for(var j = head , u=0;j <= tail;j++,u++){ | |
| 345 | - array.splice(j,1,arrayTemp[u]); | |
| 346 | - } | |
| 347 | - /*寻找中间项所在的index*/ | |
| 348 | - var nowIndex = array.indexOf(random); | |
| 451 | + /* 将对应项覆盖原来的记录 */ | |
| 452 | + for (var j = head, u = 0; j <= tail; j++, u++) { | |
| 453 | + array.splice(j, 1, arrayTemp[u]); | |
| 454 | + } | |
| 455 | + /* 寻找中间项所在的index */ | |
| 456 | + var nowIndex = array.indexOf(random); | |
| 349 | 457 | |
| 350 | - /*设置出口,当要放进去的片段只有2项的时候就可以收工了*/ | |
| 351 | - if(arrayTemp.length <= 2){ | |
| 352 | - return; | |
| 353 | - } | |
| 354 | - /*递归,同时应用其左右两个区域*/ | |
| 355 | - fastSort(array,head,nowIndex); | |
| 356 | - fastSort(array,nowIndex+1,tail); | |
| 357 | - } | |
| 358 | -if(testData.questions.length > 0){ | |
| 359 | - fastSort(testData.questions,0,testData.questions.length-1); | |
| 360 | - for(var i = 0 ; i < testData.questions.length;i++){ | |
| 361 | - | |
| 362 | - if(testData.questions[0].questions && testData.questions[0].questions.length > 1){ | |
| 363 | - fastSort(testData.questions[i].questions,0,testData.questions[i].questions.length-1); | |
| 458 | + /* 设置出口,当要放进去的片段只有2项的时候就可以收工了 */ | |
| 459 | + if (arrayTemp.length <= 2) { | |
| 460 | + return; | |
| 364 | 461 | } |
| 462 | + /* 递归,同时应用其左右两个区域 */ | |
| 463 | + fastSort(array, head, nowIndex); | |
| 464 | + fastSort(array, nowIndex + 1, tail); | |
| 365 | 465 | } |
| 366 | - | |
| 367 | -} | |
| 368 | -creatHtml(testData); | |
| 369 | -function creatHtml(data){ | |
| 466 | + function creatHtml(data) { | |
| 370 | 467 | console.log(data); |
| 371 | - $(".header_box h1").html(data.title); | |
| 468 | + $(".header_box h1").html(data.title); | |
| 372 | 469 | $("#time").html(data.exam_time); |
| 373 | - $("#score_all").html(data.score); | |
| 374 | - | |
| 375 | - if(data.questions.length>0){ | |
| 470 | + if(data.score != null && data.score > 0 && data.score != ''){ | |
| 471 | + $("#score_all").html(data.score); | |
| 472 | + } | |
| 473 | + | |
| 474 | + if (data.questions.length > 0) { | |
| 376 | 475 | $(".time").removeAttr("data-target"); |
| 377 | 476 | $(".remove").remove(); |
| 378 | 477 | $(".btn_box").remove(); |
| 379 | 478 | } |
| 380 | - | |
| 381 | - for(var i=0;i<data.questions.length;i++){ | |
| 382 | - if(data.questions[i].questions){ | |
| 383 | - $(".content").append('<div class="section section-'+i+'" data-fraction="'+data.questions[i].score+'" style="margin-top:20px;"> <h3><span class="que_num">'+'第'+ (i+1) + '大题总分:'+data.questions[i].questions.length + " X " + (parseFloat(data.questions[i].sug_score) / data.questions[i].questions.length) + " = " + data.questions[i].sug_score +'</span>'+'<span class="que_name">'+data.questions[i].content+'</span></h3><!-- <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> --> <div class="question_list"></div></div>'); | |
| 384 | - }else{ | |
| 385 | - if(i == 0){ | |
| 386 | - $(".content").append('<div class="section section0"> <div class="question_list"></div></div>'); | |
| 479 | + | |
| 480 | + for (var i = 0; i < data.questions.length; i++) { | |
| 481 | + if (data.questions[i].questions) { | |
| 482 | + $(".content") | |
| 483 | + .append( | |
| 484 | + '<div class="section section-' | |
| 485 | + + i | |
| 486 | + + '" data-fraction="' | |
| 487 | + + data.questions[i].score | |
| 488 | + + '" style="margin-top:20px;"> <h3><span class="que_num">' | |
| 489 | + + '第' | |
| 490 | + + (i + 1) | |
| 491 | + + '大题总分:' | |
| 492 | + + data.questions[i].questions.length | |
| 493 | + + " X " | |
| 494 | + + (parseFloat(data.questions[i].sug_score) / data.questions[i].questions.length) | |
| 495 | + + " = " | |
| 496 | + + data.questions[i].sug_score | |
| 497 | + + '</span>' | |
| 498 | + + '<span class="que_name">' | |
| 499 | + + data.questions[i].content | |
| 500 | + + '</span></h3><!-- <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> --> <div class="question_list"></div></div>'); | |
| 501 | + } else { | |
| 502 | + if (i == 0) { | |
| 503 | + $(".content") | |
| 504 | + .append( | |
| 505 | + '<div class="section section0"> <div class="question_list"></div></div>'); | |
| 387 | 506 | } |
| 388 | - $(".section0").find(".question_list").append('<div class="question question'+(i+1)+'"><span>'+(++questionNUm)+'、</span><ul></ul></div>'); | |
| 389 | - for(var k=0;k<parseInt(data.questions[i].option_num);k++){ | |
| 390 | - str_temp=data.questions[i].answer; | |
| 391 | - $(".section0").find(".question"+(i+1)+' ul').append('<li class="btn btn-default">'+String.fromCharCode(0x41+k)+'</li>'); | |
| 392 | - for(var l=0;l<str_temp.length;l++){ | |
| 393 | - str_temp_arry=str_temp.split(''); | |
| 394 | - code=str_temp_arry[l].charCodeAt(); | |
| 395 | - on_index=code-65; | |
| 396 | - if(on_index==k){ | |
| 397 | - $(".section0").find(".question"+(i+1)+' ul li').eq(on_index).attr("class","btn btn-default on"); | |
| 398 | - } | |
| 507 | + $(".section0").find(".question_list").append( | |
| 508 | + '<div class="question question' + (i + 1) + '"><span>' | |
| 509 | + + (++questionNUm) + '、</span><ul></ul></div>'); | |
| 510 | + for (var k = 0; k < parseInt(data.questions[i].option_num); k++) { | |
| 511 | + str_temp = data.questions[i].answer; | |
| 512 | + $(".section0").find(".question" + (i + 1) + ' ul').append( | |
| 513 | + '<li class="btn btn-default">' | |
| 514 | + + String.fromCharCode(0x41 + k) + '</li>'); | |
| 515 | + for (var l = 0; l < str_temp.length; l++) { | |
| 516 | + str_temp_arry = str_temp.split(''); | |
| 517 | + code = str_temp_arry[l].charCodeAt(); | |
| 518 | + on_index = code - 65; | |
| 519 | + if (on_index == k) { | |
| 520 | + $(".section0").find( | |
| 521 | + ".question" + (i + 1) + ' ul li').eq( | |
| 522 | + on_index).attr("class", | |
| 523 | + "btn btn-default on"); | |
| 524 | + } | |
| 399 | 525 | } |
| 400 | 526 | } |
| 401 | 527 | } |
| 402 | - | |
| 403 | - if(data.questions[i].questions){ | |
| 404 | - for(var j=0;j<data.questions[i].questions.length;j++){ | |
| 405 | - $(".section-"+i).find(".question_list").append('<div class="question question'+(j+1)+'"><span>'+(++questionNUm)+'、</span><ul></ul></div>'); | |
| 406 | - if($(".section-"+i).find(".que_name").text()=="判断题"){ | |
| 407 | - for(var k=0;k<parseInt(data.questions[i].questions[j].option_num);k++){ | |
| 408 | - str_temp=data.questions[i].questions[j].answer; | |
| 409 | - if(k%2==0){ | |
| 410 | - $(".section-"+i).find(".question"+(j+1)+' ul').append('<li class="btn btn-default">√</li>'); | |
| 411 | - }else if(k%2==1){ | |
| 412 | - $(".section-"+i).find(".question"+(j+1)+' ul').append('<li class="btn btn-default">×</li>'); | |
| 528 | + | |
| 529 | + if (data.questions[i].questions) { | |
| 530 | + for (var j = 0; j < data.questions[i].questions.length; j++) { | |
| 531 | + $(".section-" + i).find(".question_list").append( | |
| 532 | + '<div class="question question' + (j + 1) | |
| 533 | + + '"><span>' + (++questionNUm) | |
| 534 | + + '、</span><ul></ul></div>'); | |
| 535 | + if ($(".section-" + i).find(".que_name").text() == "判断题") { | |
| 536 | + for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { | |
| 537 | + str_temp = data.questions[i].questions[j].answer; | |
| 538 | + if (k % 2 == 0) { | |
| 539 | + $(".section-" + i).find( | |
| 540 | + ".question" + (j + 1) + ' ul').append( | |
| 541 | + '<li class="btn btn-default">√</li>'); | |
| 542 | + } else if (k % 2 == 1) { | |
| 543 | + $(".section-" + i).find( | |
| 544 | + ".question" + (j + 1) + ' ul').append( | |
| 545 | + '<li class="btn btn-default">×</li>'); | |
| 413 | 546 | } |
| 414 | - | |
| 415 | - if(str_temp=="√") | |
| 416 | - $(".section-"+i).find(".question"+(j+1)+' ul li').eq(0).attr("class","btn btn-default on"); | |
| 547 | + | |
| 548 | + if (str_temp == "√") | |
| 549 | + $(".section-" + i).find( | |
| 550 | + ".question" + (j + 1) + ' ul li').eq(0) | |
| 551 | + .attr("class", "btn btn-default on"); | |
| 417 | 552 | else |
| 418 | - $(".section-"+i).find(".question"+(j+1)+' ul li').eq(1).attr("class","btn btn-default on"); | |
| 553 | + $(".section-" + i).find( | |
| 554 | + ".question" + (j + 1) + ' ul li').eq(1) | |
| 555 | + .attr("class", "btn btn-default on"); | |
| 419 | 556 | } |
| 420 | - }else{ | |
| 421 | - for(var k=0;k<parseInt(data.questions[i].questions[j].option_num);k++){ | |
| 422 | - str_temp=data.questions[i].questions[j].answer; | |
| 423 | - $(".section-"+i).find(".question"+(j+1)+' ul').append('<li class="btn btn-default">'+String.fromCharCode(0x41+k)+'</li>'); | |
| 424 | - for(var l=0;l<str_temp.length;l++){ | |
| 425 | - str_temp_arry=str_temp.split(''); | |
| 426 | - code=str_temp_arry[l].charCodeAt(); | |
| 427 | - on_index=code-65; | |
| 428 | - if(on_index==k){ | |
| 429 | - $(".section-"+i).find(".question"+(j+1)+' ul li').eq(on_index).attr("class","btn btn-default on"); | |
| 430 | - } | |
| 557 | + } else { | |
| 558 | + for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { | |
| 559 | + str_temp = data.questions[i].questions[j].answer; | |
| 560 | + $(".section-" + i).find( | |
| 561 | + ".question" + (j + 1) + ' ul').append( | |
| 562 | + '<li class="btn btn-default">' | |
| 563 | + + String.fromCharCode(0x41 + k) | |
| 564 | + + '</li>'); | |
| 565 | + for (var l = 0; l < str_temp.length; l++) { | |
| 566 | + str_temp_arry = str_temp.split(''); | |
| 567 | + code = str_temp_arry[l].charCodeAt(); | |
| 568 | + on_index = code - 65; | |
| 569 | + if (on_index == k) { | |
| 570 | + $(".section-" + i).find( | |
| 571 | + ".question" + (j + 1) + ' ul li') | |
| 572 | + .eq(on_index).attr("class", | |
| 573 | + "btn btn-default on"); | |
| 574 | + } | |
| 431 | 575 | } |
| 432 | 576 | } |
| 433 | 577 | } |
| ... | ... | @@ -436,60 +580,86 @@ function creatHtml(data){ |
| 436 | 580 | } |
| 437 | 581 | } |
| 438 | 582 | |
| 439 | -var answerLen = 0 ; | |
| 440 | -/*快速建题中,每输入五个答案就加一个空格*/ | |
| 441 | -$("#answer").on("input propertychange", function(event) { | |
| 442 | - var answerStr = ""; | |
| 443 | - answerStr = $("#answer").val(); | |
| 444 | - var result = ""; | |
| 445 | - if (answerStr.length > 5) { | |
| 446 | - answerStr = answerStr.replace(new RegExp(" ", "gm"), ""); | |
| 447 | - for (var i = 0; i < answerStr.length; i++) { | |
| 448 | - result += answerStr[i]; | |
| 449 | - if (i % 5 == 4 && i != answerStr.length -1) { | |
| 450 | - result += " "; | |
| 583 | + | |
| 584 | + /*快速建题中,每输入五个答案就加一个空格*/ | |
| 585 | + $("#answer").on("input propertychange", function(event) { | |
| 586 | + var answerStr = ""; | |
| 587 | + answerStr = $("#answer").val(); | |
| 588 | + var result = ""; | |
| 589 | + if (answerStr.length > 5) { | |
| 590 | + answerStr = answerStr.replace(new RegExp(" ", "gm"), ""); | |
| 591 | + for (var i = 0; i < answerStr.length; i++) { | |
| 592 | + result += answerStr[i]; | |
| 593 | + if (i % 5 == 4 && i != answerStr.length - 1) { | |
| 594 | + result += " "; | |
| 595 | + } | |
| 451 | 596 | } |
| 597 | + } else { | |
| 598 | + result = answerStr; | |
| 452 | 599 | } |
| 453 | - } else { | |
| 454 | - result = answerStr; | |
| 455 | - } | |
| 456 | - $("#answer").val(result); | |
| 457 | - if (answerStr.length > 0) { | |
| 458 | - $(".tips").text("共" + answerStr.length + "题"); | |
| 459 | - } else { | |
| 460 | - $(".tips").text(""); | |
| 461 | - } | |
| 462 | -}) | |
| 463 | - | |
| 464 | -/*数字转汉字数字*/ | |
| 465 | -var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"]; | |
| 466 | - var chnUnitSection = ["","万","亿","万亿","亿亿"]; | |
| 467 | - var chnUnitChar = ["","十","百","千"]; | |
| 468 | - | |
| 469 | - function SectionToChinese(section){ | |
| 470 | - var strIns = '', chnStr = ''; | |
| 471 | - var unitPos = 0; | |
| 472 | - var zero = true; | |
| 473 | - while(section > 0){ | |
| 474 | - var v = section % 10; | |
| 475 | - if(v === 0){ | |
| 476 | - if(!zero){ | |
| 477 | - zero = true; | |
| 478 | - chnStr = chnNumChar[v] + chnStr; | |
| 479 | - } | |
| 480 | - }else{ | |
| 481 | - zero = false; | |
| 482 | - strIns = chnNumChar[v]; | |
| 483 | - strIns += chnUnitChar[unitPos]; | |
| 484 | - chnStr = strIns + chnStr; | |
| 485 | - } | |
| 486 | - unitPos++; | |
| 487 | - section = Math.floor(section / 10); | |
| 488 | - } | |
| 489 | - return chnStr; | |
| 490 | - } | |
| 491 | - | |
| 600 | + $("#answer").val(result); | |
| 601 | + if (answerStr.length > 0) { | |
| 602 | + $(".tips").text("共" + answerStr.length + "题"); | |
| 603 | + } else { | |
| 604 | + $(".tips").text(""); | |
| 605 | + } | |
| 606 | + }) | |
| 492 | 607 | |
| 608 | + | |
| 493 | 609 | |
| 610 | + function SectionToChinese(section) { | |
| 611 | + var strIns = '', chnStr = ''; | |
| 612 | + var unitPos = 0; | |
| 613 | + var zero = true; | |
| 614 | + while (section > 0) { | |
| 615 | + var v = section % 10; | |
| 616 | + if (v === 0) { | |
| 617 | + if (!zero) { | |
| 618 | + zero = true; | |
| 619 | + chnStr = chnNumChar[v] + chnStr; | |
| 620 | + } | |
| 621 | + } else { | |
| 622 | + zero = false; | |
| 623 | + strIns = chnNumChar[v]; | |
| 624 | + strIns += chnUnitChar[unitPos]; | |
| 625 | + chnStr = strIns + chnStr; | |
| 626 | + } | |
| 627 | + unitPos++; | |
| 628 | + section = Math.floor(section / 10); | |
| 629 | + } | |
| 630 | + return chnStr; | |
| 631 | + } | |
| 494 | 632 | |
| 633 | + | |
| 634 | + if (template != null && template.length > 0) { | |
| 635 | + | |
| 636 | + $("#addQuestion").attr("disabled", "disabled"); | |
| 637 | + $("#fast").attr("disabled", "disabled"); | |
| 638 | + for (var i = 0; i < template.length; i++) { | |
| 639 | + if (template[i].type == 1) { | |
| 640 | + var answer = ""; | |
| 641 | + for (var j = 0; j < template[i].questionNum; j++) { | |
| 642 | + answer += "1"; | |
| 643 | + } | |
| 644 | + creat(answer, template[i].optionNum, template[i].score); | |
| 645 | + } | |
| 646 | + if (template[i].type == 2) { | |
| 647 | + addQuestion(5, template[i].optionNum, 1, | |
| 648 | + template[i].questionNum, template[i].score); | |
| 649 | + } | |
| 650 | + } | |
| 651 | + | |
| 652 | + }else if (testData != null && testData.questions != null | |
| 653 | + && testData.questions.length > 0) { | |
| 654 | + fastSort(testData.questions, 0, testData.questions.length - 1); | |
| 655 | + for (var i = 0; i < testData.questions.length; i++) { | |
| 495 | 656 | |
| 657 | + if (testData.questions[0].questions | |
| 658 | + && testData.questions[0].questions.length > 1) { | |
| 659 | + fastSort(testData.questions[i].questions, 0, | |
| 660 | + testData.questions[i].questions.length - 1); | |
| 661 | + } | |
| 662 | + } | |
| 663 | + creatHtml(testData); | |
| 664 | + } | |
| 665 | +}) | ... | ... |
resources/dbconfig.properties
| 1 | 1 | #数据源 1 |
| 2 | -url:jdbc:mysql://120.78.57.84:3306/education?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | |
| 2 | +url:jdbc:mysql://120.78.57.84:3306/education3?autoReconnect=true&failOverReadOnly=false&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 | |
| 3 | 3 | #url:jdbc:mysql://192.168.0.3:3306/education?autoReconnect=true&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8 |
| 4 | 4 | driverClassName:com.mysql.jdbc.Driver |
| 5 | 5 | username:root | ... | ... |
resources/mybatis1/sunvote/PageTemplateMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="PageTemplateMapper"> | |
| 4 | + | |
| 5 | + <!--表名 --> | |
| 6 | + <sql id="tableName"> | |
| 7 | + SV_PAGETEMPLATE | |
| 8 | + </sql> | |
| 9 | + | |
| 10 | + <!-- 字段 --> | |
| 11 | + <sql id="Field"> | |
| 12 | + NAME, | |
| 13 | + SCHOOL_ID, | |
| 14 | + SUBJECT_ID, | |
| 15 | + GRADE_ID, | |
| 16 | + USER_ID, | |
| 17 | + PAGE_SCORE, | |
| 18 | + CONTENT, | |
| 19 | + PAGETEMPLATE_ID | |
| 20 | + </sql> | |
| 21 | + | |
| 22 | + <!-- 字段值 --> | |
| 23 | + <sql id="FieldValue"> | |
| 24 | + #{NAME}, | |
| 25 | + #{SCHOOL_ID}, | |
| 26 | + #{SUBJECT_ID}, | |
| 27 | + #{GRADE_ID}, | |
| 28 | + #{USER_ID}, | |
| 29 | + #{PAGE_SCORE}, | |
| 30 | + #{CONTENT}, | |
| 31 | + #{PAGETEMPLATE_ID} | |
| 32 | + </sql> | |
| 33 | + | |
| 34 | + <!-- 新增--> | |
| 35 | + <insert id="save" parameterType="pd"> | |
| 36 | + insert into | |
| 37 | + <include refid="tableName"></include> | |
| 38 | + ( | |
| 39 | + <include refid="Field"></include> | |
| 40 | + ) values ( | |
| 41 | + <include refid="FieldValue"></include> | |
| 42 | + ) | |
| 43 | + </insert> | |
| 44 | + | |
| 45 | + <!-- 删除--> | |
| 46 | + <delete id="delete" parameterType="pd"> | |
| 47 | + delete from | |
| 48 | + <include refid="tableName"></include> | |
| 49 | + where | |
| 50 | + PAGETEMPLATE_ID = #{PAGETEMPLATE_ID} | |
| 51 | + </delete> | |
| 52 | + | |
| 53 | + <!-- 修改 --> | |
| 54 | + <update id="edit" parameterType="pd"> | |
| 55 | + update | |
| 56 | + <include refid="tableName"></include> | |
| 57 | + set | |
| 58 | + NAME = #{NAME}, | |
| 59 | + SCHOOL_ID = #{SCHOOL_ID}, | |
| 60 | + SUBJECT_ID = #{SUBJECT_ID}, | |
| 61 | + GRADE_ID = #{GRADE_ID}, | |
| 62 | + USER_ID = #{USER_ID}, | |
| 63 | + PAGE_SCORE = #{PAGE_SCORE}, | |
| 64 | + CONTENT = #{CONTENT}, | |
| 65 | + PAGETEMPLATE_ID = PAGETEMPLATE_ID | |
| 66 | + where | |
| 67 | + PAGETEMPLATE_ID = #{PAGETEMPLATE_ID} | |
| 68 | + </update> | |
| 69 | + | |
| 70 | + <!-- 通过ID获取数据 --> | |
| 71 | + <select id="findById" parameterType="pd" resultType="pd"> | |
| 72 | + select | |
| 73 | + <include refid="Field"></include> | |
| 74 | + from | |
| 75 | + <include refid="tableName"></include> | |
| 76 | + where | |
| 77 | + PAGETEMPLATE_ID = #{PAGETEMPLATE_ID} | |
| 78 | + </select> | |
| 79 | + | |
| 80 | + <!-- 列表 --> | |
| 81 | + <select id="datalistPage" parameterType="page" resultType="pd"> | |
| 82 | + select | |
| 83 | + <include refid="Field"></include> | |
| 84 | + from | |
| 85 | + <include refid="tableName"></include> | |
| 86 | + where 1=1 | |
| 87 | + <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 --> | |
| 88 | + and | |
| 89 | + ( | |
| 90 | + <!-- 根据需求自己加检索条件 | |
| 91 | + 字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%') | |
| 92 | + or | |
| 93 | + 字段2 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%') | |
| 94 | + --> | |
| 95 | + ) | |
| 96 | + </if> | |
| 97 | + </select> | |
| 98 | + | |
| 99 | + <!-- 列表(全部) --> | |
| 100 | + <select id="listAll" parameterType="pd" resultType="pd"> | |
| 101 | + select | |
| 102 | + <include refid="Field"></include> | |
| 103 | + from | |
| 104 | + <include refid="tableName"></include> | |
| 105 | + where 1 = 1 | |
| 106 | + <if test="SCHOOL_ID != null and SCHOOL_ID != ''"> | |
| 107 | + and SCHOOL_ID = #{SCHOOL_ID} | |
| 108 | + </if> | |
| 109 | + <if test="SUBJECT_ID != null and SUBJECT_ID != ''"> | |
| 110 | + and SUBJECT_ID = #{SUBJECT_ID} | |
| 111 | + </if> | |
| 112 | + <if test="GRADE_ID != null and GRADE_ID != ''"> | |
| 113 | + and GRADE_ID = #{GRADE_ID} | |
| 114 | + </if> | |
| 115 | + <if test="USER_ID != null and USER_ID != ''"> | |
| 116 | + and (USER_ID = #{USER_ID} or USER_ID IS NULL) | |
| 117 | + </if> | |
| 118 | + </select> | |
| 119 | + | |
| 120 | + <!-- 批量删除 --> | |
| 121 | + <delete id="deleteAll" parameterType="String"> | |
| 122 | + delete from | |
| 123 | + <include refid="tableName"></include> | |
| 124 | + where | |
| 125 | + PAGETEMPLATE_ID in | |
| 126 | + <foreach item="item" index="index" collection="array" open="(" separator="," close=")"> | |
| 127 | + #{item} | |
| 128 | + </foreach> | |
| 129 | + </delete> | |
| 130 | + | |
| 131 | + <!-- fh313596790qq(青苔) --> | |
| 132 | +</mapper> | |
| 0 | 133 | \ No newline at end of file | ... | ... |
src/com/fh/controller/sunvote/pagetemplate/PageTemplateController.java
0 → 100644
| 1 | +package com.fh.controller.sunvote.pagetemplate; | |
| 2 | + | |
| 3 | +import java.io.PrintWriter; | |
| 4 | +import java.text.DateFormat; | |
| 5 | +import java.text.SimpleDateFormat; | |
| 6 | +import java.util.ArrayList; | |
| 7 | +import java.util.Date; | |
| 8 | +import java.util.HashMap; | |
| 9 | +import java.util.List; | |
| 10 | +import java.util.Map; | |
| 11 | +import javax.annotation.Resource; | |
| 12 | +import org.springframework.beans.propertyeditors.CustomDateEditor; | |
| 13 | +import org.springframework.stereotype.Controller; | |
| 14 | +import org.springframework.web.bind.WebDataBinder; | |
| 15 | +import org.springframework.web.bind.annotation.InitBinder; | |
| 16 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 17 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 18 | +import org.springframework.web.servlet.ModelAndView; | |
| 19 | +import com.fh.controller.base.BaseController; | |
| 20 | +import com.fh.entity.Page; | |
| 21 | +import com.fh.util.AppUtil; | |
| 22 | +import com.fh.util.ObjectExcelView; | |
| 23 | +import com.fh.util.PageData; | |
| 24 | +import com.fh.util.Jurisdiction; | |
| 25 | +import com.fh.util.Tools; | |
| 26 | +import com.fh.service.sunvote.pagetemplate.PageTemplateManager; | |
| 27 | + | |
| 28 | +/** | |
| 29 | + * 说明:试卷模板管理 | |
| 30 | + * 创建人:FH Q313596790 | |
| 31 | + * 创建时间:2018-10-29 | |
| 32 | + */ | |
| 33 | +@Controller | |
| 34 | +@RequestMapping(value="/pagetemplate") | |
| 35 | +public class PageTemplateController extends BaseController { | |
| 36 | + | |
| 37 | + String menuUrl = "pagetemplate/list.do"; //菜单地址(权限用) | |
| 38 | + @Resource(name="pagetemplateService") | |
| 39 | + private PageTemplateManager pagetemplateService; | |
| 40 | + | |
| 41 | + /**保存 | |
| 42 | + * | |
| 43 | + * 模板内容(数组) | |
| 44 | + 题型 | |
| 45 | + 小题个数 | |
| 46 | + 每个题目的选项数 | |
| 47 | + 每个题目的分数 | |
| 48 | + * @param | |
| 49 | + * @throws Exception | |
| 50 | + */ | |
| 51 | + @RequestMapping(value="/save") | |
| 52 | + public ModelAndView save() throws Exception{ | |
| 53 | + logBefore(logger, Jurisdiction.getUsername()+"新增PageTemplate"); | |
| 54 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限 | |
| 55 | + ModelAndView mv = this.getModelAndView(); | |
| 56 | + PageData pd = new PageData(); | |
| 57 | + pd = this.getPageData(); | |
| 58 | + pd.put("PAGETEMPLATE_ID", this.get32UUID()); //主键 | |
| 59 | + pagetemplateService.save(pd); | |
| 60 | + mv.addObject("msg","success"); | |
| 61 | + mv.setViewName("save_result"); | |
| 62 | + return mv; | |
| 63 | + } | |
| 64 | + | |
| 65 | + /**删除 | |
| 66 | + * @param out | |
| 67 | + * @throws Exception | |
| 68 | + */ | |
| 69 | + @RequestMapping(value="/delete") | |
| 70 | + public void delete(PrintWriter out) throws Exception{ | |
| 71 | + logBefore(logger, Jurisdiction.getUsername()+"删除PageTemplate"); | |
| 72 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限 | |
| 73 | + PageData pd = new PageData(); | |
| 74 | + pd = this.getPageData(); | |
| 75 | + pagetemplateService.delete(pd); | |
| 76 | + out.write("success"); | |
| 77 | + out.close(); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /**修改 | |
| 81 | + * @param | |
| 82 | + * @throws Exception | |
| 83 | + */ | |
| 84 | + @RequestMapping(value="/edit") | |
| 85 | + public ModelAndView edit() throws Exception{ | |
| 86 | + logBefore(logger, Jurisdiction.getUsername()+"修改PageTemplate"); | |
| 87 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校验权限 | |
| 88 | + ModelAndView mv = this.getModelAndView(); | |
| 89 | + PageData pd = new PageData(); | |
| 90 | + pd = this.getPageData(); | |
| 91 | + pagetemplateService.edit(pd); | |
| 92 | + mv.addObject("msg","success"); | |
| 93 | + mv.setViewName("save_result"); | |
| 94 | + return mv; | |
| 95 | + } | |
| 96 | + | |
| 97 | + /**列表 | |
| 98 | + * @param page | |
| 99 | + * @throws Exception | |
| 100 | + */ | |
| 101 | + @RequestMapping(value="/list") | |
| 102 | + public ModelAndView list(Page page) throws Exception{ | |
| 103 | + logBefore(logger, Jurisdiction.getUsername()+"列表PageTemplate"); | |
| 104 | + //if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码) | |
| 105 | + ModelAndView mv = this.getModelAndView(); | |
| 106 | + PageData pd = new PageData(); | |
| 107 | + pd = this.getPageData(); | |
| 108 | + String keywords = pd.getString("keywords"); //关键词检索条件 | |
| 109 | + if(null != keywords && !"".equals(keywords)){ | |
| 110 | + pd.put("keywords", keywords.trim()); | |
| 111 | + } | |
| 112 | + page.setPd(pd); | |
| 113 | + List<PageData> varList = pagetemplateService.list(page); //列出PageTemplate列表 | |
| 114 | + mv.setViewName("sunvote/pagetemplate/pagetemplate_list"); | |
| 115 | + mv.addObject("varList", varList); | |
| 116 | + mv.addObject("pd", pd); | |
| 117 | + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限 | |
| 118 | + return mv; | |
| 119 | + } | |
| 120 | + | |
| 121 | + /**去新增页面 | |
| 122 | + * @param | |
| 123 | + * @throws Exception | |
| 124 | + */ | |
| 125 | + @RequestMapping(value="/goAdd") | |
| 126 | + public ModelAndView goAdd()throws Exception{ | |
| 127 | + ModelAndView mv = this.getModelAndView(); | |
| 128 | + PageData pd = new PageData(); | |
| 129 | + pd = this.getPageData(); | |
| 130 | + mv.setViewName("sunvote/pagetemplate/pagetemplate_edit"); | |
| 131 | + mv.addObject("msg", "save"); | |
| 132 | + mv.addObject("pd", pd); | |
| 133 | + return mv; | |
| 134 | + } | |
| 135 | + | |
| 136 | + /**去修改页面 | |
| 137 | + * @param | |
| 138 | + * @throws Exception | |
| 139 | + */ | |
| 140 | + @RequestMapping(value="/goEdit") | |
| 141 | + public ModelAndView goEdit()throws Exception{ | |
| 142 | + ModelAndView mv = this.getModelAndView(); | |
| 143 | + PageData pd = new PageData(); | |
| 144 | + pd = this.getPageData(); | |
| 145 | + pd = pagetemplateService.findById(pd); //根据ID读取 | |
| 146 | + mv.setViewName("sunvote/pagetemplate/pagetemplate_edit"); | |
| 147 | + mv.addObject("msg", "edit"); | |
| 148 | + mv.addObject("pd", pd); | |
| 149 | + return mv; | |
| 150 | + } | |
| 151 | + | |
| 152 | + /**批量删除 | |
| 153 | + * @param | |
| 154 | + * @throws Exception | |
| 155 | + */ | |
| 156 | + @RequestMapping(value="/deleteAll") | |
| 157 | + @ResponseBody | |
| 158 | + public Object deleteAll() throws Exception{ | |
| 159 | + logBefore(logger, Jurisdiction.getUsername()+"批量删除PageTemplate"); | |
| 160 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return null;} //校验权限 | |
| 161 | + PageData pd = new PageData(); | |
| 162 | + Map<String,Object> map = new HashMap<String,Object>(); | |
| 163 | + pd = this.getPageData(); | |
| 164 | + List<PageData> pdList = new ArrayList<PageData>(); | |
| 165 | + String DATA_IDS = pd.getString("DATA_IDS"); | |
| 166 | + if(null != DATA_IDS && !"".equals(DATA_IDS)){ | |
| 167 | + String ArrayDATA_IDS[] = DATA_IDS.split(","); | |
| 168 | + pagetemplateService.deleteAll(ArrayDATA_IDS); | |
| 169 | + pd.put("msg", "ok"); | |
| 170 | + }else{ | |
| 171 | + pd.put("msg", "no"); | |
| 172 | + } | |
| 173 | + pdList.add(pd); | |
| 174 | + map.put("list", pdList); | |
| 175 | + return AppUtil.returnObject(pd, map); | |
| 176 | + } | |
| 177 | + | |
| 178 | + /**导出到excel | |
| 179 | + * @param | |
| 180 | + * @throws Exception | |
| 181 | + */ | |
| 182 | + @RequestMapping(value="/excel") | |
| 183 | + public ModelAndView exportExcel() throws Exception{ | |
| 184 | + logBefore(logger, Jurisdiction.getUsername()+"导出PageTemplate到excel"); | |
| 185 | + if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} | |
| 186 | + ModelAndView mv = new ModelAndView(); | |
| 187 | + PageData pd = new PageData(); | |
| 188 | + pd = this.getPageData(); | |
| 189 | + Map<String,Object> dataMap = new HashMap<String,Object>(); | |
| 190 | + List<String> titles = new ArrayList<String>(); | |
| 191 | + titles.add("模板名称"); //1 | |
| 192 | + titles.add("学校"); //2 | |
| 193 | + titles.add("科目"); //3 | |
| 194 | + titles.add("年级"); //4 | |
| 195 | + titles.add("用户ID"); //5 | |
| 196 | + titles.add("试卷总分"); //6 | |
| 197 | + titles.add("模板内容"); //7 | |
| 198 | + dataMap.put("titles", titles); | |
| 199 | + List<PageData> varOList = pagetemplateService.listAll(pd); | |
| 200 | + List<PageData> varList = new ArrayList<PageData>(); | |
| 201 | + for(int i=0;i<varOList.size();i++){ | |
| 202 | + PageData vpd = new PageData(); | |
| 203 | + vpd.put("var1", varOList.get(i).getString("NAME")); //1 | |
| 204 | + vpd.put("var2", varOList.get(i).getString("SCHOOL_ID")); //2 | |
| 205 | + vpd.put("var3", varOList.get(i).getString("SUBJECT_ID")); //3 | |
| 206 | + vpd.put("var4", varOList.get(i).getString("GRADE_ID")); //4 | |
| 207 | + vpd.put("var5", varOList.get(i).getString("USER_ID")); //5 | |
| 208 | + vpd.put("var6", varOList.get(i).getString("PAGE_SCORE")); //6 | |
| 209 | + vpd.put("var7", varOList.get(i).getString("CONTENT")); //7 | |
| 210 | + varList.add(vpd); | |
| 211 | + } | |
| 212 | + dataMap.put("varList", varList); | |
| 213 | + ObjectExcelView erv = new ObjectExcelView(); | |
| 214 | + mv = new ModelAndView(erv,dataMap); | |
| 215 | + return mv; | |
| 216 | + } | |
| 217 | + | |
| 218 | + @InitBinder | |
| 219 | + public void initBinder(WebDataBinder binder){ | |
| 220 | + DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |
| 221 | + binder.registerCustomEditor(Date.class, new CustomDateEditor(format,true)); | |
| 222 | + } | |
| 223 | +} | ... | ... |
src/com/fh/controller/sunvote/paper/PaperController.java
| ... | ... | @@ -26,6 +26,7 @@ import com.fh.controller.base.BaseController; |
| 26 | 26 | import com.fh.entity.Page; |
| 27 | 27 | import com.fh.entity.system.User; |
| 28 | 28 | import com.fh.service.api.V1Manager; |
| 29 | +import com.fh.service.sunvote.pagetemplate.PageTemplateManager; | |
| 29 | 30 | import com.fh.service.sunvote.paper.PaperManager; |
| 30 | 31 | import com.fh.service.sunvote.paperquestion.PaperQuestionManager; |
| 31 | 32 | import com.fh.service.sunvote.question.QuestionManager; |
| ... | ... | @@ -56,6 +57,9 @@ public class PaperController extends BaseController { |
| 56 | 57 | @Resource(name = "v1Service") |
| 57 | 58 | private V1Manager v1Service ; |
| 58 | 59 | |
| 60 | + @Resource(name="pagetemplateService") | |
| 61 | + private PageTemplateManager pagetemplateService; | |
| 62 | + | |
| 59 | 63 | /**保存 |
| 60 | 64 | * @param |
| 61 | 65 | * @throws Exception |
| ... | ... | @@ -267,6 +271,13 @@ public class PaperController extends BaseController { |
| 267 | 271 | pd.put("JSON", paper.toJson()); |
| 268 | 272 | logger.info(paper.toJson()); |
| 269 | 273 | |
| 274 | + String TEMPLATE_ID = pd.getString("TEMPLATE_ID"); | |
| 275 | + if(TEMPLATE_ID != null && !"".equals(TEMPLATE_ID)){ | |
| 276 | + pd.put("PAGETEMPLATE_ID", TEMPLATE_ID); | |
| 277 | + PageData template = pagetemplateService.findById(pd); | |
| 278 | + mv.addObject("TEMPLEATE", template); | |
| 279 | + } | |
| 280 | + | |
| 270 | 281 | mv.setViewName("sunvote/teacher/creat_question"); |
| 271 | 282 | mv.addObject("pd", pd); |
| 272 | 283 | if(paperType != null && "2".equals(paperType)){ | ... | ... |
src/com/fh/controller/system/login/LoginController.java
| ... | ... | @@ -28,6 +28,7 @@ import com.fh.entity.system.User; |
| 28 | 28 | import com.fh.service.api.V1Manager; |
| 29 | 29 | import com.fh.service.fhoa.datajur.DatajurManager; |
| 30 | 30 | import com.fh.service.sunvote.event.EventManager; |
| 31 | +import com.fh.service.sunvote.pagetemplate.PageTemplateManager; | |
| 31 | 32 | import com.fh.service.sunvote.school.SchoolManager; |
| 32 | 33 | import com.fh.service.sunvote.schooladmin.SchoolAdminManager; |
| 33 | 34 | import com.fh.service.sunvote.sclass.SClassManager; |
| ... | ... | @@ -93,6 +94,9 @@ public class LoginController extends BaseController { |
| 93 | 94 | @Resource(name="sclassService") |
| 94 | 95 | private SClassManager sclassService; |
| 95 | 96 | |
| 97 | + @Resource(name="pagetemplateService") | |
| 98 | + private PageTemplateManager pagetemplateService; | |
| 99 | + | |
| 96 | 100 | |
| 97 | 101 | /** |
| 98 | 102 | * 访问登录页 |
| ... | ... | @@ -260,6 +264,9 @@ public class LoginController extends BaseController { |
| 260 | 264 | sData.get("SUBJECT_NAME")); |
| 261 | 265 | session.setAttribute(USERNAME + Const.TERM_ID, |
| 262 | 266 | sData.get("TERM_ID")); |
| 267 | + sData.put("USER_ID", user.getUSER_ID()); | |
| 268 | + List<PageData> templateInfos = pagetemplateService.listAll(sData); | |
| 269 | + mv.addObject("templateInfos", templateInfos); | |
| 263 | 270 | } |
| 264 | 271 | session.setAttribute(Const.SESSION_USERNAME, USERNAME); // 放入用户名到session |
| 265 | 272 | mv.setViewName("sunvote/teacher/teacher_main"); | ... | ... |
src/com/fh/service/sunvote/pagetemplate/PageTemplateManager.java
0 → 100644
| 1 | +package com.fh.service.sunvote.pagetemplate; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.fh.entity.Page; | |
| 5 | +import com.fh.util.PageData; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 说明: 试卷模板管理接口 | |
| 9 | + * 创建人:FH Q313596790 | |
| 10 | + * 创建时间:2018-10-29 | |
| 11 | + * @version | |
| 12 | + */ | |
| 13 | +public interface PageTemplateManager{ | |
| 14 | + | |
| 15 | + /**新增 | |
| 16 | + * @param pd | |
| 17 | + * @throws Exception | |
| 18 | + */ | |
| 19 | + public void save(PageData pd)throws Exception; | |
| 20 | + | |
| 21 | + /**删除 | |
| 22 | + * @param pd | |
| 23 | + * @throws Exception | |
| 24 | + */ | |
| 25 | + public void delete(PageData pd)throws Exception; | |
| 26 | + | |
| 27 | + /**修改 | |
| 28 | + * @param pd | |
| 29 | + * @throws Exception | |
| 30 | + */ | |
| 31 | + public void edit(PageData pd)throws Exception; | |
| 32 | + | |
| 33 | + /**列表 | |
| 34 | + * @param page | |
| 35 | + * @throws Exception | |
| 36 | + */ | |
| 37 | + public List<PageData> list(Page page)throws Exception; | |
| 38 | + | |
| 39 | + /**列表(全部) | |
| 40 | + * @param pd | |
| 41 | + * @throws Exception | |
| 42 | + */ | |
| 43 | + public List<PageData> listAll(PageData pd)throws Exception; | |
| 44 | + | |
| 45 | + /**通过id获取数据 | |
| 46 | + * @param pd | |
| 47 | + * @throws Exception | |
| 48 | + */ | |
| 49 | + public PageData findById(PageData pd)throws Exception; | |
| 50 | + | |
| 51 | + /**批量删除 | |
| 52 | + * @param ArrayDATA_IDS | |
| 53 | + * @throws Exception | |
| 54 | + */ | |
| 55 | + public void deleteAll(String[] ArrayDATA_IDS)throws Exception; | |
| 56 | + | |
| 57 | +} | |
| 58 | + | ... | ... |
src/com/fh/service/sunvote/pagetemplate/impl/PageTemplateService.java
0 → 100644
| 1 | +package com.fh.service.sunvote.pagetemplate.impl; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import javax.annotation.Resource; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | +import com.fh.dao.DaoSupport; | |
| 7 | +import com.fh.entity.Page; | |
| 8 | +import com.fh.util.PageData; | |
| 9 | +import com.fh.service.sunvote.pagetemplate.PageTemplateManager; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * 说明: 试卷模板管理 | |
| 13 | + * 创建人:FH Q313596790 | |
| 14 | + * 创建时间:2018-10-29 | |
| 15 | + * @version | |
| 16 | + */ | |
| 17 | +@Service("pagetemplateService") | |
| 18 | +public class PageTemplateService implements PageTemplateManager{ | |
| 19 | + | |
| 20 | + @Resource(name = "daoSupport") | |
| 21 | + private DaoSupport dao; | |
| 22 | + | |
| 23 | + /**新增 | |
| 24 | + * @param pd | |
| 25 | + * @throws Exception | |
| 26 | + */ | |
| 27 | + public void save(PageData pd)throws Exception{ | |
| 28 | + dao.save("PageTemplateMapper.save", pd); | |
| 29 | + } | |
| 30 | + | |
| 31 | + /**删除 | |
| 32 | + * @param pd | |
| 33 | + * @throws Exception | |
| 34 | + */ | |
| 35 | + public void delete(PageData pd)throws Exception{ | |
| 36 | + dao.delete("PageTemplateMapper.delete", pd); | |
| 37 | + } | |
| 38 | + | |
| 39 | + /**修改 | |
| 40 | + * @param pd | |
| 41 | + * @throws Exception | |
| 42 | + */ | |
| 43 | + public void edit(PageData pd)throws Exception{ | |
| 44 | + dao.update("PageTemplateMapper.edit", pd); | |
| 45 | + } | |
| 46 | + | |
| 47 | + /**列表 | |
| 48 | + * @param page | |
| 49 | + * @throws Exception | |
| 50 | + */ | |
| 51 | + @SuppressWarnings("unchecked") | |
| 52 | + public List<PageData> list(Page page)throws Exception{ | |
| 53 | + return (List<PageData>)dao.findForList("PageTemplateMapper.datalistPage", page); | |
| 54 | + } | |
| 55 | + | |
| 56 | + /**列表(全部) | |
| 57 | + * @param pd | |
| 58 | + * @throws Exception | |
| 59 | + */ | |
| 60 | + @SuppressWarnings("unchecked") | |
| 61 | + public List<PageData> listAll(PageData pd)throws Exception{ | |
| 62 | + return (List<PageData>)dao.findForList("PageTemplateMapper.listAll", pd); | |
| 63 | + } | |
| 64 | + | |
| 65 | + /**通过id获取数据 | |
| 66 | + * @param pd | |
| 67 | + * @throws Exception | |
| 68 | + */ | |
| 69 | + public PageData findById(PageData pd)throws Exception{ | |
| 70 | + return (PageData)dao.findForObject("PageTemplateMapper.findById", pd); | |
| 71 | + } | |
| 72 | + | |
| 73 | + /**批量删除 | |
| 74 | + * @param ArrayDATA_IDS | |
| 75 | + * @throws Exception | |
| 76 | + */ | |
| 77 | + public void deleteAll(String[] ArrayDATA_IDS)throws Exception{ | |
| 78 | + dao.delete("PageTemplateMapper.deleteAll", ArrayDATA_IDS); | |
| 79 | + } | |
| 80 | + | |
| 81 | +} | |
| 82 | + | ... | ... |