├── WebContent ├── META-INF │ └── MANIFEST.MF ├── 01.jpg ├── 02.jpg ├── 03.jpg ├── 04.jpg ├── static │ ├── js │ │ ├── reader.js │ │ ├── exportBook.js │ │ ├── exportReader.js │ │ ├── npm.js │ │ ├── getBookTypes.js │ │ ├── getAllBookTypes.js │ │ ├── getAllReaderTypes.js │ │ ├── getReader.js │ │ ├── deleteAdmin.js │ │ ├── deleteBookType.js │ │ ├── deleteBook.js │ │ ├── deleteReader.js │ │ ├── pay.js │ │ ├── backBook.js │ │ ├── renewBook.js │ │ ├── ajax_upload.js │ │ ├── getReaderBookInfo.js │ │ ├── getBookInfo.js │ │ ├── borrowBook.js │ │ ├── getForfeitInfo.js │ │ ├── getReaderForfeitInfo.js │ │ ├── bootstrap-dropdown.min.js │ │ ├── getBorrowInfo.js │ │ ├── getBackInfo.js │ │ ├── getReaderBackInfo.js │ │ ├── addBookNum.js │ │ ├── addBookType.js │ │ ├── batchAddBook.js │ │ ├── batchAddReader.js │ │ ├── updateAuthorization.js │ │ ├── updateBookType.js │ │ ├── login.js │ │ ├── adminLogin.js │ │ ├── adminUpdateInfo.js │ │ ├── readerUpdateInfo.js │ │ ├── addAdmin.js │ │ ├── readerUpdatePwd.js │ │ ├── adminUpdatePwd.js │ │ ├── updateAdmin.js │ │ ├── addReaderType.js │ │ ├── addReader.js │ │ ├── updateReaderType.js │ │ ├── addBook.js │ │ ├── dataTables.bootstrap.js │ │ ├── updateBook.js │ │ └── updateReader.js │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ ├── assets │ │ ├── js │ │ │ └── theme.js │ │ └── css │ │ │ ├── fullcalendar.print.css │ │ │ └── admin.css │ └── css │ │ └── dataTables.bootstrap.css ├── WEB-INF │ ├── lib │ │ └── mysql-connector-java-8.0.18.jar │ └── web.xml ├── result.jsp ├── admin_login.jsp ├── register.jsp └── login.jsp ├── screenshot ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png ├── src └── com │ └── rain │ ├── bean │ ├── TypeBean.java │ ├── ProblemBean.java │ ├── BookBean.java │ ├── AdminBean.java │ └── HistoryBean.java │ ├── util │ └── DBUtil.java │ ├── servlet │ ├── deleteAdminServlet.java │ ├── deleteServlet.java │ ├── deleteProblemServlet.java │ ├── deleteUserServlet.java │ ├── deleteTypeServlet.java │ ├── AddBookTypeServlet.java │ ├── AddTimeServlet.java │ ├── updateProblemServlet.java │ ├── updateBookTypeServlet.java │ ├── AddAdminServlet.java │ ├── selectProblemServlet.java │ ├── AddBookServlet.java │ ├── updateAdminServlet.java │ ├── AdminLoginServlet.java │ ├── RegisterServlet.java │ ├── updateBookServlet.java │ ├── AddUserServlet.java │ ├── bdtimesServlet.java │ ├── brtimesServlet.java │ ├── selectServlet.java │ ├── updateUserServlet.java │ ├── AddProblemServlet.java │ ├── LoginServlet.java │ ├── borrowServlet.java │ ├── CodeServlet.java │ └── AdminServlet.java │ └── dao │ ├── TypeDao.java │ └── ProblemDao.java ├── .gitignore └── README.md /WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/2.png -------------------------------------------------------------------------------- /screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/3.png -------------------------------------------------------------------------------- /screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/4.png -------------------------------------------------------------------------------- /screenshot/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/5.png -------------------------------------------------------------------------------- /screenshot/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/6.png -------------------------------------------------------------------------------- /screenshot/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/7.png -------------------------------------------------------------------------------- /screenshot/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/8.png -------------------------------------------------------------------------------- /screenshot/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/screenshot/9.png -------------------------------------------------------------------------------- /WebContent/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/01.jpg -------------------------------------------------------------------------------- /WebContent/02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/02.jpg -------------------------------------------------------------------------------- /WebContent/03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/03.jpg -------------------------------------------------------------------------------- /WebContent/04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/04.jpg -------------------------------------------------------------------------------- /WebContent/static/js/reader.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | $('#btn_login').click(function () { 4 | window.location.href = "login.jsp"; 5 | }); 6 | 7 | }); 8 | 9 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/mysql-connector-java-8.0.18.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/WEB-INF/lib/mysql-connector-java-8.0.18.jar -------------------------------------------------------------------------------- /WebContent/static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /WebContent/static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /WebContent/static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /WebContent/static/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No245LibraryManagementSystem/HEAD/WebContent/static/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /WebContent/result.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 8 | 反馈结果 9 | 10 | 11 |

反馈成功,页面将于3s后自动跳转 12 | 点我跳转

