login.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <meta name="format-detection" content="telphone=no,email=no"/>
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
  8. <meta http-equiv="Pragma" content="no-cache">
  9. <meta http-equiv="Cache-control" content="no-cache">
  10. <meta http-equiv="Cache" content="no-cache">
  11. <title>登录</title>
  12. <link rel="stylesheet" href="/components/lib/mui.min.css"/>
  13. <link rel="stylesheet" href="/components/custom/css/common.css"/>
  14. <link rel="stylesheet" href="/app/css/xyf.common.min.css"/>
  15. </head>
  16. <body class="bg-white">
  17. <div class="input-group-card">
  18. <div class="input-row input-clear">
  19. <input id="userName" type="tel" maxlength="11" placeholder="手机号">
  20. </div>
  21. <div class="input-row input-clear">
  22. <input id="password" type="password" maxlength="20" placeholder="密码">
  23. </div>
  24. </div>
  25. <div class="subt">
  26. <input class="mui-btn-block" type="button" id="loginBtn" value="登录" onclick="login()">
  27. </div>
  28. <script src="/components/lib/jquery.min.js"></script>
  29. <script src="/components/lib/mui.min.js"></script>
  30. <script src="/app/js/xyf.login.js"></script>
  31. <script src="/components/lib/md5.js"></script>
  32. <script src="/components/custom/js/common.js"></script>
  33. <script>
  34. document.onkeydown = function (event) {
  35. if (event.keyCode == 13) {
  36. login();
  37. }
  38. }
  39. function login() {
  40. //检查手机号码
  41. var userName = $("#userName").val();
  42. if (!isPhone(userName)) {
  43. mui.toast("请输入11位正确手机号码");
  44. return;
  45. }
  46. //检查密码
  47. var password = $("#password").val();
  48. if (password.length < 6) {
  49. mui.toast("请输入正确的密码");
  50. return;
  51. }
  52. myAjax({
  53. type: "POST",
  54. url: "/superadmin/login",
  55. contentType: "json",
  56. data: JSON.stringify({"username": userName, "password": hex_md5(password)}),//使用JSON格式,不使用from data格式
  57. success: function (res) {
  58. if (res.result == 1) {
  59. var url = 'index.html';
  60. goPage(url);
  61. } else if (res.result == 0) {
  62. var btnArray = ['确定'];
  63. mui.confirm(res.description, '温馨提示', btnArray, function (e) {
  64. });
  65. } else {
  66. mui.alert(res.description, '温馨提示', '确定');
  67. }
  68. }
  69. });
  70. }
  71. </script>
  72. </body>
  73. </html>