Нет описания

login.html 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. <script src="./js/jquery.min.js?v=2.1.4"></script>
  17. <script src="./js/jquery.cookie.js"></script>
  18. <script src="Script/Common/huayi.load.js"></script>
  19. <script src="Script/Common/huayi.config.js"></script>
  20. </head>
  21. <body class="signin">
  22. <div class="signinpanel">
  23. <div class="d_left" style="width: 55%;">
  24. <!-- <div class="lg_boxs" style="display: none;"> <img src="./img/lg.png" alt="" /></div> -->
  25. </div>
  26. <div class=" d_right" style="width: 45%;">
  27. <form class="dl_form" method="get">
  28. <div class="hj_box" style="font-size: 36px;"> 平顶山电信满意度综合管理平台</div>
  29. <div class="user iut">
  30. <i class="i1 us"></i>
  31. <input type="text" placeholder="请输入管理账号" id="user">
  32. <i class="ts user_ts"></i>
  33. </div>
  34. <div class="fj iut">
  35. <i class="i1 yz"></i>
  36. <input type="text" placeholder="请输入分机号" id="fj">
  37. <i class="ts fj_ts"></i>
  38. </div>
  39. <div class="password iut">
  40. <i class="i1 ps"></i>
  41. <input type="password" placeholder="请输入密码" id="password">
  42. <i class="ts password_ts"></i>
  43. </div>
  44. <div class="b_box">
  45. <div class="btns" type="button">登录</div>
  46. </div>
  47. </form>
  48. </div>
  49. </div>
  50. <script>
  51. $(function() {
  52. /*输入框样式改变*/
  53. $("#user").focus(function() {
  54. $(this).parent().addClass("_success");
  55. });
  56. $("#user").blur(function() {
  57. $(this).parent().removeClass("_success");
  58. })
  59. $("#fj").focus(function() {
  60. $(this).parent().addClass("_success");
  61. });
  62. $("#fj").blur(function() {
  63. $(this).parent().removeClass("_success");
  64. })
  65. $("#password").focus(function() {
  66. $(this).parent().addClass("_success");
  67. });
  68. $("#password").blur(function() {
  69. $(this).parent().removeClass("_success");
  70. });
  71. /*cook存储数据*/
  72. if($.cookie("username")) {
  73. //取值如果存在则赋值
  74. $("#user").val($.cookie("user")); //用户名
  75. $("#fj").val($.cookie("fj"));
  76. }
  77. //键盘事件
  78. document.onkeydown = function(e) {
  79. var theEvent = window.event || e;
  80. var code = theEvent.keyCode || theEvent.which;
  81. if(code == 13) {
  82. $(".btns").click();
  83. }
  84. }
  85. $(".btns").click(function() {
  86. var User = $("#user").val();
  87. var Fj = $("#fj").val();
  88. var Password = $("#password").val();
  89. /*保存COOK*/
  90. //$.cookie("user", $("#user").val(),{expires: 7,secure:true});
  91. //$.cookie("fj", $("#fj").val(), {expires: 7,secure:true});
  92. /*表单验证*/
  93. if(User == "" || Fj == "" || Password == "") {
  94. $(".ts").addClass("Yz_error");
  95. if($("#user").val() == "") {
  96. $("#user").focus(function() {
  97. $(".user_ts").removeClass("Yz_error");
  98. $(".fj_ts").removeClass("Yz_error");
  99. $(".password_ts").removeClass("Yz_error");
  100. $(this).parent().addClass("_success");
  101. });
  102. } else {
  103. $(".user_ts").addClass("Yz_success");
  104. }
  105. } else {
  106. /*请求后台*/
  107. $.ajax({
  108. type: "post",
  109. url: huayi.config.callcenter_url + "/Login/login",
  110. dataType: 'json',
  111. async: true,
  112. data: {
  113. username: User,
  114. extensionphone: Fj,
  115. password: Password
  116. },
  117. success: function(data) {
  118. /*验证请求*/
  119. if(data.state == "success") {
  120. $.cookie("token", data.data.token, {
  121. expires: 7
  122. });
  123. $.cookie("extno", Fj, {
  124. expires: 7
  125. });
  126. $.cookie("u_code", User, {
  127. expires: 7
  128. });
  129. var expireDate = data.data.date.split(' ')[0];
  130. var expireDay = data.data.days;
  131. var expireText = '<span style="color:#f00;">软件到期时间:' + expireDate + ',还剩' + expireDay +'天,请联系软件厂家</span>'
  132. if (expireDay * 1 > 0) {
  133. layer.confirm(expireText, {
  134. btn: ['确定'] //按钮
  135. }, function () {
  136. window.location.href = "index.html";
  137. })
  138. }
  139. else {
  140. window.location.href = "index.html";
  141. }
  142. } else {
  143. //alert("登录失败");
  144. $("#user").val('');
  145. $("#fj").val('');
  146. $("#password").val('');
  147. }
  148. }
  149. });
  150. }
  151. });
  152. });
  153. </script>
  154. </body>
  155. </html>