伊川12345

login.html 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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">
  10. <link rel="shortcut icon" href="img/32.ico" />
  11. <link rel="stylesheet" href="./css/init.css" />
  12. <link rel="stylesheet" href="./css/login.css" />
  13. </head>
  14. <body class="signin">
  15. <div class="wrap clearfix">
  16. <div class="logoInfo clearfix">
  17. <img src="./img/logo.png" alt="" class="logoB">
  18. <span>伊川县政务服务便民热线</span>
  19. <!-- <h2>伊川县政务服务便民热线</h2> -->
  20. </div>
  21. <div class="rightCon">
  22. <div class="tab_box">
  23. <ul class="clearfix tab_ul">
  24. <li class="active">坐席登录</li>
  25. <li>用户登录</li>
  26. </ul>
  27. <div class="tab_content">
  28. <div class="tab_one">
  29. <p>
  30. <!-- <i class="login_icon login_icon_user "></i> -->
  31. <input class="zx_user" type="text" placeholder="请输入您的管理账号" />
  32. <i class="login_icon error error_zx error_zx_user"></i>
  33. </p>
  34. <p>
  35. <!-- <i class="login_icon login_icon_hua "></i> -->
  36. <input class="zx_fj" type="text" placeholder="请输入分机号" />
  37. <i class="login_icon error error_zx error_zx_fj"></i>
  38. </p>
  39. <p>
  40. <!-- <i class="login_icon login_icon_lock "></i> -->
  41. <input class="zx_psw" type="password" placeholder="请输入您的密码" />
  42. <i class="login_icon error error_zx error_zx_psw"></i>
  43. </p>
  44. <p class="login_go login_zx">登录</p>
  45. </div>
  46. <div class="tab_two" style="display: none;">
  47. <p>
  48. <!-- <i class="login_icon login_icon_user "></i> -->
  49. <input class="gl_user" type="text" placeholder="请输入您的管理账号" />
  50. <i class="login_icon error error_gl error_gl_user"></i>
  51. </p>
  52. <p>
  53. <!-- <i class="login_icon login_icon_lock"></i> -->
  54. <input class="gl_psw" type="password" placeholder="请输入您的密码" />
  55. <i class="login_icon error error_gl error_gl_psw"></i>
  56. </p>
  57. <p class="login_go login_gl">登录</p>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="service">
  62. <p style="color: #313c58; font-size: 12px;text-align: center;"></p>
  63. </div>
  64. </div>
  65. </div>
  66. <script src="./Script/Common/huayi.load.js"></script>
  67. <script src="./Script/Common/huayi.config.js"></script>
  68. <script src="./js/jquery.md5.js"></script>
  69. <script src="./js/aes/crypto-js.js"></script>
  70. <script>
  71. $(function() {
  72. var a = 0;
  73. $('.tab_ul li').click(function() {
  74. $(this).addClass("active").siblings().removeClass("active");
  75. var index = $(this).index();
  76. a = index;
  77. $('.tab_content').children('div').eq(index).show().siblings().hide();
  78. })
  79. /*cook存储数据*/
  80. if ($.cookie("username")) {
  81. //取值如果存在则赋值
  82. $(".gl_user").val($.cookie("user")); //用户名
  83. $("zx_fj").val($.cookie("fj"));
  84. $(".zx_user").val($.cookie("user"));
  85. }
  86. //键盘登录事件
  87. $('input').bind('keypress', function(event) {
  88. if (event.keyCode == "13") {
  89. if (a == 0) {
  90. $('.login_zx').trigger("click");
  91. } else {
  92. $(".login_gl").trigger("click");
  93. }
  94. }
  95. });
  96. //坐席登录
  97. $('.login_zx').click(function() {
  98. var zx_user = $(".zx_user").val();
  99. var zx_fj = $(".zx_fj").val();
  100. var zx_psw = $(".zx_psw").val();
  101. const reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!#$%^&*])[\da-zA-Z!#$%^&*]{8,}$/
  102. if(reg.test(zx_psw)){
  103. sessionStorage.setItem('passTipShow' , false)
  104. }else{
  105. sessionStorage.setItem('passTipShow' , true)
  106. }
  107. if (zx_user == "" || zx_fj == "" || zx_psw == "") {
  108. $(".error_zx").addClass('errorShow');
  109. if ($(".zx_user").val() == "") {
  110. $(".zx_user").focus(function() {
  111. $(".error_zx").removeClass('errorShow');
  112. });
  113. } else {
  114. $(".error_zx_user").removeClass('errorShow');
  115. }
  116. } else {
  117. var currenttime = CurentTime();
  118. var datatime = currenttime.split(' ')[1].split(':').join('')
  119. var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M" + datatime);
  120. var zx_psw = CryptoJS.enc.Utf8.parse($.md5(zx_psw));
  121. var encrypted = CryptoJS.AES.encrypt(zx_psw, key, {
  122. mode: CryptoJS.mode.ECB,
  123. padding: CryptoJS.pad.Pkcs7
  124. });
  125. /*请求后台*/
  126. $.cookie("extno", zx_fj);
  127. $.cookie("zx_user", zx_user);
  128. $.ajax({
  129. type: "post",
  130. url: huayi.config.callcenter_url + "/Login/login",
  131. dataType: 'json',
  132. async: true,
  133. data: {
  134. username: zx_user,
  135. extensionphone: zx_fj,
  136. LoginTime: currenttime,
  137. password: encrypted.toString()
  138. },
  139. success: function(data) {
  140. /*验证请求*/
  141. if (data.state == "success") {
  142. $.cookie("token", data.data.token, {
  143. expires: 7
  144. });
  145. $.cookie("extno", zx_fj, {
  146. expires: 7
  147. });
  148. $.cookie("zx_user", zx_user, {
  149. expires: 7
  150. });
  151. window.location.href = "home.html";
  152. }
  153. }
  154. });
  155. }
  156. })
  157. function CurentTime() {
  158. var now = new Date();
  159. var year = now.getFullYear(); //年
  160. var month = now.getMonth() + 1; //月
  161. var day = now.getDate(); //日
  162. var hh = now.getHours(); //时
  163. var mm = now.getMinutes(); //分
  164. var ss = now.getSeconds(); //秒
  165. var clock = year + "-";
  166. if (month < 10)
  167. clock += "0";
  168. clock += month + "-";
  169. if (day < 10)
  170. clock += "0";
  171. clock += day + " ";
  172. if (hh < 10)
  173. clock += "0";
  174. clock += hh + ":";
  175. if (mm < 10) clock += '0';
  176. clock += mm + ":";
  177. if (ss < 10) clock += '0';
  178. clock += ss;
  179. return (clock);
  180. }
  181. //用户登录
  182. $('.login_gl').click(function() {
  183. debugger
  184. var gl_user = $(".gl_user").val();
  185. var gl_psw = $(".gl_psw").val();
  186. if (gl_user == "" || gl_psw == "") {
  187. $(".error_gl").addClass('errorShow');
  188. if ($(".gl_user").val() == "") {
  189. $(".gl_user").focus(function() {
  190. $(".error_gl").removeClass('errorShow');
  191. });
  192. } else {
  193. $(".error_gl_user").removeClass('errorShow');
  194. }
  195. } else {
  196. var currenttime = CurentTime();
  197. var datatime = currenttime.split(' ')[1].split(':').join('')
  198. var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M" + datatime);
  199. var gl_psw = CryptoJS.enc.Utf8.parse($.md5(gl_psw));
  200. var encrypted = CryptoJS.AES.encrypt(gl_psw, key, {
  201. mode: CryptoJS.mode.ECB,
  202. padding: CryptoJS.pad.Pkcs7
  203. });
  204. /*请求后台*/
  205. $.ajax({
  206. type: "post",
  207. url: huayi.config.callcenter_url + "/Login/login",
  208. dataType: 'json',
  209. async: true,
  210. data: {
  211. username: gl_user,
  212. password: encrypted.toString(),
  213. LoginTime: currenttime
  214. },
  215. success: function(data) {
  216. /*验证请求*/
  217. if (data.state == "notoken") {
  218. layer.confirm('授权到期!', {
  219. btn: ['确定']
  220. });
  221. return;
  222. } else if (data.state == "success") {
  223. $.cookie("token", data.data.token, {
  224. expires: 7
  225. });
  226. $.cookie("zx_user", gl_user, {
  227. expires: 7
  228. });
  229. // window.location.href = "home.html";
  230. if (data.data.authdate) {
  231. layer.confirm('授权将于' + data.data.authdate +
  232. '到期,请及时联系本项目负责人!', {
  233. closeBtn: 0,
  234. btn: ['确定'] //按钮
  235. },
  236. function() {
  237. window.location.href = "home.html";
  238. });
  239. } else {
  240. // console.log(1111)
  241. window.location.href = "home.html";
  242. }
  243. }
  244. }
  245. });
  246. }
  247. })
  248. })
  249. </script>
  250. </body>
  251. </html>