注释__何家燕 (#7)

Co-authored-by: pifh2pw87 <3276264739@qq.com>
Co-committed-by: pifh2pw87 <3276264739@qq.com>
develop
pifh2pw87 5 months ago committed by pscmholb5
parent cd8fcbf6d5
commit a60905a41e

@ -1,72 +1,71 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8"> <!-- 设置文档字符编码为UTF-8 -->
<title>借阅者登录页面</title> <title>借阅者登录页面</title> <!-- 设置网页标题 -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <!-- 设置视口属性,使页面在移动设备上显示良好 -->
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 --> <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 --> <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <!-- 可选的 Bootstrap 主题文件(一般不用引入) -->
<!-- 可选的 Bootstrap 主题文件(一般不用引入) --> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> <link rel="stylesheet" href="./public/css/animate.css"> <!-- 引入动画效果的CSS文件 -->
<link rel="stylesheet" href="./public/css/animate.css"> <link rel="stylesheet" href="./public/css/login.css" /> <!-- 引入自定义的登录页面样式表 -->
<link rel="stylesheet" href="./public/css/login.css" /> <style>
<style> button:hover{
button:hover{ background-color:#ffd6e7; /* 鼠标悬停在按钮上时的背景颜色 */
background-color:#ffd6e7; }
} </style>
</style>
</head> </head>
<body> <body>
<div class="container main"> <div class="container main"> <!-- 主容器 -->
<div id="login" class="contain animated fadeInDown"> <div id="login" class="contain animated fadeInDown"> <!-- 登录表单容器,添加了动画效果 -->
<h1>借阅者登录</h1> <h1>借阅者登录</h1> <!-- 页面标题 -->
<form method="post"> <form method="post"> <!-- 登录表单使用POST方法提交数据 -->
<input type="text" name="user" class="form-control my_input" placeholder="请输入账号" required="required"> <input type="text" name="user" class="form-control my_input" placeholder="请输入账号" required="required"> <!-- 用户名输入框 -->
<input type="password" name="psw" class="form-control my_input" placeholder="请输入密码" required="required"> <input type="password" name="psw" class="form-control my_input" placeholder="请输入密码" required="required"> <!-- 密码输入框 -->
<input type="submit" class="form-control" value="登录" onclick="javascript:void(0);"> <input type="submit" class="form-control" value="登录" onclick="javascript:void(0);"><!-- 提交按钮 -->
</form> </form>
</div>
</div> </div>
<div style="position:fixed; bottom:0; right:0;"> </div>
<a href="loginManager.html" target="_blank"><img src="public/image/manager.png" width="50px" height="50px"></a><br> <div style="position:fixed; bottom:0; right:0;"> <!-- 固定位置的链接容器 -->
<a href="adminLogin.html" target="_blank"><img src="public/image/admin.png" width="50px" height="50px"></a> <a href="loginManager.html" target="_blank"><img width="50px" height="50px"></a><br> <!-- 跳转到管理员登录页面的链接 -->
</div> <a href="adminLogin.html" target="_blank"><img width="50px" height="50px"></a> <!-- 跳转到管理员登录页面的链接 -->
<script src="./public/js/layer/layer.js"></script> </div>
<script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <!-- 引入jQuery库 -->
<script src="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.js"></script> <!-- 引入Layer弹窗插件 -->
<script>
$(function(){ $(function(){
//登录 // 登录操作
$("input[type=submit]").click(function(){ $("input[type=submit]").click(function(){
$.ajax({ $.ajax({
url: "./readerLogin", url: "./readerLogin", // 请求的URL地址
type: "post", type: "post", // 请求类型为POST
data: $("form").serialize(), data: $("form").serialize(), // 序列化表单数据
dataType: "json", dataType: "json", // 预期服务器返回的数据类型为JSON
success: function( data ){ success: function(data){ // 成功回调函数
if(data.code == 0){ if(data.code == 0){ // 如果返回的code为0表示登录成功
layer.msg("登录成功", { layer.msg("登录成功", {
icon: 6, icon: 6, // 图标类型为笑脸
time: 1000 time: 1000 // 显示时间为1秒
}, function(){ }, function(){
location.href = data.url; location.href = data.url; // 跳转到指定URL
}) });
}else{ } else { // 如果返回的code不为0表示登录失败
layer.open({ layer.open({
title: "登录失败", title: "登录失败", // 弹窗标题
content: data.msg, content: data.msg, // 弹窗内容为返回的错误信息
icon: 5, icon: 5, // 图标类型为哭脸
anim: 6 anim: 6 // 动画效果
}) });
} }
} }
}) });
return false; return false; // 阻止表单默认提交行为
}) });
}) });
</script> </script>
</body> </body>
</html> </html>

@ -3141,354 +3141,381 @@
transform-origin: left center; transform-origin: left center;
} }
} }
/* 定义一个名为zoomOutLeft的关键帧动画 */
@keyframes zoomOutLeft { @keyframes zoomOutLeft {
/* 在动画的40%时 */
40% { 40% {
opacity: 1; opacity: 1; /* 保持元素完全不透明 */
-webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); /* 缩小并向右移动元素 */
transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); /* 缩小并向右移动元素 */
} }
/* 动画结束时 */
to { to {
opacity: 0; opacity: 0; /* 完全透明 */
-webkit-transform: scale(0.1) translate3d(-2000px, 0, 0); -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0); /* 将元素缩放到非常小并向左移动到视野外 */
transform: scale(0.1) translate3d(-2000px, 0, 0); transform: scale(0.1) translate3d(-2000px, 0, 0); /* 将元素缩放到非常小并向左移动到视野外 */
-webkit-transform-origin: left center; -webkit-transform-origin: left center; /* 设置变换的原点为元素的左中心 */
transform-origin: left center; transform-origin: left center; /* 设置变换的原点为元素的左中心 */
} }
} }
/* 应用zoomOutLeft动画的类 */
.zoomOutLeft { .zoomOutLeft {
-webkit-animation-name: zoomOutLeft; -webkit-animation-name: zoomOutLeft; /* 指定使用zoomOutLeft关键帧动画 */
animation-name: zoomOutLeft; animation-name: zoomOutLeft; /* 指定使用zoomOutLeft关键帧动画 */
} }
/* 定义一个名为zoomOutRight的关键帧动画用于兼容旧版WebKit浏览器 */
@-webkit-keyframes zoomOutRight { @-webkit-keyframes zoomOutRight {
/* 在动画的40%时 */
40% { 40% {
opacity: 1; opacity: 1; /* 保持元素完全不透明 */
-webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); /* 缩小并向左移动元素 */
transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); /* 缩小并向左移动元素 */
} }
/* 动画结束时 */
to { to {
opacity: 0; opacity: 0; /* 完全透明 */
-webkit-transform: scale(0.1) translate3d(2000px, 0, 0); -webkit-transform: scale(0.1) translate3d(2000px, 0, 0); /* 将元素缩放到非常小并向右移动到视野外 */
transform: scale(0.1) translate3d(2000px, 0, 0); transform: scale(0.1) translate3d(2000px, 0, 0); /* 将元素缩放到非常小并向右移动到视野外 */
-webkit-transform-origin: right center; -webkit-transform-origin: right center; /* 设置变换的原点为元素的右中心 */
transform-origin: right center; transform-origin: right center; /* 设置变换的原点为元素的右中心 */
} }
} }
/* 定义一个名为zoomOutRight的关键帧动画 */
@keyframes zoomOutRight { @keyframes zoomOutRight {
/* 在动画的40%时 */
40% { 40% {
opacity: 1; opacity: 1; /* 保持元素完全不透明 */
-webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); /* 缩小并向左移动元素 */
transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); /* 缩小并向左移动元素 */
} }
/* 动画结束时 */
to { to {
opacity: 0; opacity: 0; /* 完全透明 */
-webkit-transform: scale(0.1) translate3d(2000px, 0, 0); -webkit-transform: scale(0.1) translate3d(2000px, 0, 0); /* 将元素缩放到非常小并向右移动到视野外 */
transform: scale(0.1) translate3d(2000px, 0, 0); transform: scale(0.1) translate3d(2000px, 0, 0); /* 将元素缩放到非常小并向右移动到视野外 */
-webkit-transform-origin: right center; -webkit-transform-origin: right center; /* 设置变换的原点为元素的右中心 */
transform-origin: right center; transform-origin: right center; /* 设置变换的原点为元素的右中心 */
} }
} }
/* 应用zoomOutRight动画的类 */
.zoomOutRight { .zoomOutRight {
-webkit-animation-name: zoomOutRight; -webkit-animation-name: zoomOutRight; /* 指定使用zoomOutRight关键帧动画 */
animation-name: zoomOutRight; animation-name: zoomOutRight; /* 指定使用zoomOutRight关键帧动画 */
} }
/* 定义一个名为zoomOutUp的关键帧动画用于兼容旧版WebKit浏览器 */
@-webkit-keyframes zoomOutUp { @-webkit-keyframes zoomOutUp {
/* 在动画的40%时 */
40% { 40% {
opacity: 1; opacity: 1; /* 保持元素完全不透明 */
-webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); /* 缩小并向上移动元素 */
transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); /* 缩小并向上移动元素 */
-webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); /* 自定义缓动函数 */
animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); /* 自定义缓动函数 */
} }
/* 动画结束时 */
to { to {
opacity: 0; opacity: 0; /* 完全透明 */
-webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); /* 将元素缩放到非常小并向下移动到视野外 */
transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); /* 将元素缩放到非常小并向下移动到视野外 */
-webkit-transform-origin: center bottom; -webkit-transform-origin: center bottom; /* 设置变换的原点为元素的底部中心 */
transform-origin: center bottom; transform-origin: center bottom; /* 设置变换的原点为元素的底部中心 */
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); /* 自定义缓动函数 */
animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); /* 自定义缓动函数 */
} }
} }
/* 定义一个名为zoomOutUp的关键帧动画 */
@keyframes zoomOutUp { @keyframes zoomOutUp {
/* 在动画的40%时 */
40% { 40% {
opacity: 1; opacity: 1; /* 保持元素完全不透明 */
-webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); /* 缩小并向上移动元素 */
transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); /* 缩小并向上移动元素 */
-webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); /* 自定义缓动函数 */
animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); /* 自定义缓动函数 */
} }
/* 动画结束时 */
to { to {
opacity: 0; opacity: 0; /* 完全透明 */
-webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); /* 将元素缩放到非常小并向下移动到视野外 */
transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); /* 将元素缩放到非常小并向下移动到视野外 */
-webkit-transform-origin: center bottom; -webkit-transform-origin: center bottom; /* 设置变换的原点为元素的底部中心 */
transform-origin: center bottom; transform-origin: center bottom; /* 设置变换的原点为元素的底部中心 */
-webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); /* 自定义缓动函数 */
animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); /* 自定义缓动函数 */
} }
} }
/* 应用zoomOutUp动画的类 */
.zoomOutUp { .zoomOutUp {
-webkit-animation-name: zoomOutUp; -webkit-animation-name: zoomOutUp; /* 指定使用zoomOutUp关键帧动画 */
animation-name: zoomOutUp; animation-name: zoomOutUp; /* 指定使用zoomOutUp关键帧动画 */
} }
/* 定义一个名为slideInDown的关键帧动画用于兼容旧版WebKit浏览器 */
@-webkit-keyframes slideInDown { @-webkit-keyframes slideInDown {
from { from {
-webkit-transform: translate3d(0, -100%, 0); -webkit-transform: translate3d(0, -100%, 0); /* 从上方开始移动 */
transform: translate3d(0, -100%, 0); transform: translate3d(0, -100%, 0); /* 从上方开始移动 */
visibility: visible; visibility: visible; /* 确保元素可见 */
} }
to { to {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 回到原始位置 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 回到原始位置 */
} }
} }
/* 定义一个名为slideInDown的关键帧动画 */
@keyframes slideInDown { @keyframes slideInDown {
from { from {
-webkit-transform: translate3d(0, -100%, 0); -webkit-transform: translate3d(0, -100%, 0); /* 从上方开始移动 */
transform: translate3d(0, -100%, 0); transform: translate3d(0, -100%, 0); /* 从上方开始移动 */
visibility: visible; visibility: visible; /* 确保元素可见 */
} }
to { to {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 回到原始位置 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 回到原始位置 */
} }
} }
/* 应用slideInDown动画的类 */
.slideInDown { .slideInDown {
-webkit-animation-name: slideInDown; -webkit-animation-name: slideInDown; /* 指定使用slideInDown关键帧动画 */
animation-name: slideInDown; animation-name: slideInDown; /* 指定使用slideInDown关键帧动画 */
} }
/* 定义从左侧滑入的动画 */
@-webkit-keyframes slideInLeft { @-webkit-keyframes slideInLeft {
from { from {
-webkit-transform: translate3d(-100%, 0, 0); -webkit-transform: translate3d(-100%, 0, 0); /* 初始位置在屏幕左侧外 */
transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); /* 初始位置在屏幕左侧外 */
visibility: visible; visibility: visible; /* 元素可见 */
} }
to { to {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
} }
} }
@keyframes slideInLeft { @keyframes slideInLeft {
from { from {
-webkit-transform: translate3d(-100%, 0, 0); -webkit-transform: translate3d(-100%, 0, 0); /* 初始位置在屏幕左侧外 */
transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); /* 初始位置在屏幕左侧外 */
visibility: visible; visibility: visible; /* 元素可见 */
} }
to { to {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
} }
} }
.slideInLeft { .slideInLeft {
-webkit-animation-name: slideInLeft; -webkit-animation-name: slideInLeft; /* 使用slideInLeft动画 */
animation-name: slideInLeft; animation-name: slideInLeft; /* 使用slideInLeft动画 */
} }
/* 定义从右侧滑入的动画 */
@-webkit-keyframes slideInRight { @-webkit-keyframes slideInRight {
from { from {
-webkit-transform: translate3d(100%, 0, 0); -webkit-transform: translate3d(100%, 0, 0); /* 初始位置在屏幕右侧外 */
transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); /* 初始位置在屏幕右侧外 */
visibility: visible; visibility: visible; /* 元素可见 */
} }
to { to {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
} }
} }
@keyframes slideInRight { @keyframes slideInRight {
from { from {
-webkit-transform: translate3d(100%, 0, 0); -webkit-transform: translate3d(100%, 0, 0); /* 初始位置在屏幕右侧外 */
transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); /* 初始位置在屏幕右侧外 */
visibility: visible; visibility: visible; /* 元素可见 */
} }
to { to {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
} }
} }
.slideInRight { .slideInRight {
-webkit-animation-name: slideInRight; -webkit-animation-name: slideInRight; /* 使用slideInRight动画 */
animation-name: slideInRight; animation-name: slideInRight; /* 使用slideInRight动画 */
} }
/* 定义从上方滑入的动画 */
@-webkit-keyframes slideInUp { @-webkit-keyframes slideInUp {
from { from {
-webkit-transform: translate3d(0, 100%, 0); -webkit-transform: translate3d(0, 100%, 0); /* 初始位置在屏幕上方外 */
transform: translate3d(0, 100%, 0); transform: translate3d(0, 100%, 0); /* 初始位置在屏幕上方外 */
visibility: visible; visibility: visible; /* 元素可见 */
} }
to { to {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
} }
} }
@keyframes slideInUp { @keyframes slideInUp {
from { from {
-webkit-transform: translate3d(0, 100%, 0); -webkit-transform: translate3d(0, 100%, 0); /* 初始位置在屏幕上方外 */
transform: translate3d(0, 100%, 0); transform: translate3d(0, 100%, 0); /* 初始位置在屏幕上方外 */
visibility: visible; visibility: visible; /* 元素可见 */
} }
to { to {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 最终位置回到原位 */
} }
} }
.slideInUp { .slideInUp {
-webkit-animation-name: slideInUp; -webkit-animation-name: slideInUp; /* 使用slideInUp动画 */
animation-name: slideInUp; animation-name: slideInUp; /* 使用slideInUp动画 */
} }
/* 定义向下滑动隐藏的动画 */
@-webkit-keyframes slideOutDown { @-webkit-keyframes slideOutDown {
from { from {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 初始位置在原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 初始位置在原位 */
} }
to { to {
visibility: hidden; visibility: hidden; /* 元素不可见 */
-webkit-transform: translate3d(0, 100%, 0); -webkit-transform: translate3d(0, 100%, 0); /* 最终位置在屏幕下方外 */
transform: translate3d(0, 100%, 0); transform: translate3d(0, 100%, 0); /* 最终位置在屏幕下方外 */
} }
} }
@keyframes slideOutDown { @keyframes slideOutDown {
from { from {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 初始位置在原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 初始位置在原位 */
} }
to { to {
visibility: hidden; visibility: hidden; /* 元素不可见 */
-webkit-transform: translate3d(0, 100%, 0); -webkit-transform: translate3d(0, 100%, 0); /* 最终位置在屏幕下方外 */
transform: translate3d(0, 100%, 0); transform: translate3d(0, 100%, 0); /* 最终位置在屏幕下方外 */
} }
} }
.slideOutDown { .slideOutDown {
-webkit-animation-name: slideOutDown; -webkit-animation-name: slideOutDown; /* 使用slideOutDown动画 */
animation-name: slideOutDown; animation-name: slideOutDown; /* 使用slideOutDown动画 */
} }
/* 定义向左滑动隐藏的动画 */
@-webkit-keyframes slideOutLeft { @-webkit-keyframes slideOutLeft {
from { from {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 初始位置在原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 初始位置在原位 */
} }
to { to {
visibility: hidden; visibility: hidden; /* 元素不可见 */
-webkit-transform: translate3d(-100%, 0, 0); -webkit-transform: translate3d(-100%, 0, 0); /* 最终位置在屏幕左侧外 */
transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); /* 最终位置在屏幕左侧外 */
} }
} }
@keyframes slideOutLeft { @keyframes slideOutLeft {
from { from {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 初始位置在原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 初始位置在原位 */
} }
to { to {
visibility: hidden; visibility: hidden; /* 元素不可见 */
-webkit-transform: translate3d(-100%, 0, 0); -webkit-transform: translate3d(-100%, 0, 0); /* 最终位置在屏幕左侧外 */
transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0); /* 最终位置在屏幕左侧外 */
} }
} }
.slideOutLeft { .slideOutLeft {
-webkit-animation-name: slideOutLeft; -webkit-animation-name: slideOutLeft; /* 使用slideOutLeft动画 */
animation-name: slideOutLeft; animation-name: slideOutLeft; /* 使用slideOutLeft动画 */
} }
/* 定义向右滑动隐藏的动画 */
@-webkit-keyframes slideOutRight { @-webkit-keyframes slideOutRight {
from { from {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 初始位置在原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 初始位置在原位 */
} }
to { to {
visibility: hidden; visibility: hidden; /* 元素不可见 */
-webkit-transform: translate3d(100%, 0, 0); -webkit-transform: translate3d(100%, 0, 0); /* 最终位置在屏幕右侧外 */
transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); /* 最终位置在屏幕右侧外 */
} }
} }
@keyframes slideOutRight { @keyframes slideOutRight {
from { from {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 初始位置在原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 初始位置在原位 */
} }
to { to {
visibility: hidden; visibility: hidden; /* 元素不可见 */
-webkit-transform: translate3d(100%, 0, 0); -webkit-transform: translate3d(100%, 0, 0); /* 最终位置在屏幕右侧外 */
transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); /* 最终位置在屏幕右侧外 */
} }
} }
.slideOutRight { .slideOutRight {
-webkit-animation-name: slideOutRight; -webkit-animation-name: slideOutRight; /* 使用slideOutRight动画 */
animation-name: slideOutRight; animation-name: slideOutRight; /* 使用slideOutRight动画 */
} }
/* 定义向上滑动隐藏的动画 */
@-webkit-keyframes slideOutUp { @-webkit-keyframes slideOutUp {
from { from {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 初始位置在原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 初始位置在原位 */
} }
to { to {
visibility: hidden; visibility: hidden; /* 元素不可见 */
-webkit-transform: translate3d(0, -100%, 0); -webkit-transform: translate3d(0, -100%, 0); /* 最终位置在屏幕上方外 */
transform: translate3d(0, -100%, 0); transform: translate3d(0, -100%, 0); /* 最终位置在屏幕上方外 */
} }
} }
@keyframes slideOutUp { @keyframes slideOutUp {
from { from {
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); /* 初始位置在原位 */
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); /* 初始位置在原位 */
} }
to { to {
visibility: hidden; visibility: hidden; /* 元素不可见 */
-webkit-transform: translate3d(0, -100%, 0); -webkit-transform: translate3d(0, -100%, 0); /* 最终位置在屏幕上方外 */
transform: translate3d(0, -100%, 0); transform: translate3d(0, -100%, 0); /* 最终位置在屏幕上方外 */
} }
} }
.slideOutUp { .slideOutUp {
-webkit-animation-name: slideOutUp; -webkit-animation-name: slideOutUp; /* 使用slideOutUp动画 */
animation-name: slideOutUp; animation-name: slideOutUp; /* 使用slideOutUp动画 */
} }

