login-v5.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <link rel="stylesheet" href="styles.css">
  7. <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
  8. <link rel="icon" th:href="@{//images/logo.ico}">
  9. <title>Account Login</title>
  10. <style>
  11. * {
  12. margin: 0;
  13. padding: 0;
  14. box-sizing: border-box;
  15. font-family: 'Poppins', sans-serif;
  16. }
  17. body {
  18. display: flex;
  19. justify-content: center;
  20. align-items: center;
  21. min-height: 100vh;
  22. /* 以下是背景图片相关设置 */
  23. /*background-image: url('/images/loginbg.png');*/
  24. /* background-color: #0c0f13;*/
  25. background-image: url("/images/logo-v1.png");
  26. background-size: cover;
  27. background-position: center;
  28. background-repeat: no-repeat;
  29. width: 100%;
  30. overflow: hidden;
  31. }
  32. .container {
  33. position: relative;
  34. min-height: 100vh;
  35. width: 100%;
  36. background: rgba(255, 255, 255, 0.2); /* 设置半透明白色背景,使内容更易读 */
  37. }
  38. .logo {
  39. position: absolute;
  40. top: 50px;
  41. left: 50px;
  42. display: flex;
  43. align-items: center;
  44. }
  45. .logo img {
  46. width: 32px;
  47. height: 32px;
  48. margin-right: 10px;
  49. }
  50. .logo h2 {
  51. font-size: 24px;
  52. font-weight: 700;
  53. color: #333;
  54. }
  55. .login-box {
  56. position: absolute;
  57. top: 50%;
  58. left: 50%;
  59. transform: translate(-50%, -50%);
  60. width: 350px;
  61. padding: 40px;
  62. background: #fff;
  63. border-radius: 20px;
  64. box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  65. text-align: center;
  66. }
  67. .avatar {
  68. width: 100px;
  69. height: 100px;
  70. border-radius: 50%;
  71. overflow: hidden;
  72. margin: 0 auto 20px;
  73. }
  74. .avatar img {
  75. width: 100%;
  76. height: 100%;
  77. object-fit: cover;
  78. }
  79. .login-box h2 {
  80. font-size: 23px;
  81. font-weight: 700;
  82. color: #2980b9;
  83. margin-bottom: 20px;
  84. }
  85. .input-box {
  86. position: relative;
  87. width: 100%;
  88. margin-bottom: 20px;
  89. }
  90. .input-box input {
  91. width: 100%;
  92. padding: 10px;
  93. border: 1px solid #ccc;
  94. border-radius: 10px;
  95. outline: none;
  96. font-size: 16px;
  97. }
  98. .input-box i {
  99. position: absolute;
  100. top: 50%;
  101. right: 10px;
  102. transform: translateY(-50%);
  103. font-size: 18px;
  104. color: #ccc;
  105. }
  106. .login-btn {
  107. width: 100%;
  108. padding: 10px;
  109. background: #007bff;
  110. color: #fff;
  111. border: none;
  112. border-radius: 10px;
  113. font-size: 16px;
  114. cursor: pointer;
  115. }
  116. .login-box p {
  117. margin-top: 10px;
  118. font-size: 14px;
  119. }
  120. .login-box p a {
  121. color: #007bff;
  122. text-decoration: none;
  123. }
  124. .container .input-box .icon-2{
  125. background: url("/images/icon-login.png") no-repeat -54px 0;
  126. }
  127. </style>
  128. </head>
  129. <body>
  130. <div class="container">
  131. <div class="logo">
  132. <img src="/images/logo.png" alt="User Icon">
  133. <h2>科研管控平台</h2>
  134. </div>
  135. <div class="login-box">
  136. <div class="avatar">
  137. <img src="/images/logo.png" alt="Avatar">
  138. </div>
  139. <h2>Welcome back</h2>
  140. <form class="layui-form">
  141. <div class="input-box">
  142. <span class="icon icon-2"></span>
  143. <input type="text" name="username" id="username" lay-verify="required" placeholder="账户名" maxlength="24" autocomplete="current-password"/>
  144. <i class="fas fa-user"></i>
  145. </div>
  146. <div class="input-box">
  147. <span class="icon icon-2"></span>
  148. <input type="password" placeholder="密码" id="password" name="password" lay-verify="required" maxlength="18" autocomplete="current-password">
  149. <i class="fas fa-lock"></i>
  150. </div>
  151. <button type="submit" class="login-btn" id="logn">登录</button>
  152. <!-- <p>Don't have an account? <a href="#">signup</a></p>-->
  153. </form>
  154. </div>
  155. </div>
  156. <script>
  157. const inputs = [
  158. document.getElementById('username'),
  159. document.getElementById('password')
  160. ]
  161. inputs.forEach(input =>{
  162. input.addEventListener('input',function () {
  163. this.value = this.value.replace(/\s+/g,'');
  164. })
  165. })
  166. </script>
  167. <script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
  168. <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
  169. <script th:src="@{/lib/md5/md5.min.js}" charset="utf-8"></script>
  170. <script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
  171. <script>
  172. AjaxUtil.ctx = /*[[@{/}]]*/'';
  173. // 在页面加载完毕后调用拦截器函数
  174. layui.use(['form','layNotify','layer'],function () {
  175. var form = layer.form,
  176. layNotify = layui.layNotify;
  177. layer = layui.layer;
  178. const logn = document.getElementById('logn');
  179. const username = document.getElementById('username');
  180. const password = document.getElementById('password');
  181. // 登录
  182. logn.addEventListener('click',function () {
  183. console.log('我登录了');
  184. if (username.value != null){
  185. layer.msg('用户名不能为空!',{icon:2},function () {
  186. });
  187. }
  188. if (password.value != null){
  189. layer.msg('密码不能为空!',{icon:2},function () {
  190. })
  191. }
  192. });
  193. })
  194. </script>
  195. </body>
  196. </html>