13 | 14 | -------------------------------------------------------------------------------- /src/com/rain/bean/TypeBean.java: -------------------------------------------------------------------------------- 1 | package com.rain.bean; 2 | 3 | public class TypeBean { 4 | /** 5 | * 图书分类的数据表的bean 6 | */ 7 | private int tid;// 分类的id 8 | private String name;// 分类的名称 9 | 10 | public int getTid() { 11 | return tid; 12 | } 13 | 14 | public void setTid(int tid) { 15 | this.tid = tid; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /WebContent/static/js/exportBook.js: -------------------------------------------------------------------------------- 1 | function exportBook(){ 2 | //获得basePath 3 | basePath=$('#basePath').val(); 4 | ajax( 5 | { 6 | method:'GET', 7 | url:'admin/bookManageAction_exportBook.action', 8 | callback:function(data) { 9 | showInfo("数据已导出:点击下载"); 10 | } 11 | } 12 | 13 | ); 14 | 15 | } 16 | 17 | 18 | 19 | 20 | function showInfo(msg) { 21 | $("#div_info").html(msg); 22 | $("#modal_info").modal('show'); 23 | } 24 | -------------------------------------------------------------------------------- /WebContent/static/js/exportReader.js: -------------------------------------------------------------------------------- 1 | function exportReader(){ 2 | //获得basePath 3 | basePath=$('#basePath').val(); 4 | ajax( 5 | { 6 | method:'GET', 7 | url:'admin/readerManageAction_exportReader.action', 8 | callback:function(data) { 9 | showInfo("数据已导出:点击下载"); 10 | } 11 | } 12 | 13 | ); 14 | 15 | } 16 | 17 | 18 | 19 | 20 | function showInfo(msg) { 21 | $("#div_info").html(msg); 22 | $("#modal_info").modal('show'); 23 | } 24 | -------------------------------------------------------------------------------- /WebContent/static/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /WebContent/static/js/getBookTypes.js: -------------------------------------------------------------------------------- 1 | window.onload = new function(){ 2 | ajax( 3 | { 4 | url:"bookAction_getAllBookTypes.action", 5 | type:"json", 6 | callback:function(data) { 7 | // 循环遍历每个图书分类,每个名称生成一个option对象,添加到中 8 | for(var index in data) { 9 | var op = document.createElement("option");//创建一个指名名称元素 10 | op.value = data[index].typeId;//设置op的实际值为当前的图书分类编号 11 | var textNode = document.createTextNode(data[index].typeName);//创建文本节点 12 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 13 | 14 | document.getElementById("bookTypeId").appendChild(op); 15 | } 16 | } 17 | } 18 | ); 19 | }; -------------------------------------------------------------------------------- /WebContent/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | books 4 | 5 | index.html 6 | index.htm 7 | index.jsp 8 | default.html 9 | default.htm 10 | default.jsp 11 | 12 | -------------------------------------------------------------------------------- /WebContent/static/js/getAllReaderTypes.js: -------------------------------------------------------------------------------- 1 | window.onload = new function(){ 2 | ajax( 3 | { 4 | url:"admin/readerTypeManageAction_getAllReaderTypes.action", 5 | type:"json", 6 | callback:function(data) { 7 | // 循环遍历每个读者分类,每个名称生成一个option对象,添加到 56 | 57 |
58 | 62 |
63 | 64 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /WebContent/static/js/updateBookType.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * ajax提交修改图书分类的信息 4 | * @param {Object} '#updateBookType' 5 | */ 6 | $(function () { 7 | 8 | 9 | $('#updateBookType').click(function () { 10 | 11 | 12 | if (!validUpdateBookType()) { 13 | return; 14 | } 15 | 16 | var postdata = "id="+$.trim($("#updateBookTypeId").val())+"&typeName="+$.trim($("#updateBookTypeName").val()); 17 | ajax( 18 | { 19 | method:'POST', 20 | url:'admin/bookTypeManageAction_updateBookType.action', 21 | params: postdata, 22 | callback:function(data) { 23 | if (data == 1) { 24 | $("#updateModal").modal("hide");//关闭模糊框 25 | showInfo("修改成功"); 26 | 27 | }else { 28 | $("#updateinfo").modal("hide");//关闭模糊框 29 | showInfo("修改失败"); 30 | } 31 | 32 | } 33 | } 34 | 35 | ); 36 | 37 | 38 | }); 39 | 40 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 41 | location.reload(); //刷新当前页面 42 | }); 43 | 44 | 45 | 46 | }); 47 | 48 | 49 | 50 | 51 | 52 | 53 | /** 54 | * 获取需要修改图书分类信息 55 | * @param {Object} id 需要修改的图书分类id 56 | */ 57 | function updateBookType(id){ 58 | ajax( 59 | { 60 | method:'POST', 61 | url:'admin/bookTypeManageAction_getBookType.action', 62 | params: "id=" + id, 63 | type:"json", 64 | callback:function(data) { 65 | $("#updateBookTypeId").val(data.typeId); 66 | $("#updateBookTypeName").val(data.typeName); 67 | 68 | } 69 | } 70 | 71 | ); 72 | 73 | 74 | } 75 | 76 | 77 | 78 | function validUpdateBookType() { 79 | var flag = true; 80 | 81 | var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); 82 | var bookType = $.trim($("#updateBookTypeName").val()); 83 | if(bookType == ""){ 84 | $('#updateBookTypeName').parent().addClass("has-error"); 85 | $('#updateBookTypeName').next().text("请输入图书分类名称"); 86 | $("#updateBookTypeName").next().show(); 87 | flag = false; 88 | }else if(!reg.test(bookType)){ 89 | $('#updateBookTypeName').parent().addClass("has-error"); 90 | $('#updateBookTypeName').next().text("图书分类名称必须为中文"); 91 | $("#updateBookTypeName").next().show(); 92 | flag = false; 93 | }else { 94 | $('#updateBookTypeName').parent().removeClass("has-error"); 95 | $('#updateBookTypeName').next().text(""); 96 | $("#updateBookTypeName").next().hide(); 97 | } 98 | 99 | 100 | 101 | 102 | return flag; 103 | } 104 | 105 | 106 | 107 | function showInfo(msg) { 108 | $("#div_info").text(msg); 109 | $("#modal_info").modal('show'); 110 | } 111 | 112 | 113 | -------------------------------------------------------------------------------- /WebContent/static/js/login.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#login_submit').click(function () { 5 | if (!validLogin()) { 6 | return; 7 | } 8 | 9 | 10 | var postdata = "paperNO="+$.trim($("#username").val())+"&pwd="+ $.trim($("#password").val()); 11 | ajax( 12 | { 13 | method:'POST', 14 | url:'readerLoginAction_login.action', 15 | params: postdata, 16 | callback:function(data) { 17 | if (data == 1) { 18 | window.location.href = "reader.jsp"; 19 | } else if (data == -1) { 20 | showInfo("账号不存在"); 21 | } else if (data == -2) { 22 | showInfo("密码错误"); 23 | } else { 24 | showInfo("登录失败,请重试"); 25 | } 26 | 27 | } 28 | } 29 | 30 | ); 31 | 32 | 33 | }); 34 | 35 | 36 | 37 | var alert = $('.alert'); 38 | var formWidth = $('.bootstrap-admin-login-form').innerWidth(); 39 | var alertPadding = parseInt($('.alert').css('padding')); 40 | if (isNaN(alertPadding)) { 41 | alertPadding = parseInt($(alert).css('padding-left')); 42 | } 43 | $('.alert').width(formWidth - 2 * alertPadding); 44 | 45 | }); 46 | 47 | function validLogin() { 48 | var flag = true; 49 | 50 | var username = $.trim($("#username").val()); 51 | if (username == "") { 52 | $('#username').parent().addClass("has-error"); 53 | $('#username').next().text("请输入账号"); 54 | $("#username").next().show(); 55 | flag = false; 56 | } else if (username.length<2 || username.length > 15) { 57 | $("#username").parent().addClass("has-error"); 58 | $("#username").next().text("账号长度必须在2~15之间"); 59 | $("#username").next().show(); 60 | flag = false; 61 | } else { 62 | $('#username').parent().removeClass("has-error"); 63 | $('#username').next().text(""); 64 | $("#username").next().hide(); 65 | } 66 | 67 | var password = $.trim($("#password").val()); 68 | if (password == "") { 69 | $('#password').parent().addClass("has-error"); 70 | $('#password').next().text("请输入密码"); 71 | $("#password").next().show(); 72 | flag = false; 73 | } else if (password.length<3||password.length > 15) { 74 | $("#password").parent().addClass("has-error"); 75 | $("#password").next().text("密码长度必须在3~15之间"); 76 | $("#password").next().show(); 77 | flag = false; 78 | } else { 79 | $('#password').parent().removeClass("has-error"); 80 | $('#password').next().text(""); 81 | $("#password").next().hide(); 82 | } 83 | return flag; 84 | } 85 | 86 | function showInfo(msg) { 87 | $("#div_info").text(msg); 88 | $("#modal_info").modal('show'); 89 | } -------------------------------------------------------------------------------- /WebContent/static/js/adminLogin.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | 3 | 4 | $('#login_submit').click(function () { 5 | if (!validLogin()) { 6 | return; 7 | } 8 | 9 | 10 | var postdata = "username="+$.trim($("#username").val())+"&pwd="+ $.trim($("#password").val()); 11 | ajax( 12 | { 13 | method:'POST', 14 | url:'adminLoginAction_login.action', 15 | params: postdata, 16 | callback:function(data) { 17 | if (data == 1) { 18 | //管理员 19 | window.location.href = "admin/admin.jsp"; 20 | } else if (data == -1) { 21 | showInfo("账号不存在"); 22 | } else if (data == -2) { 23 | showInfo("密码错误"); 24 | } else { 25 | showInfo("登录失败,请重试"); 26 | } 27 | 28 | } 29 | } 30 | 31 | ); 32 | 33 | 34 | }); 35 | 36 | 37 | 38 | var alert = $('.alert'); 39 | var formWidth = $('.bootstrap-admin-login-form').innerWidth(); 40 | var alertPadding = parseInt($('.alert').css('padding')); 41 | if (isNaN(alertPadding)) { 42 | alertPadding = parseInt($(alert).css('padding-left')); 43 | } 44 | $('.alert').width(formWidth - 2 * alertPadding); 45 | 46 | }); 47 | 48 | function validLogin() { 49 | var flag = true; 50 | 51 | var username = $.trim($("#username").val()); 52 | if (username == "") { 53 | $('#username').parent().addClass("has-error"); 54 | $('#username').next().text("请输入账号"); 55 | $("#username").next().show(); 56 | flag = false; 57 | } else if (username.length<2 || username.length > 15) { 58 | $("#username").parent().addClass("has-error"); 59 | $("#username").next().text("账号长度必须在2~15之间"); 60 | $("#username").next().show(); 61 | flag = false; 62 | } else { 63 | $('#username').parent().removeClass("has-error"); 64 | $('#username').next().text(""); 65 | $("#username").next().hide(); 66 | } 67 | 68 | var password = $.trim($("#password").val()); 69 | if (password == "") { 70 | $('#password').parent().addClass("has-error"); 71 | $('#password').next().text("请输入密码"); 72 | $("#password").next().show(); 73 | flag = false; 74 | } else if (password.length<3 || password.length > 15) { 75 | $("#password").parent().addClass("has-error"); 76 | $("#password").next().text("密码长度必须在3~15之间"); 77 | $("#password").next().show(); 78 | flag = false; 79 | } else { 80 | $('#password').parent().removeClass("has-error"); 81 | $('#password').next().text(""); 82 | $("#password").next().hide(); 83 | } 84 | return flag; 85 | } 86 | 87 | function showInfo(msg) { 88 | $("#div_info").text(msg); 89 | $("#modal_info").modal('show'); 90 | } -------------------------------------------------------------------------------- /src/com/rain/servlet/LoginServlet.java: -------------------------------------------------------------------------------- 1 | package com.rain.servlet; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.annotation.WebServlet; 7 | import javax.servlet.http.HttpServlet; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import javax.servlet.http.HttpSession; 11 | 12 | import com.rain.bean.AdminBean; 13 | import com.rain.dao.AdminDao; 14 | 15 | /** 16 | * Servlet implementation class LoginServlet 17 | */ 18 | @WebServlet("/LoginServlet") 19 | public class LoginServlet extends HttpServlet { 20 | private static final long serialVersionUID = 1L; 21 | 22 | /** 23 | * @see HttpServlet#HttpServlet() 24 | */ 25 | public LoginServlet() { 26 | super(); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 32 | * response) 33 | */ 34 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 35 | throws ServletException, IOException { 36 | // TODO Auto-generated method stub 37 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 38 | } 39 | 40 | /** 41 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 42 | * response) 43 | */ 44 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 45 | throws ServletException, IOException { 46 | request.setCharacterEncoding("UTF-8"); 47 | response.setContentType("text/html;charset=UTF-8"); 48 | // 获取账号和密码 49 | String username = request.getParameter("username"); 50 | String password = request.getParameter("password"); 51 | String text = request.getParameter("code"); 52 | String code = (String) request.getSession().getAttribute("code"); 53 | AdminDao userdao = new AdminDao(); 54 | // 对账号和密码进行判断 55 | boolean result = userdao.Login_verify(username, password); 56 | HttpSession session = request.getSession(); 57 | if (code.equalsIgnoreCase(text)) { 58 | // 判断输入正确 59 | if (result) { 60 | AdminBean adminbean = new AdminBean(); 61 | AdminDao admindao = new AdminDao(); 62 | // 更新账号和密码查找出读者的信息 63 | adminbean = admindao.getAdminInfo(username, password); 64 | // 将aid存入session中 65 | session.setAttribute("aid", "" + adminbean.getAid()); 66 | // 设置session的失效时间 67 | session.setMaxInactiveInterval(6000); 68 | // 根据status的值来判断是管理员,还是读者,status=1为读者 69 | if (adminbean.getStatus() == 1) { 70 | response.sendRedirect("/books/index.jsp"); 71 | } else { 72 | response.sendRedirect("/books/admin.jsp"); 73 | } 74 | } else { 75 | // 没有找到对应的账号和密码,返回重新登录 76 | session.setAttribute("state", "密码错误"); 77 | response.sendRedirect("/books/login.jsp"); 78 | } 79 | } else { 80 | session.setAttribute("state", "验证码错误"); 81 | response.sendRedirect("/books/login.jsp"); 82 | } 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/com/rain/dao/TypeDao.java: -------------------------------------------------------------------------------- 1 | package com.rain.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | 9 | import com.rain.bean.TypeBean; 10 | import com.rain.util.DBUtil; 11 | 12 | /** 13 | * 图书分类的类 14 | */ 15 | public class TypeDao { 16 | /** 17 | * 获取所有图书类型的信息,返回数组形式 18 | * 19 | * @return 20 | */ 21 | public ArrayList get_ListInfo() { 22 | ArrayList tag_Array = new ArrayList(); 23 | Connection conn = DBUtil.getConnectDb(); 24 | String sql = "select * from booktype"; 25 | PreparedStatement stm = null; 26 | ResultSet rs = null; 27 | try { 28 | stm = conn.prepareStatement(sql); 29 | rs = stm.executeQuery(); 30 | while (rs.next()) { 31 | TypeBean tag = new TypeBean(); 32 | tag.setTid(rs.getInt("tid")); 33 | tag.setName(rs.getString("name")); 34 | tag_Array.add(tag); 35 | } 36 | } catch (SQLException e) { 37 | // TODO Auto-generated catch block 38 | e.printStackTrace(); 39 | } finally { 40 | DBUtil.CloseDB(rs, stm, conn); 41 | } 42 | return tag_Array; 43 | } 44 | 45 | /** 46 | * 修改图书分类的信息 47 | * 48 | * @param tid 49 | * @param name 50 | */ 51 | public void updateTypeBook(int tid, String name) { 52 | // TODO Auto-generated method stub 53 | Connection conn = DBUtil.getConnectDb(); 54 | String sql = "update booktype set name=? where tid=?"; 55 | PreparedStatement stm = null; 56 | try { 57 | stm = conn.prepareStatement(sql); 58 | stm.setString(1, name); 59 | stm.setInt(2, tid); 60 | stm.executeUpdate(); 61 | } catch (SQLException e) { 62 | // TODO Auto-generated catch block 63 | e.printStackTrace(); 64 | } 65 | } 66 | 67 | /** 68 | * 添加一个图书分类 69 | * 70 | * @param name 71 | */ 72 | public void addBookType(String name) { 73 | // TODO Auto-generated method stub 74 | Connection conn = DBUtil.getConnectDb(); 75 | String sql = "insert into booktype(name) values(?)"; 76 | int rs = 0; 77 | PreparedStatement stm = null; 78 | try { 79 | stm = conn.prepareStatement(sql); 80 | stm.setString(1, name); 81 | ; 82 | rs = stm.executeUpdate(); 83 | } catch (SQLException e) { 84 | // TODO Auto-generated catch block 85 | e.printStackTrace(); 86 | } 87 | } 88 | 89 | /** 90 | * 删除一个图书分类 91 | * 92 | * @param tid 93 | */ 94 | public void deleteBookType(int tid) { 95 | // TODO Auto-generated method stub 96 | Connection conn = DBUtil.getConnectDb(); 97 | String sql = "delete from booktype where tid=?"; 98 | PreparedStatement stm = null; 99 | try { 100 | stm = conn.prepareStatement(sql); 101 | stm.setInt(1, tid); 102 | stm.executeUpdate(); 103 | } catch (SQLException e) { 104 | // TODO Auto-generated catch block 105 | e.printStackTrace(); 106 | } 107 | // System.out.println(uid); 108 | 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/com/rain/servlet/borrowServlet.java: -------------------------------------------------------------------------------- 1 | package com.rain.servlet; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import javax.servlet.http.HttpSession; 12 | 13 | import com.rain.bean.AdminBean; 14 | import com.rain.dao.AdminDao; 15 | import com.rain.dao.BookDao; 16 | 17 | /** 18 | * Servlet implementation class borrowServlet 19 | */ 20 | @WebServlet("/borrowServlet") 21 | public class borrowServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * @see HttpServlet#HttpServlet() 26 | */ 27 | public borrowServlet() { 28 | super(); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | /** 33 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 34 | * response) 35 | */ 36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 37 | throws ServletException, IOException { 38 | // TODO Auto-generated method stub 39 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 40 | // 设置编码类型 41 | request.setCharacterEncoding("UTF-8"); 42 | response.setContentType("text/html;charset=UTF-8"); 43 | BookDao bookdao = new BookDao(); 44 | // 为了区分借书和还书的功能,设置tip,tip为1,表示借书 45 | int tip = Integer.parseInt(request.getParameter("tip")); 46 | if (tip == 1) { 47 | // 获取图书id 48 | int bid = Integer.parseInt(request.getParameter("bid")); 49 | int show = Integer.parseInt(request.getParameter("show")); 50 | HttpSession session = request.getSession(); 51 | AdminBean admin = new AdminBean(); 52 | // 获取到存入session的aid读者id 53 | String aid = (String) session.getAttribute("aid"); 54 | AdminDao admindao = new AdminDao(); 55 | // 通过aid获取到读者的信息 56 | admin = admindao.get_AidInfo2(aid); 57 | // 将借阅记录存入数据表 58 | bookdao.borrowBook(bid, admin); 59 | if (show == 1) { 60 | response.sendRedirect("/books/select.jsp"); 61 | } else { 62 | response.sendRedirect("/books/bdtimes.jsp"); 63 | } 64 | } else { 65 | // 还书功能,获取借阅记录的hid 66 | int hid = Integer.parseInt(request.getParameter("hid")); 67 | /** 68 | * 还书在管理员和读者界面都有,为了区分,设置了show字段,show为1表示读者界面 69 | */ 70 | int show = Integer.parseInt(request.getParameter("show")); 71 | // 调用还书函数,改变status字段 72 | bookdao.borrowBook2(hid); 73 | if (show == 1) { 74 | response.sendRedirect("/books/borrow.jsp"); 75 | } else { 76 | response.sendRedirect("/books/admin_borrow.jsp"); 77 | } 78 | 79 | } 80 | 81 | } 82 | 83 | /** 84 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 85 | * response) 86 | */ 87 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 88 | throws ServletException, IOException { 89 | // TODO Auto-generated method stub 90 | doGet(request, response); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/com/rain/servlet/CodeServlet.java: -------------------------------------------------------------------------------- 1 | package com.rain.servlet; 2 | 3 | import java.awt.Color; 4 | import java.awt.Font; 5 | import java.awt.Graphics; 6 | import java.awt.image.BufferedImage; 7 | import java.io.IOException; 8 | import java.util.Random; 9 | 10 | import javax.imageio.ImageIO; 11 | import javax.servlet.ServletException; 12 | import javax.servlet.annotation.WebServlet; 13 | import javax.servlet.http.HttpServlet; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import javax.servlet.http.HttpSession; 17 | 18 | /** 19 | * Servlet implementation class text 20 | */ 21 | @WebServlet("/CodeServlet") 22 | public class CodeServlet extends HttpServlet { 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 27 | * response) 28 | */ 29 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 30 | throws ServletException, IOException { 31 | doPost(request, response); 32 | } 33 | 34 | /** 35 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 36 | * response) 37 | */ 38 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 39 | throws ServletException, IOException { 40 | request.setCharacterEncoding("utf-8"); 41 | 42 | BufferedImage bfi = new BufferedImage(80, 25, BufferedImage.TYPE_INT_RGB); 43 | Graphics g = bfi.getGraphics(); 44 | g.fillRect(0, 0, 80, 25); 45 | 46 | // 验证码字符范围 47 | char[] ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".toCharArray(); 48 | Random r = new Random(); 49 | int index; 50 | StringBuffer sb = new StringBuffer(); // 保存字符串 51 | for (int i = 0; i < 4; i++) { 52 | index = r.nextInt(ch.length); 53 | g.setColor(new Color(r.nextInt(255), r.nextInt(255), r.nextInt(255))); 54 | Font font = new Font("宋体", 30, 20); 55 | g.setFont(font); 56 | g.drawString(ch[index] + "", (i * 20) + 2, 23); 57 | sb.append(ch[index]); 58 | } 59 | 60 | // 设置验证码中的干扰线 61 | for (int i = 0; i < 6; i++) { 62 | // 随机获取干扰线的起点和终点 63 | int xstart = (int) (Math.random() * 80); 64 | int ystart = (int) (Math.random() * 25); 65 | int xend = (int) (Math.random() * 80); 66 | int yend = (int) (Math.random() * 25); 67 | g.setColor(interLine(1, 255)); 68 | g.drawLine(xstart, ystart, xend, yend); 69 | } 70 | HttpSession session = request.getSession(); // 保存到session 71 | session.setAttribute("code", sb.toString()); 72 | ImageIO.write(bfi, "JPG", response.getOutputStream()); // 写到输出流 73 | } 74 | 75 | private static Color interLine(int Low, int High) { 76 | if (Low > 255) 77 | Low = 255; 78 | if (High > 255) 79 | High = 255; 80 | if (Low < 0) 81 | Low = 0; 82 | if (High < 0) 83 | High = 0; 84 | int interval = High - Low; 85 | int r = Low + (int) (Math.random() * interval); 86 | int g = Low + (int) (Math.random() * interval); 87 | int b = Low + (int) (Math.random() * interval); 88 | return new Color(r, g, b); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /WebContent/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | 4 | 5 | 6 | 7 | 注册账号 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 |
26 |
27 |
选择主题
28 |
29 | 30 | 31 |
32 |
33 |
34 | 73 |
74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /WebContent/static/js/adminUpdateInfo.js: -------------------------------------------------------------------------------- 1 | /** 2 | *管理员点击个人资料修改按钮触发进行ajax异步请求 3 | * @param {Object} '#admin_updateInfo' 4 | */ 5 | 6 | $(function () { 7 | 8 | 9 | $('#admin_updateInfo').click(function () { 10 | 11 | 12 | if (!validUpdateAdminInfo()) { 13 | return; 14 | } 15 | 16 | var postdata ="username="+$.trim($("#username").val())+"&name="+$.trim($("#name").val())+"&phone="+ $.trim($("#phone").val()); 17 | ajax( 18 | { 19 | method:'POST', 20 | url:'admin/adminInfoAction_adminInfo.action', 21 | params: postdata, 22 | callback:function(data) { 23 | if (data == 1) { 24 | $("#updateinfo").modal("hide");//关闭模糊框 25 | showInfo("修改成功"); 26 | 27 | }else { 28 | $("#updateinfo").modal("hide");//关闭模糊框 29 | showInfo("修改失败"); 30 | } 31 | 32 | } 33 | } 34 | 35 | ); 36 | 37 | 38 | }); 39 | 40 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 41 | location.reload(); //刷新当前页面 42 | }); 43 | 44 | 45 | 46 | }); 47 | 48 | 49 | function validUpdateAdminInfo() { 50 | var flag = true; 51 | 52 | var username = $.trim($("#username").val()); 53 | if (username == "") { 54 | $('#username').parent().addClass("has-error"); 55 | $('#username').next().text("请输入用户名"); 56 | $("#username").next().show(); 57 | flag = false; 58 | } else if (username.length<2 || username.length > 15) { 59 | $("#username").parent().addClass("has-error"); 60 | $("#username").next().text("用户名长度必须在2~15之间"); 61 | $("#username").next().show(); 62 | flag = false; 63 | } else { 64 | $('#username').parent().removeClass("has-error"); 65 | $('#username').next().text(""); 66 | $("#username").next().hide(); 67 | } 68 | 69 | 70 | 71 | var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); 72 | var name = $.trim($("#name").val()); 73 | if(name == ""){ 74 | $('#name').parent().addClass("has-error"); 75 | $('#name').next().text("请输入真实姓名"); 76 | $("#name").next().show(); 77 | flag = false; 78 | }else if(!reg.test(name)){ 79 | $('#name').parent().addClass("has-error"); 80 | $('#name').next().text("真实姓名必须为中文"); 81 | $("#name").next().show(); 82 | flag = false; 83 | }else { 84 | $('#name').parent().removeClass("has-error"); 85 | $('#name').next().text(""); 86 | $("#name").next().hide(); 87 | } 88 | 89 | var phone = $.trim($("#phone").val()); 90 | if(phone == ""){ 91 | $('#phone').parent().addClass("has-error"); 92 | $('#phone').next().text("请输入联系号码"); 93 | $("#phone").next().show(); 94 | flag = false; 95 | }else if(!(/^1[34578]\d{9}$/.test(phone))){ 96 | //电话号码格式的校验 97 | $('#phone').parent().addClass("has-error"); 98 | $('#phone').next().text("手机号码有误"); 99 | $("#phone").next().show(); 100 | return false; 101 | }else { 102 | $('#phone').parent().removeClass("has-error"); 103 | $('#phone').next().text(""); 104 | $("#phone").next().hide(); 105 | } 106 | 107 | 108 | return flag; 109 | } 110 | 111 | 112 | function showInfo(msg) { 113 | $("#div_info").text(msg); 114 | $("#modal_info").modal('show'); 115 | } -------------------------------------------------------------------------------- /WebContent/static/js/readerUpdateInfo.js: -------------------------------------------------------------------------------- 1 | 2 | $(function () { 3 | 4 | 5 | $('#reader_updateInfo').click(function () { 6 | 7 | 8 | if (!validUpdateReaderInfo()) { 9 | 10 | return; 11 | } 12 | 13 | var postdata = "name="+$.trim($("#name").val())+"&phone="+ $.trim($("#phone").val())+"&email="+ $.trim($("#email").val()); 14 | ajax( 15 | { 16 | method:'POST', 17 | url:'reader/readerInfoAction_readerInfo.action', 18 | params: postdata, 19 | callback:function(data) { 20 | if (data == 1) { 21 | $("#updateinfo").modal("hide");//关闭模糊框 22 | showInfo("修改成功"); 23 | 24 | 25 | }else { 26 | $("#updateinfo").modal("hide");//关闭模糊框 27 | showInfo("修改失败"); 28 | } 29 | 30 | } 31 | } 32 | 33 | ); 34 | 35 | 36 | }); 37 | 38 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 39 | location.reload(); //刷新当前页面 40 | }); 41 | 42 | }); 43 | 44 | 45 | 46 | 47 | function validUpdateReaderInfo() { 48 | var flag = true; 49 | 50 | 51 | var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); 52 | var name = $.trim($("#name").val()); 53 | if(name == ""){ 54 | $('#name').parent().addClass("has-error"); 55 | $('#name').next().text("请输入真实姓名"); 56 | $("#name").next().show(); 57 | flag = false; 58 | }else if(!reg.test(name)){ 59 | $('#name').parent().addClass("has-error"); 60 | $('#name').next().text("真实姓名必须为中文"); 61 | $("#name").next().show(); 62 | flag = false; 63 | }else { 64 | $('#name').parent().removeClass("has-error"); 65 | $('#name').next().text(""); 66 | $("#name").next().hide(); 67 | } 68 | 69 | 70 | var phone = $.trim($("#phone").val()); 71 | if(phone == ""){ 72 | $('#phone').parent().addClass("has-error"); 73 | $('#phone').next().text("请输入联系号码"); 74 | $("#phone").next().show(); 75 | flag = false; 76 | }else if(!(/^1[34578]\d{9}$/.test(phone))){ 77 | //电话号码格式的校验 78 | $('#phone').parent().addClass("has-error"); 79 | $('#phone').next().text("手机号码有误"); 80 | $("#phone").next().show(); 81 | flag = false; 82 | }else { 83 | $('#phone').parent().removeClass("has-error"); 84 | $('#phone').next().text(""); 85 | $("#phone").next().hide(); 86 | } 87 | 88 | 89 | 90 | var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; 91 | var email = $.trim($("#email").val()); 92 | if(email == ""){ 93 | $('#email').parent().addClass("has-error"); 94 | $('#email').next().text("请输入邮箱"); 95 | $("#email").next().show(); 96 | flag = false; 97 | }else if(!reg.test(email)){ 98 | //email格式的校验 99 | $('#email').parent().addClass("has-error"); 100 | $('#email').next().text("邮箱格式有误"); 101 | $("#email").next().show(); 102 | flag = false; 103 | }else { 104 | $('#email').parent().removeClass("has-error"); 105 | $('#email').next().text(""); 106 | $("#email").next().hide(); 107 | } 108 | 109 | 110 | return flag; 111 | } 112 | 113 | 114 | 115 | function showInfo(msg) { 116 | $("#div_info").text(msg); 117 | $("#modal_info").modal('show'); 118 | } -------------------------------------------------------------------------------- /src/com/rain/servlet/AdminServlet.java: -------------------------------------------------------------------------------- 1 | package com.rain.servlet; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import javax.servlet.ServletException; 7 | import javax.servlet.annotation.WebServlet; 8 | import javax.servlet.http.HttpServlet; 9 | import javax.servlet.http.HttpServletRequest; 10 | import javax.servlet.http.HttpServletResponse; 11 | import javax.servlet.http.HttpSession; 12 | 13 | import com.rain.bean.AdminBean; 14 | import com.rain.dao.AdminDao; 15 | import com.rain.dao.BookDao; 16 | 17 | /** 18 | * Servlet implementation class AdminServlet 19 | */ 20 | @WebServlet("/AdminServlet") 21 | public class AdminServlet extends HttpServlet { 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * @see HttpServlet#HttpServlet() 26 | */ 27 | public AdminServlet() { 28 | super(); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | /** 33 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse 34 | * response) 35 | */ 36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) 37 | throws ServletException, IOException { 38 | // TODO Auto-generated method stub 39 | // response.getWriter().append("Served at: ").append(request.getContextPath()); 40 | } 41 | 42 | /** 43 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse 44 | * response) 45 | */ 46 | protected void doPost(HttpServletRequest request, HttpServletResponse response) 47 | throws ServletException, IOException { 48 | // TODO Auto-generated method stub 49 | PrintWriter out = response.getWriter(); 50 | // 设置编码类型 51 | request.setCharacterEncoding("UTF-8"); 52 | response.setContentType("text/html;charset=UTF-8"); 53 | // 这里为了简单,设置了tip,用来区分是修改密码功能,还是修改个人资料的功能,tip=1为修改密码 54 | int tip = Integer.parseInt(request.getParameter("tip")); 55 | // 获取发起请求页面的文件名称,这个在对应的jsp里面的表单填写,修改完成后就可以直接返回对应的页面 56 | String url = request.getParameter("url"); 57 | HttpSession session = request.getSession(); 58 | AdminBean adminbean = new AdminBean(); 59 | // 获取存到session的aid 60 | String aid = (String) session.getAttribute("aid"); 61 | AdminDao admindao = new AdminDao(); 62 | // 通过aid获取到读者的信息 63 | adminbean = admindao.get_AidInfo2(aid); 64 | // 修改密码 65 | if (tip == 1) { 66 | // 获取到输入的旧密码,新密码 67 | String password = request.getParameter("password"); 68 | String password2 = request.getParameter("password2"); 69 | // 获取读者数据表中的密码 70 | String old_password = adminbean.getPassword(); 71 | // 对旧密码进行比较,如果相同就修改,不相同就直接退出 72 | if (old_password.equals(password)) { 73 | admindao.updateUser(adminbean.getAid(), adminbean.getUsername(), password2, adminbean.getName(), 74 | adminbean.getEmail(), adminbean.getPhone(), adminbean.getLend_num(), adminbean.getMax_num()); 75 | response.sendRedirect("/books/" + url + ".jsp"); 76 | } else { 77 | out.write(""); 79 | } 80 | } else { 81 | // 修改个人资料 82 | // 获取输入的信息 83 | String name = request.getParameter("name"); 84 | String email = request.getParameter("email"); 85 | String phone = request.getParameter("phone"); 86 | // 修改输入的信息到数据表中 87 | admindao.updateUser(adminbean.getAid(), adminbean.getUsername(), adminbean.getPassword(), name, email, 88 | phone, adminbean.getLend_num(), adminbean.getMax_num()); 89 | response.sendRedirect("/books/" + url + ".jsp"); 90 | } 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /WebContent/static/js/addAdmin.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * ajax提交添加管理员的信息 4 | * @param {Object} '#addAdmin' 5 | */ 6 | $(function () { 7 | 8 | 9 | 10 | 11 | $('#addAdmin').click(function () { 12 | 13 | if (!validAddAdmin()) { 14 | return; 15 | } 16 | var postdata = "username="+$.trim($("#addUsername").val())+"&name="+$.trim($("#addName").val())+"&phone="+ $.trim($("#addPhone").val()); 17 | ajax( 18 | { 19 | method:'POST', 20 | url:'admin/adminManageAction_addAdmin.action', 21 | params: postdata, 22 | callback:function(data) { 23 | if (data == 1) { 24 | $("#addModal").modal("hide");//关闭模糊框 25 | showInfo("添加成功"); 26 | 27 | }else if (data == -1) { 28 | $("#addModal").modal("hide");//关闭模糊框 29 | showInfo("该管理员已存在"); 30 | }else { 31 | $("#addModal").modal("hide");//关闭模糊框 32 | showInfo("添加失败"); 33 | } 34 | 35 | } 36 | } 37 | 38 | ); 39 | 40 | 41 | }); 42 | 43 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 44 | location.reload(); //刷新当前页面 45 | }); 46 | 47 | 48 | 49 | }); 50 | 51 | 52 | 53 | function validAddAdmin() { 54 | var flag = true; 55 | 56 | var username = $.trim($("#addUsername").val()); 57 | if (username == "") { 58 | $('#addUsername').parent().addClass("has-error"); 59 | $('#addUsername').next().text("请输入用户名"); 60 | $("#addUsername").next().show(); 61 | flag = false; 62 | } else if (username.length<2 || username.length > 15) { 63 | $("#addUsername").parent().addClass("has-error"); 64 | $("#addUsername").next().text("用户名长度必须在2~15之间"); 65 | $("#addUsername").next().show(); 66 | flag = false; 67 | } else { 68 | $('#addUsername').parent().removeClass("has-error"); 69 | $('#addUsername').next().text(""); 70 | $("#addUsername").next().hide(); 71 | } 72 | 73 | 74 | 75 | var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); 76 | var name = $.trim($("#addName").val()); 77 | if(name == ""){ 78 | $('#addName').parent().addClass("has-error"); 79 | $('#addName').next().text("请输入真实姓名"); 80 | $("#addName").next().show(); 81 | flag = false; 82 | }else if(!reg.test(name)){ 83 | $('#addName').parent().addClass("has-error"); 84 | $('#addName').next().text("真实姓名必须为中文"); 85 | $("#addName").next().show(); 86 | flag = false; 87 | }else { 88 | $('#addName').parent().removeClass("has-error"); 89 | $('#addName').next().text(""); 90 | $("#addName").next().hide(); 91 | } 92 | 93 | var phone = $.trim($("#addPhone").val()); 94 | if(phone == ""){ 95 | $('#addPhone').parent().addClass("has-error"); 96 | $('#addPhone').next().text("请输入联系号码"); 97 | $("#addPhone").next().show(); 98 | flag = false; 99 | }else if(!(/^1[34578]\d{9}$/.test(phone))){ 100 | //电话号码格式的校验 101 | $('#addPhone').parent().addClass("has-error"); 102 | $('#addPhone').next().text("手机号码有误"); 103 | $("#addPhone").next().show(); 104 | return false; 105 | }else { 106 | $('#addPhone').parent().removeClass("has-error"); 107 | $('#addPhone').next().text(""); 108 | $("#addPhone").next().hide(); 109 | } 110 | 111 | 112 | return flag; 113 | } 114 | 115 | 116 | 117 | 118 | 119 | 120 | function showInfo(msg) { 121 | $("#div_info").text(msg); 122 | $("#modal_info").modal('show'); 123 | } 124 | 125 | 126 | -------------------------------------------------------------------------------- /WebContent/static/js/readerUpdatePwd.js: -------------------------------------------------------------------------------- 1 | 2 | $(function () { 3 | 4 | 5 | $('#update_readerPwd').click(function () { 6 | 7 | if (!validUpdateReaderPwd()) { 8 | return; 9 | } 10 | 11 | var postdata = "oldPwd="+$.trim($("#oldPwd").val())+"&newPwd="+ $.trim($("#newPwd").val())+"&confirmPwd="+ $.trim($("#confirmPwd").val()); 12 | ajax( 13 | { 14 | method:'POST', 15 | url:'reader/readerInfoAction_readerPwd.action', 16 | params: postdata, 17 | callback:function(data) { 18 | if (data == 1) { 19 | $("#updatepwd").modal("hide");//关闭模糊框 20 | showInfo("修改成功"); 21 | 22 | }else if (data == 0) { 23 | showInfo("确认密码不一致"); 24 | }else if(data == -1){ 25 | showInfo("原密码错误"); 26 | }else{ 27 | showInfo("修改失败"); 28 | } 29 | 30 | 31 | } 32 | } 33 | 34 | ); 35 | 36 | 37 | }); 38 | 39 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 40 | location.reload(); //刷新当前页面 41 | }); 42 | 43 | 44 | }); 45 | 46 | 47 | function validUpdateReaderPwd() { 48 | var flag = true; 49 | 50 | 51 | var oldPwd = $.trim($("#oldPwd").val()); 52 | if (oldPwd == "") { 53 | $('#oldPwd').parent().addClass("has-error"); 54 | $('#oldPwd').next().text("请输入密码"); 55 | $("#oldPwd").next().show(); 56 | flag = false; 57 | } else if (oldPwd.length<3 || oldPwd.length > 15) { 58 | $("#oldPwd").parent().addClass("has-error"); 59 | $("#oldPwd").next().text("密码长度必须在3~15之间"); 60 | $("#oldPwd").next().show(); 61 | flag = false; 62 | } else { 63 | $('#oldPwd').parent().removeClass("has-error"); 64 | $('#oldPwd').next().text(""); 65 | $("#oldPwd").next().hide(); 66 | } 67 | 68 | 69 | var newPwd = $.trim($("#newPwd").val()); 70 | if (newPwd == "") { 71 | $('#newPwd').parent().addClass("has-error"); 72 | $('#newPwd').next().text("请输入新密码"); 73 | $("#newPwd").next().show(); 74 | flag = false; 75 | } else if (newPwd.length<3 || newPwd.length > 15) { 76 | $("#newPwd").parent().addClass("has-error"); 77 | $("#newPwd").next().text("新密码长度必须在3~15之间"); 78 | $("#newPwd").next().show(); 79 | flag = false; 80 | } else { 81 | $('#newPwd').parent().removeClass("has-error"); 82 | $('#newPwd').next().text(""); 83 | $("#newPwd").next().hide(); 84 | } 85 | 86 | 87 | var confirmPwd = $.trim($("#confirmPwd").val()); 88 | if (confirmPwd == "") { 89 | $('#confirmPwd').parent().addClass("has-error"); 90 | $('#confirmPwd').next().text("请输入密码"); 91 | $("#confirmPwd").next().show(); 92 | flag = false; 93 | } else if (confirmPwd.length<3 || confirmPwd.length > 15) { 94 | $("#confirmPwd").parent().addClass("has-error"); 95 | $("#confirmPwd").next().text("密码长度必须在3~15之间"); 96 | $("#confirmPwd").next().show(); 97 | flag = false; 98 | }else if (confirmPwd!=newPwd) { 99 | $("#confirmPwd").parent().addClass("has-error"); 100 | $("#confirmPwd").next().text("确认密码不一致"); 101 | $("#confirmPwd").next().show(); 102 | flag = false; 103 | } else { 104 | $('#confirmPwd').parent().removeClass("has-error"); 105 | $('#confirmPwd').next().text(""); 106 | $("#confirmPwd").next().hide(); 107 | } 108 | 109 | 110 | 111 | return flag; 112 | } 113 | 114 | 115 | 116 | function showInfo(msg) { 117 | $("#div_info").text(msg); 118 | $("#modal_info").modal('show'); 119 | } -------------------------------------------------------------------------------- /WebContent/static/js/adminUpdatePwd.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 点击修改按钮之后ajax提交数据修改密码 3 | * @param {Object} '#update_adminPwd' 4 | */ 5 | $(function () { 6 | 7 | 8 | $('#update_adminPwd').click(function () { 9 | 10 | 11 | if (!validUpdateAdminPwd()) { 12 | return; 13 | } 14 | 15 | var postdata = "oldPwd="+$.trim($("#oldPwd").val())+"&newPwd="+ $.trim($("#newPwd").val())+"&confirmPwd="+ $.trim($("#confirmPwd").val()); 16 | ajax( 17 | { 18 | method:'POST', 19 | url:'admin/adminInfoAction_adminPwd.action', 20 | params: postdata, 21 | callback:function(data) { 22 | if (data == 1) { 23 | $("#updatepwd").modal("hide");//关闭模糊框 24 | showInfo("修改成功"); 25 | 26 | 27 | }else if (data == 0) { 28 | showInfo("确认密码不一致"); 29 | }else if(data == -1){ 30 | showInfo("原密码错误"); 31 | }else{ 32 | showInfo("修改失败"); 33 | } 34 | 35 | 36 | } 37 | } 38 | 39 | ); 40 | 41 | 42 | }); 43 | 44 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 45 | location.reload(); //刷新当前页面 46 | }); 47 | 48 | 49 | }); 50 | 51 | 52 | 53 | function validUpdateAdminPwd() { 54 | var flag = true; 55 | 56 | 57 | var oldPwd = $.trim($("#oldPwd").val()); 58 | if (oldPwd == "") { 59 | $('#oldPwd').parent().addClass("has-error"); 60 | $('#oldPwd').next().text("请输入密码"); 61 | $("#oldPwd").next().show(); 62 | flag = false; 63 | } else if (oldPwd.length<3 || oldPwd.length > 15) { 64 | $("#oldPwd").parent().addClass("has-error"); 65 | $("#oldPwd").next().text("密码长度必须在3~15之间"); 66 | $("#oldPwd").next().show(); 67 | flag = false; 68 | } else { 69 | $('#oldPwd').parent().removeClass("has-error"); 70 | $('#oldPwd').next().text(""); 71 | $("#oldPwd").next().hide(); 72 | } 73 | 74 | 75 | var newPwd = $.trim($("#newPwd").val()); 76 | if (newPwd == "") { 77 | $('#newPwd').parent().addClass("has-error"); 78 | $('#newPwd').next().text("请输入新密码"); 79 | $("#newPwd").next().show(); 80 | flag = false; 81 | } else if (newPwd.length<3 || newPwd.length > 15) { 82 | $("#newPwd").parent().addClass("has-error"); 83 | $("#newPwd").next().text("新密码长度必须在3~15之间"); 84 | $("#newPwd").next().show(); 85 | flag = false; 86 | } else { 87 | $('#newPwd').parent().removeClass("has-error"); 88 | $('#newPwd').next().text(""); 89 | $("#newPwd").next().hide(); 90 | } 91 | 92 | 93 | var confirmPwd = $.trim($("#confirmPwd").val()); 94 | if (confirmPwd == "") { 95 | $('#confirmPwd').parent().addClass("has-error"); 96 | $('#confirmPwd').next().text("请输入密码"); 97 | $("#confirmPwd").next().show(); 98 | flag = false; 99 | } else if (confirmPwd.length<3 || confirmPwd.length > 15) { 100 | $("#confirmPwd").parent().addClass("has-error"); 101 | $("#confirmPwd").next().text("密码长度必须在3~15之间"); 102 | $("#confirmPwd").next().show(); 103 | flag = false; 104 | }else if (confirmPwd!=newPwd) { 105 | $("#confirmPwd").parent().addClass("has-error"); 106 | $("#confirmPwd").next().text("确认密码不一致"); 107 | $("#confirmPwd").next().show(); 108 | flag = false; 109 | } else { 110 | $('#confirmPwd').parent().removeClass("has-error"); 111 | $('#confirmPwd').next().text(""); 112 | $("#confirmPwd").next().hide(); 113 | } 114 | 115 | 116 | 117 | return flag; 118 | } 119 | 120 | 121 | function showInfo(msg) { 122 | $("#div_info").text(msg); 123 | $("#modal_info").modal('show'); 124 | } -------------------------------------------------------------------------------- /WebContent/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8"%> 3 | <% 4 | String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() 5 | + request.getContextPath() + "/"; 6 | %> 7 | 8 | 9 | 10 | 11 | 12 | 图书馆管理系统 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 31 | 36 | 37 | 38 | 44 | 45 | 46 | 47 |
48 |
49 |
50 |
51 | × 52 | 欢迎登录图书馆管理系统 53 |
54 | 97 |
98 |
99 |
100 | 101 | -------------------------------------------------------------------------------- /WebContent/static/js/updateAdmin.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * ajax提交修改管理员的信息 4 | * @param {Object} '#updateAdmin' 5 | */ 6 | $(function () { 7 | 8 | 9 | $('#updateAdmin').click(function () { 10 | 11 | 12 | if (!validUpdateAdmin()) { 13 | return; 14 | } 15 | 16 | var postdata = "id="+$.trim($("#updateId").val())+"&username="+$.trim($("#updateUsername").val())+"&name="+$.trim($("#updateName").val())+"&phone="+ $.trim($("#updatePhone").val()); 17 | ajax( 18 | { 19 | method:'POST', 20 | url:'admin/adminManageAction_updateAdmin.action', 21 | params: postdata, 22 | callback:function(data) { 23 | if (data == 1) { 24 | $("#updateModal").modal("hide");//关闭模糊框 25 | showInfo("修改成功"); 26 | 27 | }else { 28 | $("#updateinfo").modal("hide");//关闭模糊框 29 | showInfo("修改失败"); 30 | } 31 | 32 | } 33 | } 34 | 35 | ); 36 | 37 | 38 | }); 39 | 40 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 41 | location.reload(); //刷新当前页面 42 | }); 43 | 44 | 45 | 46 | }); 47 | 48 | 49 | 50 | 51 | 52 | 53 | /** 54 | * 获取需要修改用户信息 55 | * @param {Object} username 需要修改的用户名 56 | */ 57 | function updateAdmin(id){ 58 | ajax( 59 | { 60 | method:'POST', 61 | url:'admin/adminManageAction_getAdmin.action', 62 | params: "id=" + id, 63 | type:"json", 64 | callback:function(data) { 65 | $("#updateId").val(data.aid); 66 | $("#updateUsername").val(data.username); 67 | $("#updateName").val(data.name); 68 | $("#updatePhone").val(data.phone); 69 | $("#updatePwd").val(data.pwd); 70 | 71 | } 72 | } 73 | 74 | ); 75 | 76 | 77 | } 78 | 79 | 80 | function validUpdateAdmin() { 81 | var flag = true; 82 | 83 | var username = $.trim($("#updateUsername").val()); 84 | if (username == "") { 85 | $('#updateUsername').parent().addClass("has-error"); 86 | $('#updateUsername').next().text("请输入用户名"); 87 | $("#updateUsername").next().show(); 88 | flag = false; 89 | } else if (username.length<2 || username.length > 15) { 90 | $("#updateUsername").parent().addClass("has-error"); 91 | $("#updateUsername").next().text("用户名长度必须在2~15之间"); 92 | $("#updateUsername").next().show(); 93 | flag = false; 94 | } else { 95 | $('#updateUsername').parent().removeClass("has-error"); 96 | $('#updateUsername').next().text(""); 97 | $("#updateUsername").next().hide(); 98 | } 99 | 100 | 101 | var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); 102 | var name = $.trim($("#updateName").val()); 103 | if(name == ""){ 104 | $('#updateName').parent().addClass("has-error"); 105 | $('#updateName').next().text("请输入真实姓名"); 106 | $("#updateName").next().show(); 107 | flag = false; 108 | }else if(!reg.test(name)){ 109 | $('#updateName').parent().addClass("has-error"); 110 | $('#updateName').next().text("真实姓名必须为中文"); 111 | $("#updateName").next().show(); 112 | flag = false; 113 | }else { 114 | $('#updateName').parent().removeClass("has-error"); 115 | $('#updateName').next().text(""); 116 | $("#updateName").next().hide(); 117 | } 118 | 119 | var phone = $.trim($("#updatePhone").val()); 120 | if(phone == ""){ 121 | $('#updatePhone').parent().addClass("has-error"); 122 | $('#updatePhone').next().text("请输入联系号码"); 123 | $("#updatePhone").next().show(); 124 | flag = false; 125 | }else if(!(/^1[34578]\d{9}$/.test(phone))){ 126 | //电话号码格式的校验 127 | $('#updatePhone').parent().addClass("has-error"); 128 | $('#updatePhone').next().text("手机号码有误"); 129 | $("#updatePhone").next().show(); 130 | return false; 131 | }else { 132 | $('#updatePhone').parent().removeClass("has-error"); 133 | $('#updatePhone').next().text(""); 134 | $("#updatePhone").next().hide(); 135 | } 136 | 137 | 138 | return flag; 139 | } 140 | 141 | 142 | 143 | function showInfo(msg) { 144 | $("#div_info").text(msg); 145 | $("#modal_info").modal('show'); 146 | } 147 | 148 | 149 | -------------------------------------------------------------------------------- /WebContent/static/css/dataTables.bootstrap.css: -------------------------------------------------------------------------------- 1 | table.dataTable { 2 | clear: both; 3 | margin-top: 6px !important; 4 | margin-bottom: 6px !important; 5 | max-width: none !important; 6 | } 7 | table.dataTable td, 8 | table.dataTable th { 9 | -webkit-box-sizing: content-box; 10 | -moz-box-sizing: content-box; 11 | box-sizing: content-box; 12 | } 13 | table.dataTable.nowrap th, 14 | table.dataTable.nowrap td { 15 | white-space: nowrap; 16 | } 17 | 18 | div.dataTables_wrapper div.dataTables_length label { 19 | font-weight: normal; 20 | text-align: left; 21 | white-space: nowrap; 22 | } 23 | div.dataTables_wrapper div.dataTables_length select { 24 | width: 75px; 25 | display: inline-block; 26 | } 27 | div.dataTables_wrapper div.dataTables_filter { 28 | text-align: right; 29 | } 30 | div.dataTables_wrapper div.dataTables_filter label { 31 | font-weight: normal; 32 | white-space: nowrap; 33 | text-align: left; 34 | } 35 | div.dataTables_wrapper div.dataTables_filter input { 36 | margin-left: 0.5em; 37 | display: inline-block; 38 | width: auto; 39 | } 40 | div.dataTables_wrapper div.dataTables_info { 41 | padding-top: 8px; 42 | white-space: nowrap; 43 | } 44 | div.dataTables_wrapper div.dataTables_paginate { 45 | margin: 0; 46 | white-space: nowrap; 47 | text-align: right; 48 | } 49 | div.dataTables_wrapper div.dataTables_paginate ul.pagination { 50 | margin: 2px 0; 51 | white-space: nowrap; 52 | } 53 | 54 | table.dataTable thead > tr > th, 55 | table.dataTable thead > tr > td { 56 | padding-right: 30px; 57 | } 58 | table.dataTable thead > tr > th:active, 59 | table.dataTable thead > tr > td:active { 60 | outline: none; 61 | } 62 | table.dataTable thead .sorting, 63 | table.dataTable thead .sorting_asc, 64 | table.dataTable thead .sorting_desc, 65 | table.dataTable thead .sorting_asc_disabled, 66 | table.dataTable thead .sorting_desc_disabled { 67 | cursor: pointer; 68 | position: relative; 69 | } 70 | table.dataTable thead .sorting:after, 71 | table.dataTable thead .sorting_asc:after, 72 | table.dataTable thead .sorting_desc:after, 73 | table.dataTable thead .sorting_asc_disabled:after, 74 | table.dataTable thead .sorting_desc_disabled:after { 75 | position: absolute; 76 | bottom: 8px; 77 | right: 8px; 78 | display: block; 79 | font-family: 'Glyphicons Halflings'; 80 | opacity: 0.5; 81 | } 82 | table.dataTable thead .sorting:after { 83 | opacity: 0.2; 84 | content: "\e150"; 85 | /* sort */ 86 | } 87 | table.dataTable thead .sorting_asc:after { 88 | content: "\e155"; 89 | /* sort-by-attributes */ 90 | } 91 | table.dataTable thead .sorting_desc:after { 92 | content: "\e156"; 93 | /* sort-by-attributes-alt */ 94 | } 95 | table.dataTable thead .sorting_asc_disabled:after, 96 | table.dataTable thead .sorting_desc_disabled:after { 97 | color: #eee; 98 | } 99 | 100 | div.dataTables_scrollHead table.dataTable { 101 | margin-bottom: 0 !important; 102 | } 103 | 104 | div.dataTables_scrollBody table { 105 | border-top: none; 106 | margin-top: 0 !important; 107 | margin-bottom: 0 !important; 108 | } 109 | div.dataTables_scrollBody table thead .sorting:after, 110 | div.dataTables_scrollBody table thead .sorting_asc:after, 111 | div.dataTables_scrollBody table thead .sorting_desc:after { 112 | display: none; 113 | } 114 | div.dataTables_scrollBody table tbody tr:first-child th, 115 | div.dataTables_scrollBody table tbody tr:first-child td { 116 | border-top: none; 117 | } 118 | 119 | div.dataTables_scrollFoot table { 120 | margin-top: 0 !important; 121 | border-top: none; 122 | } 123 | 124 | @media screen and (max-width: 767px) { 125 | div.dataTables_wrapper div.dataTables_length, 126 | div.dataTables_wrapper div.dataTables_filter, 127 | div.dataTables_wrapper div.dataTables_info, 128 | div.dataTables_wrapper div.dataTables_paginate { 129 | text-align: center; 130 | } 131 | } 132 | table.dataTable.table-condensed > thead > tr > th { 133 | padding-right: 20px; 134 | } 135 | table.dataTable.table-condensed .sorting:after, 136 | table.dataTable.table-condensed .sorting_asc:after, 137 | table.dataTable.table-condensed .sorting_desc:after { 138 | top: 6px; 139 | right: 6px; 140 | } 141 | 142 | table.table-bordered.dataTable { 143 | border-collapse: separate !important; 144 | } 145 | table.table-bordered.dataTable th, 146 | table.table-bordered.dataTable td { 147 | border-left-width: 0; 148 | } 149 | table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, 150 | table.table-bordered.dataTable td:last-child, 151 | table.table-bordered.dataTable td:last-child { 152 | border-right-width: 0; 153 | } 154 | table.table-bordered.dataTable tbody th, 155 | table.table-bordered.dataTable tbody td { 156 | border-bottom-width: 0; 157 | } 158 | 159 | div.dataTables_scrollHead table.table-bordered { 160 | border-bottom-width: 0; 161 | } 162 | -------------------------------------------------------------------------------- /WebContent/static/js/addReaderType.js: -------------------------------------------------------------------------------- 1 | 2 | $(function () { 3 | 4 | 5 | $('#addReaderType').click(function () { 6 | 7 | 8 | if (!validAddReaderType()) { 9 | return; 10 | } 11 | 12 | var postdata = "readerTypeName="+$.trim($("#addType").val())+"&maxNum="+$.trim($("#addMaxNum").val())+"&bday="+ $.trim($("#addBday").val()) 13 | +"&penalty="+ $.trim($("#addPenalty").val())+"&renewDays="+ $.trim($("#addrenewDays").val()); 14 | ajax( 15 | { 16 | method:'POST', 17 | url:'admin/readerTypeManageAction_addReaderType.action', 18 | params: postdata, 19 | callback:function(data) { 20 | if (data == 1) { 21 | $("#addModal").modal("hide");//关闭模糊框 22 | showInfo("添加成功"); 23 | 24 | }else { 25 | $("#addModal").modal("hide");//关闭模糊框 26 | showInfo("添加失败"); 27 | } 28 | 29 | } 30 | } 31 | 32 | ); 33 | 34 | 35 | }); 36 | 37 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 38 | location.reload(); //刷新当前页面 39 | }); 40 | 41 | 42 | 43 | }); 44 | 45 | 46 | 47 | 48 | function validAddReaderType() { 49 | var flag = true; 50 | 51 | 52 | 53 | var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); 54 | var typeName = $.trim($("#addType").val()); 55 | if(typeName == ""){ 56 | $('#addType').parent().addClass("has-error"); 57 | $('#addType').next().text("请输入读者类型名称"); 58 | $("#addType").next().show(); 59 | flag = false; 60 | }else if(!reg.test(typeName)){ 61 | $('#addType').parent().addClass("has-error"); 62 | $('#addType').next().text("读者类型名称必须为中文"); 63 | $("#addType").next().show(); 64 | flag = false; 65 | }else { 66 | $('#addType').parent().removeClass("has-error"); 67 | $('#addType').next().text(""); 68 | $("#addType").next().hide(); 69 | } 70 | 71 | var maxNum = $.trim($("#addMaxNum").val()); 72 | if(maxNum == ""){ 73 | $('#addMaxNum').parent().addClass("has-error"); 74 | $('#addMaxNum').next().text("请输入最大借阅数量"); 75 | $("#addMaxNum").next().show(); 76 | flag = false; 77 | }else if(maxNum<=0 || maxNum!=parseInt(maxNum)){ 78 | $('#addMaxNum').parent().addClass("has-error"); 79 | $('#addMaxNum').next().text("最大借阅数量必须为正整数"); 80 | $("#addMaxNum").next().show(); 81 | flag = false; 82 | } else { 83 | $('#addMaxNum').parent().removeClass("has-error"); 84 | $('#addMaxNum').next().text(""); 85 | $("#addMaxNum").next().hide(); 86 | } 87 | 88 | 89 | 90 | var bday = $.trim($("#addBday").val()); 91 | if(bday == ""){ 92 | $('#addBday').parent().addClass("has-error"); 93 | $('#addBday').next().text("请输入最大借阅天数"); 94 | $("#addBday").next().show(); 95 | flag = false; 96 | }else if(bday<=0 || bday!=parseInt(bday)){ 97 | $('#addBday').parent().addClass("has-error"); 98 | $('#addBday').next().text("最大借阅天数必须为正整数"); 99 | $("#addBday").next().show(); 100 | flag = false; 101 | } else { 102 | $('#addBday').parent().removeClass("has-error"); 103 | $('#addBday').next().text(""); 104 | $("#addBday").next().hide(); 105 | } 106 | 107 | 108 | var penalty = $.trim($("#addPenalty").val()); 109 | if(penalty == ""){ 110 | $('#addPenalty').parent().addClass("has-error"); 111 | $('#addPenalty').next().text("请输入逾期每日罚金"); 112 | $("#addPenalty").next().show(); 113 | flag = false; 114 | }else if(penalty<=0 || penalty!=parseInt(penalty)){ 115 | $('#addPenalty').parent().addClass("has-error"); 116 | $('#addPenalty').next().text("逾期每日罚金必须为正整数"); 117 | $("#addPenalty").next().show(); 118 | flag = false; 119 | } else { 120 | $('#addPenalty').parent().removeClass("has-error"); 121 | $('#addPenalty').next().text(""); 122 | $("#addPenalty").next().hide(); 123 | } 124 | 125 | 126 | var renewDays = $.trim($("#addrenewDays").val()); 127 | if(renewDays == ""){ 128 | $('#addrenewDays').parent().addClass("has-error"); 129 | $('#addrenewDays').next().text("请输入续借天数"); 130 | $("#addrenewDays").next().show(); 131 | flag = false; 132 | }else if(renewDays<=0 || renewDays!=parseInt(renewDays)){ 133 | $('#addrenewDays').parent().addClass("has-error"); 134 | $('#addrenewDays').next().text("续借天数必须为正整数"); 135 | $("#addrenewDays").next().show(); 136 | flag = false; 137 | } else { 138 | $('#addrenewDays').parent().removeClass("has-error"); 139 | $('#addrenewDays').next().text(""); 140 | $("#addrenewDays").next().hide(); 141 | } 142 | 143 | 144 | 145 | return flag; 146 | } 147 | 148 | 149 | 150 | 151 | 152 | 153 | function showInfo(msg) { 154 | $("#div_info").text(msg); 155 | $("#modal_info").modal('show'); 156 | } 157 | 158 | 159 | -------------------------------------------------------------------------------- /WebContent/static/js/addReader.js: -------------------------------------------------------------------------------- 1 | window.onload = new function(){ 2 | ajax( 3 | { 4 | url:"admin/readerTypeManageAction_getAllReaderTypes.action", 5 | type:"json", 6 | callback:function(data) { 7 | // 循环遍历每个读者分类,每个名称生成一个option对象,添加到中 56 | for(var index in data) { 57 | var op = document.createElement("option");//创建一个指名名称元素 58 | op.value = data[index].typeId;//设置op的实际值为当前的图书分类编号 59 | var textNode = document.createTextNode(data[index].typeName);//创建文本节点 60 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 61 | 62 | document.getElementById("addBookType").appendChild(op); 63 | } 64 | } 65 | } 66 | ); 67 | }); 68 | 69 | 70 | }); 71 | 72 | 73 | 74 | function validAddBook() { 75 | var flag = true; 76 | 77 | var ISBN = $.trim($("#addISBN").val()); 78 | if (ISBN == "") { 79 | $('#addISBN').parent().addClass("has-error"); 80 | $('#addISBN').next().text("请输入图书ISBN码"); 81 | $("#addISBN").next().show(); 82 | flag = false; 83 | } else { 84 | $('#addISBN').parent().removeClass("has-error"); 85 | $('#addISBN').next().text(""); 86 | $("#addISBN").next().hide(); 87 | } 88 | 89 | var bookName = $.trim($("#addBookName").val()); 90 | if (bookName == "") { 91 | $('#addBookName').parent().addClass("has-error"); 92 | $('#addBookName').next().text("请输入图书名称"); 93 | $("#addBookName").next().show(); 94 | flag = false; 95 | }else { 96 | $('#addBookName').parent().removeClass("has-error"); 97 | $('#addBookName').next().text(""); 98 | $("#addBookName").next().hide(); 99 | } 100 | 101 | 102 | var bookType = $.trim($("#addBookType").val()); 103 | if(bookType == -1){ 104 | $('#addBookType').parent().addClass("has-error"); 105 | $('#addBookType').next().text("请选择图书分类"); 106 | $("#addBookType").next().show(); 107 | flag = false; 108 | }else { 109 | $('#addBookType').parent().removeClass("has-error"); 110 | $('#addBookType').next().text(""); 111 | $("#addBookType").next().hide(); 112 | } 113 | 114 | var autho = $.trim($("#addAutho").val()); 115 | if(autho == ""){ 116 | $('#addAutho').parent().addClass("has-error"); 117 | $('#addAutho').next().text("请输入作者名称"); 118 | $("#addAutho").next().show(); 119 | flag = false; 120 | }else { 121 | $('#addAutho').parent().removeClass("has-error"); 122 | $('#addAutho').next().text(""); 123 | $("#addAutho").next().hide(); 124 | } 125 | 126 | 127 | var press = $.trim($("#addPress").val()); 128 | if(press == ""){ 129 | $('#addPress').parent().addClass("has-error"); 130 | $('#addPress').next().text("请输入出版社名称"); 131 | $("#addPress").next().show(); 132 | flag = false; 133 | }else { 134 | $('#addPress').parent().removeClass("has-error"); 135 | $('#addPress').next().text(""); 136 | $("#addPress").next().hide(); 137 | } 138 | 139 | var num = $.trim($("#addNum").val()); 140 | if(num == ""){ 141 | $('#addNum').parent().addClass("has-error"); 142 | $('#addNum').next().text("请输入总数量"); 143 | $("#addNum").next().show(); 144 | flag = false; 145 | }else if(num<=0 || num!=parseInt(num)){ 146 | $('#addNum').parent().addClass("has-error"); 147 | $('#addNum').next().text("数量必须为正整数"); 148 | $("#addNum").next().show(); 149 | flag = false; 150 | }else { 151 | $('#addNum').parent().removeClass("has-error"); 152 | $('#addNum').next().text(""); 153 | $("#addNum").next().hide(); 154 | } 155 | 156 | 157 | var price = $.trim($("#addPrice").val()); 158 | if(price == ""){ 159 | $('#addPrice').parent().addClass("has-error"); 160 | $('#addPrice').next().text("请输入总数量"); 161 | $("#addPrice").next().show(); 162 | flag = false; 163 | }else if(price<=0 || price!=parseInt(price)){ 164 | $('#addPrice').parent().addClass("has-error"); 165 | $('#addPrice').next().text("数量必须为正整数"); 166 | $("#addPrice").next().show(); 167 | flag = false; 168 | }else { 169 | $('#addPrice').parent().removeClass("has-error"); 170 | $('#addPrice').next().text(""); 171 | $("#addPrice").next().hide(); 172 | } 173 | 174 | 175 | 176 | return flag; 177 | } 178 | 179 | 180 | 181 | 182 | function showInfo(msg) { 183 | $("#div_info").text(msg); 184 | $("#modal_info").modal('show'); 185 | } 186 | -------------------------------------------------------------------------------- /src/com/rain/dao/ProblemDao.java: -------------------------------------------------------------------------------- 1 | package com.rain.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | 9 | import com.rain.bean.AdminBean; 10 | import com.rain.bean.ProblemBean; 11 | import com.rain.util.DBUtil; 12 | 13 | public class ProblemDao { 14 | /** 15 | * 获取所有反馈问题的信息,返回数组形式 16 | * 17 | * @return 18 | */ 19 | public ArrayList get_ListInfo() { 20 | ArrayList tag_Array = new ArrayList(); 21 | Connection conn = DBUtil.getConnectDb(); 22 | String sql = "select * from problem"; 23 | PreparedStatement stm = null; 24 | ResultSet rs = null; 25 | try { 26 | stm = conn.prepareStatement(sql); 27 | rs = stm.executeQuery(); 28 | while (rs.next()) { 29 | ProblemBean tag = new ProblemBean(); 30 | tag.setPid(rs.getInt("pid")); 31 | tag.setAid(rs.getInt("aid")); 32 | tag.setName(rs.getString("name")); 33 | tag.setPage(rs.getString("page")); 34 | tag.setBody(rs.getString("body")); 35 | tag.setPhone(rs.getString("phone")); 36 | tag.setStatus(rs.getString("status")); 37 | tag_Array.add(tag); 38 | } 39 | } catch (SQLException e) { 40 | // TODO Auto-generated catch block 41 | e.printStackTrace(); 42 | } finally { 43 | DBUtil.CloseDB(rs, stm, conn); 44 | } 45 | return tag_Array; 46 | } 47 | /** 48 | * 获取所有反馈问题的信息,返回数组形式 49 | * 50 | * @return 51 | */ 52 | public ArrayList get_ListInfo2(String aid) { 53 | ArrayList tag_Array = new ArrayList(); 54 | Connection conn = DBUtil.getConnectDb(); 55 | String sql = "select * from problem where aid=" + aid; 56 | PreparedStatement stm = null; 57 | ResultSet rs = null; 58 | try { 59 | stm = conn.prepareStatement(sql); 60 | rs = stm.executeQuery(); 61 | while (rs.next()) { 62 | ProblemBean tag = new ProblemBean(); 63 | tag.setPid(rs.getInt("pid")); 64 | tag.setAid(rs.getInt("aid")); 65 | tag.setName(rs.getString("name")); 66 | tag.setPage(rs.getString("page")); 67 | tag.setBody(rs.getString("body")); 68 | tag.setPhone(rs.getString("phone")); 69 | tag.setStatus(rs.getString("status")); 70 | tag_Array.add(tag); 71 | } 72 | } catch (SQLException e) { 73 | // TODO Auto-generated catch block 74 | e.printStackTrace(); 75 | } finally { 76 | DBUtil.CloseDB(rs, stm, conn); 77 | } 78 | return tag_Array; 79 | } 80 | /** 81 | * 添加一个反馈问题 82 | * 83 | * @param adminbean 84 | * @param name 85 | * @param page 86 | * @param body 87 | * @param phone 88 | */ 89 | public void addProblem(AdminBean adminbean, String name, String page, String body, String phone) { 90 | // TODO Auto-generated method stub 91 | Connection conn = DBUtil.getConnectDb(); 92 | String sql = "insert into problem(aid,name,page,body,phone) values(?,?,?,?,?)"; 93 | int rs = 0; 94 | PreparedStatement stm = null; 95 | try { 96 | stm = conn.prepareStatement(sql); 97 | stm.setInt(1, adminbean.getAid()); 98 | stm.setString(2, name); 99 | stm.setString(3, page); 100 | stm.setString(4, body); 101 | stm.setString(5, phone); 102 | rs = stm.executeUpdate(); 103 | } catch (SQLException e) { 104 | // TODO Auto-generated catch block 105 | e.printStackTrace(); 106 | } 107 | } 108 | 109 | /** 110 | * 删除一个反馈问题 111 | * 112 | * @param pid 113 | */ 114 | public void deleteProblem(int pid) { 115 | // TODO Auto-generated method stub 116 | Connection conn = DBUtil.getConnectDb(); 117 | String sql = "delete from problem where pid=?"; 118 | PreparedStatement stm = null; 119 | try { 120 | stm = conn.prepareStatement(sql); 121 | stm.setInt(1, pid); 122 | stm.executeUpdate(); 123 | } catch (SQLException e) { 124 | // TODO Auto-generated catch block 125 | e.printStackTrace(); 126 | } 127 | } 128 | 129 | /** 130 | * 修改反馈问题的状态 131 | * 132 | * @param pid 133 | * @param status 134 | */ 135 | public void updateProblem(int pid, String status) { 136 | // TODO Auto-generated method stub 137 | Connection conn = DBUtil.getConnectDb(); 138 | String sql = "update problem set status=? where pid=?"; 139 | PreparedStatement stm = null; 140 | try { 141 | stm = conn.prepareStatement(sql); 142 | stm.setString(1, status); 143 | stm.setInt(2, pid); 144 | stm.executeUpdate(); 145 | } catch (SQLException e) { 146 | // TODO Auto-generated catch block 147 | e.printStackTrace(); 148 | } 149 | } 150 | 151 | /** 152 | * 查找反馈问题,根据输入的名称,使用like进行模糊查询,然后返回一个ArrayList数组类型 153 | * 154 | * @param name 155 | * @return 156 | */ 157 | public ArrayList getLikeList(String name) { 158 | // TODO Auto-generated method stub 159 | ArrayList tag_Array = new ArrayList(); 160 | Connection conn = DBUtil.getConnectDb(); 161 | String sql = "select * from problem where name like '%" + name + "%' or page like '%" + name 162 | + "%' or body like '%" + name + "%' or status like '%" + name + "%'"; 163 | PreparedStatement stm = null; 164 | ResultSet rs = null; 165 | try { 166 | stm = conn.prepareStatement(sql); 167 | rs = stm.executeQuery(); 168 | while (rs.next()) { 169 | ProblemBean tag = new ProblemBean(); 170 | tag.setPid(rs.getInt("pid")); 171 | tag.setAid(rs.getInt("aid")); 172 | tag.setName(rs.getString("name")); 173 | tag.setPage(rs.getString("page")); 174 | tag.setBody(rs.getString("body")); 175 | tag.setPhone(rs.getString("phone")); 176 | tag.setStatus(rs.getString("status")); 177 | tag_Array.add(tag); 178 | } 179 | } catch (SQLException e) { 180 | // TODO Auto-generated catch block 181 | e.printStackTrace(); 182 | } finally { 183 | DBUtil.CloseDB(rs, stm, conn); 184 | } 185 | return tag_Array; 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /WebContent/static/js/dataTables.bootstrap.js: -------------------------------------------------------------------------------- 1 | /*! DataTables Bootstrap 3 integration 2 | * ©2011-2014 SpryMedia Ltd - datatables.net/license 3 | */ 4 | 5 | /** 6 | * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and 7 | * DataTables 1.10 or newer. 8 | * 9 | * This file sets the defaults and adds options to DataTables to style its 10 | * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap 11 | * for further information. 12 | */ 13 | (function(window, document, undefined){ 14 | 15 | var factory = function( $, DataTable ) { 16 | "use strict"; 17 | 18 | 19 | /* Set the defaults for DataTables initialisation */ 20 | $.extend( true, DataTable.defaults, { 21 | dom: 22 | "<'row'<'col-sm-6'l><'col-sm-6'f>>" + 23 | "<'row'<'col-sm-12'tr>>" + 24 | "<'row'<'col-sm-5'i><'col-sm-7'p>>", 25 | renderer: 'bootstrap' 26 | } ); 27 | 28 | 29 | /* Default class modification */ 30 | $.extend( DataTable.ext.classes, { 31 | sWrapper: "dataTables_wrapper form-inline dt-bootstrap", 32 | sFilterInput: "form-control input-sm", 33 | sLengthSelect: "form-control input-sm" 34 | } ); 35 | 36 | 37 | /* Bootstrap paging button renderer */ 38 | DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) { 39 | var api = new DataTable.Api( settings ); 40 | var classes = settings.oClasses; 41 | var lang = settings.oLanguage.oPaginate; 42 | var btnDisplay, btnClass, counter=0; 43 | 44 | var attach = function( container, buttons ) { 45 | var i, ien, node, button; 46 | var clickHandler = function ( e ) { 47 | e.preventDefault(); 48 | if ( !$(e.currentTarget).hasClass('disabled') ) { 49 | api.page( e.data.action ).draw( 'page' ); 50 | } 51 | }; 52 | 53 | for ( i=0, ien=buttons.length ; i 0 ? 72 | '' : ' disabled'); 73 | break; 74 | 75 | case 'previous': 76 | btnDisplay = lang.sPrevious; 77 | btnClass = button + (page > 0 ? 78 | '' : ' disabled'); 79 | break; 80 | 81 | case 'next': 82 | btnDisplay = lang.sNext; 83 | btnClass = button + (page < pages-1 ? 84 | '' : ' disabled'); 85 | break; 86 | 87 | case 'last': 88 | btnDisplay = lang.sLast; 89 | btnClass = button + (page < pages-1 ? 90 | '' : ' disabled'); 91 | break; 92 | 93 | default: 94 | btnDisplay = button + 1; 95 | btnClass = page === button ? 96 | 'active' : ''; 97 | break; 98 | } 99 | 100 | if ( btnDisplay ) { 101 | node = $('
  • ', { 102 | 'class': classes.sPageButton+' '+btnClass, 103 | 'id': idx === 0 && typeof button === 'string' ? 104 | settings.sTableId +'_'+ button : 105 | null 106 | } ) 107 | .append( $('', { 108 | 'href': '#', 109 | 'aria-controls': settings.sTableId, 110 | 'data-dt-idx': counter, 111 | 'tabindex': settings.iTabIndex 112 | } ) 113 | .html( btnDisplay ) 114 | ) 115 | .appendTo( container ); 116 | 117 | settings.oApi._fnBindAction( 118 | node, {action: button}, clickHandler 119 | ); 120 | 121 | counter++; 122 | } 123 | } 124 | } 125 | }; 126 | 127 | // IE9 throws an 'unknown error' if document.activeElement is used 128 | // inside an iframe or frame. 129 | var activeEl; 130 | 131 | try { 132 | // Because this approach is destroying and recreating the paging 133 | // elements, focus is lost on the select button which is bad for 134 | // accessibility. So we want to restore focus once the draw has 135 | // completed 136 | activeEl = $(host).find(document.activeElement).data('dt-idx'); 137 | } 138 | catch (e) {} 139 | 140 | attach( 141 | $(host).empty().html('
      ').children('ul'), 142 | buttons 143 | ); 144 | 145 | if ( activeEl ) { 146 | $(host).find( '[data-dt-idx='+activeEl+']' ).focus(); 147 | } 148 | }; 149 | 150 | 151 | /* 152 | * TableTools Bootstrap compatibility 153 | * Required TableTools 2.1+ 154 | */ 155 | if ( DataTable.TableTools ) { 156 | // Set the classes that TableTools uses to something suitable for Bootstrap 157 | $.extend( true, DataTable.TableTools.classes, { 158 | "container": "DTTT btn-group", 159 | "buttons": { 160 | "normal": "btn btn-default", 161 | "disabled": "disabled" 162 | }, 163 | "collection": { 164 | "container": "DTTT_dropdown dropdown-menu", 165 | "buttons": { 166 | "normal": "", 167 | "disabled": "disabled" 168 | } 169 | }, 170 | "print": { 171 | "info": "DTTT_print_info" 172 | }, 173 | "select": { 174 | "row": "active" 175 | } 176 | } ); 177 | 178 | // Have the collection use a bootstrap compatible drop down 179 | $.extend( true, DataTable.TableTools.DEFAULTS.oTags, { 180 | "collection": { 181 | "container": "ul", 182 | "button": "li", 183 | "liner": "a" 184 | } 185 | } ); 186 | } 187 | 188 | }; // /factory 189 | 190 | 191 | // Define as an AMD module if possible 192 | if ( typeof define === 'function' && define.amd ) { 193 | define( ['jquery', 'datatables'], factory ); 194 | } 195 | else if ( typeof exports === 'object' ) { 196 | // Node/CommonJS 197 | factory( require('jquery'), require('datatables') ); 198 | } 199 | else if ( jQuery ) { 200 | // Otherwise simply initialise as normal, stopping multiple evaluation 201 | factory( jQuery, jQuery.fn.dataTable ); 202 | } 203 | 204 | 205 | })(window, document); 206 | 207 | -------------------------------------------------------------------------------- /WebContent/static/js/updateBook.js: -------------------------------------------------------------------------------- 1 | 2 | $(function () { 3 | 4 | 5 | $('#updateBook').click(function () { 6 | 7 | 8 | if (!validUpdateBook()) { 9 | return; 10 | } 11 | 12 | var postdata = "bookId="+$.trim($("#updateBookId").val())+"&bookName="+$.trim($("#updateBookName").val())+"&bookTypeId="+$.trim($("#updateBookType").val()) 13 | +"&autho="+ $.trim($("#updateAutho").val())+"&press="+ $.trim($("#updatePress").val())+"&price="+ $.trim($("#updatePrice").val()) 14 | +"&description="+ $.trim($("#updateDescription").val())+"&ISBN="+ $.trim($("#updateISBN").val()); 15 | ajax( 16 | { 17 | method:'POST', 18 | url:'admin/bookManageAction_updateBook.action', 19 | params: postdata, 20 | callback:function(data) { 21 | if (data == 1) { 22 | $("#updateModal").modal("hide");//关闭模糊框 23 | showInfo("修改成功"); 24 | 25 | }else { 26 | $("#updateinfo").modal("hide");//关闭模糊框 27 | showInfo("修改失败"); 28 | } 29 | 30 | } 31 | } 32 | 33 | ); 34 | 35 | 36 | }); 37 | 38 | 39 | 40 | 41 | 42 | 43 | $('#modal_info').on('hide.bs.modal',function() {//提示模糊框隐藏时候触发 44 | location.reload(); //刷新当前页面 45 | }); 46 | 47 | 48 | 49 | }); 50 | 51 | 52 | 53 | 54 | 55 | 56 | function updateBook(id){ 57 | $("#updateBookType option[value!=-1]").remove();//移除先前的选项 58 | ajax( 59 | { 60 | url:"admin/bookManageAction_getAllBookTypes.action", 61 | type:"json", 62 | callback:function(data) { 63 | // 循环遍历每个图书分类,每个名称生成一个option对象,添加到中 65 | for(var index in data) { 66 | var op = document.createElement("option");//创建一个指名名称元素 67 | op.value = data[index].readerTypeId;//设置op的实际值为当前的读者分类编号 68 | var textNode = document.createTextNode(data[index].readerTypeName);//创建文本节点 69 | op.appendChild(textNode);//把文本子节点添加到op元素中,指定其显示值 70 | 71 | document.getElementById("updateReaderType").appendChild(op); 72 | } 73 | ajax( 74 | { 75 | method:'POST', 76 | url:'admin/readerManageAction_getReader.action', 77 | params: "readerId=" + id, 78 | type:"json", 79 | callback:function(data) { 80 | $("#updateReaderID").val(data.readerId); 81 | $("#updatePaperNO").val(data.paperNO); 82 | $("#updateName").val(data.name); 83 | $("#updateEmail").val(data.email); 84 | $("#updatePhone").val(data.phone); 85 | $("#updateReaderType").val(data.readerType.readerTypeId); 86 | } 87 | } 88 | 89 | ); 90 | } 91 | 92 | 93 | 94 | 95 | } 96 | ); 97 | 98 | 99 | 100 | } 101 | 102 | 103 | 104 | function validUpdateReader() { 105 | var flag = true; 106 | 107 | var paperNO = $.trim($("#updatePaperNO").val()); 108 | if (paperNO == "") { 109 | $('#updatePaperNO').parent().addClass("has-error"); 110 | $('#updatePaperNO').next().text("请输入读者证件号"); 111 | $("#updatePaperNO").next().show(); 112 | flag = false; 113 | }else { 114 | $('#updatePaperNO').parent().removeClass("has-error"); 115 | $('#updatePaperNO').next().text(""); 116 | $("#updatePaperNO").next().hide(); 117 | } 118 | 119 | 120 | 121 | var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); 122 | var name = $.trim($("#updateName").val()); 123 | if(name == ""){ 124 | $('#updateName').parent().addClass("has-error"); 125 | $('#updateName').next().text("请输入真实姓名"); 126 | $("#updateName").next().show(); 127 | flag = false; 128 | }else if(!reg.test(name)){ 129 | $('#updateName').parent().addClass("has-error"); 130 | $('#updateName').next().text("真实姓名必须为中文"); 131 | $("#updateName").next().show(); 132 | flag = false; 133 | }else { 134 | $('#updateName').parent().removeClass("has-error"); 135 | $('#updateName').next().text(""); 136 | $("#updateName").next().hide(); 137 | } 138 | 139 | var phone = $.trim($("#updatePhone").val()); 140 | if(phone == ""){ 141 | $('#updatePhone').parent().addClass("has-error"); 142 | $('#updatePhone').next().text("请输入联系号码"); 143 | $("#updatePhone").next().show(); 144 | flag = false; 145 | }else if(!(/^1[34578]\d{9}$/.test(phone))){ 146 | //电话号码格式的校验 147 | $('#updatePhone').parent().addClass("has-error"); 148 | $('#updatePhone').next().text("手机号码有误"); 149 | $("#updatePhone").next().show(); 150 | return false; 151 | }else { 152 | $('#updatePhone').parent().removeClass("has-error"); 153 | $('#updatePhone').next().text(""); 154 | $("#updatePhone").next().hide(); 155 | } 156 | 157 | var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; 158 | var email = $.trim($("#updateEmail").val()); 159 | if(email == ""){ 160 | $('#updateEmail').parent().addClass("has-error"); 161 | $('#updateEmail').next().text("请输入邮箱"); 162 | $("#updateEmail").next().show(); 163 | flag = false; 164 | }else if(!reg.test(email)){ 165 | //邮箱格式的校验 166 | $('#updateEmail').parent().addClass("has-error"); 167 | $('#updateEmail').next().text("邮箱格式有误"); 168 | $("#updateEmail").next().show(); 169 | return false; 170 | }else { 171 | $('#updateEmail').parent().removeClass("has-error"); 172 | $('#updateEmail').next().text(""); 173 | $("#updateEmail").next().hide(); 174 | } 175 | 176 | 177 | 178 | var readerType = $.trim($("#updateReaderType").val()); 179 | if(readerType == -1){ 180 | $('#updateReaderType').parent().addClass("has-error"); 181 | $('#updateReaderType').next().text("请选择读者类型"); 182 | $("#updateReaderType").next().show(); 183 | flag = false; 184 | }else { 185 | $('#updateReaderType').parent().removeClass("has-error"); 186 | $('#updateReaderType').next().text(""); 187 | $("#updateReaderType").next().hide(); 188 | } 189 | 190 | return flag; 191 | } 192 | 193 | 194 | 195 | 196 | 197 | function showInfo(msg) { 198 | $("#div_info").text(msg); 199 | $("#modal_info").modal('show'); 200 | } 201 | 202 | 203 | -------------------------------------------------------------------------------- /WebContent/static/assets/css/fullcalendar.print.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * FullCalendar v0.0.0 Print Stylesheet 3 | * Docs & License: http://fullcalendar.io/ 4 | * (c) 2016 Adam Shaw 5 | */ 6 | 7 | /* 8 | * Include this stylesheet on your page to get a more printer-friendly calendar. 9 | * When including this stylesheet, use the media='print' attribute of the tag. 10 | * Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css. 11 | */ 12 | 13 | .fc { 14 | max-width: 100% !important; 15 | } 16 | 17 | 18 | /* Global Event Restyling 19 | --------------------------------------------------------------------------------------------------*/ 20 | 21 | .fc-event { 22 | background: #fff !important; 23 | color: #000 !important; 24 | page-break-inside: avoid; 25 | } 26 | 27 | .fc-event .fc-resizer { 28 | display: none; 29 | } 30 | 31 | 32 | /* Table & Day-Row Restyling 33 | --------------------------------------------------------------------------------------------------*/ 34 | 35 | .fc th, 36 | .fc td, 37 | .fc hr, 38 | .fc thead, 39 | .fc tbody, 40 | .fc-row { 41 | border-color: #ccc !important; 42 | background: #fff !important; 43 | } 44 | 45 | /* kill the overlaid, absolutely-positioned components */ 46 | /* common... */ 47 | .fc-bg, 48 | .fc-bgevent-skeleton, 49 | .fc-highlight-skeleton, 50 | .fc-helper-skeleton, 51 | /* for timegrid. within cells within table skeletons... */ 52 | .fc-bgevent-container, 53 | .fc-business-container, 54 | .fc-highlight-container, 55 | .fc-helper-container { 56 | display: none; 57 | } 58 | 59 | /* don't force a min-height on rows (for DayGrid) */ 60 | .fc tbody .fc-row { 61 | height: auto !important; /* undo height that JS set in distributeHeight */ 62 | min-height: 0 !important; /* undo the min-height from each view's specific stylesheet */ 63 | } 64 | 65 | .fc tbody .fc-row .fc-content-skeleton { 66 | position: static; /* undo .fc-rigid */ 67 | padding-bottom: 0 !important; /* use a more border-friendly method for this... */ 68 | } 69 | 70 | .fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td { /* only works in newer browsers */ 71 | padding-bottom: 1em; /* ...gives space within the skeleton. also ensures min height in a way */ 72 | } 73 | 74 | .fc tbody .fc-row .fc-content-skeleton table { 75 | /* provides a min-height for the row, but only effective for IE, which exaggerates this value, 76 | making it look more like 3em. for other browers, it will already be this tall */ 77 | height: 1em; 78 | } 79 | 80 | 81 | /* Undo month-view event limiting. Display all events and hide the "more" links 82 | --------------------------------------------------------------------------------------------------*/ 83 | 84 | .fc-more-cell, 85 | .fc-more { 86 | display: none !important; 87 | } 88 | 89 | .fc tr.fc-limited { 90 | display: table-row !important; 91 | } 92 | 93 | .fc td.fc-limited { 94 | display: table-cell !important; 95 | } 96 | 97 | .fc-popover { 98 | display: none; /* never display the "more.." popover in print mode */ 99 | } 100 | 101 | 102 | /* TimeGrid Restyling 103 | --------------------------------------------------------------------------------------------------*/ 104 | 105 | /* undo the min-height 100% trick used to fill the container's height */ 106 | .fc-time-grid { 107 | min-height: 0 !important; 108 | } 109 | 110 | /* don't display the side axis at all ("all-day" and time cells) */ 111 | .fc-agenda-view .fc-axis { 112 | display: none; 113 | } 114 | 115 | /* don't display the horizontal lines */ 116 | .fc-slats, 117 | .fc-time-grid hr { /* this hr is used when height is underused and needs to be filled */ 118 | display: none !important; /* important overrides inline declaration */ 119 | } 120 | 121 | /* let the container that holds the events be naturally positioned and create real height */ 122 | .fc-time-grid .fc-content-skeleton { 123 | position: static; 124 | } 125 | 126 | /* in case there are no events, we still want some height */ 127 | .fc-time-grid .fc-content-skeleton table { 128 | height: 4em; 129 | } 130 | 131 | /* kill the horizontal spacing made by the event container. event margins will be done below */ 132 | .fc-time-grid .fc-event-container { 133 | margin: 0 !important; 134 | } 135 | 136 | 137 | /* TimeGrid *Event* Restyling 138 | --------------------------------------------------------------------------------------------------*/ 139 | 140 | /* naturally position events, vertically stacking them */ 141 | .fc-time-grid .fc-event { 142 | position: static !important; 143 | margin: 3px 2px !important; 144 | } 145 | 146 | /* for events that continue to a future day, give the bottom border back */ 147 | .fc-time-grid .fc-event.fc-not-end { 148 | border-bottom-width: 1px !important; 149 | } 150 | 151 | /* indicate the event continues via "..." text */ 152 | .fc-time-grid .fc-event.fc-not-end:after { 153 | content: "..."; 154 | } 155 | 156 | /* for events that are continuations from previous days, give the top border back */ 157 | .fc-time-grid .fc-event.fc-not-start { 158 | border-top-width: 1px !important; 159 | } 160 | 161 | /* indicate the event is a continuation via "..." text */ 162 | .fc-time-grid .fc-event.fc-not-start:before { 163 | content: "..."; 164 | } 165 | 166 | /* time */ 167 | 168 | /* undo a previous declaration and let the time text span to a second line */ 169 | .fc-time-grid .fc-event .fc-time { 170 | white-space: normal !important; 171 | } 172 | 173 | /* hide the the time that is normally displayed... */ 174 | .fc-time-grid .fc-event .fc-time span { 175 | display: none; 176 | } 177 | 178 | /* ...replace it with a more verbose version (includes AM/PM) stored in an html attribute */ 179 | .fc-time-grid .fc-event .fc-time:after { 180 | content: attr(data-full); 181 | } 182 | 183 | 184 | /* Vertical Scroller & Containers 185 | --------------------------------------------------------------------------------------------------*/ 186 | 187 | /* kill the scrollbars and allow natural height */ 188 | .fc-scroller, 189 | .fc-day-grid-container, /* these divs might be assigned height, which we need to cleared */ 190 | .fc-time-grid-container { /* */ 191 | overflow: visible !important; 192 | height: auto !important; 193 | } 194 | 195 | /* kill the horizontal border/padding used to compensate for scrollbars */ 196 | .fc-row { 197 | border: 0 !important; 198 | margin: 0 !important; 199 | } 200 | 201 | 202 | /* Button Controls 203 | --------------------------------------------------------------------------------------------------*/ 204 | 205 | .fc-button-group, 206 | .fc button { 207 | display: none; /* don't display any button-related controls */ 208 | } 209 | -------------------------------------------------------------------------------- /WebContent/static/assets/css/admin.css: -------------------------------------------------------------------------------- 1 | /** 2 | * admin.css 3 | */ 4 | 5 | 6 | /* 7 | fixed-layout 固定头部和边栏布局 8 | */ 9 | 10 | html, 11 | body { 12 | height: 100%; 13 | overflow: hidden; 14 | } 15 | 16 | ul { 17 | margin-top: 0; 18 | } 19 | 20 | .admin-icon-yellow { 21 | color: #ffbe40; 22 | } 23 | 24 | .admin-header { 25 | position: fixed; 26 | top: 0; 27 | left: 0; 28 | right: 0; 29 | z-index: 1500; 30 | font-size: 1.4rem; 31 | margin-bottom: 0; 32 | } 33 | 34 | .admin-header-list a:hover :after { 35 | content: none; 36 | } 37 | 38 | .admin-main { 39 | position: relative; 40 | height: 100%; 41 | padding-top: 51px; 42 | background: #f3f3f3; 43 | } 44 | 45 | .admin-menu { 46 | position: fixed; 47 | z-index: 10; 48 | bottom: 30px; 49 | right: 20px; 50 | } 51 | 52 | .admin-sidebar { 53 | width: 260px; 54 | min-height: 100%; 55 | float: left; 56 | border-right: 1px solid #cecece; 57 | } 58 | 59 | .admin-sidebar.am-active { 60 | z-index: 1600; 61 | } 62 | 63 | .admin-sidebar-list { 64 | margin-bottom: 0; 65 | } 66 | 67 | .admin-sidebar-list li a { 68 | color: #5c5c5c; 69 | padding-left: 24px; 70 | } 71 | 72 | .admin-sidebar-list li:first-child { 73 | border-top: none; 74 | } 75 | 76 | .admin-sidebar-sub { 77 | margin-top: 0; 78 | margin-bottom: 0; 79 | box-shadow: 0 16px 8px -15px #e2e2e2 inset; 80 | background: #ececec; 81 | padding-left: 24px; 82 | } 83 | 84 | .admin-sidebar-sub li:first-child { 85 | border-top: 1px solid #dedede; 86 | } 87 | 88 | .admin-sidebar-panel { 89 | margin: 10px; 90 | } 91 | 92 | .admin-content { 93 | display: -webkit-box; 94 | display: -webkit-flex; 95 | display: -ms-flexbox; 96 | display: flex; 97 | -webkit-box-orient: vertical; 98 | -webkit-box-direction: normal; 99 | -webkit-flex-direction: column; 100 | -ms-flex-direction: column; 101 | flex-direction: column; 102 | background: #fff; 103 | } 104 | 105 | .admin-content, 106 | .admin-sidebar { 107 | height: 100%; 108 | overflow-x: hidden; 109 | overflow-y: scroll; 110 | -webkit-overflow-scrolling: touch; 111 | } 112 | 113 | .admin-content-body { 114 | -webkit-box-flex: 1; 115 | -webkit-flex: 1 0 auto; 116 | -ms-flex: 1 0 auto; 117 | flex: 1 0 auto; 118 | } 119 | 120 | .admin-content-footer { 121 | font-size: 85%; 122 | color: #777; 123 | } 124 | 125 | .admin-content-list { 126 | border: 1px solid #e9ecf1; 127 | margin-top: 0; 128 | } 129 | 130 | .admin-content-list li { 131 | border: 1px solid #e9ecf1; 132 | border-width: 0 1px; 133 | margin-left: -1px; 134 | } 135 | 136 | .admin-content-list li:first-child { 137 | border-left: none; 138 | } 139 | 140 | .admin-content-list li:last-child { 141 | border-right: none; 142 | } 143 | 144 | .admin-content-table a { 145 | color: #535353; 146 | } 147 | .admin-content-file { 148 | margin-bottom: 0; 149 | color: #666; 150 | } 151 | 152 | .admin-content-file p { 153 | margin: 0 0 5px 0; 154 | font-size: 1.4rem; 155 | } 156 | 157 | .admin-content-file li { 158 | padding: 10px 0; 159 | } 160 | 161 | .admin-content-file li:first-child { 162 | border-top: none; 163 | } 164 | 165 | .admin-content-file li:last-child { 166 | border-bottom: none; 167 | } 168 | 169 | .admin-content-file li .am-progress { 170 | margin-bottom: 4px; 171 | } 172 | 173 | .admin-content-file li .am-progress-bar { 174 | line-height: 14px; 175 | } 176 | 177 | .admin-content-task { 178 | margin-bottom: 0; 179 | } 180 | 181 | .admin-content-task li { 182 | padding: 5px 0; 183 | border-color: #eee; 184 | } 185 | 186 | .admin-content-task li:first-child { 187 | border-top: none; 188 | } 189 | 190 | .admin-content-task li:last-child { 191 | border-bottom: none; 192 | } 193 | 194 | .admin-task-meta { 195 | font-size: 1.2rem; 196 | color: #999; 197 | } 198 | 199 | .admin-task-bd { 200 | font-size: 1.4rem; 201 | margin-bottom: 5px; 202 | } 203 | 204 | .admin-content-comment { 205 | margin-bottom: 0; 206 | } 207 | 208 | .admin-content-comment .am-comment-bd { 209 | font-size: 1.4rem; 210 | } 211 | 212 | .admin-content-pagination { 213 | margin-bottom: 0; 214 | } 215 | .admin-content-pagination li a { 216 | padding: 4px 8px; 217 | } 218 | 219 | @media only screen and (min-width: 641px) { 220 | .admin-sidebar { 221 | display: block; 222 | position: static; 223 | background: none; 224 | } 225 | 226 | .admin-offcanvas-bar { 227 | position: static; 228 | width: auto; 229 | background: none; 230 | -webkit-transform: translate3d(0, 0, 0); 231 | -ms-transform: translate3d(0, 0, 0); 232 | transform: translate3d(0, 0, 0); 233 | overflow-y: visible; 234 | min-height: 100%; 235 | } 236 | .admin-offcanvas-bar:after { 237 | content: none; 238 | } 239 | } 240 | 241 | @media only screen and (max-width: 640px) { 242 | .admin-sidebar { 243 | width: inherit; 244 | } 245 | 246 | .admin-offcanvas-bar { 247 | background: #f3f3f3; 248 | } 249 | 250 | .admin-offcanvas-bar:after { 251 | background: #BABABA; 252 | } 253 | 254 | .admin-sidebar-list a:hover, .admin-sidebar-list a:active{ 255 | -webkit-transition: background-color .3s ease; 256 | -moz-transition: background-color .3s ease; 257 | -ms-transition: background-color .3s ease; 258 | -o-transition: background-color .3s ease; 259 | transition: background-color .3s ease; 260 | background: #E4E4E4; 261 | } 262 | 263 | .admin-content-list li { 264 | padding: 10px; 265 | border-width: 1px 0; 266 | margin-top: -1px; 267 | } 268 | 269 | .admin-content-list li:first-child { 270 | border-top: none; 271 | } 272 | 273 | .admin-content-list li:last-child { 274 | border-bottom: none; 275 | } 276 | 277 | .admin-form-text { 278 | text-align: left !important; 279 | } 280 | 281 | } 282 | 283 | /* 284 | * user.html css 285 | */ 286 | .user-info { 287 | margin-bottom: 15px; 288 | } 289 | 290 | .user-info .am-progress { 291 | margin-bottom: 4px; 292 | } 293 | 294 | .user-info p { 295 | margin: 5px; 296 | } 297 | 298 | .user-info-order { 299 | font-size: 1.4rem; 300 | } 301 | 302 | /* 303 | * errorLog.html css 304 | */ 305 | 306 | .error-log .am-pre-scrollable { 307 | max-height: 40rem; 308 | } 309 | 310 | /* 311 | * table.html css 312 | */ 313 | 314 | .table-main { 315 | font-size: 1.4rem; 316 | padding: .5rem; 317 | } 318 | 319 | .table-main button { 320 | background: #fff; 321 | } 322 | 323 | .table-check { 324 | width: 30px; 325 | } 326 | 327 | .table-id { 328 | width: 50px; 329 | } 330 | 331 | @media only screen and (max-width: 640px) { 332 | .table-select { 333 | margin-top: 10px; 334 | margin-left: 5px; 335 | } 336 | } 337 | 338 | /* 339 | gallery.html css 340 | */ 341 | 342 | .gallery-list li { 343 | padding: 10px; 344 | } 345 | 346 | .gallery-list a { 347 | color: #666; 348 | } 349 | 350 | .gallery-list a:hover { 351 | color: #3bb4f2; 352 | } 353 | 354 | .gallery-title { 355 | margin-top: 6px; 356 | font-size: 1.4rem; 357 | } 358 | 359 | .gallery-desc { 360 | font-size: 1.2rem; 361 | margin-top: 4px; 362 | } 363 | 364 | /* 365 | 404.html css 366 | */ 367 | 368 | .page-404 { 369 | background: #fff; 370 | border: none; 371 | width: 200px; 372 | margin: 0 auto; 373 | } 374 | --------------------------------------------------------------------------------