login.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>login</title>
  8. <link rel="stylesheet" type="text/css" href="css/bootstrap-grid.css"/><!--CSS RESET-->
  9. <link href="http://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  10. <link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css"><!--演示页面样式,使用时可以不引用-->
  11. <script src="js/jquery-2.1.1.min.js"></script>
  12. <script src="js/jquery_cookie_min.js"></script>
  13. <script src="js/ip.js"></script>
  14. <style>
  15. .demo {
  16. padding: 20px 0;
  17. background: linear-gradient(to right, #7AB6B6 50%, #E5CFAA 50%);
  18. }
  19. .form-horizontal {
  20. background-color: #fff;
  21. font-family: 'Arimo', sans-serif;
  22. text-align: center;
  23. padding: 50px 30px 50px;
  24. box-shadow: 12px 12px 0 0 rgba(0, 0, 0, 0.3);
  25. }
  26. .form-horizontal .heading {
  27. color: #555;
  28. font-size: 30px;
  29. font-weight: 600;
  30. letter-spacing: 1px;
  31. text-transform: capitalize;
  32. margin: 0 0 50px 0;
  33. }
  34. .form-horizontal .form-group {
  35. margin: 0 auto 30px;
  36. position: relative;
  37. }
  38. .form-horizontal .form-group:nth-last-child(2) {
  39. margin-bottom: 20px;
  40. }
  41. .form-horizontal .form-group:last-child {
  42. margin: 0;
  43. }
  44. .form-horizontal .form-group > i {
  45. color: #999;
  46. transform: translateY(-50%);
  47. position: absolute;
  48. left: 5px;
  49. top: 50%;
  50. }
  51. .form-horizontal .form-control {
  52. color: #7AB6B6;
  53. background-color: #fff;
  54. font-size: 17px;
  55. letter-spacing: 1px;
  56. height: 40px;
  57. padding: 5px 10px 2px 25px;
  58. box-shadow: 0 0 0 0 transparent;
  59. border: none;
  60. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  61. border-radius: 0;
  62. display: inline-block;
  63. }
  64. .form-control::placeholder {
  65. color: rgba(0, 0, 0, 0.2);
  66. font-size: 16px;
  67. }
  68. .form-horizontal .form-control:focus {
  69. border-bottom: 1px solid #7AB6B6;
  70. box-shadow: none;
  71. }
  72. .form-horizontal .btn {
  73. color: #7AB6B6;
  74. background-color: #EDF6F5;
  75. font-size: 18px;
  76. font-weight: 700;
  77. letter-spacing: 1px;
  78. border-radius: 5px;
  79. width: 50%;
  80. height: 45px;
  81. padding: 7px 30px;
  82. margin: 0 auto 25px;
  83. border: none;
  84. display: block;
  85. position: relative;
  86. transition: all 0.3s ease;
  87. }
  88. .form-horizontal .btn:focus,
  89. .form-horizontal .btn:hover {
  90. color: #fff;
  91. background-color: #7AB6B6;
  92. }
  93. .form-horizontal .btn:before,
  94. .form-horizontal .btn:after {
  95. content: '';
  96. background-color: #7AB6B6;
  97. height: 50%;
  98. width: 2px;
  99. position: absolute;
  100. left: 0;
  101. bottom: 0;
  102. z-index: 1;
  103. transition: all 0.3s;
  104. }
  105. .form-horizontal .btn:after {
  106. bottom: auto;
  107. top: 0;
  108. left: auto;
  109. right: 0;
  110. }
  111. .form-horizontal .btn:hover:before,
  112. .form-horizontal .btn:hover:after {
  113. height: 100%;
  114. width: 50%;
  115. opacity: 0;
  116. }
  117. .form-horizontal .create_account {
  118. color: #D6BC8B;
  119. font-size: 16px;
  120. font-weight: 600;
  121. display: inline-block;
  122. }
  123. .form-horizontal .create_account:hover {
  124. color: #7AB6B6;
  125. text-decoration: none;
  126. }
  127. </style>
  128. </head>
  129. <body>
  130. <div class="htmleaf-container">
  131. <header class="htmleaf-header" style="height: 200px;">
  132. <div class="htmleaf-links">
  133. </div>
  134. </header>
  135. <div class="demo form-bg">
  136. <div class="container">
  137. <div class="row">
  138. <div class="col-md-4"></div>
  139. <div class="col-md-4">
  140. <form class="form-horizontal">
  141. <div class="heading">Login form</div>
  142. <div class="form-group">
  143. <i class="fa fa-user"></i><input required name="login[username]" type="text"
  144. class="form-control" placeholder="Username"
  145. id="InputUsername">
  146. </div>
  147. <div class="form-group">
  148. <i class="fa fa-lock"></i><input required name="login[password]" type="password"
  149. class="form-control" placeholder="Password"
  150. id="InputPassword"/>
  151. </div>
  152. <div class="form-group">
  153. <button type="submit" class="btn btn-default" onClick="subLoginAction();return false;"><i
  154. class="fa fa-arrow-right"></i></button>
  155. <!--<span>Don't have an account? <a href="" class="create_account">Sign up</a></span>-->
  156. </div>
  157. </form>
  158. </div>
  159. <div class="col-md-4"></div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </body>
  165. <script type="text/javascript">
  166. function subLoginAction() {
  167. let username = $("#InputUsername").val();
  168. let password = $("#InputPassword").val();
  169. let post_data = {
  170. 'username': username,
  171. 'password': password
  172. };
  173. var url= http+"user/login";
  174. var data_string = JSON.stringify(post_data);
  175. // 首次获取
  176. $.ajax({
  177. url: url,
  178. type: "post",
  179. dataType:"JSON",
  180. data: data_string,
  181. success: function (data)
  182. {
  183. if (data['code'] == 0) {
  184. $.cookie('access_token', data.res.access_token, data.res.access_expire)
  185. $.cookie('refresh_token', data.res.refresh_token, data.res.refresh_expire)
  186. window.location.href = "sku_index.html";
  187. } else {
  188. alert(data['msg'])
  189. }
  190. },
  191. error:function (XMLHttpRequest) {
  192. console.log("失败!");
  193. }
  194. });
  195. }
  196. </script>
  197. </html>