login.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  6. <meta name="format-detection" content="email=no" />
  7. <meta name="format-detection" content="telephone=no" />
  8. <title>登录</title>
  9. <link rel="stylesheet" href="../css/reset.css">
  10. <style>
  11. html{font-size:10px}
  12. html,body{
  13. height: 100%;
  14. overflow: hidden;
  15. }
  16. .flex-wrap{
  17. display: -webkit-box;
  18. display: -webkit-flex;
  19. display: flex;
  20. }
  21. .flex-con{
  22. -webkit-box-flex: 1;
  23. -webkit-flex: 1;
  24. flex: 1;
  25. }
  26. body{
  27. display: -webkit-box;
  28. display: -webkit-flex;
  29. display: flex;
  30. -webkit-box-orient: vertical;
  31. -webkit-flex-flow: column;
  32. flex-flow: column;
  33. }
  34. header{
  35. height: 4rem;
  36. line-height: 4rem;
  37. background-color: #252736;
  38. }
  39. header h2{
  40. width: 100%;
  41. height: 100%;
  42. font-size: 1.8rem;
  43. color: #fff;
  44. font-weight: lighter;
  45. text-align: center;
  46. position: relative;
  47. }
  48. header i{
  49. display: inline-block;
  50. width: 4.3rem;
  51. height: 4.3rem;
  52. background: url("../img/index/backBtn.png") no-repeat 30%/60%;
  53. position: absolute;
  54. left: 0;
  55. bottom: 0;
  56. }
  57. header a{
  58. display: inline-block;
  59. font-size: 1.2rem;
  60. color: #fff;
  61. position: absolute;
  62. right: 1.2rem;
  63. top: 0;
  64. }
  65. main{
  66. height: calc(100% - 4rem);
  67. padding-top: 2.5rem;
  68. background: url("../img/login/logoBg.jpg") round;
  69. }
  70. .banner{
  71. width: 10rem;
  72. height: 12rem;
  73. margin: 0 auto 4rem;
  74. }
  75. .banner img{
  76. display: block;
  77. width: 100%;
  78. height: 100%;
  79. }
  80. .inputDiv{
  81. padding: 0 1.4rem;
  82. }
  83. .inputDiv form{
  84. background-color: #fff;
  85. border-radius: .5rem;
  86. overflow: hidden;
  87. }
  88. .inputDiv label{
  89. display: block;
  90. height: 4.2rem;
  91. border: 1px solid #dfdfdf;
  92. padding-left: 1rem;
  93. }
  94. .inputDiv label:nth-of-type(1){
  95. border-bottom: none;
  96. border-top-left-radius: .3rem;
  97. border-top-right-radius: .3rem;
  98. }
  99. .inputDiv label:nth-of-type(2){
  100. border-bottom-left-radius: .3rem;
  101. border-bottom-right-radius: .3rem;
  102. }
  103. label>input{
  104. width: 100%;
  105. height: 100%;
  106. background-color: rgba(0,0,0,0);
  107. border: none;
  108. outline: none;
  109. font-size: 1.3rem;
  110. padding-left: 2.3rem;
  111. }
  112. .userName{
  113. background: url("../img/login/un.png") no-repeat 4%/5%;
  114. }
  115. .password{
  116. background: url("../img/login/pw.png") no-repeat 4%/5%;
  117. }
  118. .loginBtn{
  119. width: 100%;
  120. height: 3.5rem;
  121. line-height: 3.5rem;
  122. text-align: center;
  123. font-size: 1.5rem;
  124. color: #fff;
  125. background: url("../img/login/loginBtnBg.png") round;
  126. background-size: 100%;
  127. margin: 1.5rem 0;
  128. }
  129. .other{
  130. padding: 0 1.4rem;
  131. font-size: 1.2rem;
  132. }
  133. ::-webkit-input-placeholder{
  134. color: #b4b4b4;
  135. }
  136. .remindImg{
  137. width: 100%;
  138. height: 4.5rem;
  139. background: url("../img/login/remind.png") round;
  140. background-size: 100%;
  141. margin-top: .3rem;
  142. }
  143. .remindDiv{
  144. height: 3rem;
  145. line-height: 3rem;
  146. text-align: center;
  147. font-size: 1.2rem;
  148. color: #fff;
  149. padding: 0 1rem;
  150. border-radius: 2rem;
  151. background-color: rgba(0,0,0,0.7);
  152. position: fixed;
  153. bottom: 20%;
  154. left: 50%;
  155. -webkit-transform: translateX(-50%);
  156. transform: translateX(-50%);
  157. opacity: 0;
  158. -webkit-transition: .5s;
  159. transition: .5s;
  160. z-index: -99;
  161. }
  162. .remindDiv.active{
  163. opacity: 1;
  164. z-index: 99;
  165. }
  166. @media screen and (min-width:321px) and (max-width:375px){html{font-size:11px}}
  167. @media screen and (min-width:376px) and (max-width:414px){html{font-size:12px}}
  168. @media screen and (min-width:415px) and (max-width:639px){html{font-size:13px}}
  169. @media screen and (min-width:640px) and (max-width:719px){html{font-size:18px}}
  170. @media screen and (min-width:720px) and (max-width:749px){html{font-size:19px}}
  171. @media screen and (min-width:750px) and (max-width:799px){html{font-size:20px}}
  172. @media screen and (min-width:800px){html{font-size:25px}}
  173. </style>
  174. </head>
  175. <body>
  176. <header>
  177. <h2><i id="backBtn" onclick="toBack()"></i>登录<a href="./register.html">注册</a></h2>
  178. </header>
  179. <main class="flex-con">
  180. <div class="banner">
  181. <img src="../img/login/LOGO.png" alt="">
  182. </div>
  183. <div class="inputDiv">
  184. <form action="#">
  185. <label class="userName"><input type="tel" id="username" value="" placeholder="请输入账号/手机号"></label>
  186. <label class="password"><input type="password" value="" id="password" placeholder="请输入密码"></label>
  187. </form>
  188. <button class="loginBtn">登录</button>
  189. </div>
  190. <div class="other clearFix">
  191. <a href="./findPW.html" class="right">忘记密码?</a>
  192. </div>
  193. <div class="remindImg"></div>
  194. <div class="remindDiv"></div>
  195. </main>
  196. <script src="../js/modules.js"></script>
  197. <script src="../js/publicData.js"></script>
  198. <script>
  199. window.onload=function () {
  200. var oLoginBtn=document.getElementsByClassName("loginBtn")[0],
  201. remindDiv=document.getElementsByClassName("remindDiv")[0];
  202. var oValue={},remindTi,oRemindTime;
  203. oLoginBtn.onclick=function () {
  204. var username=document.getElementById("username").value,
  205. password=document.getElementById("password").value;
  206. oValue.username=username;
  207. oValue.password=password;
  208. Ajax("post",pageUrl+"/Api/Index/login",oValue,function (data) {
  209. if(data.status==200){
  210. // sessionStorage.setItem("userData",JSON.stringify(data.data));
  211. location.href="../index.html";
  212. }else {
  213. remindMes(data.message)
  214. }
  215. })
  216. }
  217. function remindMes(val) {
  218. if(oRemindTime) clearTimeout(oRemindTime);
  219. remindDiv.innerText=val;
  220. addCls(remindDiv,'active');
  221. oRemindTime=setTimeout(function () {
  222. removeCls(remindDiv,'active');
  223. oRemindTime=undefined;
  224. },2000)
  225. }
  226. }
  227. function toBack() {
  228. window.history.back();
  229. }
  230. </script>
  231. </body>
  232. </html>