@ -1,156 +1,168 @@
/* General styles for the modal */ /* 设置全局样式,适用于所有模态框 */
/*
Styles for the html/body for special modal where we want 3d effects
Note that we need a container wrapping all content on the page for the
perspective effects (not including the modals and the overlay).
*/
.md-perspective, .md-perspective,
.md-perspective body { .md-perspective body {
height: 100%; height: 100%; /* 设置高度为100% */
overflow: hidden; overflow: hidden; /* 隐藏溢出内容 */
} }
/* 容器样式,用于包裹页面内容以实现透视效果 */
.container { .container {
background: steelblue; background: steelblue; /* 设置背景颜色为钢蓝色 */
min-height: 100%; min-height: 100%; /* 最小高度为100% */
width:100%; width:100%; /* 宽度为100% */
} }
/* 模态框基本样式 */
.md-modal { .md-modal {
position: fixed; position: fixed; /* 固定定位 */
top: 50%; top: 50%; /* 距离顶部50% */
left: 50%; left: 50%; /* 距离左侧50% */
width: 50%; width: 50%; /* 宽度为50% */
max-width: 630px; max-width: 630px; /* 最大宽度为630px */
min-width: 320px; min-width: 320px; /* 最小宽度为320px */
height: auto; height: auto; /* 高度自动 */
z-index: 2000; z-index: 2000; /* z轴索引为2000 */
visibility: hidden; visibility: hidden; /* 初始不可见 */
-webkit-backface-visibility: hidden; -webkit-backface-visibility: hidden; /* Webkit浏览器隐藏背面 */
-moz-backface-visibility: hidden; -moz-backface-visibility: hidden; /* Firefox浏览器隐藏背面 */
backface-visibility: hidden; backface-visibility: hidden; /* 标准方式隐藏背面 */
-webkit-transform: translateX(-50%) translateY(-50%); -webkit-transform: translateX(-50%) translateY(-50%); /* Webkit浏览器居中 */
-moz-transform: translateX(-50%) translateY(-50%); -moz-transform: translateX(-50%) translateY(-50%); /* Firefox浏览器居中 */
-ms-transform: translateX(-50%) translateY(-50%); -ms-transform: translateX(-50%) translateY(-50%); /* IE浏览器居中 */
transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); /* 标准方式居中 */
} }
/* 显示模态框时的样式 */
.md-show { .md-show {
visibility: visible; visibility: visible; /* 设置为可见 */
} }
/* 遮罩层样式 */
.md-overlay { .md-overlay {
position: fixed; position: fixed; /* 固定定位 */
width: 100%; width: 100%; /* 宽度为100% */
height: 100%; height: 100%; /* 高度为100% */
visibility: hidden; visibility: hidden; /* 初始不可见 */
top: 0; top: 0; /* 距离顶部0 */
left: 0; left: 0; /* 距离左侧0 */
z-index: 1000; z-index: 1000; /* z轴索引为1000 */
opacity: 0; opacity: 0; /* 初始透明度为0 */
background: rgba(232, 232, 232, 0.5); background: rgba(232, 232, 232, 0.5); /* 背景色和透明度 */
-webkit-transition: all 0.3s; -webkit-transition: all 0.3s; /* Webkit浏览器过渡效果 */
-moz-transition: all 0.3s; -moz-transition: all 0.3s; /* Firefox浏览器过渡效果 */
transition: all 0.3s; transition: all 0.3s; /* 标准方式过渡效果 */
} }
/* 当模态框显示时,遮罩层的样式 */
.md-show ~ .md-overlay { .md-show ~ .md-overlay {
opacity: 1; opacity: 1; /* 透明度为1 */
visibility: visible; visibility: visible; /* 设置为可见 */
} }
/* Content styles */ /* 内容区域样式 */
.md-content { .md-content {
color: black; color: black; /* 文字颜色为黑色 */
background: lightblue; background: lightblue; /* 背景色为浅蓝色 */
position: relative; position: relative; /* 相对定位 */
border-radius: 3px; border-radius: 3px; /* 圆角半径为3px */
margin: 0 auto; margin: 0 auto; /* 水平居中 */
} }
/* 标题样式 */
.md-content h3 { .md-content h3 {
margin: 0; margin: 0; /* 外边距为0 */
padding: 0.4em; padding: 0.4em; /* 内边距为0.4em */
text-align: center; text-align: center; /* 文本居中 */
font-size: 2.4em; font-size: 2.4em; /* 字体大小为2.4em */
font-weight: 300; font-weight: 300; /* 字体粗细为300 */
opacity: 0.8; opacity: 0.8; /* 透明度为0.8 */
background: rgba(0,0,0,0.1); background: rgba(0,0,0,0.1); /* 背景色和透明度 */
border-radius: 3px 3px 0 0; border-radius: 3px 3px 0 0; /* 圆角半径上左和上右为3px下左和下右为0 */
} }
/* 内容区域的子元素样式 */
.md-content > div { .md-content > div {
padding: 15px 40px 30px; padding: 15px 40px 30px; /* 内边距 */
margin: 0; margin: 0; /* 外边距为0 */
font-weight: 300; font-weight: 300; /* 字体粗细为300 */
font-size: 1.15em; font-size: 1.15em; /* 字体大小为1.15em */
} }
/* 内容区域内的段落样式 */
.md-content > div p { .md-content > div p {
margin: 0; margin: 0; /* 外边距为0 */
padding: 10px 0; padding: 10px 0; /* 内边距为10px 0 */
} }
/* 内容区域内的无序列表样式 */
.md-content > div ul { .md-content > div ul {
margin: 0; margin: 0; /* 外边距为0 */
padding: 0 0 30px 20px; padding: 0 0 30px 20px; /* 内边距为0 0 30px 20px */
} }
/* 列表项样式 */
.md-content > div ul li { .md-content > div ul li {
padding: 5px 0; padding: 5px 0; /* 内边距为5px 0 */
} }
/* 按钮样式 */
.md-content button { .md-content button {
display: block; display: block; /* 块级显示 */
margin: 0 auto; margin: 0 auto; /* 水平居中 */
font-size: 0.8em; font-size: 0.8em; /* 字体大小为0.8em */
} }
/* Individual modal styles with animations/transitions */ /* 特效133D切片效果 */
/* Effect 13: 3D slit */
.md-effect-13.md-modal { .md-effect-13.md-modal {
-webkit-perspective: 1300px; -webkit-perspective: 1300px; /* Webkit浏览器透视效果 */
-moz-perspective: 1300px; -moz-perspective: 1300px; /* Firefox浏览器透视效果 */
perspective: 1300px; perspective: 1300px; /* 标准方式透视效果 */
} }
/* 特效13的内容样式 */
.md-effect-13 .md-content { .md-effect-13 .md-content {
-webkit-transform-style: preserve-3d; -webkit-transform-style: preserve-3d; /* Webkit浏览器保留3D变换 */
-moz-transform-style: preserve-3d; -moz-transform-style: preserve-3d; /* Firefox浏览器保留3D变换 */
transform-style: preserve-3d; transform-style: preserve-3d; /* 标准方式保留3D变换 */
-webkit-transform: translateZ(-3000px) rotateY(90deg); -webkit-transform: translateZ(-3000px) rotateY(90deg); /* Webkit浏览器初始位置和旋转角度 */
-moz-transform: translateZ(-3000px) rotateY(90deg); -moz-transform: translateZ(-3000px) rotateY(90deg); /* Firefox浏览器初始位置和旋转角度 */
-ms-transform: translateZ(-3000px) rotateY(90deg); -ms-transform: translateZ(-3000px) rotateY(90deg); /* IE浏览器初始位置和旋转角度 */
transform: translateZ(-3000px) rotateY(90deg); transform: translateZ(-3000px) rotateY(90deg); /* 标准方式初始位置和旋转角度 */
opacity: 0; opacity: 0; /* 初始透明度为0 */
} }
/* 显示特效13时的动画效果 */
.md-show.md-effect-13 .md-content { .md-show.md-effect-13 .md-content {
-webkit-animation: slit .7s forwards ease-out; -webkit-animation: slit .7s forwards ease-out; /* Webkit浏览器动画效果 */
-moz-animation: slit .7s forwards ease-out; -moz-animation: slit .7s forwards ease-out; /* Firefox浏览器动画效果 */
animation: slit .7s forwards ease-out; animation: slit .7s forwards ease-out; /* 标准方式动画效果 */
} }
/* Webkit浏览器的动画关键帧 */
@-webkit-keyframes slit { @-webkit-keyframes slit {
50% { -webkit-transform: translateZ(-250px) rotateY(89deg); opacity: .5; -webkit-animation-timing-function: ease-out;} 50% { -webkit-transform: translateZ(-250px) rotateY(89deg); opacity: .5; -webkit-animation-timing-function: ease-out;} /* 中间状态 */
100% { -webkit-transform: translateZ(0) rotateY(0deg); opacity: 1; } 100% { -webkit-transform: translateZ(0) rotateY(0deg); opacity: 1; } /* 结束状态 */
} }
/* Firefox浏览器的动画关键帧 */
@-moz-keyframes slit { @-moz-keyframes slit {
50% { -moz-transform: translateZ(-250px) rotateY(89deg); opacity: .5; -moz-animation-timing-function: ease-out;} 50% { -moz-transform: translateZ(-250px) rotateY(89deg); opacity: .5; -moz-animation-timing-function: ease-out;} /* 中间状态 */
100% { -moz-transform: translateZ(0) rotateY(0deg); opacity: 1; } 100% { -moz-transform: translateZ(0) rotateY(0deg); opacity: 1; } /* 结束状态 */
} }
@keyframes slit { /* IE浏览器的动画关键帧 */
50% { transform: translateZ(-250px) rotateY(89deg); opacity: 1; animation-timing-function: ease-in;} @-ms-keyframes slit {
100% { transform: translateZ(0) rotateY(0deg); opacity: 1; } 50% { -ms-transform: translateZ(-250px) rotateY(89deg); opacity: .5; -ms-animation-timing-function: ease-out;} /* 中间状态 */
100% { -ms-transform: translateZ(0) rotateY(0deg); opacity: 1; } /* 结束状态 */
} }
/* 标准方式的动画关键帧 */
@keyframes slit {
50% { transform: translateZ(-250px) rotateY(89deg); opacity:1; animation-timing-function: ease-in;} /* 中间状态 */
100% { transform: translateZ(0) rotateY(0deg); opacity: 1; } /* 结束状态 */
}
/* 如果屏幕宽度小于或等于32em则调整字体大小 */
@media screen and (max-width: 32em) { @media screen and (max-width: 32em) {
body { font-size: 75%; } body { font-size: 75%; } /* 字体大小缩小到75% */
} }

@ -1,45 +1,50 @@
/* General Demo Style */ /* 导入Lato字体 */
@import url(http://fonts.googleapis.com/css?family=Lato:300,400,700); @import url(http://fonts.googleapis.com/css?family=Lato:300,400,700);
/* 定义codropsicons字体 */
@font-face { @font-face {
font-family: 'codropsicons'; font-family: 'codropsicons';
src:url('../fonts/codropsicons/codropsicons.eot'); src:url('../fonts/codropsicons/codropsicons.eot');
src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'), src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'),
url('../fonts/codropsicons/codropsicons.woff') format('woff'), url('../fonts/codropsicons/codropsicons.woff') format('woff'),
url('../fonts/codropsicons/codropsicons.ttf') format('truetype'), url('../fonts/codropsicons/codropsicons.ttf') format('truetype'),
url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg'); url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg');
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }
/* 设置所有元素的盒模型为border-box */
*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } *, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
/* 设置body和html的默认样式 */
body, html { font-size: 100%; padding: 0; margin: 0; } body, html { font-size: 100%; padding: 0; margin: 0; }
/* Clearfix hack by Nicolas Gallagher: http://nicolasgallagher.com/micro-clearfix-hack/ */ /* Clearfix hack,用于清除浮动 */
.clearfix:before, .clearfix:after { content: " "; display: table; } .clearfix:before, .clearfix:after { content: " "; display: table; }
.clearfix:after { clear: both; } .clearfix:after { clear: both; }
/* 设置body的字体、颜色和背景色 */
body { body {
font-family: 'Lato', Calibri, Arial, sans-serif; font-family: 'Lato', Calibri, Arial, sans-serif;
color: #fff; color: #fff;
background: lightblue; background: lightblue;
} }
/* 主内容和头部容器的样式 */
/* Header Style */
.main, .main,
.container > header { .container > header {
margin: 0 auto; margin: 0 auto;
padding: 2em; padding: 2em;
} }
/* 头部容器的文本对齐和背景色 */
.container > header { .container > header {
text-align: center; text-align: center;
background: lightblue; background: lightblue;
padding: 3em; padding: 3em;
} }
/* 头部标题的字体大小和行高 */
.container > header h1 { .container > header h1 {
font-size: 2.625em; font-size: 2.625em;
line-height: 1.3; line-height: 1.3;
@ -47,17 +52,19 @@ body {
font-weight: 300; font-weight: 300;
} }
/* 头部副标题的样式 */
.container > header span { .container > header span {
display: block; display: block;
opacity: 0.7; opacity: 0.7;
padding: 0 0 0.6em 0.1em; padding: 0 0 0.6em 0.1em;
} }
/* Main Content */ /* 主内容的宽度限制 */
.main { .main {
max-width: 69em; max-width: 69em;
} }
/* 列的样式 */
.column { .column {
float: left; float: left;
width: 50%; width: 50%;
@ -66,10 +73,12 @@ body {
position: relative; position: relative;
} }
/* 第二列的阴影效果 */
.column:nth-child(2) { .column:nth-child(2) {
box-shadow: -1px 0 0 rgba(0,0,0,0.1); box-shadow: -1px 0 0 rgba(0,0,0,0.1);
} }
/* 列中段落的样式 */
.column p { .column p {
font-weight: 300; font-weight: 300;
font-size: 2em; font-size: 2em;
@ -79,11 +88,7 @@ body {
line-height: 1.5; line-height: 1.5;
} }
/* To Navigation Style */ /* 按钮的样式 */
button { button {
border: none; border: none;
padding: 0.6em 1.2em; padding: 0.6em 1.2em;
@ -99,32 +104,33 @@ button {
border-radius: 2px; border-radius: 2px;
} }
/* 按钮悬停时的样式 */
button:hover { button:hover {
background: cornflowerblue; background: cornflowerblue;
} }
/* 媒体查询屏幕宽度小于等于46.0625em时 */
@media screen and (max-width: 46.0625em) { @media screen and (max-width: 46.0625em) {
.column { .column {
width: 100%; width: 100%; /* 列宽变为100% */
min-width: auto; min-width: auto; /* 最小宽度自动 */
min-height: auto; min-height: auto; /* 最小高度自动 */
padding: 1em; padding: 1em; /* 内边距增加 */
} }
.column p { .column p {
text-align: left; text-align: left; /* 段落左对齐 */
font-size: 1.5em; font-size: 1.5em; /* 字体大小减小 */
} }
.column:nth-child(2) { .column:nth-child(2) {
box-shadow: 0 -1px 0 rgba(0,0,0,0.1); box-shadow: 0 -1px 0 rgba(0,0,0,0.1); /* 阴影方向改变 */
} }
} }
/* 媒体查询屏幕宽度小于等于25em时 */
@media screen and (max-width: 25em) { @media screen and (max-width: 25em) {
.codrops-icon span { .codrops-icon span {
display: none; display: none; /* 隐藏图标描述文字 */
} }
}
}

@ -1,48 +1,53 @@
body{ body {
background-color: #f5f5f5; background-color: #f5f5f5; /* 设置页面背景颜色为浅灰色 */
} }
.main{
margin-top: 150px; .main {
font-family: system-ui,cursive,sans-serif; margin-top: 150px; /* 设置主内容区域的上边距为150像素 */
} font-family: system-ui, cursive, sans-serif; /* 设置字体样式优先使用系统默认UI字体其次是手写体和无衬线体 */
#login{ }
max-width: 500px;
margin: 0 auto; #login {
padding:25px 45px 45px 45px; max-width: 500px; /* 设置登录框的最大宽度为500像素 */
box-shadow: 8px 8px #b3e5fc; margin: 0 auto; /* 水平居中对齐 */
border-radius: 15px; padding: 25px 45px 45px 45px; /* 设置内边距上、右、下、左均为45像素 */
background-image: -webkit-linear-gradient(top left, #ffd6e7, #cdfcf9); box-shadow: 8px 8px #b3e5fc; /* 设置阴影效果偏移量为8像素颜色为#b3e5fc */
background-image: -o-linear-gradient(top left, #ffd6e7, #cdfcf9); border-radius: 15px; /* 设置边框圆角半径为15像素 */
background-image: linear-gradient(to bottom right, #ffd6e7, #cdfcf9); background-image: -webkit-linear-gradient(to top left, #ffd6e7, #cdfcf9); /* 设置背景渐变色,从左上角到右下角,颜色从#ffd6e7渐变到#cdfcf9 */
font-size: 16px; background-image: -o-linear-gradient(to top left, #ffd6e7, #cdfcf9); /* 兼容旧版Opera浏览器的渐变色设置 */
} background-image: linear-gradient(to bottom right, #ffd6e7, #cdfcf9); /* 标准渐变色设置,从左下角到右上角,颜色从#ffd6e7渐变到#cdfcf9 */
#login h1{ font-size: 16px; /* 设置字体大小为16像素 */
color: #4dd0e1; }
text-align: center;
font-size: 30px; #login h1 {
} color: #4dd0e1; /* 设置标题文字颜色为#4dd0e1 */
#login .my_input{ text-align: center; /* 文本居中对齐 */
margin-top: 25px; font-size: 30px; /* 设置标题字体大小为30像素 */
border: none; }
background-color: rgba(0,0,0,0);
box-shadow: none;
border-bottom: 2px solid white;
border-radius: 0px;
font-size: 20px;
transition: all 0.3s;
}
#login .my_input:hover{
border-bottom: 2px solid #ff9c6e;
}
#login input[type=submit]{
margin-top: 45px;
background-color: #fce4ec;
font-size: 18px;
transition: all 0.5s;
border-radius: 15px;
}
#login input[type=submit]:hover{
background-color: #ffd6e7;
} #login .my_input {
margin-top: 25px; /* 设置输入框的上边距为25像素 */
border: none; /* 移除边框 */
background-color: rgba(0, 0, 0, 0); /* 设置背景颜色为透明 */
box-shadow: none; /* 移除阴影效果 */
border-bottom: 2px solid white; /* 设置底部边框为2像素宽的白色实线 */
border-radius: 0px; /* 设置边框圆角半径为0像素 */
font-size: 20px; /* 设置字体大小为20像素 */
transition: all 0.3s; /* 设置所有属性的过渡时间为0.3秒 */
}
#login .my_input:hover {
border-bottom: 2px solid #ff9c6e; /* 当鼠标悬停时底部边框变为2像素宽的橙色实线 */
}
#login input[type=submit] {
margin-top: 45px; /* 设置提交按钮的上边距为45像素 */
background-color: #fce4ec; /* 设置按钮背景颜色为#fce4ec */
font-size: 18px; /* 设置按钮字体大小为18像素 */
transition: all 0.5s; /* 设置所有属性的过渡时间为0.5秒 */
border-radius: 15px; /* 设置按钮边框圆角半径为15像素 */
}
#login input[type=submit]:hover {
background-color: #ffd6e7; /* 当鼠标悬停时,按钮背景颜色变为#ffd6e7 */
}

