Нет описания

login.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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. <script src="./Script/Common/huayi.load.js"></script>
  13. <script src="./Script/Common/huayi.config.js"></script>
  14. <script src="./js/jquery.md5.js"></script>
  15. <script src="./js/purify.min.js"></script>
  16. <script src="./js/aes/crypto-js.js"></script>
  17. <style>
  18. html {
  19. margin: 0 auto;
  20. padding: 0;
  21. height: 100%;
  22. }
  23. body {
  24. height: 100%;
  25. background: #fff;
  26. }
  27. .wrap {
  28. width: 100%;
  29. height: 100%;
  30. }
  31. .wrap_right {
  32. float: left;
  33. width: 50%;
  34. height: 100%;
  35. }
  36. .wrap_left {
  37. float: left;
  38. width: 50%;
  39. height: 100%;
  40. }
  41. .wrap_right {
  42. position: relative;
  43. }
  44. .wrap_bj {
  45. width: 100%;
  46. height: 100%;
  47. background: url(img/left_amg_01.jpg) no-repeat;
  48. background-size: 100% 100%;
  49. }
  50. .tab_box {
  51. border: 1px solid #41caf2;
  52. border-top-right-radius: 15px;
  53. border-bottom-left-radius: 15px;
  54. margin: 50px auto 65px;
  55. padding: 0;
  56. overflow: hidden;
  57. width: 410px;
  58. }
  59. .tab_box ul {
  60. list-style: none;
  61. margin: 0;
  62. padding: 0;
  63. width: 100%;
  64. height: 50px;
  65. line-height: 50px;
  66. font-size: 16px;
  67. color: #41caf2;
  68. border-bottom: 1px solid #41caf2;
  69. text-align: center;
  70. }
  71. .tab_box ul li {
  72. width: 50%;
  73. float: left;
  74. }
  75. .active {
  76. background: #41caf2;
  77. color: #fff;
  78. }
  79. .tab_content {
  80. margin: 57px 0 35px 0;
  81. }
  82. .tab_content div p {
  83. width: 80%;
  84. margin: 0 auto;
  85. height: 35px;
  86. border: 1px solid #41caf2;
  87. border-radius: 15px;
  88. margin-bottom: 25px;
  89. line-height: 30px;
  90. padding-left: 20px;
  91. }
  92. .tab_content div p input {
  93. width: 75%;
  94. border: 0;
  95. font-size: 16px;
  96. outline: none;
  97. font-family: "仿宋", "宋体";
  98. }
  99. .login_icon {
  100. display: inline-block;
  101. width: 17px;
  102. height: 19px;
  103. vertical-align: middle;
  104. margin-right: 15px;
  105. }
  106. .login_icon_user {
  107. background: url(img/login_user.png) no-repeat;
  108. }
  109. .login_icon_lock {
  110. background: url(img/login_lock.png) no-repeat;
  111. }
  112. .login_icon_hua {
  113. background: url(img/login_hua.png) no-repeat;
  114. }
  115. .login_go {
  116. text-align: center;
  117. padding: 0 !important;
  118. font-size: 16px;
  119. letter-spacing: 16px;
  120. font-family: "仿宋", "宋体";
  121. color: #fff;
  122. filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#1f90ec, endcolorstr=#1cb5ef, gradientType=1);
  123. background: -webkit-gradient(li near, 0 0, 100% 0, from(#1f90ec), to(#1cb5ef));
  124. background: -webkit-linear-gradient(left, #1f90ec, #1cb5ef);
  125. background: -moz-linear-gradient(left, #1f90ec, #1cb5ef);
  126. background: -o-linear-gradient(left, #1f90ec, #1cb5ef);
  127. background: linear-gradient(left, #1f90ec, #1cb5ef);
  128. cursor: pointer;
  129. }
  130. .error {
  131. height: 13px;
  132. background: url(img/yz.png) no-repeat 0 -8px;
  133. display: none;
  134. }
  135. .errorShow {
  136. display: inline-block;
  137. }
  138. .rightCon {
  139. width: 100%;
  140. position: absolute;
  141. top: 0;
  142. bottom: 0;
  143. right: 0;
  144. left: 0;
  145. margin: auto;
  146. height: 580px;
  147. }
  148. .leftCon {
  149. width: 30%;
  150. position: absolute;
  151. top: 41%;
  152. bottom: 0;
  153. right: 0;
  154. left: 50%;
  155. margin: auto;
  156. }
  157. .leftCon img {
  158. width: 100%;
  159. }
  160. .leftCon p {
  161. font-size: 28px;
  162. letter-spacing: 10px;
  163. color: #e60111;
  164. line-height: 80px;
  165. }
  166. .service {
  167. width: 100%;
  168. position: absolute;
  169. bottom: 30px;
  170. }
  171. </style>
  172. </head>
  173. <body class="signin">
  174. <div class="wrap clearfix">
  175. <div class="wrap_left" style="position: relative;">
  176. <div class="wrap_bj"></div>
  177. <div class="leftCon">
  178. <img src="img/logintext.png"/>
  179. </div>
  180. </div>
  181. <div class="wrap_right">
  182. <div class="rightCon">
  183. <div class="logo" style="width: 100%;text-align: center;"></div>
  184. <div class="tab_box">
  185. <ul class="clearfix tab_ul">
  186. <li class="active">坐席登录</li>
  187. <li>用户登录</li>
  188. </ul>
  189. <div class="tab_content">
  190. <div class="tab_one">
  191. <p>
  192. <i class="login_icon login_icon_user "></i>
  193. <input class="zx_user" type="text" placeholder="请输入您的管理账号" />
  194. <i class="login_icon error error_zx error_zx_user"></i>
  195. </p>
  196. <p>
  197. <i class="login_icon login_icon_hua "></i>
  198. <input class="zx_fj" type="text" placeholder="请输入分机号" />
  199. <i class="login_icon error error_zx error_zx_fj"></i>
  200. </p>
  201. <p>
  202. <i class="login_icon login_icon_lock "></i>
  203. <input class="zx_psw" type="password" placeholder="请输入您的密码" />
  204. <i class="login_icon error error_zx error_zx_psw"></i>
  205. </p>
  206. <p class="login_go login_zx">登录</p>
  207. </div>
  208. <div class="tab_two" style="display: none;">
  209. <p>
  210. <i class="login_icon login_icon_user "></i>
  211. <input class="gl_user" type="text" placeholder="请输入您的管理账号" />
  212. <i class="login_icon error error_gl error_gl_user"></i>
  213. </p>
  214. <p>
  215. <i class="login_icon login_icon_lock"></i>
  216. <input class="gl_psw" type="password" placeholder="请输入您的密码" />
  217. <i class="login_icon error error_gl error_gl_psw"></i>
  218. </p>
  219. <p class="login_go login_gl">登录</p>
  220. </div>
  221. </div>
  222. </div>
  223. <div class="service" >
  224. <p style="color: #313c58; font-size: 12px;text-align: center;"></p>
  225. </div>
  226. </div>
  227. </div>
  228. </div>
  229. <script>
  230. $(function() {
  231. var a=0;
  232. $('.tab_ul li').click(function() {
  233. $(this).addClass("active").siblings().removeClass("active");
  234. var index = $(this).index();
  235. a=index;
  236. $('.tab_content').children('div').eq(index).show().siblings().hide();
  237. })
  238. /*cook存储数据*/
  239. if($.cookie("username")) {
  240. //取值如果存在则赋值
  241. $(".gl_user").val($.cookie("user")); //用户名
  242. $("zx_fj").val($.cookie("fj"));
  243. $(".zx_user").val($.cookie("user"));
  244. }
  245. //键盘登录事件
  246. $('input').bind('keypress', function(event) {
  247. if(event.keyCode == "13") {
  248. if(a == 0) {
  249. $('.login_zx').trigger("click");
  250. } else {
  251. $(".login_gl").trigger("click");
  252. }
  253. }
  254. });
  255. //坐席登录
  256. $('.login_zx').click(function(){
  257. var zx_user = DOMPurify.sanitize($(".zx_user").val());
  258. var zx_fj = DOMPurify.sanitize($(".zx_fj").val());
  259. var zx_psw = DOMPurify.sanitize($(".zx_psw").val());
  260. if(zx_user == "" || zx_fj == "" || zx_psw == "") {
  261. $(".error_zx").addClass('errorShow');
  262. if (zx_user== "") {
  263. $(".zx_user").focus(function() {
  264. $(".error_zx").removeClass('errorShow');
  265. });
  266. } else {
  267. $(".error_zx_user").removeClass('errorShow');
  268. }
  269. }else {
  270. var currenttime=CurentTime();
  271. var datatime=currenttime.split(' ')[1].split(':').join('')
  272. var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M"+datatime);
  273. var zx_psw = CryptoJS.enc.Utf8.parse($.md5(zx_psw));
  274. var encrypted = CryptoJS.AES.encrypt(zx_psw, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  275. /*请求后台*/
  276. $.cookie("extno",zx_fj);
  277. $.cookie("zx_user",zx_user);
  278. $.ajax({
  279. type: "post",
  280. url: huayi.config.callcenter_url + "/Login/login",
  281. dataType: 'json',
  282. async: true,
  283. data: {
  284. username: zx_user,
  285. extensionphone: zx_fj,
  286. LoginTime:currenttime,
  287. password:encrypted.toString()
  288. },
  289. success: function(data) {
  290. /*验证请求*/
  291. if(data.state == "success") {
  292. $.cookie("token", data.data.token, {
  293. expires: 7
  294. });
  295. $.cookie("extno", zx_fj, {
  296. expires: 7
  297. });
  298. $.cookie("zx_user", zx_user, {
  299. expires: 7
  300. });
  301. window.location.href = "home.html";
  302. }
  303. }
  304. });
  305. }
  306. })
  307. function CurentTime(){
  308. var now = new Date();
  309. var year = now.getFullYear(); //年
  310. var month = now.getMonth() + 1; //月
  311. var day = now.getDate(); //日
  312. var hh = now.getHours(); //时
  313. var mm = now.getMinutes(); //分
  314. var ss = now.getSeconds(); //秒
  315. var clock = year + "-";
  316. if(month < 10)
  317. clock += "0";
  318. clock += month + "-";
  319. if(day < 10)
  320. clock += "0";
  321. clock += day + " ";
  322. if(hh < 10)
  323. clock += "0";
  324. clock += hh + ":";
  325. if (mm < 10) clock += '0';
  326. clock += mm + ":";
  327. if (ss < 10) clock += '0';
  328. clock += ss;
  329. return(clock);
  330. }
  331. //用户登录
  332. $('.login_gl').click(function() {
  333. var gl_user = DOMPurify.sanitize($(".gl_user").val());
  334. var gl_psw = DOMPurify.sanitize($(".gl_psw").val());
  335. if(gl_user == "" || gl_psw == "") {
  336. $(".error_gl").addClass('errorShow');
  337. if (gl_user == "") {
  338. $(".gl_user").focus(function() {
  339. $(".error_gl").removeClass('errorShow');
  340. });
  341. } else {
  342. $(".error_gl_user").removeClass('errorShow');
  343. }
  344. } else {
  345. var currenttime=CurentTime();
  346. var datatime=currenttime.split(' ')[1].split(':').join('')
  347. var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M"+datatime);
  348. var gl_psw = CryptoJS.enc.Utf8.parse($.md5(gl_psw));
  349. var encrypted = CryptoJS.AES.encrypt(gl_psw, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  350. // var decrypt = CryptoJS.AES.decrypt(encrypted, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  351. // console.log(CryptoJS.enc.Utf8.stringify(decrypt).toString());
  352. // return false;
  353. /*请求后台*/
  354. $.ajax({
  355. type: "post",
  356. url: huayi.config.callcenter_url + "/Login/login",
  357. dataType: 'json',
  358. async: true,
  359. data: {
  360. username: gl_user,
  361. password: encrypted.toString(),
  362. LoginTime:currenttime
  363. },
  364. success: function(data) {
  365. /*验证请求*/
  366. if(data.state == "success") {
  367. $.cookie("token", data.data.token, {
  368. expires: 7
  369. });
  370. $.cookie("zx_user", gl_user, {
  371. expires: 7
  372. });
  373. window.location.href = "home.html";
  374. }
  375. //else{
  376. // $(".gl_user").val('');
  377. // $(".gl_psw").val('');
  378. //}
  379. }
  380. });
  381. }
  382. })
  383. })
  384. </script>
  385. </body>
  386. </html>