Nessuna descrizione

login.html 11KB

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