@ -1,133 +1,141 @@
body{ body {
background: white; background: white; /* 设置背景颜色为白色 */
color: #DDD; color: #DDD; /* 设置文本颜色为浅灰色 */
font-family: 'Helvetica', 'Lucida Grande', 'Arial', sans-serif; font-family: 'Helvetica', 'Lucida Grande', 'Arial', sans-serif; /* 设置字体 */
} }
.border{
height: 99%; .border {
width: 30%; height: 99%; /* 设置高度为父容器的99% */
width: 30%; /* 设置宽度为父容器的30% */
} }
.rain{
height: 400px; .rain {
width: 35%; height: 400px; /* 设置固定高度为400像素 */
width: 35%; /* 设置宽度为父容器的35% */
} }
/* Layout with mask */
.rain{ /* 使用遮罩布局 */
padding: 10px 12px 12px 10px; .rain {
-moz-box-shadow: 10px 10px 10px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; padding: 10px 12px 12px 10px; /* 设置内边距 */
-webkit-box-shadow: 8px 8px 8px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; -moz-box-shadow: 10px 10px 10px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; /* Firefox阴影效果 */
box-shadow: 8px 8px 8px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; -webkit-box-shadow: 8px 8px 8px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; /* Webkit阴影效果 */
margin: 100px auto; box-shadow: 8px 8px 8px rgba(255,255,255,1) inset, -9px -9px 8px rgba(255,255,255,1) inset; /* 标准阴影效果 */
margin: 100px auto; /* 设置外边距,使元素居中 */
} }
/* Artifical "border" to clear border to bypass mask */
.border{ /* 人工“边框”以清除遮罩 */
padding: 1px; .border {
-moz-border-radius: 5px; padding: 1px; /* 设置内边距 */
-webkit-border-radius: 5px; -moz-border-radius: 5px; /* Firefox圆角效果 */
border-radius: 5px; -webkit-border-radius: 5px; /* Webkit圆角效果 */
border-radius: 5px; /* 标准圆角效果 */
} }
.border, .border,
.rain, .rain,
.border.start, .border.start,
.rain.start{ .rain.start {
background-repeat: repeat-x, repeat-x, repeat-x, repeat-x; background-repeat: repeat-x, repeat-x, repeat-x, repeat-x; /* 设置背景重复模式 */
background-position: 0 0, 0 0, 0 0, 0 0; background-position: 0 0, 0 0, 0 0, 0 0; /* 设置背景位置 */
/* Blue-ish Green Fallback for Mozilla */ /* Firefox下的蓝色渐变背景 */
background-image: -moz-linear-gradient(left, #09BA5E 0%, #00C7CE 15%, #3472CF 26%, #00C7CE 48%, #0CCF91 91%, #09BA5E 100%); background-image: -moz-linear-gradient(left, #09BA5E 0%, #00C7CE 15%, #3472CF 26%, #00C7CE 48%, #0CCF91 91%, #09BA5E 100%);
/* Add "Highlight" Texture to the Animation */ /* 添加动画纹理 */
background-image: -webkit-gradient(linear, left top, right top, color-stop(1%,rgba(0,0,0,.3)), color-stop(23%,rgba(0,0,0,.1)), color-stop(40%,rgba(255,231,87,.1)), color-stop(61%,rgba(255,231,87,.2)), color-stop(70%,rgba(255,231,87,.1)), color-stop(80%,rgba(0,0,0,.1)), color-stop(100%,rgba(0,0,0,.25))); background-image: -webkit-gradient(linear, left top, right top, color-stop(1%,rgba(0,0,0,.3)), color-stop(23%,rgba(0,0,0,.1)), color-stop(40%,rgba(255,231,87,.1)), color-stop(61%,rgba(255,231,87,.2)), color-stop(70%,rgba(255,231,87,.1)), color-stop(80%,rgba(0,0,0,.1)), color-stop(100%,rgba(0,0,0,.25)));
/* Starting Color */ /* 起始颜色 */
background-color: #39f; background-color: #39f;
/* Just do something for IE-suck */ /* IE滤镜效果 */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00BA1B', endColorstr='#00BA1B',GradientType=1 ); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00BA1B', endColorstr='#00BA1B',GradientType=1 );
} }
/* Non-keyframe fallback animation */ /* 非关键帧动画回退 */
.border.end, .border.end,
.rain.end{ .rain.end {
-moz-transition-property: background-position; -moz-transition-property: background-position; /* Firefox过渡属性 */
-moz-transition-duration: 30s; -moz-transition-duration: 30s; /* Firefox过渡持续时间 */
-moz-transition-timing-function: linear; -moz-transition-timing-function: linear; /* Firefox过渡时间函数 */
-webkit-transition-property: background-position; -webkit-transition-property: background-position; /* Webkit过渡属性 */
-webkit-transition-duration: 30s; -webkit-transition-duration: 30s; /* Webkit过渡持续时间 */
-webkit-transition-timing-function: linear; -webkit-transition-timing-function: linear; /* Webkit过渡时间函数 */
-o-transition-property: background-position; -o-transition-property: background-position; /* Opera过渡属性 */
-o-transition-duration: 30s; -o-transition-duration: 30s; /* Opera过渡持续时间 */
-o-transition-timing-function: linear; -o-transition-timing-function: linear; /* Opera过渡时间函数 */
transition-property: background-position; transition-property: background-position; /* 标准过渡属性 */
transition-duration: 30s; transition-duration: 30s; /* 标准过渡持续时间 */
transition-timing-function: linear; transition-timing-function: linear; /* 标准过渡时间函数 */
background-position: -5400px 0, -4600px 0, -3800px 0, -3000px 0; background-position: -5400px 0, -4800px 0, -4200px 0, -3600px 0; /* 设置背景位置 */
} }
/* Keyfram-licious animation */ /* 关键帧动画 */
@-webkit-keyframes colors { @-webkit-keyframes colors {
0% {background-color: pink;} 0% {background: pink;} /* 开始时的颜色 */
15% {background-color: hotpink;} 15% {background: hotpink;} /* 15%时的颜色 */
30% {background-color: rosybrown;} 30% {background: rosybrown;} /* 30%时的颜色 */
45% {background-color: steelblue;} 45% {background: steelblue;} /* 45%时的颜色 */
60% {background-color: black;} 60% {background: black;} /* 60%时的颜色 */
75% {background-color: #c9c0d3;} 75% {background: #c9c0d3;} /* 75%时的颜色 */
90% {background-color: darkgreen;} 90% {background: darkgreen;} /* 90%时的颜色 */
100% {background-color: orange;} 100% {background: orange;} /* 结束时的颜色 */
} }
.border,.rain{
-webkit-animation-direction: normal; .border,
-webkit-animation-duration: 20s; .rain {
-webkit-animation-iteration-count: infinite; -webkit-animation-direction: normal; /* Webkit动画方向 */
-webkit-animation-name: colors; -webkit-animation-duration: 20s; /* Webkit动画持续时间 */
-webkit-animation-timing-function: ease; -webkit-animation-iteration-count: infinite; /* Webkit动画迭代次数 */
-webkit-animation-timing-function: ease; /* Webkit动画时间函数 */
-webkit-animation-name: colors; /* Webkit动画名称 */
} }
/* In-Active State Style */ /* 无焦点状态样式 */
.border.unfocus{ .border.unfocus {
background: #333 !important; background: #333 !important; /* 强制背景颜色 */
-moz-box-shadow: 0px 0px 15px rgba(255,255,255,.2); -moz-box-shadow: 0px 0px 15px rgba(255,255,255,.2) inset; /* Firefox阴影效果 */
-webkit-box-shadow: 0px 0px 15px rgba(255,255,255,.2); -webkit-box-shadow: 0px 0px 15px rgba(255,255,255,.2) inset; /* Webkit阴影效果 */
box-shadow: 0px 0px 15px rgba(255,255,255,.2); box-shadow: 0px 0px 15px rgba(255,255,255,.2) inset; /* 标准阴影效果 */
-webkit-animation-name: none; -webkit-animation-name: none; /* Webkit无动画 */
} }
.rain.unfocus{
background: #000 !important; .rain.unfocus {
-webkit-animation-name: none; background: #000 !important; /* 强制背景颜色 */
-webkit-animation-name: none; /* Webkit无动画 */
} }
/* Regular Form Styles */ /* 表单样式 */
form{ form {
background: darkred; background: darkred; /* 设置背景颜色为深红色 */
-moz-border-radius: 5px; -moz-border-radius: 5px; /* Firefox圆角效果 */
-webkit-border-radius: 5px; -webkit-border-radius: 5px; /* Webkit圆角效果 */
border-radius: 5px; border-radius: 5px; /* 标准圆角效果 */
height: 100%; height: 100%; /* 设置高度为父容器的100% */
width: 335%; width: 335%; /* 设置宽度为父容器的335% */
background: -moz-radial-gradient(50% 46% 90deg,circle closest-corner, white, lightblue); background: -moz-radial-gradient(center 46% 90deg, closest-corner, white, lightblue); /* Firefox径向渐变背景 */
background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 150, from(lightcyan), to(lightblue)); background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 150, from(lightcyan), to(lightblue));/* Webkit径向渐变背景 */
} }
form label{
display: block; form label {
padding: 10px 10px 5px 15px; display: block; /* 块级显示 */
font-size: 20px; padding: 10px 15px 10px 15px; /* 设置内边距 */
color: hotpink; font-size: 20px; /* 设置字体大小 */
color: hotpink; /* 设置字体颜色 */
} }
form textarea{ form input {
display: block; display: block; /* 块级显示 */
margin: 5px 10px 10px 15px; margin: 5px 10px 10px 15px; /* 设置外边距 */
width: 85%; width: 85%; /* 设置宽度为父容器的85% */
background: #f0f8ff; background: #f0f8ff; /* 设置背景颜色 */
-moz-box-shadow: 0px 0px 4px grey inset; -moz-box-shadow: 0px 0px 4px grey inset; /* Firefox阴影效果 */
-webkit-box-shadow: 0px 0px 4px grey inset; -webkit-box-shadow: 0px 0px 4px grey inset; /* Webkit阴影效果 */
box-shadow: 0px 0px 4px grey inset; box-shadow: 0px 0px 4px grey inset; /* 标准阴影效果 */
outline: 1px solid black; outline: 1px solid black; /* 设置轮廓线 */
border: 1px solid grey; border: 1px solid grey; /* 设置边框 */
padding: 5px; padding: 5px; /* 设置内边距 */
color: black; color: black; /* 设置字体颜色 */
font-size: 16px; font-size: 16px; /* 设置字体大小 */
} }
form textarea:focus{
outline: 2px solid white; form input:focus {
color: #c0c0c0; outline: 2px solid white; /* 设置聚焦时的轮廓线 */
background-color: white; color: #c0c0c0; /* 设置聚焦时的字体颜色 */
background-color: white; /* 设置聚焦时的背景颜色 */
} }

@ -1,91 +1,94 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title></title> <title></title>
<!-- Bootstrap --> <!-- 引入Bootstrap CSS -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- 引入jQueryBootstrap的JavaScript插件依赖于jQuery -->
<script src="../js/jquery.min.js"></script> <script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script> <!-- 引入Bootstrap JavaScript -->
<style> <script src="../js/bootstrap.min.js"></script>
.showCarousel .carousel-inner > .item > img {
display: block; <style>
width:100%; /* 轮播图图片样式 */
height:620px; .showCarousel .carousel-inner > .item > img {
} display: block;
.showCarousel{ width:100%;
margin-top:2%; height:620px;
} }
font{ /* 轮播图顶部间距 */
font-size:40px; .showCarousel{
color:black; margin-top:2%;
font-family:YouYuan; }
font-weight:900; /* 字体样式 */
} font{
.carousel-caption{ font-size:40px;
margin-bottom:10%; color:black;
} font-family:YouYuan;
</style> font-weight:900;
}
/* 轮播图文字描述底部间距 */
.carousel-caption{
margin-bottom:10%;
}
</style>
</head> </head>
<body> <body>
<% <%
if(session.getAttribute("reader")!=null && session.getAttribute("reader_first")!=null &&session.getAttribute("reader_first").equals("1")){ // 检查会话属性 'reader' 和 'reader_first' 是否不为空且 'reader_first' 等于 "1"
session.setAttribute("reader_first", "2"); if(session.getAttribute("reader") != null && session.getAttribute("reader_first") != null && session.getAttribute("reader_first").equals("1")){
//session.setAttribute("reader", session.getAttribute("reader")); // 将 'reader_first' 设置为 "2",表示用户已经访问过
session.setAttribute("reader_first", "2");
// 可选地,可以在会话中保留 reader 属性
// session.setAttribute("reader", session.getAttribute("reader"));
}
%> %>
<script>window.parent.location.href = "./04readerFrame.jsp";</script>
<%
}
%>
<!-- 轮播组件 -->
<div id="carousel-example-generic" class="carousel slide showCarousel" data-ride="carousel" data-interval="2000" style="width:96%;margin-left:2%;"> <div id="carousel-example-generic" class="carousel slide showCarousel" data-ride="carousel" data-interval="2000" style="width:96%;margin-left:2%;">
<!-- Indicators --> <!-- 指示器 -->
<ol class="carousel-indicators"> <ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li> <li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li> <li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol> </ol>
<!-- Wrapper for slides --> <!-- 轮播内容 -->
<div class="carousel-inner" role="listbox"> <div class="carousel-inner" role="listbox">
<div class="item active"> <div class="item active">
<img src="../public/image/1.jpg" alt="..."> <img src="path/to/image1.jpg" alt="..."> <!-- 在这里添加你的图片路径 -->
<div class="carousel-caption"> <div class="carousel-caption">
<font style="color:white;">唯有知识永不负你!</font> <font style="color:white;">唯有知识永不负你!</font>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<img src="../public/image/2.jpg" alt="..."> <img src="path/to/image2.jpg" alt="..."> <!-- 在这里添加你的图片路径 -->
<div class="carousel-caption"> <div class="carousel-caption">
<font style="color:white;">学海无涯,书韵悠扬</font> <font style="color:white;">学海无涯,书韵悠扬</font>
</div> </div>
</div> </div>
<div class="item"> <div class="item">
<img src="../public/image/3.jpg" alt="..."> <img src="path/to/image3.jpg" alt="..."> <!-- 在这里添加你的图片路径 -->
<div class="carousel-caption"> <div class="carousel-caption">
<font style="color:white;">图一份神闲气静,书几笔悦目赏心</font> <font style="color:white;">图一份神闲气静,书几笔悦目赏心</font>
</div> </div>
</div>
</div> </div>
</div>
<!-- Controls --> <!-- 控制按钮 -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span> <span class="sr-only">Previous</span>
</a> </a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span> <span class="sr-only">Next</span>
</a> </a>
</div> </div>
</body> </body>
</html> </html>

@ -1,61 +1,64 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title></title> <title></title>
<!-- Bootstrap --> <!-- 引入Bootstrap的CSS文件 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<style>
</style> <style>
</style>
</head> </head>
<body> <body>
<nav class="navbar navbar-inverse" role="navigation"> <!-- 导航栏 -->
<div class="container-fluid"> <nav class="navbar navbar-inverse" role="navigation">
<!-- Brand and toggle get grouped for better mobile display --> <div class="container-fluid">
<div class="navbar-header"> <!-- Brand and toggle get grouped for better mobile display -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <div class="navbar-header">
<span class="sr-only">Toggle navigation</span> <!-- 折叠按钮,用于在小屏幕设备上显示菜单 -->
<span class="icon-bar"></span> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="icon-bar"></span> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> <span class="icon-bar"></span>
<a class="navbar-brand" href="#">欢迎登陆图书管理系统</a> <span class="icon-bar"></span>
</div> </button>
<!-- 网站标题 -->
<a class="navbar-brand" href="#">欢迎登陆图书管理系统</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<!-- 左侧导航链接 -->
<ul class="nav navbar-nav">
<li><p style="margin-top:25%;color:grey;">借阅者页面<span class="sr-only">(current)</span></p></li>
</ul>
<!-- Collect the nav links, forms, and other content for toggling --> <!-- 右侧导航链接 -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right">
<ul class="nav navbar-nav"> <li><a href=";">
<li><p style="margin-top:25%;color:grey;">借阅者页面<span class="sr-only">(current)</span></p></li> <!-- 如果session中没有reader属性则不显示任何内容否则显示reader的值 -->
</ul> <%if(session.getAttribute("reader")==null){
// 空操作
<ul class="nav navbar-nav navbar-right">
<li><a href="javascript:;">
<%if(session.getAttribute("reader")==null){
} else{%> } else{%>
<%=session.getAttribute("reader") %> <%=session.getAttribute("reader") %>
<%} %> <%} %>
</a></li> </a></li>
<%if(session.getAttribute("reader") !=null) {%> <!-- 如果session中有reader属性则显示退出链接否则显示登录链接 -->
<li><a href="./exit" target="_parent">退出</a></li> <%if(session.getAttribute("reader") !=null) {%>
<%}else{%> <li><a href="./exit" target="_parent">退出</a></li>
<li><a href="04readerFrame.jsp" target="_parent" onClick="">登录</a></li> <%}else{%>
<%} <li><a href="04readerFrame.jsp" target="_parent" onClick="">登录</a></li>
%> <%}
%>
</ul> </ul>
</div>
</div> </div>
</nav> </div>
</nav>
</body> </body>
</html> </html>

