You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
library_manage_system/WebContent/loginManager.html

67 lines
3.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html> <!-- 声明文档类型为HTML5 -->
<html> <!-- HTML文档的根元素 -->
<head> <!-- head元素包含元数据 -->
<meta charset="UTF-8"> <!-- 设置字符编码为UTF-8 -->
<title>图书管理员登录页面</title> <!-- 设置网页标题 -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <!-- 设置视口属性,使页面在移动设备上正常显示 -->
<!-- 最新版本的 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">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<!-- 可选的 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="./public/css/animate.css"> <!-- 引入动画样式表 -->
<link rel="stylesheet" href="./public/css/login.css" /> <!-- 引入自定义登录样式表 -->
</head>
<body> <!-- body元素包含网页内容 -->
<div class="container main"> <!-- 主容器 -->
<div id="login" class="contain animated fadeInDown"> <!-- 登录表单容器,带有动画效果 -->
<h1>工作人员登录</h1> <!-- 登录标题 -->
<form method="post"> <!-- 表单使用POST方法提交 -->
<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="submit" class="form-control" value="登录" onclick="javascript:void(0);"> <!-- 提交按钮 -->
</form>
</div>
</div>
<div style="position:fixed; bottom:0; right:0;"> <!-- 固定位置的链接容器 -->
<a href="reader/04readerFrame.jsp" target="_blank"><img width="50px" height="50px"></a><br> <!-- 读者管理链接 -->
<a href="adminLogin.html" target="_blank"><img width="50px" height="50px"></a> <!-- 管理员登录链接 -->
</div>
<script src="./public/js/layer/layer.js"></script>
<script>
$(function(){ <!-- jQuery文档就绪函数 -->
//登录
$("input[type=submit]").click(function(){ <!-- 绑定点击事件到提交按钮 -->
$.ajax({ <!-- 发起Ajax请求 -->
url: "./managerLogin", <!-- 请求URL -->
type: "post", <!-- 请求类型为POST -->
data: $("form").serialize(), <!-- 序列化表单数据作为请求参数 -->
dataType: "json", <!-- 期望服务器返回JSON格式的数据 -->
success: function( data ){ <!-- 请求成功时的回调函数 -->
if(data.code == 0){ <!-- 如果返回码为0表示登录成功 -->
layer.msg("登录成功", { <!-- 弹出提示消息 -->
icon: 6, <!-- 图标类型 -->
time: 1000 <!-- 显示时间 -->
}, function(){
location.href = data.url; <!-- 跳转到指定URL -->
})
}else{ <!-- 如果返回码不为0表示登录失败 -->
layer.open({ <!-- 弹出错误提示框 -->
title: "登录失败", <!-- 提示框标题 -->
content: data.msg, <!-- 提示框内容 -->
icon: 5, <!-- 图标类型 -->
anim: 6 <!-- 动画效果 -->
})
}
}
})
return false; <!-- 阻止默认表单提交行为 -->
})
})
</script>
</body>
</html>