鑫苑新版本前端代码

login.html 5.6KB

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