@ -1,54 +1,68 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title></title> <title></title>
<!-- Bootstrap --> <!-- 引入Bootstrap样式表 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script> <!-- 这里没有实际引入jQuery但通常需要引入 -->
<script src="../js/bootstrap.min.js"></script> <style>
<style> /* 自定义侧边栏菜单项的悬停效果 */
.sidebar li a:hover{ .sidebar li a:hover{
background:#337ab7; background:#337ab7; /* 背景颜色设置为蓝色 */
color:white; color:white; /* 文字颜色设置为白色 */
} }
.faq-tabbable li a:focus{ /* 自定义侧边栏菜单项获得焦点时的效果 */
background:skyblue; .faq-tabbable li a:focus{
color:white; background:skyblue; /* 背景颜色设置为天蓝色 */
} color:white; /* 文字颜色设置为白色 */
</style> }
</style>
</head> </head>
<body> <body>
<div style="text-align:center;width:100%;height:100%;font-size20px;"> <div style="text-align:center;width:100%;height:100%;font-size20px;">
<ul class="nav nav-pills nav-stacked nav-inverse sidebar faq-tabbable"> <!-- 创建一个居中的div容器宽度和高度均为100%字体大小为20px -->
<ul class="nav nav-pills nav-stacked nav-inverse sidebar faq-tabbable">
<!-- 创建一个无序列表,用于显示侧边栏菜单项 -->
<% if(session.getAttribute("reader")!=null){%> <% if(session.getAttribute("reader")!=null){%>
<li role="presentation"><a href="01main.jsp" target="view_frame"><span class="glyphicon glyphicon-picture" aria-hidden="true">&nbsp;首页</span></a></li> <!-- 如果 session 中存在 reader 属性,则显示以下菜单项 -->
<li role="presentation"><a href="05book.jsp" target="view_frame"><span class="glyphicon glyphicon-search" aria-hidden="true">&nbsp;图书查询</span></a></li> <li role="presentation"><a href="01main.jsp" target="view_frame"><span class="glyphicon glyphicon-picture" aria-hidden="true">&nbsp;首页</span></a></li>
<li role="presentation"><a href="12rules.jsp" target="view_frame"><span class="glyphicon glyphicon-bell" aria-hidden="true">&nbsp;读者规则</span></a></li> <!-- 菜单项:首页 -->
<li role="presentation"><a href="07announcement.jsp" target="view_frame"><span class="glyphicon glyphicon-bullhorn" aria-hidden="true">&nbsp;查看公告</span></a></li> <li role="presentation"><a href="05book.jsp" target="view_frame"><span class="glyphicon glyphicon-search" aria-hidden="true">&nbsp;图书查询</span></a></li>
<li role="presentation"><a href="index.jsp" target="view_frame"><span class="glyphicon glyphicon-user" aria-hidden="true">&nbsp;个人信息</span></a></li> <!-- 菜单项:图书查询 -->
<li role="presentation"><a href="06borrow.jsp" target="view_frame"><span class="glyphicon glyphicon-book" aria-hidden="true">&nbsp;借阅信息</span></a></li> <li role="presentation"><a href="12rules.jsp" target="view_frame"><span class="glyphicon glyphicon-bell" aria-hidden="true">&nbsp;读者规则</span></a></li>
<li role="presentation"><a href="08illegalInfo.jsp" target="view_frame"><span class="glyphicon glyphicon-remove" aria-hidden="true">&nbsp;违章信息</span></a></li> <!-- 菜单项:读者规则 -->
<li role="presentation"><a href="13message.jsp" target="view_frame"><span class="glyphicon glyphicon-pencil" aria-hidden="true">&nbsp;读者留言</span></a></li> <li role="presentation"><a href="07announcement.jsp" target="view_frame"><span class="glyphicon glyphicon-bullhorn" aria-hidden="true">&nbsp;查看公告</span></a></li>
<% <!-- 菜单项:查看公告 -->
}else{ <li role="presentation"><a href="index.jsp" target="view_frame"><span class="glyphicon glyphicon-user" aria-hidden="true">&nbsp;个人信息</span></a></li>
%> <!-- 菜单项:个人信息 -->
<li role="presentation"><a href="01main.jsp" target="view_frame"><span class="glyphicon glyphicon-picture" aria-hidden="true">&nbsp;首页</span></a></li> <li role="presentation"><a href="06borrow.jsp" target="view_frame"><span class="glyphicon glyphicon-book" aria-hidden="true">&nbsp;借阅信息</span></a></li>
<li role="presentation"><a href="05book.jsp" target="view_frame"><span class="glyphicon glyphicon-search" aria-hidden="true">&nbsp;图书查询</span></a></li> <!-- 菜单项:借阅信息 -->
<li role="presentation"><a href="12rules.jsp" target="view_frame"><span class="glyphicon glyphicon-bell" aria-hidden="true">&nbsp;读者规则</span></a></li> <li role="presentation"><a href="08illegalInfo.jsp" target="view_frame"><span class="glyphicon glyphicon-remove" aria-hidden="true">&nbsp;违章信息</span></a></li>
<li role="presentation"><a href="07announcement.jsp" target="view_frame"><span class="glyphicon glyphicon-bullhorn" aria-hidden="true">&nbsp;查看公告</span></a></li> <!-- 菜单项:违章信息 -->
<li role="presentation"><a href="15checkMessage.jsp" target="view_frame"><span class="glyphicon glyphicon-envelope" aria-hidden="true">&nbsp;查看留言</span></a></li> <li role="presentation"><a href="13message.jsp" target="view_frame"><span class="glyphicon glyphicon-pencil" aria-hidden="true">&nbsp;读者留言</span></a></li>
<% <!-- 菜单项:读者留言 -->
} <% } else { %>
%> <!-- 如果 session 中不存在 reader 属性,则显示以下菜单项 -->
</ul> <li role="presentation"><a href="01main.jsp" target="view_frame"><span class="glyphicon glyphicon-picture" aria-hidden="true">&nbsp;首页</span></a></li>
</div> <!-- 菜单项:首页 -->
<li role="presentation"><a href="05book.jsp" target="view_frame"><span class="glyphicon glyphicon-search" aria-hidden="true">&nbsp;图书查询</span></a></li>
<!-- 菜单项:图书查询 -->
<li role="presentation"><a href="12rules.jsp" target="view_frame"><span class="glyphicon glyphicon-bell" aria-hidden="true">&nbsp;读者规则</span></a></li>
<!-- 菜单项:读者规则 -->
<li role="presentation"><a href="07announcement.jsp" target="view_frame"><span class="glyphicon glyphicon-bullhorn" aria-hidden="true">&nbsp;查看公告</span></a></li>
<!-- 菜单项:查看公告 -->
<li role="presentation"><a href="15checkMessage.jsp" target="view_frame"><span class="glyphicon glyphicon-envelope" aria-hidden="true">&nbsp;查看留言</span></a></li>
<!-- 菜单项:查看留言 -->
<% } %>
</ul>
</div>
</body> </body>
</html> </html>

@ -3,33 +3,50 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 设置页面字符编码为UTF-8 -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>借阅者页面</title>
<!-- Bootstrap --> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../css/bootstrap.min.css" rel="stylesheet"> <!-- 确保页面在IE浏览器中以最新的渲染模式显示 -->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1">
<script src="../js/bootstrap.min.js"></script> <!-- 使页面在移动设备上具有响应式设计 -->
<title>借阅者页面</title>
<!-- 设置页面标题为“借阅者页面” -->
<!-- 引入Bootstrap样式表 -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<!-- 这里没有实际引入jQuery库需要补充 -->
</head> </head>
<frameset rows="7%,*" frameborder="no" border="0">
<frame src="02readerNav.jsp" scrolling="no"> <!-- 使用frameset布局将页面分为上下两个部分 -->
<frameset rows="7%,*" frameborder="no" border="0">
<!-- 第一部分占整个页面高度的7%,不显示滚动条 -->
<frame scrolling="no">
<!-- 这里可以放置导航栏或其他固定内容 -->
</frame>
<frameset cols="14%,*" frameborder="no" border="0"> <!-- 第二部分占整个页面剩余的高度,分为左右两个部分 -->
<frame src="03readerNavLeft.jsp"> <frameset cols="14%,*" frameborder="no" border="0">
<!-- 左侧部分占整个页面宽度的14%,右侧部分占剩余宽度 -->
<frame >
<!-- 左侧框架,可以放置菜单或导航 -->
</frame>
<% <%
if(session.getAttribute("reader") == null){ if(session.getAttribute("reader") == null){
%> %>
<frame src="06borrow.jsp" name="view_frame"> <!-- 如果session中没有reader属性则显示一个空的view_frame框架 -->
<frame name="view_frame">
<%
}else{
%>
<!-- 如果session中有reader属性则显示一个空的view_frame框架 -->
<frame name="view_frame">
<% <%
}else{
%>
<frame src="01main.jsp" name="view_frame">
<%
} }
%> %>
</frameset> </frameset>

@ -1,145 +1,133 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title> <title>Insert title here</title> <!-- 页面标题 -->
<meta charset="utf-8"> <meta charset="utf-8"> <!-- 设置文档的字符编码为UTF-8 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 设置视口宽度和初始缩放比例 -->
<title></title> <title>图书管理系统</title> <!-- 页面标题 -->
<!-- Bootstrap CSS -->
<!-- Bootstrap --> <link href="../css/bootstrap.min.css" rel="stylesheet"> <!-- 引入Bootstrap样式表 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap-table.css" rel="stylesheet"> <!-- 引入Bootstrap表格样式表 -->
<link href="../css/bootstrap-table.css" rel="stylesheet"> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <link rel="stylesheet" href="../public/layui/css/layui.css" media="all"> <!-- 引入LayUI样式表 -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap-table.js"></script>
<script src="../bootstrap-table-zh-CN.js"></script>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<style> <style>
.layui-table,.layui-table-view{ .layui-table,.layui-table-view{
margin: 0 0px; margin: 0 0px; /* 设置表格的外边距 */
} }
.layui-form-select dl dd.layui-this { background-color: #01AAED; } .layui-form-select dl dd.layui-this { background-color: #01AAED; } /* 设置下拉选择框选中项的背景颜色 */
</style> </style>
</head> </head>
<body> <body>
<jsp:useBean id="msg" scope="session" class="javabean.JDBCBean"></jsp:useBean> <!-- 使用 JSP Bean -->
<script src="../public/layui/layui.js" charset="utf-8"></script> <jsp:useBean id="msg" scope="session" class="javabean.JDBCBean"></jsp:useBean> <!-- 声明一个JSP BeanID为msg作用域为session类为javabean.JDBCBean -->
<!-- 表单 -->
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table>
<!-- 头部工具栏 -->
<script type="text/html" id="headBar">
条件搜索:
<div class="layui-inline">
<select id="condition" name="condition" lay-verify="required">
<option value=""></option>
<option value="id">图书编号</option>
<option value="name">图书名称</option>
<option value="author">作者</option>
<option value="position">位置</option>
<option value="description">描述</option>
</select>
</div>
<div class="layui-inline">
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off">
</div>
<button class="layui-btn layui-bg-blue" name="condition" data-type="reload" lay-event="search">搜索</button>
</script>
<!-- 表单 -->
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table> <!-- 定义一个隐藏的表格ID为cardTable用于LayUI的过滤功能 -->
<script> <!-- 头部工具栏 -->
layui.use(['table','jquery'], function(){ 条件搜索:
$ = layui.jquery; <div class="layui-inline">
var table = layui.table; <select id="condition" name="condition" lay-verify="required"> <!-- 创建一个下拉选择框ID为condition名称为condition验证规则为必填 -->
// 进行渲染 <option value=""></option> <!-- 空选项 -->
var tableIns = table.render({ <option value="id">图书编号</option> <!-- 图书编号选项 -->
elem: '#cardTable' <option value="name">图书名称</option> <!-- 图书名称选项 -->
,url:'./book' <option value="author">作者</option> <!-- 作者选项 -->
,toolbar: '#headBar' <option value="position">位置</option> <!-- 位置选项 -->
,cols: [[ <option value="description">描述</option> <!-- 描述选项 -->
{field:'id', width:120, title: '图书编号', sort: true} </select>
,{field:'name', width:130, title: '图书名称', sort: true} </div>
,{field:'author', width:100, title: '作者', sort: true} <div class="layui-inline">
,{field:'library_id', title: '图书馆', width: 100, sort: true} <input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off"> <!-- 创建一个输入框类为layui-inputID为conditionValue名称为conditionValue自动完成关闭 -->
,{field:'sort_id', width:100, title: '分类', sort: true,} </div>
,{field:'position', width:100, title: '位置', sort: true} <button class="layui-btn layui-bg-blue" name="condition" data-type="reload" lay-event="search">搜索</button> <!-- 创建一个按钮类为layui-btn和layui-bg-blue名称为condition数据类型为reload事件为search显示文本为搜索 -->
,{field:'status', width:100, title: '状态', sort: true,templet: function (item) {
var btns="";
if(item.status=='0'){
btns += '<span class=""style="color:orange">已借出</span>';
}else if(item.status=='1'){
btns += '<span class=""style="color:green">未借出</span>';
}
return btns;
}
}
,{field:'description', minWidth:80, title: '描述'}
]] <!-- 引入 layui 和 jQuery -->
,page: true <script src="../public/layui/layui.js"></script> <!-- 引入LayUI脚本文件 -->
,page: {theme: '#2F88FF'}, <script src="../public/jquery/jquery.min.js"></script> <!-- 引入jQuery脚本文件 -->
}); <script>
layui.use(['table','jquery'], function(){ // 使用LayUI的table和jQuery模块
// 头部工具栏事件 $ = layui.jquery; // 将LayUI的jQuery赋值给$变量
table.on('toolbar(formFilter)', function(obj){ var table = layui.table; // 获取LayUI的table对象
var checkStatus = table.checkStatus(obj.config.id); // 进行渲染
switch(obj.event){ var tableIns = table.render({
// 条件查找图书证 elem: '#cardTable', // 绑定元素即表格的ID
case 'search': url: './book', // 数据接口地址
var conditionValue = $('#conditionValue'); toolbar: '#headBar', // 头部工具栏的ID
var condition = $('#condition'); cols: [[ // 表头
{field:'id', width:120, title: '图书编号', sort: true}, // 图书编号列宽度120标题为图书编号可排序
// 进行搜索,重新渲染 {field:'name', width:130, title: '图书名称', sort: true}, // 图书名称列宽度130标题为图书名称可排序
tableIns.reload({ {field:'author', width:100, title: '作者', sort: true}, // 作者列宽度100标题为作者可排序
where: { //设定异步数据接口的额外参数,任意设 {field:'library_id', title: '图书馆', width: 100, sort: true}, // 图书馆列标题为图书馆宽度100可排序
"condition": condition.val(), {field:'sort_id', width:100, title: '分类', sort: true}, // 分类列宽度100标题为分类可排序
"conditionValue": conditionValue.val() {field:'position', width:100, title: '位置', sort: true}, // 位置列宽度100标题为位置可排序
} {field:'status', width:100, title: '状态', sort: true, templet: function (item) { // 状态列宽度100标题为状态可排序自定义模板函数
,page: { var btns = ""; // 初始化按钮字符串
curr: 1 //重新从第 1 页开始 if(item.status == '0'){ // 如果状态为0
} btns += '<span class="" style="color:orange">已借出</span>'; // 添加已借出的红色文字
}); } else if(item.status == '1'){ // 如果状态为1
break; btns += '<span class="" style="color:green">未借出</span>'; // 添加未借出的绿色文字
}
case 'add': return btns; // 返回按钮字符串
var addCardLayer = layer.open({ }},
type: 2, {field:'description', minWidth:80, title: '描述'}, // 描述列最小宽度80标题为描述
title: '添加借书证', ]],
area: ['800px', '500px'], page: true // 开启分页
maxmin: true, });
shadeClose: true, // 头部工具栏事件
content: 'cardadd.jsp', table.on('toolbar(formFilter)', function(obj){ // 监听头部工具栏事件
}); var checkStatus = table.checkStatus(obj.config.id); // 获取选中行的状态
//layer.full(addCardLayer); switch(obj.event){ // 根据事件类型执行不同的操作
}; case 'condition': // 如果事件类型是condition
var condition = $('#condition'); // 获取条件选择框
var conditionValue = $('#conditionValue'); // 获取条件值输入框
// 条件查找图书证
var value = conditionValue.val(); // 获取输入框的值
conditionValue.val(''); // 清空输入框的值
tableIns.reload({ // 重新加载表格数据
where: { // 查询参数
condition: condition.val(), // 条件字段
value: value // 条件值
},
page: { // 分页参数
curr: 1 // 从第一页开始重新加载
}
});
break;
case 'add': // 如果事件类型是add
var addCardLayer = layer.open({ // 打开新增图书证的弹出层
type: 2, // 弹出层类型为iframe
title: '添加借书证', // 弹出层标题
area: ['800px', '500px'], // 弹出层大小
maxmin: true, // 允许最大化和最小化
shadeClose: true, // 点击遮罩层是否允许关闭
content: 'addBook.jsp', // 弹出层内容页面路径
});
break;
}
}); });
// 侧边工具栏事件
// 侧边工具栏事件 table.on(('tool(formFilter)'), function(obj){ // 监听侧边工具栏事件
table.on(('tool(formFilter)'), function(obj){ var data = obj.data; // 获取当前行的数据
var data = obj.data; var layEvent = obj.event; // 获取事件类型
var layEvent = obj.event; var tr = obj.tr; // 获取当前行的DOM对象
var tr = obj.tr; switch(layEvent){ // 根据事件类型执行不同的操作
switch(obj.event){ case 'edit': // 如果事件类型是edit
case 'edit': layer.open({ // 打开更改信息的弹出层
layer.open({ type: 2, // 弹出层类型为iframe
type: 2, title: '更改信息', // 弹出层标题
title: '更改信息', area: ['800px', '600px'], // 弹出层大小
area: ['800px', '600px'], maxmin: true, // 允许最大化和最小化
maxmin: true, shadeClose: true, // 点击遮罩层是否允许关闭
shadeClose: true, content: '', // 这里需要填写实际的内容页面路径
content: '', });
}) break;
break; }
} })
})
}); });
</script> </script>
</body> </body>
</html> </html>

