中鑫之宝5.0前端

login.html 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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, maximum-scale=1.0">
  6. <title>登录</title>
  7. <meta name="keywords">
  8. <meta name="description">
  9. <meta name="renderer" content="webkit|ie-comp|ie-stand" />
  10. <link rel="shortcut icon" href="img/32.ico" />
  11. <link href="./css/bootstrap.min.css" rel="stylesheet">
  12. <link href="./css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
  13. <link href="./css/animate.min.css" rel="stylesheet">
  14. <link href="./css/style.min.css" rel="stylesheet">
  15. <link href="./css/login.min.css" rel="stylesheet">
  16. <!--[if lt IE 9]>
  17. <meta http-equiv="refresh" content="0;ie.html" />
  18. <![endif]-->
  19. <script src="./js/jquery.min.js?v=2.1.4"></script>
  20. <script src="./js/jquery.cookie.js"></script>
  21. <script src="Script/Common/huayi.load.js"></script>
  22. <script src="Script/Common/huayi.config.js"></script>
  23. </head>
  24. <body class="signin">
  25. <div class="signinpanel">
  26. <div class="d_left" style="width: 55%;">
  27. <div class="lg_boxs"> <img src="./img/lg.png" alt="" /></div>
  28. </div>
  29. <div class=" d_right" style="width: 45%;">
  30. <form class="dl_form" method="get">
  31. <div class="hj_box"> <img class=" hj" src="./img/hj.png" alt="" /></div>
  32. <div class="user iut">
  33. <i class="i1 us"></i>
  34. <input type="text" placeholder="请输入管理账号" id="user">
  35. <i class="ts user_ts"></i>
  36. </div>
  37. <div class="fj iut">
  38. <i class="i1 yz"></i>
  39. <input type="text" placeholder="请输入分机号" id="fj">
  40. <i class="ts fj_ts"></i>
  41. </div>
  42. <div class="password iut">
  43. <i class="i1 ps"></i>
  44. <input type="password" placeholder="请输入密码" id="password">
  45. <i class="ts password_ts"></i>
  46. </div>
  47. <div class="b_box">
  48. <div class="btns" type="button">登录</div>
  49. </div>
  50. <h3 class="t_bootm">技术服务热线:400-637-1311</h3>
  51. </form>
  52. </div>
  53. </div>
  54. <script>
  55. $(function () {
  56. /*输入框样式改变*/
  57. $("#user").focus(function () {
  58. $(this).parent().addClass("_success");
  59. });
  60. $("#user").blur(function () {
  61. $(this).parent().removeClass("_success");
  62. })
  63. $("#fj").focus(function () {
  64. $(this).parent().addClass("_success");
  65. });
  66. $("#fj").blur(function () {
  67. $(this).parent().removeClass("_success");
  68. })
  69. $("#password").focus(function () {
  70. $(this).parent().addClass("_success");
  71. });
  72. $("#password").blur(function () {
  73. $(this).parent().removeClass("_success");
  74. });
  75. /*cook存储数据*/
  76. if ($.cookie("username")) {
  77. //取值如果存在则赋值
  78. $("#user").val($.cookie("user"));//用户名
  79. $("#fj").val($.cookie("fj"));
  80. }
  81. $(".btns").click(function () {
  82. var User = $("#user").val();
  83. var Fj = $("#fj").val();
  84. var Password = $("#password").val();
  85. /*保存COOK*/
  86. //$.cookie("user", $("#user").val(),{expires: 7,secure:true});
  87. //$.cookie("fj", $("#fj").val(), {expires: 7,secure:true});
  88. /*表单验证*/
  89. if (User == "" || Fj == "" || Password == "") {
  90. $(".ts").addClass("Yz_error");
  91. if ($("#user").val() == "") {
  92. $("#user").focus(function () {
  93. $(".user_ts").removeClass("Yz_error");
  94. $(".fj_ts").removeClass("Yz_error");
  95. $(".password_ts").removeClass("Yz_error");
  96. $(this).parent().addClass("_success");
  97. });
  98. } else {
  99. $(".user_ts").addClass("Yz_success");
  100. }
  101. } else {
  102. /*请求后台*/
  103. $.ajax({
  104. type: "post",
  105. url: huayi.config.callcenter_url+"/Login/login",
  106. dataType: 'json',
  107. async: true,
  108. data: {
  109. username: User,
  110. extensionphone: Fj,
  111. password: Password
  112. },
  113. success: function (data) {
  114. /*验证请求*/
  115. if (data.state == "success") {
  116. $.cookie("token", data.data.token, { expires: 7 });
  117. $.cookie("extno", Fj, { expires: 7 });
  118. window.location.href = "index.html";
  119. } else {
  120. alert("登录失败");
  121. $("#user").val('');
  122. $("#fj").val('');
  123. $("#password").val('');
  124. }
  125. }
  126. });
  127. }
  128. });
  129. });
  130. /*点击提交*/
  131. /*cook*/
  132. </script>
  133. </body>
  134. </html>