123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>login</title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="robots" content="all,follow">
- <link rel="stylesheet" href="https://www.jq22.com/jquery/bootstrap-4.2.1.css">
- <link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">
- </head>
- <body>
- <div class="page login-page">
- <div class="container d-flex align-items-center">
- <div class="form-holder has-shadow">
- <div class="row">
- <!-- Logo & Information Panel-->
- <div class="col-lg-6">
- <div class="info d-flex align-items-center">
- <div class="content">
- <div class="logo">
- <h1>欢迎登录</h1>
- </div>
- <p>红雨车位管理系统</p>
- </div>
- </div>
- </div>
- <!-- Form Panel -->
- <div class="col-lg-6 bg-white">
- <div class="form d-flex align-items-center">
- <div class="content">
- <form method="post" action="login.html" class="form-validate" id="loginFrom">
- <div class="form-group">
- <input id="login-username" type="text" name="userName" data-msg="请输入用户名" placeholder="用户名" value="admin" class="input-material">
- <div id="login-username-err" class="is-invalid invalid-feedback" style="display: block;"></div>
- </div>
- <div class="form-group">
- <input id="login-password" type="password" name="passWord" data-msg="请输入密码" placeholder="密码" class="input-material">
- <div id="login-password-err" class="is-invalid invalid-feedback" style="display: block;"></div>
- </div>
- <button id="login" type="submit" class="btn btn-primary">登录</button>
- <div style="margin-top: -40px;">
- <div class="custom-control custom-checkbox " style="float: right;">
- <input type="checkbox" class="custom-control-input" id="check2" >
- <label class="custom-control-label" for="check2">自动登录</label>
- </div>
- <div class="custom-control custom-checkbox " style="float: right;">
- <input type="checkbox" class="custom-control-input" id="check1" >
- <label class="custom-control-label" for="check1">记住密码 </label>
- </div>
- </div>
- </form>
- <br />
- <small>没有账号?</small><a href="register.html" class="signup"> 注册</a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- JavaScript files-->
- <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
- <script src="https://www.jq22.com/jquery/bootstrap-3.3.4.js"></script>
- <script src="vendor/jquery-validation/jquery.validate.min.js"></script><!--表单验证-->
- <!-- Main File-->
- <script src="js/front.js"></script>
- <script>
- /*
- 验证用户名
- */
- function checkUserName(){
- //标识
- let usernameFlag;
- //验证用户名 6-8位
- let username = document.getElementById("login-username");
- //获取value
- username_val = username.value;
- if (username_val.length >= 6 && username_val.length <= 8 ){
- usernameFlag = true;
- console.log("符合")
- //不展示
- let loginusernameerr = document.getElementById("login-username-err");
- loginusernameerr.style.display = "none";
- // loginusernameerr.innerText = "用户名需要6-8位"
- //return true;
- }else{
- usernameFlag = false;
- console.log("不符合")
- /*展示样式*/
- let loginusernameerr = document.getElementById("login-username-err");
- loginusernameerr.style.display = "block";
- loginusernameerr.innerText = "用户名需要6-8位"
- }
- return usernameFlag
- }
- /*
- 验证密码
- */
- function checkPassWord(){
- //验证密码6-8位
- let password = document.getElementById("login-password");
- //获取value
- password_val = password.value;
- if (password_val.length >= 6 && password_val.length <= 8 ){
- console.log("密码符合")
- //不展示
- let lperr = document.getElementById("login-password-err");
- lperr.style.display = "none";
- // lperr.innerText = "密码需要6-8位"
- return true;
- }else{
- console.log("密码不符合")
- /*展示样式*/
- let lperr = document.getElementById("login-password-err");
- lperr.style.display = "block";
- lperr.innerText = "密码需要6-8位"
- return false;
- }
- }
- /*
- 验证方法
- */
- function loginFromOnSubmit(){
- //调用
- return checkUserName() && checkPassWord() ;
- }
- //js 获取按钮点击事件
- let loginBtn = document.getElementById("login");
- // 点击事件
- loginBtn.onclick = function (){
- // 提交表单 抓取表单
- let loginFrom = document.getElementById("loginFrom");
- // 提交事件
- loginFrom.onsubmit = loginFromOnSubmit;
- }
- </script>
- </body>
- </html>
|