@ -1,130 +1,116 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- 定义文档类型为HTML 4.01 Transitional -->
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- 设置页面内容类型和字符编码 -->
<title>Insert title here</title> <title>Insert title here</title> <!-- 页面标题 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet"> <!-- 引入Bootstrap CSS文件 -->
<link href="../css/bootstrap-table.css" rel="stylesheet"> <link href="../css/bootstrap-table.css" rel="stylesheet"> <!-- 引入Bootstrap Table CSS文件 -->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script> <link rel="stylesheet" href="../public/layui/css/layui.css" media="all"> <!-- 引入Layui CSS文件 -->
<script src="../js/bootstrap-table.js"></script>
<script src="../bootstrap-table-zh-CN.js"></script>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
<style> <style>
.layui-table,.layui-table-view{ .layui-table,.layui-table-view{
margin: 0 0px; margin: 0 0px; /* 设置表格的外边距为0 */
} }
</style> </style>
</head> </head>
<body> <body>
<script src="../public/layui/layui.js" charset="utf-8"></script> <!-- 表单 -->
<!-- 表单 --> <% if(session.getAttribute("reader")==null){%> <!-- 检查用户是否登录 -->
<% if(session.getAttribute("reader")==null){%> location.href = "../loginReader.html"; <!-- 如果未登录,重定向到登录页面 -->
<script> <% } %>
location.href = "../loginReader.html"; <table class="layui-hide" id="cardTable" lay-filter="formFilter"></table> <!-- 隐藏的表格元素,用于后续渲染 -->
</script>
<%
}
%>
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table>
<!-- 头部工具栏 -->
<script type="text/html" id="headBar">
条件搜索:
<div class="layui-inline">
<select id="condition" name="condition" lay-verify="required">
<option value=""></option>
<option value="book_id">图书编号</option>
<option value="borrow_date">借阅日期</option>
<option value="end_date">截止日期</option>
<option value="return_date">归还日期</option>
</select> <!-- 头部工具栏 -->
</div> 条件搜索:
<div class="layui-inline"> <div class="layui-inline">
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off"> <select id="condition" name="condition" lay-verify="required"> <!-- 下拉选择框,用于选择查询条件 -->
</div> <option value=""></option>
<button class="layui-btn" name="condition" data-type="reload" lay-event="search">搜索</button> <option value="book_id">图书编号</option>
</script> <option value="borrow_date">借阅日期</option>
<option value="end_date">截止日期</option>
<option value="return_date">归还日期</option>
</select>
</div>
<div class="layui-inline">
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off"> <!-- 输入框,用于输入查询条件值 -->
</div>
<button class="layui-btn" name="condition" data-type="reload" lay-event="search">搜索</button> <!-- 搜索按钮 -->
<script src="../js/jquery-3.2.1.min.js"></script> <!-- 引入jQuery库 -->
<script src="../js/bootstrap.min.js"></script> <!-- 引入Bootstrap JavaScript文件 -->
<script src="../js/bootstrap-table.min.js"></script> <!-- 引入Bootstrap Table JavaScript文件 -->
<script src="../public/layui/layui.js"></script> <!-- 引入Layui JavaScript文件 -->
<script>
layui.use(['table','jquery'], function(){ <!-- 使用Layui的table和jQuery模块 -->
$ = layui.jquery; <!-- 获取jQuery对象 -->
var table = layui.table; <!-- 获取table对象 -->
// 进行渲染
var tableIns = table.render({
elem: '#cardTable' <!-- 绑定表格元素 -->
,url:'./borrow' <!-- 数据接口地址 -->
,toolbar: '#headBar' <!-- 绑定工具栏元素 -->
,cols: [[
{field:'card_id', width:180, title: '借阅证号', sort: true}, <!-- 定义表格列 -->
{field:'book_id', width:130, title: '图书编号', sort: true},
{field:'borrow_date', width:250, title: '借阅日期', sort: true},
{field:'end_date', title: '截止日期', width: 250, sort: true},
{field:'return_date', width:250, title: '归还时间', sort: true}
]]
,page: true <!-- 启用分页 -->
});
<script> // 头部工具栏事件
layui.use(['table','jquery'], function(){ table.on('toolbar(formFilter)', function(obj){
$ = layui.jquery; var checkStatus = table.checkStatus(obj.config.id); <!-- 获取选中状态 -->
var table = layui.table; switch(obj.event){
// 进行渲染 case 'search': <!-- 处理搜索事件 -->
var tableIns = table.render({ var conditionValue = $('#conditionValue'); <!-- 获取条件值输入框 -->
elem: '#cardTable' var condition = $('#condition'); <!-- 获取条件选择框 -->
,url:'./borrow' // 进行搜索,重新渲染
,toolbar: '#headBar' tableIns.reload({
,cols: [[ where: { //设定异步数据接口的额外参数,任意设
{field:'card_id', width:180, title: '借阅证号', sort: true} "condition": condition.val(),
,{field:'book_id', width:130, title: '图书编号', sort: true} "conditionValue": conditionValue.val()
,{field:'borrow_date', width:250, title: '借阅日期', sort: true} }
,{field:'end_date', title: '截止日期', width: 250, sort: true} ,page: {
,{field:'return_date', width:250, title: '归还时间', sort: true} curr: 1 //重新从第 1 页开始
}
]] });
,page: true break;
}); case 'add': <!-- 处理添加事件 -->
var addCardLayer = layer.open({
// 头部工具栏事件 type: 2,
table.on('toolbar(formFilter)', function(obj){ title: '添加借书证',
var checkStatus = table.checkStatus(obj.config.id); area: ['800px', '500px'],
switch(obj.event){ maxmin: true,
// 条件查找借阅记录 shadeClose: true,
case 'search': content: 'cardadd.jsp',
var conditionValue = $('#conditionValue'); });
var condition = $('#condition'); //layer.full(addCardLayer);
};
// 进行搜索,重新渲染
tableIns.reload({
where: { //设定异步数据接口的额外参数,任意设
"condition": condition.val(),
"conditionValue": conditionValue.val()
}
,page: {
curr: 1 //重新从第 1 页开始
}
});
break;
case 'add':
var addCardLayer = layer.open({
type: 2,
title: '添加借书证',
area: ['800px', '500px'],
maxmin: true,
shadeClose: true,
content: 'cardadd.jsp',
});
//layer.full(addCardLayer);
};
}); });
// 侧边工具栏事件 // 侧边工具栏事件
table.on(('tool(formFilter)'), function(obj){ table.on(('tool(formFilter)'), function(obj){
var data = obj.data; var data = obj.data; <!-- 获取当前行的数据 -->
var layEvent = obj.event; var layEvent = obj.event; <!-- 获取触发的事件类型 -->
var tr = obj.tr; var tr = obj.tr; <!-- 获取当前行的DOM对象 -->
switch(obj.event){ switch(obj.event){
case 'edit': case 'edit': <!-- 处理编辑事件 -->
layer.open({ layer.open({
type: 2, type: 2,
title: '更改信息', title: '更改信息',
area: ['800px', '600px'], area: ['800px', '600px'],
maxmin: true, maxmin: true,
shadeClose: true, shadeClose: true,
content: '', content: '',
}) })
break; break;
} }
}) })
}); });
</script> </script>
</body> </body>
</html> </html>

@ -1,57 +1,58 @@
<%@ page import="java.sql.*" %> <%@ page import="java.sql.*" %> <!-- 导入Java SQL包用于数据库操作 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%> <!-- 设置页面语言为Java内容类型为HTML字符编码为UTF-8 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- 定义文档类型为HTML 4.01 Transitional -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8"> <!-- 设置字符编码为UTF-8 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 设置IE浏览器的兼容模式 -->
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 设置视口宽度和初始缩放比例 -->
<title></title> <title></title> <!-- 页面标题 -->
<!-- Bootstrap --> <!-- Bootstrap CSS文件 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script> <style>
<style> body{
body{ font-family:YouYuan; /* 设置页面字体为YouYuan */
font-family:YouYuan; }
} </style>
</style>
</head> </head>
<body> <body>
<div style="background: steelblue;height: 30px;;color:#fff;border-radius: 8px;width: 90%;margin:auto auto;"> <div style="background: steelblue;height: 30px;color:#fff;border-radius: 8px;width: 90%;margin:auto auto;">
<marquee style="font-size:20px;font-family:YouYuan;" behavior="scroll" direction="left" hspace="0.1%" vspace="0.1%" loop="-1" scrollamount="20" scrolldelay="100" onMouseOut="this.start()" onMouseOver="this.stop()"> <marquee style="font-size:20px;font-family:YouYuan;" behavior="scroll" direction="left" hspace="0.1%" vspace="0.1%" loop="-1" scrollamount="20" scrolldelay="100" "this.start()" "this.stop()">
❤图书馆公告栏,记得查收公告呀!❤ &#10084;图书馆公告栏,记得查收公告呀!&#10084; <!-- 滚动公告栏 -->
</marquee>  </marquee>
</div> </div>
<div class="a" align="center"> <div class="a" align="center">
<h2>近期公告</h2>
<jsp:useBean id="check" scope="session" class="javabean.JDBCBean"></jsp:useBean> <h2>近期公告</h2> <!-- 显示“近期公告”标题 -->
<%
<jsp:useBean id="check" scope="session" class="javabean.JDBCBean"></jsp:useBean> <!-- 使用JSP标签声明一个JavaBean对象ID为check作用域为session类为javabean.JDBCBean -->
<!-- SQL查询语句选择announcement表中的所有记录 -->
<!-- 执行SQL查询并将结果存储在ResultSet对象rs中 -->
<%
String sql="select*from announcement"; String sql="select*from announcement";
ResultSet rs = check.executeQuery(sql); ResultSet rs = check.executeQuery(sql);
while (rs.next()) { while (rs.next()) {
%> %>
<div class="panel panel-info" style="margin-left:5%;width:80%;"> <div class="panel panel-info" style="margin-left:5%;width:80%;"> <!-- 创建一个Bootstrap面板样式为信息面板左边距为5%宽度为80% -->
<div class="panel-heading" align="center"> <div class="panel-heading" align="center"> <!-- 面板头部,居中对齐 -->
<span><%=rs.getString("TITLE") %></span> <span><%=rs.getString("TITLE") %></span> <!-- 显示公告标题 -->
<span style="margin-right:1%;"><%=rs.getString("PUBLISH_DATE") %></span> <span style="margin-right:1%;"><%=rs.getString("PUBLISH_DATE") %></span> <!-- 显示公告发布日期 -->
</div> </div>
<div class="panel-body" > <div class="panel-body"> <!-- 面板主体部分 -->
<p style="word-wrap:break-word;"><%=rs.getString("DETAIL") %></p> <p style="word-wrap:break-word;"><%=rs.getString("DETAIL") %></p> <!-- 显示公告详情,自动换行 -->
</div> </div>
</div> </div>
<% <%
} }
%> %>
</div> </div>
</body> </body>
</html> </html>

@ -4,136 +4,136 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title> <title>Insert title here</title> <!-- 设置网页标题 -->
<!-- Bootstrap --> <!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet"> <!-- 引入Bootstrap CSS文件 -->
<link href="../css/bootstrap-table.css" rel="stylesheet"> <link href="../css/bootstrap-table.css" rel="stylesheet"> <!-- 引入Bootstrap Table CSS文件 -->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap-table.js"></script>
<script src="../bootstrap-table-zh-CN.js"></script>
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all"> <link rel="stylesheet" href="../public/layui/css/layui.css" media="all"> <!-- 引入Layui CSS文件 -->
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all"> <link rel="stylesheet" href="../public/layui/css/layui.css" media="all"> <!-- 重复引入Layui CSS文件可能是冗余代码 -->
<style> <style>
.layui-table,.layui-table-view{ .layui-table,.layui-table-view{
margin: 0 0px; margin: 0 0px; /* 设置表格的外边距为0 */
} }
.layui-form-select dl dd.layui-this { background-color: #FF5722; } .layui-form-select dl dd.layui-this { background-color: #FF5722; } /* 设置下拉选择框选中项的背景颜色 */
</style> </style>
</head> </head>
<body> <body>
<% <%
if(session.getAttribute("reader") == null){ if(session.getAttribute("reader") == null){ // 如果会话中的reader属性为空
%> %>
location.href="../loginReader.html"; // 重定向到登录页面
<%
}
%>
<!-- 表单 -->
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table> <!-- 定义一个隐藏的表格元素,用于后续渲染 -->
<!-- 头部工具栏 -->
条件搜索:
<div class="layui-inline">
<select id="condition" name="condition" lay-verify="required"> <!-- 创建一个下拉选择框,用于选择搜索条件 -->
<option value=""></option>
<option value="book_id">图书编号</option>
<option value="borrow_date">借阅日期</option>
<option value="end_date">截止日期</option>
<option value="return_date">归还日期</option>
<option value="illegal">违章信息</option>
<option value="manager_id">处理人</option>
</select>
</div>
<div class="layui-inline">
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off"> <!-- 创建一个输入框,用于输入搜索条件值 -->
</div>
<button class="layui-btn layui-btn-danger" name="condition" data-type="reload" lay-event="search">搜索</button> <!-- 创建一个按钮,用于触发搜索操作 -->
<script> <script>
location.href="../loginReader.html"; layui.use(['table','jquery'], function(){ // 使用Layui的table和jQuery模块
</script> $ = layui.jquery; // 获取jQuery对象
<% var table = layui.table; // 获取table对象
} // 进行渲染
%> var tableIns = table.render({
<script src="../public/layui/layui.js" charset="utf-8"></script> elem: '#cardTable' // 指定渲染的表格元素ID
<!-- 表单 --> ,url:'./illegal' // 数据接口地址
<table class="layui-hide" id="cardTable" lay-filter="formFilter"></table> ,toolbar: '#headBar' // 指定工具栏模板的选择器或DOM元素
,cols: [[ // 定义表格列配置
<!-- 头部工具栏 --> {field:'card_id', width:180, title: '借阅证号', sort: true} // 借阅证号列配置
<script type="text/html" id="headBar"> ,{field:'book_id', minwidth:80, title: '图书编号', sort: true} // 图书编号列配置
条件搜索: ,{field:'borrow_date', width:250, title: '借阅日期', sort: true} // 借阅日期列配置
<div class="layui-inline"> ,{field:'end_date', title: '截止日期', width: 250, sort: true} // 截止日期列配置
<select id="condition" name="condition" lay-verify="required"> ,{field:'return_date', width:250, title: '归还时间', sort: true} // 归还时间列配置
<option value=""></option> ,{field:'illegal', width:180, title: '违章信息', sort: true,style:'color: red;'} // 违章信息列配置,文字颜色为红色
<option value="book_id">图书编号</option> ,{field:'manager_id', width:90, title: '处理人', sort: true} // 处理人列配置
<option value="borrow_date">借阅日期</option>
<option value="end_date">截止日期</option> ]]
<option value="return_date">归还日期</option> ,page: true // 开启分页功能
<option value="illegal">违章信息</option> ,page: {theme: '#FF5722'}, // 设置分页组件的主题颜色为橙色
<option value="manager_id">处理人</option> });
</select>
</div> // 头部工具栏事件
<div class="layui-inline"> table.on('toolbar(formFilter)', function(obj){ // 监听头部工具栏事件
<input class="layui-input" id="conditionValue" name="conditionValue" id="demoReload" autocomplete="off"> var checkStatus = table.checkStatus(obj.config.id); // 获取当前表格的选中状态
</div> switch(obj.event){ // 根据事件类型进行处理
<button class="layui-btn layui-btn-danger" name="condition" data-type="reload" lay-event="search">搜索</button> // 条件查找图书证
</script> case 'search': // 如果事件类型是搜索
var conditionValue = $('#conditionValue'); // 获取条件值输入框的jQuery对象
var condition = $('#condition'); // 获取条件选择框的jQuery对象
<script> // 进行搜索,重新渲染
layui.use(['table','jquery'], function(){ tableIns.reload({
$ = layui.jquery; where: { //设定异步数据接口的额外参数,任意设
var table = layui.table; "condition": condition.val(), // 设置查询条件字段名
// 进行渲染 "conditionValue": conditionValue.val() // 设置查询条件值
var tableIns = table.render({ },
elem: '#cardTable' page: {
,url:'./illegal' curr: 1 //重新从第 1 页开始
,toolbar: '#headBar' }
,cols: [[ });
{field:'card_id', width:180, title: '借阅证号', sort: true} break;
,{field:'book_id', minwidth:80, title: '图书编号', sort: true}
,{field:'borrow_date', width:250, title: '借阅日期', sort: true} case 'add': // 如果事件类型是添加
,{field:'end_date', title: '截止日期', width: 250, sort: true} var addCardLayer = layer.open({ // 打开一个新的弹出层
,{field:'return_date', width:250, title: '归还时间', sort: true} type: 2, // 弹出层类型为iframe层
,{field:'illegal', width:180, title: '违章信息', sort: true,style:'color: red;'} title: '添加借书证', // 弹出层标题
,{field:'manager_id', width:90, title: '处理人', sort: true} area: ['800px', '500px'], // 弹出层大小
maxmin: true, // 允许最大化和最小化
]] shadeClose: true, // 点击遮罩关闭弹出层
,page: true content: 'cardAdd.jsp', // 弹出层内容为cardAdd.jsp页面
,page: {theme: '#FF5722'}, });
}); //layer.full(addCardLayer); // 注释掉的代码,用于全屏显示弹出层
};
// 头部工具栏事件 });
table.on('toolbar(formFilter)', function(obj){
var checkStatus = table.checkStatus(obj.config.id); // 侧边工具栏事件
switch(obj.event){ table.on(('tool(formFilter)'), function(obj){ // 监听侧边工具栏事件
// 条件查找图书证 var data = obj.data; // 获取当前行的数据
case 'search': var layEvent = obj.event; // 获取事件类型
var conditionValue = $('#conditionValue'); var tr = obj.tr; // 获取当前行的DOM对象
var condition = $('#condition'); switch(layEvent){ // 根据事件类型进行处理
//更多操作按钮的事件处理可以在这里添加
// 进行搜索,重新渲染 case 'edit': // 如果事件类型是编辑
tableIns.reload({ layer.open({ // 打开一个新的弹出层
where: { //设定异步数据接口的额外参数,任意设 type: 2, // 弹出层类型为iframe层
"condition": condition.val(), title: '更改信息', // 弹出层标题
"conditionValue": conditionValue.val() area: ['800px', '600px'], // 弹出层大小
} maxmin: true, // 允许最大化和最小化
,page: { shadeClose: true, // 点击遮罩关闭弹出层
curr: 1 //重新从第 1 页开始 content: '', // 弹出层内容为空,需要根据实际需求填写
} });
}); break;
break; };
});
case 'add':
var addCardLayer = layer.open({
type: 2,
title: '添加借书证',
area: ['800px', '500px'],
maxmin: true,
shadeClose: true,
content: 'cardadd.jsp',
});
//layer.full(addCardLayer);
};
}); });
// 侧边工具栏事件
table.on(('tool(formFilter)'), function(obj){
var data = obj.data;
var layEvent = obj.event;
var tr = obj.tr;
switch(obj.event){
case 'edit':
layer.open({
type: 2,
title: '更改信息',
area: ['800px', '600px'],
maxmin: true,
shadeClose: true,
content: '',
})
break;
}
})
});
</script> </script>
</body> </body>
</html> </html>

@ -1,64 +1,62 @@
<%@ page import="java.sql.*"%> <%@ page import="java.sql.*"%> <!-- 导入Java SQL包 -->
<%@ page import="java.util.*"%> <%@ page import="java.util.*"%> <!-- 导入Java Util包 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%> <!-- 设置页面语言为Java内容类型和字符编码为UTF-8 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- 定义HTML文档类型 -->
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- 设置内容类型和字符编码 -->
<title>修改密码</title> <title>修改密码</title> <!-- 设置页面标题 -->
<script src="${ctx}/toastr/toastr.min.js"></script>
<link rel="stylesheet" href="${ctx}/toastr/toastr.min.css"> <link rel="stylesheet" href="${ctx}/toastr/toastr.min.css"> <!-- 引入外部CSS样式表 -->
</head> </head>
<body> <body>
<jsp:useBean id="check" scope="session" class="javabean.JDBCBean"></jsp:useBean> <jsp:useBean id="check" scope="session" class="javabean.JDBCBean"></jsp:useBean> <!-- 使用JSP的useBean标签来实例化一个名为check的JavaBean对象 -->
<% <%
String psw1 = request.getParameter("psw1"); String psw1 = request.getParameter("psw1"); <!-- 获取请求参数psw1的值 -->
String psw2 = request.getParameter("psw2"); String psw2 = request.getParameter("psw2"); <!-- 获取请求参数psw2的值 -->
//out.println(psw1 + " " + psw2); <!-- 注释掉的代码用于输出psw1和psw2的值 -->
String id = session.getAttribute("reader").toString(); <!-- 从会话中获取reader属性并转换为字符串 -->
if (psw1.equals(psw2) && psw1 != null && psw2 != null && !psw1.trim().equals("")
&& !psw2.trim().equals("")) { <!-- 检查两个密码是否相同且不为空 -->
String sql = "update borrow_card set PASSWORD ='" + psw1 + "' where ID=" + id; <!-- 构建SQL更新语句 -->
try {
int i = check.executeUpdate(sql); <!-- 执行SQL更新操作 -->
if (i == 1) { <!-- 如果更新成功 -->
%>
('修改成功!'); <!-- 弹出提示信息 -->
window.location.href = "index.jsp"; <!-- 重定向到index.jsp页面 -->
<%
} else { <!-- 如果更新不成功 -->
%>
('修改未成功!'); <!-- 弹出提示信息 -->
window.location.href = "index.jsp"; <!-- 重定向到index.jsp页面 -->
//out.println(psw1 + " " + psw2); <%
String id = session.getAttribute("reader").toString(); }
} catch (Exception e) { <!-- 捕获异常 -->
%>
if (psw1.equals(psw2) && psw1 != null && psw2 != null && !psw1.trim().equals("") ('修改未成功!'); <!-- 弹出提示信息 -->
&& !psw2.trim().equals("")) { window.location.href = "index.jsp"; <!-- 重定向到index.jsp页面 -->
String sql = "update borrow_card set PASSWORD ='" + psw1 + "' where ID=" + id;
try {
int i = check.executeUpdate(sql);
if (i == 1) {
%>
<script>
alert('修改成功!');
window.location.href = "index.jsp";
</script>
<% <%
} else { }
%> } else { <!-- 如果密码验证失败 -->
<script> %>
alert('修改未成功!');
window.location.href = "index.jsp";
</script>
<%
}
} catch (Exception e) {
%>
<script>
alert('修改未成功!');
window.location.href = "index.jsp";
</script>
<%
}
} else {
%>
<script>
alert('修改未成功!');
window.location.href = "index.jsp";
</script>
<%
}
%>
('修改未成功!'); <!-- 弹出提示信息 -->
window.location.href = "index.jsp"; <!-- 重定向到index.jsp页面 -->
<%
}
%>
</body> </body>
</html> </html>

@ -1,68 +1,79 @@
<%@ page import="java.sql.*" %> <%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %> <%@ page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
pageEncoding="UTF-8"%> <!-- 以上三行为JSP页面指令用于设置页面属性和导入所需的Java包 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 设置页面字符编码为UTF-8 -->
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title> <!-- 兼容IE浏览器 -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap --> <!-- 响应式布局的视口设置 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <title></title>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- 页面标题为空 -->
<script src="../js/jquery.min.js"></script> <!-- 引入Bootstrap CSS和JS文件 -->
<script src="../js/bootstrap.min.js"></script> <!-- Bootstrap是一个前端框架用于快速布局和样式设计 -->
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" id="templatecss" type="text/css" href="../public/css/message.css"> <script src="../js/jquery.min.js"></script>
<style> <script src="../js/bootstrap.min.js"></script>
body{ <!-- 引入自定义CSS -->
background-color:#fff; <link rel="stylesheet" id="templatecss" type="text/css" href="../public/css/message.css">
color:black; <!-- 内联样式设置body的背景色和文字颜色 -->
} <style>
</style> body{
background-color:#fff;
color:black;
}
</style>
</head> </head>
<body> <body>
<!-- jQuery代码用于初始化Bootstrap的popover插件 -->
<script> <script>
$(function () { $(function () {
$("[data-toggle='popover']").popover(); $("[data-toggle='popover']").popover();
}); });
</script> </script>
<!-- 使用JSP标签引入JavaBean用于数据库操作 -->
<jsp:useBean id="msg" scope="session" class="javabean.JDBCBean"></jsp:useBean> <jsp:useBean id="msg" scope="session" class="javabean.JDBCBean"></jsp:useBean>
<!-- 页面居中显示标题 -->
<div align="center"><h1 style="color:steelblue;font-family:YouYuan;font-weight:900;">读者规则信息查看</h1></div> <div align="center"><h1 style="color:steelblue;font-family:YouYuan;font-weight:900;">读者规则信息查看</h1></div>
<!-- 设置内容上边距,居中显示按钮 -->
<div style="margin-top:5%;" align="center"> <div style="margin-top:5%;" align="center">
<!-- 以下为JSP脚本用于从数据库查询并展示读者规则信息 -->
<% <%
String sql = "select * from rules"; String sql = "select * from rules";
// 执行SQL查询
ResultSet rs = msg.executeQuery(sql); ResultSet rs = msg.executeQuery(sql);
// 遍历查询结果集
while (rs.next()) { while (rs.next()) {
if(Integer.parseInt(rs.getString("ID")) % 2== 1){ if(Integer.parseInt(rs.getString("ID")) % 2== 1){
%> %>
<button type="button" class="btn btn-lg btn-info" title="可借阅数量:<%=rs.getString("BORROW_NUM") %>" data-html="true" <!-- 如果ID为奇数使用蓝色按钮展示规则信息并设置popover提示 -->
data-container="body" data-trigger="focus" data-toggle="popover" data-placement="left" <button type="button" class="btn btn-lg btn-info" title="可借阅数量:<%=rs.getString("BORROW_NUM") %>" data-html="true"
data-container="body" data-trigger="focus" data-toggle="popover" data-placement="left"
data-content="可借阅天数:<%=rs.getString("LIMIT_DAY") %><br>可借阅图书馆:<%=rs.getString("BORROW_LIBRARY") %><br>过期扣费/天:<%=rs.getString("OVERTIME_FEE") %>" style="width:40%;height:100%;font-size:17px;margin-top:4%;"> data-content="可借阅天数:<%=rs.getString("LIMIT_DAY") %><br>可借阅图书馆:<%=rs.getString("BORROW_LIBRARY") %><br>过期扣费/天:<%=rs.getString("OVERTIME_FEE") %>" style="width:40%;height:100%;font-size:17px;margin-top:4%;">
借阅证规则编号:<%=rs.getString("ID")%> 借阅证规则编号:<%=rs.getString("ID")%> //设置借阅证规则编号
</button><br><br> </button><br><br>
<% <%
}else{ }else{
%> %>
<button type="button" class="btn btn-lg btn-primary" title="可借阅数量:<%=rs.getString("BORROW_NUM") %>" data-html="true" <!-- 如果ID为偶数使用蓝色按钮展示规则信息并设置popover提示 -->
data-container="body" data-trigger="focus" data-toggle="popover" data-placement="right" <button type="button" class="btn btn-lg btn-primary" title="可借阅数量:<%=rs.getString("BORROW_NUM") %>" data-html="true"
data-content="可借阅天数:<%=rs.getString("LIMIT_DAY") %><br>可借阅图书馆:<%=rs.getString("BORROW_LIBRARY") %><br>过期扣费/天:<%=rs.getString("OVERTIME_FEE") %>" style="width:40%;height:100%;font-size:17px;margin-top:4%;"> data-container="body" data-trigger="focus" data-toggle="popover" data-placement="right"
data-content="可借阅天数:<%=rs.getString("LIMIT_DAY") %><br>可借阅图书馆:<%=rs.getString("BORROW_LIBRARY") %><br>过期扣费/天:<%=rs.getString("OVERTIME_FEE") %>" style="width:40%;height:100%;font-size:17px;margin-top:4%;">
借阅证规则编号:<%=rs.getString("ID")%>
借阅证规则编号:<%=rs.getString("ID")%>
</button><br><br>
<% </button><br><br>
} <%
}
} }
%> %>
</div> <!-- 结束JSP脚本 -->
</div>
</body> </body>
</html> </html>

@ -1,46 +1,53 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title></title> <title></title>
<!-- Bootstrap --> <!-- 引入Bootstrap CSS文件 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script> <script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script> <!-- 引入自定义CSS文件 -->
<link rel="stylesheet" id="templatecss" type="text/css" href="../public/css/message.css">
<link rel="stylesheet" id="templatecss" type="text/css" href="../public/css/message.css">
</head> </head>
<body id="home"> <body id="home">
<script>
//$(document).ready(function () { <!-- 以下JavaScript代码被注释掉了用于在页面加载时设置当前日期和时间 -->
// var date = new Date(+new Date()+8*3600*1000).toISOString().replace(/T/g,' ').replace(/\.[\d]{3}Z/,''); <!-- $(document).ready(function () {
// alert(date);//2017-01-22 11:08:46 var date = new Date(+new Date()+8*3600*1000).toISOString().replace(/T/g,' ').replace(/\.[\d]{3}Z/,'');
// $('#date_info').val(today); (date);//2017-01-22 11:08:46
//}) $('#date_info').val(today);
</script> }) -->
<div class="rain">
<div class="border start"> <div class="rain">
<form action="14messageSub.jsp" method="post"> <div class="border start">
<label for="mes" style="margin-left:36%;">留言板</label> <!-- 表单提交到14messageSub.jsp使用POST方法 -->
<textarea id="mes" name="msg" placeholder="请输入您的留言" style="height:50%;width:90%"></textarea> <form action="14messageSub.jsp" method="post">
<!-- <label for="date">日期</label>--> <!-- 留言板标题 -->
<!-- <input id="date" type="text" name="time" placeholder="请输入时间" style="width:90%"/><br> --> <label for="mes" style="margin-left:36%;">留言板</label>
<!-- <input type="datetime_local" id="date_info" placeholder="请输入时间"/> --> <!-- 多行文本输入框,用于用户输入留言 -->
<br><br> <textarea id="mes" name="msg" placeholder="请输入您的留言" style="height:50%;width:90%"></textarea>
<div align="center"> <!-- 日期输入框被注释掉 -->
<button type="submit" class="btn btn-warning" style="margin-left:0">提交</button>&emsp;&emsp;&emsp; <!-- <label for="date">日期</label>-->
<button type="reset" class="btn btn-danger" style="margin-right:0">重置</button>&emsp;&emsp;&emsp; <!-- <input id="date" type="text" name="time" placeholder="请输入时间" style="width:90%"/><br> -->
<button type="reset" class="btn btn-info" style="margin-right:0" onClick="location.href='15checkMessage.jsp'">查看留言</button> <!-- <input type="datetime_local" id="date_info" placeholder="请输入时间"/> -->
</div> <br><br>
</form> <div align="center">
<!-- 提交按钮 -->
<button type="submit" class="btn btn-warning" style="margin-left:0">提交</button>&emsp;&emsp;&emsp;
<!-- 重置按钮 -->
<button type="reset" class="btn btn-danger" style="margin-right:0">重置</button>&emsp;&emsp;&emsp;
<!-- 查看留言按钮点击后跳转到15checkMessage.jsp页面 -->
<button type="reset" class="btn btn-info" style="margin-right:0" onclick="location.href='15checkMessage.jsp'">查看留言</button>
</div> </div>
</div> </form>
</body> </div>
</div>
</body>
</body> </body>
</html> </html>

@ -1,47 +1,53 @@
<%@ page import="java.sql.*" %> <%@ page import="java.sql.*" %> <!-- 导入Java SQL包用于数据库操作 -->
<%@ page import="java.util.*" %> <%@ page import="java.util.*" %> <!-- 导入Java工具包包含日期时间类等 -->
<%@ page import="javabean.DateTime"%> <%@ page import="javabean.DateTime"%> <!-- 导入自定义的DateTime类 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%> <!-- 设置页面语言为Java内容类型和字符编码为UTF-8 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- 定义HTML文档类型 -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8"> <!-- 设置字符编码为UTF-8 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 设置IE浏览器兼容模式 -->
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 设置视口宽度和初始缩放比例 -->
<title></title> <title></title> <!-- 页面标题 -->
<!-- Bootstrap --> <!-- Bootstrap CSS文件 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery库Bootstrap的所有JavaScript插件都依赖jQuery所以必须放在前边 -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<link rel="stylesheet" id="templatecss" type="text/css" <!-- 自定义CSS文件 -->
href="../public/css/message.css"> <link rel="stylesheet" id="templatecss" type="text/css" href="../public/css/message.css">
</head> </head>
<body> <body>
<jsp:useBean id="msg" scope="session" class="javabean.JDBCBean"></jsp:useBean> <!-- 使用JSP标签声明一个JavaBean对象msg作用域为session类为javabean.JDBCBean -->
<% <jsp:useBean id="msg" scope="session" class="javabean.JDBCBean"></jsp:useBean>
DateTime date=new DateTime(); <%
//out.println(date.show()); // 创建DateTime对象实例
String time = date.show(); DateTime date = new DateTime();
// 获取当前时间字符串
String mes = request.getParameter("msg"); String time = date.show();
try{ // 从请求中获取参数msg的值
String card = session.getAttribute("reader").toString(); String mes = request.getParameter("msg");
try {
// 从session中获取reader属性并转换为字符串
String card = session.getAttribute("reader").toString();
// 构建SQL插入语句
String sql = "insert into message(card_id,detail,public_date)values('" + card + "','" + mes + "','" + time + "');"; String sql = "insert into message(card_id,detail,public_date)values('" + card + "','" + mes + "','" + time + "');";
if (card!=null&&mes!=null&& !mes.trim().equals("")) { // 检查card和mes是否不为空且mes不为空白字符串
if (card != null && mes != null && !mes.trim().equals("")) {
// 执行SQL插入操作
int i = msg.executeUpdate(sql); int i = msg.executeUpdate(sql);
// 根据插入结果进行跳转
if (i == 1) { if (i == 1) {
%> %>
// 这是用户提交留言后的处理逻辑
<script> <script>
alert('留言成功!'); alert('留言成功!');
window.location.href = "15checkMessage.jsp"; window.location.href = "15checkMessage.jsp";//将当前浏览器窗口重定向到指定的jsp
</script> </script>
<% <%
} }
@ -53,7 +59,7 @@
</script> </script>
<% <%
} }
} else { } else {
%> %>
<script> <script>

@ -1,54 +1,53 @@
<%@ page import="java.sql.*" %> <%@ page import="java.sql.*" %> <!-- 导入Java SQL包用于数据库操作 -->
<%@ page import="java.util.*" %> <%@ page import="java.util.*" %> <!-- 导入Java工具包包含日期时间类等 -->
<%@ page import="javabean.DateTime"%> <%@ page import="javabean.DateTime"%> <!-- 导入自定义的DateTime类 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%> <!-- 设置页面语言为Java内容类型和字符编码为UTF-8 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- 定义HTML文档类型 -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8"> <!-- 设置字符编码为UTF-8 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 设置IE浏览器兼容模式 -->
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 设置视口宽度和初始缩放比例 -->
<title></title> <title></title> <!-- 页面标题 -->
<!-- Bootstrap --> <!-- Bootstrap CSS文件 -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery库Bootstrap的所有JavaScript插件都依赖jQuery所以必须放在前边 -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<link rel="stylesheet" id="templatecss" type="text/css" href="../public/css/message.css"> <!-- 自定义CSS文件 -->
<style type="text/css"> <link rel="stylesheet" id="templatecss" type="text/css" href="../public/css/message.css">
.text-dark{ <style type="text/css">
color:black; .text-dark{
font-family:YouYuan; color:black; <!-- 设置文本颜色为黑色 -->
} font-family:YouYuan; <!-- 设置字体为YouYuan -->
body{ }
background-color:#fff; body{
font-size:16px; background-color:#fff; <!-- 设置背景颜色为白色 -->
} font-size:16px; <!-- 设置字体大小为16px -->
</style> }
</style>
</head> </head>
<body> <body>
<jsp:useBean id="msg" scope="session" class="javabean.JDBCBean"></jsp:useBean> <jsp:useBean id="msg" scope="session" class="javabean.JDBCBean"></jsp:useBean> <!-- 使用JSP标签声明一个JavaBean对象ID为msg作用域为session类为javabean.JDBCBean -->
<div align="center"><h3 style="color:#F08080;">☆★留言板★☆</h3></div> <div align="center"><h3 style="color:#F08080;">☆★留言板★☆</h3></div> <!-- 居中显示标题,标题颜色为粉红色 -->
<% <%
String sql = "select CARD_ID,DETAIL,PUBLIC_DATE from message order by PUBLIC_DATE desc"; String sql = "select CARD_ID,DETAIL,PUBLIC_DATE from message order by PUBLIC_DATE desc"; //<!-- SQL查询语句选择CARD_ID、DETAIL和PUBLIC_DATE字段按PUBLIC_DATE降序排列 -->
ResultSet rs = msg.executeQuery(sql); ResultSet rs = msg.executeQuery(sql); //<!-- 执行SQL查询返回结果集 -->
while (rs.next()) { while (rs.next()) { //<!-- 遍历结果集 -->
%> %>
<div class="panel panel-default" style="width:60%;height:80%; margin-left:20%;"> <div class="panel panel-default" style="width:60%;height:80%; margin-left:20%;"> <!-- 创建一个面板宽度60%高度80%左边距20% -->
<div class="panel-body" align="center"> <div class="panel-body" align="center"> <!-- 面板主体部分,内容居中 -->
<p class="bg-info text-dark"><%=rs.getString("CARD_ID")%></p> <p class="bg-info text-dark"><%=rs.getString("CARD_ID")%></p> <!-- 显示CARD_ID字段的值背景色为蓝色文本颜色为黑色 -->
<div style="word-wrap:break-word;"><p class="bg-warning text-dark"><%=rs.getString("DETAIL")%></p></div> <div style="word-wrap:break-word;"><p class="bg-warning text-dark"><%=rs.getString("DETAIL")%></p></div> <!-- 显示DETAIL字段的值自动换行背景色为黄色文本颜色为黑色 -->
<p class="bg-danger text-dark"><%=rs.getString("PUBLIC_DATE")%></p> <p class="bg-danger text-dark"><%=rs.getString("PUBLIC_DATE")%></p> <!-- 显示PUBLIC_DATE字段的值背景色为红色文本颜色为黑色 -->
</div>
</div> </div>
<hr> </div>
<hr> <!-- 水平线分隔符 -->
<% <%
} }
%> %>
</body> </body>
</html> </html>

@ -1,141 +1,122 @@
<%@ page import="java.sql.*"%> <%@ page import="java.sql.*"%> <!-- 导入Java SQL包用于数据库操作 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%> <!-- 设置页面语言为Java内容类型为HTML字符编码为UTF-8 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- 定义文档类型为HTML 4.01 Transitional -->
<html> <html>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" /> <!-- 设置字符编码为UTF-8 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <!-- 设置浏览器兼容模式 -->
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- 设置视口宽度和初始缩放比例 -->
<title>Nifty Modal Window Effects</title> <title>Nifty Modal Window Effects</title> <!-- 设置网页标题 -->
<meta name="description" <meta name="description"
content="Nifty Modal Window Effects with CSS Transitions and Animations" /> content="Nifty Modal Window Effects with CSS Transitions and Animations" /> <!-- 设置网页描述 -->
<meta name="keywords" <meta name="keywords"
content="modal, window, overlay, modern, box, css transition, css animation, effect, 3d, perspective" /> content="modal, window, overlay, modern, box, css transition, css animation, effect, 3d, perspective" /> <!-- 设置网页关键词 -->
<meta name="author" content="Codrops" /> <meta name="author" content="Codrops" /> <!-- 设置作者信息 -->
<!-- Bootstrap --> <!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/bootstrap.min.css" rel="stylesheet"> <!-- 引入Bootstrap样式表 -->
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) --> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery所以必须放在前边) -->
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="../public/css/default.css" /> <!-- 引入默认样式表 -->
<link rel="stylesheet" type="text/css" href="../public/css/default.css" /> <link rel="stylesheet" type="text/css"
<link rel="stylesheet" type="text/css" href="../public/css/component.css" /> <!-- 引入组件样式表 -->
href="../public/css/component.css" />
<script src="../public/js/modernizr.custom.js"></script>
</head> </head>
<body> <body>
<% <%
if (session.getAttribute("reader") == null) { if (session.getAttribute("reader") == null) { //<!-- 如果会话中的reader属性为空 -->
%> %>
<script> location.href = "../loginReader.html"; <!-- 重定向到登录页面 -->
location.href = "../loginReader.html"; <%
</script> }
<% %>
} <jsp:useBean id="check" scope="session" class="javabean.JDBCBean"></jsp:useBean> <!-- 使用JSP标签创建JDBCBean对象 -->
%> <!-- All modals added here for the demo. You would of course just have one, dynamically created -->
<jsp:useBean id="check" scope="session" class="javabean.JDBCBean"></jsp:useBean>
<!-- All modals added here for the demo. You would of course just have one, dynamically created -->
<div class="md-modal md-effect-13" id="modal-13"> <div class="md-modal md-effect-13" id="modal-13"> <!-- 模态框容器 -->
<div class="md-content"> <div class="md-content"> <!-- 模态框内容 -->
<h3>修改密码</h3> <h3>修改密码</h3> <!-- 模态框标题 -->
<form action="11updatePswSus.jsp" method="post" <form action="11updatePswSus.jsp" method="post"
class="form-horizontal"> class="form-horizontal"> <!-- 表单提交到11updatePswSus.jsp使用POST方法水平排列表单元素 -->
<div class="form-group" align="center"> <div class="form-group" align="center"> <!-- 表单组 -->
<br>
<label for="psw1" class="col-sm-2 control-label">新密码</label>
<div class="col-sm-10" align="center">
<input type="password" class="form-control" name="psw1" id="password1" placeholder="请输入新密码" style="width:70%;"/>
</div>
</div>
<br> <br>
<div class="form-group" align="center"> <label for="psw1" class="col-sm-2 control-label">新密码</label> <!-- 新密码标签 -->
<label for="psw2" class="col-sm-2 control-label">新密码</label> <div class="col-sm-10" align="center"> <!-- 输入框容器 -->
<div class="col-sm-10"> <input type="password" class="form-control" name="psw1" id="password1" placeholder="请输入新密码" style="width:70%;"/> <!-- 新密码输入框 -->
<input type="password" class="form-control" name="psw2" id="password2" placeholder="请再次输入密码进行确认" style="width:70%;"/>
</div>
</div> </div>
<div align="center"> </div>
<input type="submit" class="btn btn-primary" value="确认"> <br>
<div class="form-group" align="center"> <!-- 表单组 -->
<label for="psw2" class="col-sm-2 control-label">新密码</label> <!-- 确认新密码标签 -->
<div class="col-sm-10"> <!-- 输入框容器 -->
<input type="password" class="form-control" name="psw2" id="password2" placeholder="请再次输入密码进行确认" style="width:70%;"/> <!-- 确认新密码输入框 -->
</div> </div>
</div>
<div align="center"> <!-- 提交按钮容器 -->
<input type="submit" class="btn btn-primary" value="确认"> <!-- 提交按钮 -->
<br> <br>
</form> </div>
<button class="md-close btn-primary">取消</button> </form>
<br> <button class="md-close btn-primary">取消</button> <!-- 取消按钮 -->
</div> <br>
</div> </div>
</div>
<div class="container"> <div class="container"> <!-- 主容器 -->
<!-- Top Navigation --> <!-- Top Navigation -->
<header style="backgorund-color:lightblue;height:20%;font-align:center;width:100%;font-family:YouYuan;"> <header style="backgorund-color:lightblue;height:20%;width:100%;font-family:YouYuan;"> <!-- 顶部导航栏 -->
<h1>个人信息 <h1>个人信息
<span class="glyphicon glyphicon-bookmark" aria-hidden="true" style="font-size:17px;">&nbsp;Success is waking up in the morning,so excited about what you have to do.</span> <span class="glyphicon glyphicon-bookmark" aria-hidden="true" style="font-size:17px">&nbsp;&nbsp;Success is waking up in the morning, excited about what you have to do.</span>
</h1> </h1>
</header> </header>
<div class="main clearfix" style="font-size:10px;margin-top:5%;font-family:YouYuan;">
<div class="column">
<%
try{
String cardId=session.getAttribute("reader").toString();
String sql="select*from borrow_card where ID = '"+ cardId +"';";
ResultSet rs = check.executeQuery(sql);
while (rs.next()) {
%>
<% int id = rs.getInt(1);%>
<p><span class="glyphicon glyphicon-tags">&nbsp;借阅证编号:<%=rs.getString("ID")%></span></p><br>
<p><span class="glyphicon glyphicon-user">&nbsp;借阅证姓名:<%=rs.getString("READER")%></span></p><br>
<p><span class="glyphicon glyphicon-tag">&nbsp;规则编号:<%=rs.getString("RULE_ID")%></span></p><br>
<p><span class="glyphicon glyphicon-star-empty">&nbsp;状态:
<%
if(rs.getString("STATUS").equals("1")){
out.println("可用");
}
else{
out.println("挂失");
}
%>
</span></p>
<%
}
}catch(Exception e){
}
%>
</div>
<div class="column" align="center" style="font-size:15px">
<button class="md-trigger" data-modal="modal-13" style="margin-top:20%;">修改密码</button>
</div> <div class="main clearfix" style="font-size:10px;margin-top:5%;font-family:YouYuan;"> <!-- 主要内容区域 -->
<div class="column"> <!-- 左侧列 -->
<%
try{
String cardId = session.getAttribute("reader").toString(); // 获取会话中的reader属性并转换为字符串
String sql = "select * from borrow_card where ID = '" + cardId + "';"; // SQL查询语句根据reader ID查询借阅卡信息
ResultSet rs = check.executeQuery(sql); // 执行SQL查询返回结果集
while(rs.next()){ // 遍历结果集
%>
<% int id =rs.getInt("ID"); %> <%-- 获取ID字段的值 --%>
<p><span class="glyphicon glyphicon-tags">&nbsp;借阅卡编号:<%=rs.getString("ID")%></span></p> <%-- 显示借阅卡编号 --%>
<p><span class="glyphicon glyphicon-user">&nbsp;借阅人:<%=rs.getString("READER")%></span></p> <%-- 显示借阅人 --%>
<p><span class="glyphicon glyphicon-tag">&nbsp;规则编号:<%=rs.getString("RULE_ID")%></span></p> <%-- 显示规则编号 --%>
<p><span class="glyphicon glyphicon-star-empty">&nbsp;状态:
<%
if(rs.getString("STATUS").equals("1")){ // 根据状态值判断状态
out.println("可用"); // 如果状态值为1显示“可用”
}else{
out.println("挂失"); // 如果状态值不为1显示“挂失”
}
%>
</span></p>
<%}
}catch(Exception e){ // 捕获异常
}
%>
</div>
<div class="column" align="center" style="font-size:15px;"> <!-- 右侧列 -->
<button class="md-trigger btn-primary" data-modal="modal-13" style="margin-top:20%;">修改密码</button> <!-- 修改密码按钮 -->
</div> </div>
</div> </div>
<!-- /container --> </div>
<div class="md-overlay"></div>
<!-- the overlay element -->
<!-- classie.js by @desandro: https://github.com/desandro/classie -->
<script src="../public/js/classie.js"></script>
<script src="../public/js/modalEffects.js"></script>
<!-- for the blur effect --> <div class="md-overlay"></div> <!-- 模态框覆盖层 -->
<!-- by @derSchepp https://github.com/Schepp/CSS-Filters-Polyfill --> <!-- classie by @desandro https://github.com/desandro/classie -->
<script> <!-- classie.js - class helper functions by desandro -->
// this is important for IEs <script src="js/classie.js"></script>
var polyfilter_scriptpath = '/js/'; <!-- for the blur effect -->
</script> <!-- by @derekdrees https://github.com/ded/SpinKit -->
<script src="../public/js/cssParser.js"></script> <script src="js/spinkit.js"></script>
<script src="../public/js/css-filters-polyfill.js"></script> <script>
// this is important for the blur effect
var polyfillscriptpath = 'polyfill/'; // polyfill脚本路径
</script>
</body> </body>
</html> </html>

@ -1,67 +1,71 @@
package javabean; package javabean; // 定义包名,用于组织类和接口
import java.sql.Connection; import java.sql.Connection; // 导入Connection类用于数据库连接
import java.sql.PreparedStatement; import java.sql.PreparedStatement; // 导入PreparedStatement类用于执行预编译的SQL语句
import java.sql.ResultSet; import java.sql.ResultSet; // 导入ResultSet类用于存储查询结果
import java.sql.SQLException; import java.sql.SQLException; // 导入SQLException类用于处理SQL异常
import java.util.HashMap; import java.util.HashMap; // 导入HashMap类用于存储键值对
import java.util.TreeMap; import java.util.TreeMap; // 导入TreeMap类用于存储有序的键值对
public class Common { public class Common { // 定义公共类Common
/** /**
* *
* @return * @param table
* @throws SQLException * @return
* @throws ClassNotFoundException * @throws SQLException 访
* @throws ClassNotFoundException
*/ */
public static int getCount(String table) throws SQLException, ClassNotFoundException { public static int getCount(String table) throws SQLException, ClassNotFoundException {
if(table == null || table.equals("")) { if(table == null || table.equals("")) { // 检查表名是否为空
return 0; return 0; // 如果为空返回0
} }
Connection connection = null; Connection connection = null; // 初始化数据库连接对象
PreparedStatement pstmt = null; PreparedStatement pstmt = null; // 初始化预编译语句对象
ResultSet resultSet = null; ResultSet resultSet = null; // 初始化结果集对象
connection = Base.getConnection(); connection = Base.getConnection(); // 获取数据库连接
try { try {
pstmt = connection.prepareStatement("select count(*) as count from " +table); pstmt = connection.prepareStatement("select count(*) as count from " +table); // 准备SQL查询语句
resultSet = pstmt.executeQuery(); resultSet = pstmt.executeQuery(); // 执行查询并获取结果集
resultSet.next(); resultSet.next(); // 移动到结果集的第一行
return resultSet.getInt("count"); return resultSet.getInt("count"); // 返回计数结果
}catch(Exception e) { }catch(Exception e) { // 捕获所有异常
return 0; return 0; // 发生异常时返回0
}finally { }finally {
Base.closeResource(connection, pstmt, resultSet); Base.closeResource(connection, pstmt, resultSet); // 关闭资源
} }
} }
/**
*
* @return ID
* @throws SQLException 访
*/
public static TreeMap<String, String> getLibraryMap() throws SQLException { public static TreeMap<String, String> getLibraryMap() throws SQLException {
Connection connection = null; Connection connection = null; // 初始化数据库连接对象
PreparedStatement libraryPstmt = null; PreparedStatement libraryPstmt = null; // 初始化预编译语句对象
ResultSet librarySet = null; ResultSet librarySet = null; // 初始化结果集对象
String librarySql = "select id,name from library"; String librarySql = "select id,name from library"; // SQL查询语句
TreeMap<String, String> map = new TreeMap<String, String>(); TreeMap<String, String> map = new TreeMap<String, String>(); // 创建有序映射对象
// 获取图书馆 // 获取图书馆
try { try {
connection = (Connection) Base.getConnection(); connection = (Connection) Base.getConnection(); // 获取数据库连接
libraryPstmt = connection.prepareStatement(librarySql); libraryPstmt = connection.prepareStatement(librarySql); // 准备SQL查询语句
librarySet = libraryPstmt.executeQuery(); librarySet = libraryPstmt.executeQuery(); // 执行查询并获取结果集
while(librarySet.next()) { while(librarySet.next()) { // 遍历结果集
map.put(librarySet.getString("id"), librarySet.getString("name")); map.put(librarySet.getString("id"), librarySet.getString("name")); // 将结果添加到映射中
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) { // 捕获类未找到异常
return null; return null; // 返回null
} catch (SQLException e) { } catch (SQLException e) { // 捕获SQL异常
return null; return null; // 返回null
} finally { } finally {
Base.closeResource(connection, libraryPstmt, librarySet); Base.closeResource(connection, libraryPstmt, librarySet); // 关闭资源
} }
return map; return map; // 返回映射对象
} }
public static void main(String[] args) throws SQLException { public static void main(String[] args) throws SQLException { // 主方法,程序入口点
System.out.println(Common.getLibraryMap()); System.out.println(Common.getLibraryMap()); // 打印图书馆映射信息
} }
} }

@ -8,24 +8,26 @@ import java.sql.SQLException;
public class Reader { public class Reader {
@SuppressWarnings("null") @SuppressWarnings("null")
public String login(String user, String psw) throws ClassNotFoundException, SQLException { public String login(String user, String psw) throws ClassNotFoundException, SQLException {
//检查用户名是否为空
if (user == null || user.trim().equals("")) { if (user == null || user.trim().equals("")) {
return "账号不能为空"; return "账号不能为空";
} else if (psw == null || psw.trim().equals("")) { } else if (psw == null || psw.trim().equals("")) {//检查密码是否为空
return "密码不能为空"; return "密码不能为空";
} }
Connection connection = null; Connection connection = null; // 数据库连接对象
PreparedStatement pstmt = null; PreparedStatement pstmt = null; // 预编译的SQL语句对象
ResultSet resultSet = null; ResultSet resultSet = null; // 查询结果集对象
String sql = "select * from borrow_card where ID=? and PASSWORD=?"; String sql = "select * from borrow_card where ID=? and PASSWORD=?"; // SQL查询语句
connection = Base.getConnection();
pstmt = (PreparedStatement) connection.prepareStatement(sql); connection = Base.getConnection(); // 获取数据库连接
pstmt.setString(1, user); pstmt = (PreparedStatement) connection.prepareStatement(sql); // 创建PreparedStatement对象
pstmt.setString(2, psw); pstmt.setString(1, user); // 设置第一个参数(用户名)
resultSet = pstmt.executeQuery(); pstmt.setString(2, psw); // 设置第二个参数(密码)
if (resultSet.next()) { resultSet = pstmt.executeQuery(); // 执行查询
if (resultSet.next()) { // 如果查询有结果,说明账号密码正确
return "1"; return "1";
} }
return "账号或密码错误"; return "账号或密码错误"; // 如果没有查询到结果,返回错误信息
} }
} }

@ -1,88 +1,89 @@
package javabean; package javabean; // 定义包名,用于组织类和接口
import java.math.BigInteger; import java.math.BigInteger; // 导入BigInteger类用于处理大整数
import java.security.MessageDigest; import java.security.MessageDigest; // 导入MessageDigest类用于生成MD5摘要
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException; // 导入NoSuchAlgorithmException异常类用于处理没有指定算法的情况
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat; // 导入SimpleDateFormat类用于格式化日期
import net.sf.json.JSONObject; import net.sf.json.JSONObject; // 导入JSONObject类用于处理JSON数据
public class Util { public class Util { // 定义一个公共类Util
/** /**
* json * json
* @param str * @param str json
* @param contain * @param contain
* @return * @return
*/ */
public static int getCountString(String str, String contain) { public static int getCountString(String str, String contain) {
int count = ( str.length()-str.replace(contain, "").length() ) / contain.length(); int count = ( str.length()-str.replace(contain, "").length() ) / contain.length(); // 计算包含特定字符串的次数
return count; return count; // 返回计数结果
} }
/** /**
* datetime .0 , * datetime .0 ,
* @param dateTime * @param dateTime
* @return * @return .0
*/ */
public static String getFormatDateTime(String dateTime) { public static String getFormatDateTime(String dateTime) {
if(dateTime != null && dateTime.indexOf(".0") != -1) { if(dateTime != null && dateTime.indexOf(".0") != -1) { // 如果字符串不为空且包含".0"
return dateTime.substring(0, dateTime.length()-2); return dateTime.substring(0, dateTime.length()-2); // 去除最后两个字符(即".0"
}else if(dateTime != null) { }else if(dateTime != null) { // 如果字符串不为空但不包含".0"
return dateTime; return dateTime; // 直接返回原字符串
} }
return null; return null; // 如果字符串为空返回null
} }
/** /**
* *
* @return * @return
*/ */
public static String getCurrentTimeString() { public static String getCurrentTimeString() {
java.util.Date date = new java.util.Date(); java.util.Date date = new java.util.Date(); // 创建当前日期对象
SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); // 定义日期格式
return dateFormat.format(date); return dateFormat.format(date); // 返回格式化后的日期字符串
} }
/* /*
* json * json
*/ */
public static String jsonResponse(int code, String msg, String data) { public static String jsonResponse(int code, String msg, String data) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject(); // 创建JSON对象
jsonObject.put("code", code); jsonObject.put("code", code); // 添加code字段
jsonObject.put("msg", msg); jsonObject.put("msg", msg); // 添加msg字段
if( data!=null ) { if( data!=null ) { // 如果data不为空
jsonObject.put("data", data); jsonObject.put("data", data); // 添加data字段
} }
return jsonObject.toString(); return jsonObject.toString(); // 返回JSON字符串
} }
/* /*
* md5 * md5
*/ */
public static String stringToMD5(String plainText) { public static String stringToMD5(String plainText) {
byte[] secretBytes = null; byte[] secretBytes = null; // 定义字节数组用于存储MD5摘要
try { try {
secretBytes = MessageDigest.getInstance("md5").digest( secretBytes = MessageDigest.getInstance("md5").digest(
plainText.getBytes()); plainText.getBytes()); // 生成MD5摘要
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) { // 捕获没有该算法的异常
throw new RuntimeException("没有这个md5算法"); throw new RuntimeException("没有这个md5算法"); // 抛出运行时异常
} }
String md5code = new BigInteger(1, secretBytes).toString(16); String md5code = new BigInteger(1, secretBytes).toString(16); // 将字节数组转换为16进制字符串
for (int i = 0; i < 32 - md5code.length(); i++) { for (int i = 0; i < 32 - md5code.length(); i++) { // 如果长度不足32位前面补0
md5code = "0" + md5code; md5code = "0" + md5code;
} }
return md5code; return md5code; // 返回MD5字符串
} }
public static String passMd5(String password) { public static String passMd5(String password) {
String salt = "ew!.E"; String salt = "ew!.E"; // 定义盐值
return Util.stringToMD5(password +salt); return Util.stringToMD5(password +salt); // 返回加盐后的MD5字符串
} }
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(Util.passMd5("admin")); System.out.println(Util.passMd5("admin")); // 测试MD5加密函数输出加密后的字符串
//java.util.Date date = new java.util.Date(); //java.util.Date date = new java.util.Date(); // 注释掉的代码:创建当前日期对象
//SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); //SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); // 注释掉的代码:定义日期格式
//System.out.println(dateFormat.format(date)); //System.out.println(dateFormat.format(date)); // 注释掉的代码:输出格式化后的日期字符串
} }
} }

@ -24,20 +24,25 @@ import net.sf.json.JSONObject;
public class Book extends HttpServlet { public class Book extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 设置响应内容类型为JSON字符编码为UTF-8
resp.setContentType("application/json; charset=utf8"); resp.setContentType("application/json; charset=utf8");
// 接收参数
String limit = req.getParameter("limit"); // 接收请求参数
String page = req.getParameter("page"); String limit = req.getParameter("limit"); // 每页显示的记录数
String condition = (String) req.getParameter("condition"); String page = req.getParameter("page"); // 当前页码
String conditionValue = (String) req.getParameter("conditionValue"); String condition = (String) req.getParameter("condition"); // 查询条件字段
String where = ""; // 无限制条件 String conditionValue = (String) req.getParameter("conditionValue"); // 查询条件值
String where = ""; // SQL查询条件字符串
// 默认分页参数
if (page == null) { if (page == null) {
page = "1"; page = "1";
} }
if (limit == null) { if (limit == null) {
limit = "10"; limit = "10";
} }
// 准备查询
// 数据库连接和SQL语句准备
Connection connection = null; Connection connection = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement countPstmt = null; PreparedStatement countPstmt = null;
@ -45,30 +50,44 @@ public class Book extends HttpServlet {
ResultSet countSet = null; ResultSet countSet = null;
String sql = ""; String sql = "";
String countSql = ""; String countSql = "";
// 准备返回参数
int code = 1;
String msg = "无数据";
int count = 0;
JSONObject jsonData = new JSONObject(); // 返回数据结构初始化
JSONArray jsonArray = new JSONArray(); int code = 1; // 状态码1表示失败0表示成功
JSONObject jsonResult = new JSONObject(); String msg = "无数据"; // 消息提示
// 进行查询 int count = 0; // 总记录数
JSONObject jsonData = new JSONObject(); // 单条记录的JSON对象
JSONArray jsonArray = new JSONArray(); // 所有记录的JSON数组
JSONObject jsonResult = new JSONObject(); // 最终返回的JSON对象
try { try {
// 获取数据库连接
connection = (Connection) Base.getConnection(); connection = (Connection) Base.getConnection();
sql = "select * from books "; sql = "select * from books ";
// 根据条件拼接SQL查询语句
if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) { if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) {
where = " where " + condition + " like '%" + conditionValue + "%' "; where = " where " + condition + " like '%" + conditionValue + "%' ";
sql += where; sql += where;
} }
sql += " limit ?,?";// 1 10 (1-1)*10 // 分页查询
sql += " limit ?,?"; // 计算偏移量和限制数量
pstmt = connection.prepareStatement(sql); pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit)); pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit));
pstmt.setInt(2, Integer.parseInt(limit)); pstmt.setInt(2, Integer.parseInt(limit));
resultSet = pstmt.executeQuery(); resultSet = pstmt.executeQuery();
while (resultSet.next()) {
// 处理查询结果集
while (resultSet.next()) {
// 获取图书信息
String library = resultSet.getString("library_id"); String library = resultSet.getString("library_id");
String sortid = resultSet.getString("sort_id");
jsonData.put("id", resultSet.getString("id"));
jsonData.put("name", resultSet.getString("name"));
jsonData.put("author", resultSet.getString("author"));
jsonData.put("position", resultSet.getString("position"));
jsonData.put("status", resultSet.getString("status"));
jsonData.put("description", resultSet.getString("description"));
// 获取图书馆名称
String sql1 = "select * from library where ID =" + library; String sql1 = "select * from library where ID =" + library;
PreparedStatement pstmt1 = connection.prepareStatement(sql1); PreparedStatement pstmt1 = connection.prepareStatement(sql1);
ResultSet rs1 = pstmt1.executeQuery(); ResultSet rs1 = pstmt1.executeQuery();
@ -76,8 +95,9 @@ public class Book extends HttpServlet {
while (rs1.next()) { while (rs1.next()) {
lib = rs1.getString("name"); lib = rs1.getString("name");
} }
jsonData.put("library_id", lib);
String sortid = resultSet.getString("sort_id"); // 获取分类名称
String sql2 = "select * from book_sort where ID =" + sortid; String sql2 = "select * from book_sort where ID =" + sortid;
PreparedStatement pstmt2 = connection.prepareStatement(sql2); PreparedStatement pstmt2 = connection.prepareStatement(sql2);
ResultSet rs2 = pstmt2.executeQuery(); ResultSet rs2 = pstmt2.executeQuery();
@ -85,17 +105,12 @@ public class Book extends HttpServlet {
while (rs2.next()) { while (rs2.next()) {
sort = rs2.getString("name"); sort = rs2.getString("name");
} }
jsonData.put("id", resultSet.getString("id"));
jsonData.put("name", resultSet.getString("name"));
jsonData.put("author", resultSet.getString("author"));
jsonData.put("library_id", lib);
jsonData.put("sort_id", sort); jsonData.put("sort_id", sort);
jsonData.put("position", resultSet.getString("position"));
jsonData.put("status", resultSet.getString("status")); // 将单条记录添加到JSON数组中
jsonData.put("description", resultSet.getString("description"));
jsonArray.add(jsonData); jsonArray.add(jsonData);
} }
// 统计总记录数
countSql = "select count(*) as count from books "; countSql = "select count(*) as count from books ";
countSql += where; countSql += where;
countPstmt = connection.prepareStatement(countSql); countPstmt = connection.prepareStatement(countSql);
@ -104,28 +119,28 @@ public class Book extends HttpServlet {
count = countSet.getInt("count"); count = countSet.getInt("count");
} }
if (!jsonArray.isEmpty()) { if (!jsonArray.isEmpty()) {
code = 0; code = 0; // 查询成功
msg = "查询成功"; msg = "查询成功";
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
msg = "class没找到"; msg = "class没找到"; // 类未找到异常处理
} catch (SQLException e) { } catch (SQLException e) {
msg = "sql错误"; msg = "sql错误"; // SQL异常处理
} finally { } finally {
// 关闭资源
try { try {
Base.closeResource(null, pstmt, resultSet); Base.closeResource(null, pstmt, resultSet);
Base.closeResource(connection, countPstmt, countSet); Base.closeResource(connection, countPstmt, countSet);
} catch (SQLException e) { } catch (SQLException e) {
msg = "关闭资源失败"; msg = "关闭资源失败"; // 关闭资源异常处理
} }
} }
// 返回数据 // 构建返回的JSON对象
jsonResult.put("code", code); jsonResult.put("code", code);
jsonResult.put("count", count); jsonResult.put("count", count);
jsonResult.put("msg", msg); jsonResult.put("msg", msg);
jsonResult.put("data", jsonArray.toArray()); jsonResult.put("data", jsonArray.toArray());
// 输出JSON响应
PrintWriter out = resp.getWriter(); PrintWriter out = resp.getWriter();
out.print(jsonResult.toString()); out.print(jsonResult.toString());
} }

@ -25,93 +25,93 @@ import net.sf.json.JSONObject;
public class Borrow extends HttpServlet { public class Borrow extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//设置响应内容类型为JSON编码格式为UTF-8
resp.setContentType("application/json; charset=utf8"); resp.setContentType("application/json; charset=utf8");
// 接收参数 // 接收分页参数
String limit = req.getParameter("limit"); String limit = req.getParameter("limit"); // 每页显示记录数
String page = req.getParameter("page"); String page = req.getParameter("page"); // 当前页码
String condition = (String) req.getParameter("condition"); String condition = (String) req.getParameter("condition"); // 查询条件字段名
String conditionValue = (String) req.getParameter("conditionValue"); String conditionValue = (String) req.getParameter("conditionValue"); // 查询条件值
String where = ""; // 无限制条件 String where = ""; // 初始化查询条件字符串
if (page == null) { if (page == null) {
page = "1"; page = "1"; // 默认第一页
} }
if (limit == null) { if (limit == null) {
limit = "10"; limit = "10"; // 默认每页显示10条记录
} }
// 准备查询 // 准备数据库连接和查询对象
Connection connection = null; Connection connection = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement countPstmt = null; PreparedStatement countPstmt = null;
ResultSet resultSet = null; ResultSet resultSet = null;
ResultSet countSet = null; ResultSet countSet = null;
String sql = ""; String sql = ""; // SQL查询语句
String countSql = ""; String countSql = ""; // 统计总数SQL查询语句
// 准备返回参数 // 返回结果的参数
int code = 1; int code = 1; // 状态码1表示失败0表示成功
String msg = "无数据"; String msg = "无数据"; // 返回消息
int count = 0; int count = 0; // 总记录数
HttpSession session = req.getSession(); HttpSession session = req.getSession(); // 获取用户会话
JSONObject jsonData = new JSONObject(); JSONObject jsonData = new JSONObject(); // JSON对象存储单条记录数据
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray(); // JSON数组存储多条记录数据
JSONObject jsonResult = new JSONObject(); JSONObject jsonResult = new JSONObject(); // JSON对象存储最终返回结果
// 进行查询 // 执行查询操作
try { try {
connection = (Connection) Base.getConnection(); connection = (Connection) Base.getConnection(); // 获取数据库连接
sql = "select * from borrow_books where card_id = " + session.getAttribute("reader"); sql = "select * from borrow_books where card_id = " + session.getAttribute("reader"); // 构建基本查询语句
if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) { if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) {
where = " and " + condition + " like '%" + conditionValue + "%' "; where = " and " + condition + " like '%" + conditionValue + "%' "; // 添加查询条件
sql += where; sql += where; // 拼接完整查询语句
} }
sql += " limit ?,?";// 1 10 (1-1)*10 sql += " limit ?,?"; // 添加分页限制
System.out.println("???" + sql); System.out.println("???" + sql); // 打印SQL查询语句调试用
pstmt = connection.prepareStatement(sql); pstmt = connection.prepareStatement(sql); // 预编译SQL查询语句
pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit)); pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit)); // 设置第一个参数:起始位置
pstmt.setInt(2, Integer.parseInt(limit)); pstmt.setInt(2, Integer.parseInt(limit)); // 设置第二个参数:每页显示记录数
resultSet = pstmt.executeQuery(); resultSet = pstmt.executeQuery(); // 执行查询,获取结果集
while (resultSet.next()) { while (resultSet.next()) {
jsonData.put("id", resultSet.getString("id")); jsonData.put("id", resultSet.getString("id")); // 获取并存储记录ID
jsonData.put("card_id", resultSet.getString("card_id")); jsonData.put("card_id", resultSet.getString("card_id")); // 获取并存储读者ID
jsonData.put("book_id", resultSet.getString("book_id")); jsonData.put("book_id", resultSet.getString("book_id")); // 获取并存储书籍ID
jsonData.put("borrow_date", resultSet.getString("borrow_date")); jsonData.put("borrow_date", resultSet.getString("borrow_date")); // 获取并存储借阅日期
jsonData.put("end_date", resultSet.getString("end_date")); jsonData.put("end_date", resultSet.getString("end_date")); // 获取并存储到期日期
jsonData.put("return_date", resultSet.getString("return_date")); jsonData.put("return_date", resultSet.getString("return_date")); // 获取并存储归还日期
jsonArray.add(jsonData); jsonArray.add(jsonData); // 将记录添加到JSON数组中
} }
countSql = "select count(*) as count from borrow_books where card_id = " countSql = "select count(*) as count from borrow_books where card_id = " + req.getSession().getAttribute("reader"); // 构建统计总数SQL查询语句
+ req.getSession().getAttribute("reader"); countSql += where; // 拼接查询条件
countSql += where; countPstmt = connection.prepareStatement(countSql); // 预编译统计总数SQL查询语句
countPstmt = connection.prepareStatement(countSql); countSet = countPstmt.executeQuery(); // 执行查询,获取结果集
countSet = countPstmt.executeQuery();
if (countSet.next()) { if (countSet.next()) {
count = countSet.getInt("count"); count = countSet.getInt("count"); // 获取总记录数
} }
if (!jsonArray.isEmpty()) { if (!jsonArray.isEmpty()) { // 如果JSON数组不为空表示有数据
code = 0; code = 0; // 设置状态码为0表示成功
msg = "查询成功"; msg = "查询成功"; // 设置返回消息为“查询成功”
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) { // 捕获类未找到异常
msg = "class没找到"; msg = "class没找到"; // 设置返回消息为“class没找到”
} catch (SQLException e) { } catch (SQLException e) { // 捕获SQL异常
msg = "sql错误"; msg = "sql错误"; // 设置返回消息为“sql错误”
} finally { } finally { // 最终块,用于关闭资源
try { try {
Base.closeResource(null, pstmt, resultSet); Base.closeResource(null, pstmt, resultSet); // 关闭查询语句和结果集
Base.closeResource(connection, countPstmt, countSet); Base.closeResource(connection, countPstmt, countSet); // 关闭数据库连接和统计结果集
} catch (SQLException e) { } catch (SQLException e) { // 捕获SQL异常
msg = "关闭资源失败"; msg = "关闭资源失败"; // 设置返回消息为“关闭资源失败”
} }
} }
// 返回数据 // 将结果封装成JSON对象并输出到响应中
jsonResult.put("code", code); jsonResult.put("code", code); // 添加状态码到JSON对象中
jsonResult.put("count", count); jsonResult.put("count", count); // 添加总记录数到JSON对象中
jsonResult.put("msg", msg); jsonResult.put("msg", msg); // 添加返回消息到JSON对象中
jsonResult.put("data", jsonArray.toArray()); jsonResult.put("data", jsonArray.toArray()); // 添加数据数组到JSON对象中
PrintWriter out = resp.getWriter(); PrintWriter out = resp.getWriter(); // 获取响应输出流
out.print(jsonResult.toString()); out.print(jsonResult.toString()); // 输出JSON结果到响应中
} }
} }

@ -19,11 +19,14 @@ public class Exit extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
// 获取当前请求的会话对象。如果会话不存在,则创建一个新的会话。
HttpSession session = req.getSession(); HttpSession session = req.getSession();
// 检查会话中是否存在名为 "reader" 的属性。
if (session.getAttribute("reader") != null) { if (session.getAttribute("reader") != null) {
// 如果存在,则移除该属性。
session.removeAttribute("reader"); session.removeAttribute("reader");
} }
// 重定向到指定的 JSP 页面。
resp.sendRedirect(req.getContextPath() + "/reader/04readerFrame.jsp"); resp.sendRedirect(req.getContextPath() + "/reader/04readerFrame.jsp");
} }
} }

@ -25,52 +25,66 @@ import net.sf.json.JSONObject;
public class Illegal extends HttpServlet { public class Illegal extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 设置响应内容类型为 JSON并指定字符编码为 UTF-8
resp.setContentType("application/json; charset=utf8"); resp.setContentType("application/json; charset=utf8");
// 接收参数
String limit = req.getParameter("limit"); // 接收请求参数
String page = req.getParameter("page"); String limit = req.getParameter("limit"); // 每页显示记录数
String condition = (String) req.getParameter("condition"); String page = req.getParameter("page"); // 当前页码
String conditionValue = (String) req.getParameter("conditionValue"); String condition = (String) req.getParameter("condition"); // 查询条件字段
String where = ""; // 无限制条件 String conditionValue = (String) req.getParameter("conditionValue"); // 查询条件值
String where = ""; // 初始化查询条件字符串
// 如果未提供分页参数,则使用默认值
if (page == null) { if (page == null) {
page = "1"; page = "1"; // 默认第一页
} }
if (limit == null) { if (limit == null) {
limit = "10"; limit = "10"; // 默认每页显示10条记录
} }
// 准备查询
// 准备数据库连接和查询对象
Connection connection = null; Connection connection = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
PreparedStatement countPstmt = null; PreparedStatement countPstmt = null;
ResultSet resultSet = null; ResultSet resultSet = null;
ResultSet countSet = null; ResultSet countSet = null;
String sql = ""; String sql = ""; // SQL 查询语句
String countSql = ""; String countSql = ""; // 统计总记录数的 SQL 查询语句
// 准备返回参数
int code = 1; // 准备返回结果的参数
String msg = "无数据"; int code = 1; // 状态码1表示失败0表示成功
int count = 0; String msg = "无数据"; // 返回消息
HttpSession session = req.getSession(); int count = 0; // 总记录数
HttpSession session = req.getSession(); // 获取会话对象
// 用于存储查询结果的 JSON 对象和数组
JSONObject jsonData = new JSONObject(); JSONObject jsonData = new JSONObject();
JSONArray jsonArray = new JSONArray(); JSONArray jsonArray = new JSONArray();
JSONObject jsonResult = new JSONObject(); JSONObject jsonResult = new JSONObject();
// 进行查询
// 进行数据库查询操作
try { try {
// 获取数据库连接
connection = (Connection) Base.getConnection(); connection = (Connection) Base.getConnection();
sql = "select * from borrow_books where ILLEGAL is not null and length(trim(illegal))>0 AND CARD_ID = " // 构建 SQL 查询语句,查询借阅记录中存在违规信息的记录
+ session.getAttribute("reader"); sql = "select * from borrow_books where ILLEGAL is not null and length(trim(illegal))>0 AND CARD_ID = " + session.getAttribute("reader");
// 如果提供了查询条件,则添加到 SQL 查询语句中
if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) { if (condition != null && conditionValue != null && !condition.equals("") && !conditionValue.equals("")) {
where = " and " + condition + " like '%" + conditionValue + "%' "; where = " and " + condition + " like '%" + conditionValue + "%' ";
sql += where; sql += where;
} }
sql += " limit ?,?";// 1 10 (1-1)*10 // 添加分页限制条件
System.out.println("???" + sql); sql += " limit ?,?"; // 例如limit 1,10 (1-1)*10
System.out.println("???" + sql); // 打印 SQL 查询语句(调试用)
pstmt = connection.prepareStatement(sql); pstmt = connection.prepareStatement(sql);
// 设置分页参数,计算起始位置和每页记录数
pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit)); pstmt.setInt(1, (Integer.parseInt(page) - 1) * Integer.parseInt(limit));
pstmt.setInt(2, Integer.parseInt(limit)); pstmt.setInt(2, Integer.parseInt(limit));
// 执行查询并处理结果集
resultSet = pstmt.executeQuery(); resultSet = pstmt.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
// 将查询结果集中的每一行数据存入 JSON 对象中,并添加到 JSON 数组中
jsonData.put("id", resultSet.getString("id")); jsonData.put("id", resultSet.getString("id"));
jsonData.put("card_id", resultSet.getString("card_id")); jsonData.put("card_id", resultSet.getString("card_id"));
jsonData.put("book_id", resultSet.getString("book_id")); jsonData.put("book_id", resultSet.getString("book_id"));
@ -81,39 +95,39 @@ public class Illegal extends HttpServlet {
jsonData.put("manager_id", resultSet.getString("manager_id")); jsonData.put("manager_id", resultSet.getString("manager_id"));
jsonArray.add(jsonData); jsonArray.add(jsonData);
} }
countSql = "select count(*) as count from borrow_books where ILLEGAL is not null and length(trim(illegal))>0 AND CARD_ID = " // 构建统计总记录数的 SQL 查询语句,并执行查询以获取总记录数
+ session.getAttribute("reader"); countSql = "select count(*) as count from borrow_books where ILLEGAL is not null and length(trim(illegal))>0 AND CARD_ID = " + session.getAttribute("reader");
countSql += where; countSql += where;
countPstmt = connection.prepareStatement(countSql); countPstmt = connection.prepareStatement(countSql);
countSet = countPstmt.executeQuery(); countSet = countPstmt.executeQuery();
if (countSet.next()) { if (countSet.next()) {
count = countSet.getInt("count"); count = countSet.getInt("count"); // 获取总记录数
} }
// 如果查询结果不为空,则更新状态码和消息
if (!jsonArray.isEmpty()) { if (!jsonArray.isEmpty()) {
code = 0; code = 0; // 查询成功
msg = "查询成功"; msg = "查询成功";
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
msg = "class没找到"; msg = "class没找到"; // 捕获类未找到异常并设置错误消息
} catch (SQLException e) { } catch (SQLException e) {
msg = "sql错误"; msg = "sql错误"; // 捕获 SQL 异常并设置错误消息
} finally { } finally {
// 关闭数据库资源
try { try {
Base.closeResource(null, pstmt, resultSet); Base.closeResource(null, pstmt, resultSet);
Base.closeResource(connection, countPstmt, countSet); Base.closeResource(connection, countPstmt, countSet);
} catch (SQLException e) { } catch (SQLException e) {
msg = "关闭资源失败"; msg = "关闭资源失败"; // 捕获关闭资源时的异常并设置错误消息
} }
} }
// 返回数据 // 将查询结果封装到 JSON 对象中并返回给客户端
jsonResult.put("code", code); jsonResult.put("code", code); // 状态码
jsonResult.put("count", count); jsonResult.put("count", count); // 总记录数
jsonResult.put("msg", msg); jsonResult.put("msg", msg); // 返回消息
jsonResult.put("data", jsonArray.toArray()); jsonResult.put("data", jsonArray.toArray()); // 查询结果数据
PrintWriter out = resp.getWriter(); PrintWriter out = resp.getWriter(); // 获取输出流对象
out.print(jsonResult.toString()); out.print(jsonResult.toString()); // 输出 JSON 字符串作为响应
} }
} }

@ -25,15 +25,18 @@ public class ReaderLogin extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { throws ServletException, IOException {
// 设置头文件 // 设置响应内容类型和字符编码
response.setContentType("application/json; charset=utf8"); response.setContentType("application/json; charset=utf8");
PrintWriter out = response.getWriter(); PrintWriter out = response.getWriter();
// 获取账号密码
// 获取请求参数中的账号和密码
String user = request.getParameter("user"); String user = request.getParameter("user");
String psw = request.getParameter("psw"); String psw = request.getParameter("psw");
// 设置响应map
// 创建一个HashMap用于存储响应数据
HashMap<String, Object> hashMap = new HashMap<String, Object>(); HashMap<String, Object> hashMap = new HashMap<String, Object>();
// 创建Reader对象并调用其login方法进行登录验证
Reader reader = new Reader(); Reader reader = new Reader();
String result = null; String result = null;
try { try {
@ -41,18 +44,23 @@ public class ReaderLogin extends HttpServlet {
} catch (ClassNotFoundException | SQLException e) { } catch (ClassNotFoundException | SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
// 根据登录结果设置响应数据
if (result != null && result.equals("1")) { if (result != null && result.equals("1")) {
// 登录成功,创建会话并设置相关属性
HttpSession session = request.getSession(); HttpSession session = request.getSession();
session.setAttribute("reader", user); session.setAttribute("reader", user);
session.setAttribute("reader_first", "1"); // 登录 session.setAttribute("reader_first", "1"); // 标记为首次登录
hashMap.put("code", 0); hashMap.put("code", 0); // 状态码0表示成功
hashMap.put("msg", "登录成功"); hashMap.put("msg", "登录成功"); // 提示信息
hashMap.put("url", request.getContextPath() + "/reader/01main.jsp"); hashMap.put("url", request.getContextPath() + "/reader/01main.jsp"); // 跳转页面
} else { } else {
hashMap.put("code", 1); // 登录失败,设置错误信息
hashMap.put("msg", result); hashMap.put("code", 1); // 状态码1表示失败
hashMap.put("msg", result); // 错误信息
} }
// response.sendRedirect(request.getContextPath() +"/test.jsp");
// 将响应数据转换为JSON格式并输出
JSONObject json = JSONObject.fromObject(hashMap); JSONObject json = JSONObject.fromObject(hashMap);
out.write(json.toString()); out.write(json.toString());

Loading…
Cancel
Save